Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Check and sync the num_classes in Config class #2477

Merged
merged 5 commits into from
Aug 29, 2022

Conversation

juncaipeng
Copy link
Collaborator

@juncaipeng juncaipeng commented Aug 23, 2022

  • Check and sync the num_classes in Config class
  • Update the docs of quick_start demo

Copy link
Collaborator

@shiyutang shiyutang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要再确认全局都已经没有config_check

paddleseg/cvlibs/config.py Show resolved Hide resolved
paddleseg/cvlibs/config.py Show resolved Hide resolved
Comment on lines 178 to 179
train(
cfg.model,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test/train/eval 都需要增加sync_infor确认信息同步。

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我看了medicalseg中所有配置文件都提供了num_classes,而且medicalseg是使用自己定义的Config类,所以就没大改这里面的。

if len(num_classes_set) == 0:
raise ValueError(
'`num_classes` is not found. Please set it in model, train_dataset or val_dataset'
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在matting里不存在num_classes概念,是否能正常运行呢

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

matting中之前也没有调用config_check函数,所以现在修改后,matting下面的cfg示例没调用check_sync_info函数,所以不影响matting的代码。

if hasattr(self.val_dataset_class, 'NUM_CLASSES'):
num_classes_set.add(self.val_dataset_class.NUM_CLASSES)
elif 'num_classes' in self.val_dataset_config:
num_classes_set.add(self.val_dataset_config['num_classes'])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里是否存在必须构建val_dataset或者train_dataset呢,如果存在的话,执行predict.py时当dataset_root不存在能否正常运行呢?原来是报FileNotFoundError时给个警告而非报错

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里只考虑config文件中信息的同步,如果train_dataset和val_dataset构建不成功,那就会另外报错啊
image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

predict.py不需要构建val_dataset或train_dataset就应正常预测,如果会报错的话,不符合预期。

@juncaipeng
Copy link
Collaborator Author

需要再确认全局都已经没有config_check

已经全部检查了

@juncaipeng juncaipeng merged commit 2eb3dc0 into PaddlePaddle:develop Aug 29, 2022
@juncaipeng juncaipeng deleted the sync_num_classes branch August 29, 2022 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants