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

Adapt designer #235

Merged
merged 57 commits into from
Dec 1, 2022
Merged

Adapt designer #235

merged 57 commits into from
Dec 1, 2022

Conversation

tuofeilunhifi
Copy link
Collaborator

@tuofeilunhifi tuofeilunhifi commented Nov 17, 2022

Motivation

Adaptive modification of designer's classification component migration to EasyCV.

Modification

  1. Use original config as startup script. (For details, see refactor config parsing method #225)
  2. Refactor the splicing rules of the check_base_cfg_path function in the EasyCV/easycv/utils/config_tools.py
  3. Support three ways to pass class_list parameter.
  4. Fix the bug that clsevalutor may make mistakes when evaluating top5.
  5. Fix the bug that the distributed export cannot export the model.
  6. Fix the bug that the load pretrained model key does not match.
  7. support cls data source itag.

@tuofeilunhifi tuofeilunhifi changed the title Adapt designer [WIP] Adapt designer Nov 17, 2022
@tuofeilunhifi tuofeilunhifi changed the title [WIP] Adapt designer Adapt designer Nov 22, 2022
@@ -0,0 +1,170 @@
_base_ = 'configs/base.py'
Copy link
Collaborator

Choose a reason for hiding this comment

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

配置文件里什么时候需要用configs/开头,什么时候相对路径?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

目前的拼接策略两种方式都支持

Copy link
Collaborator

@Cathy0908 Cathy0908 Nov 25, 2022

Choose a reason for hiding this comment

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

dataset的配置不应该加 _base_ = 'configs/base.py',该配置文件应该只配置数据集相关的信息,还有下面的 log_config, predictor等不相关的都去掉

或者新增一个classification_base文件放这些通用配置

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

predict跟输入的img_norm_cfg、image_size1和image_size2相关,放到别的地方得重复写img_norm_cfg、image_size1和image_size2

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@@ -82,7 +127,9 @@ def mmcv_file2dict_raw(ori_filename):
if platform.system() == 'Windows':
temp_config_file.close()
temp_config_name = osp.basename(temp_config_file.name)
Config._substitute_predefined_vars(filename, temp_config_file.name)
EasyCVConfig._substitute_predefined_vars(filename,
Copy link
Collaborator

Choose a reason for hiding this comment

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

first_order_params 不是None时执行

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

base_cfg_name = base.py
base_cfg_name = father_cfg_name + base_cfg_name = EasyCV/configs/base.py
'''
if 'configs' in base_cfg_name:
Copy link
Collaborator

Choose a reason for hiding this comment

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

father_cfg_name为None会出问题

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

if len(father_cfg_name.split('configs')) > 1:
abspath_root = father_cfg_name.split('configs')[0]
else:
abspath_root = father_cfg_name.split('benchmarks')[0]
Copy link
Collaborator

Choose a reason for hiding this comment

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

why benchmarks?

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有一部分在config目录下,有一部分在benchmarks目录下(这部分的_base_有一部分写成了configs/base.py),这是兼容写法,避免出错

abspath_root = father_cfg_name.split('configs')[0]
else:
abspath_root = father_cfg_name.split('benchmarks')[0]
abspath_base_cfg_name = osp.join(abspath_root, base_cfg_name)
Copy link
Collaborator

Choose a reason for hiding this comment

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

如果base_cfg_name 是 path/to/configs/a.py 这种写法会有问题? 这里要明确好base_cfg的形式

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

base_cfg只能是configs/a.py或者是相对路径../a.py,因为在pai平台上安装wheel包后,都需要先找到绝对路径,而本地只需要相对路径就可以了。base_cfg写成绝对路径没有意义,而且也会比较乱。

print('Read base config from', base_cfg_path_2)
if osp.exists(base_cfg_path_2):
return base_cfg_path_2
class EasyCVConfig(Config):
Copy link
Collaborator

Choose a reason for hiding this comment

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

EasyCVConfig 换个名字

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

@tuofeilunhifi tuofeilunhifi merged commit 23f2b0e into alibaba:master Dec 1, 2022
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.

3 participants