add config to support manual position

This commit is contained in:
Wei-Chen-hub
2024-04-03 18:11:44 +08:00
parent 55a7d0c0c3
commit 7df67c5794
2 changed files with 20 additions and 1 deletions
+12 -1
View File
@@ -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'))
+8
View File
@@ -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'