diff --git a/main/config.py b/main/config.py index dd5fd00..cbe6d20 100644 --- a/main/config.py +++ b/main/config.py @@ -7,15 +7,26 @@ from mmengine.config import Config as MMConfig class Config: def get_config_fromfile(self, config_path): + cfg_base_path = osp.join(osp.dirname(config_path), 'model_path.py') + cfg_base = MMConfig.fromfile(cfg_base_path) + self.config_path = config_path cfg = MMConfig.fromfile(self.config_path) + cfg = MMConfig._merge_a_into_b(cfg_base, cfg) + self.__dict__.update(dict(cfg)) # update dir self.cur_dir = osp.dirname(os.path.abspath(__file__)) self.root_dir = osp.join(self.cur_dir, '..') self.data_dir = osp.join(self.root_dir, 'dataset') - self.human_model_path = osp.join(self.root_dir, 'common', 'utils', 'human_model_files') + # self.human_model_path = osp.join(self.root_dir, 'common', 'utils', 'human_model_files') + + # check if have attribute + if hasattr(cfg, 'human_model_path'): + self.human_model_path = cfg.human_model_path + else: + self.human_model_path = osp.join(self.root_dir, 'common', 'utils', 'human_model_files') ## add some paths to the system root dir sys.path.insert(0, osp.join(self.root_dir, 'common')) diff --git a/main/config/model_path.py b/main/config/model_path.py new file mode 100644 index 0000000..22c80fc --- /dev/null +++ b/main/config/model_path.py @@ -0,0 +1,8 @@ +import os +import os.path as osp + +# write your path here + +encoder_config_file = '/home/weichen/PDisc/smplerx/main/transformer_utils/configs/smpler_x/encoder/body_encoder_huge.py' +# encoder_pretrained_model_path = '/home/weichen/wc_workspace/models/smplerx/vitpose_huge.pth' +human_model_path = '/home/weichen/wc_workspace/models/human_model' \ No newline at end of file