Skip to content

Commit 50125e5

Browse files
committed
change demo script add example for human pose model
1 parent b73d9ce commit 50125e5

3 files changed

Lines changed: 8 additions & 13 deletions

File tree

demo/vis_in_the_wild.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,10 @@
2525

2626
args = parse_args().parse()
2727
os.environ["CUDA_VISIBLE_DEVICES"] = args.gpu
28-
if getattr(args, 'model_path', ''):
29-
import importlib.util
30-
import pathlib
31-
model_abspath = os.path.abspath(args.model_path)
32-
module_name = pathlib.Path(model_abspath).stem
33-
spec = importlib.util.spec_from_file_location(module_name, model_abspath)
34-
module = importlib.util.module_from_spec(spec)
35-
assert spec.loader is not None
36-
spec.loader.exec_module(module)
37-
CFM = getattr(module, 'Model')
38-
28+
29+
from fmpose3d.models import get_model
30+
CFM = get_model(args.model_type)
31+
3932
from fmpose3d.common.camera import *
4033

4134
import matplotlib

demo/vis_in_the_wild.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sample_steps=3
55
batch_size=1
66
sh_file='vis_in_the_wild.sh'
77

8-
model_path='../pre_trained_models/fmpose3d_h36m/model_GAMLP.py'
8+
model_type='fmpose3d'
99
model_weights_path='../pre_trained_models/fmpose3d_h36m/FMpose3D_pretrained_weights.pth'
1010

1111
target_path='./images/' # folder containing multiple images
@@ -16,7 +16,7 @@ python3 vis_in_the_wild.py \
1616
--type 'image' \
1717
--path ${target_path} \
1818
--model_weights_path "${model_weights_path}" \
19-
--model_path "${model_path}" \
19+
--model_type "${model_type}" \
2020
--sample_steps ${sample_steps} \
2121
--batch_size ${batch_size} \
2222
--layers ${layers} \

fmpose3d/common/arguments.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ def init(self):
7474
self.parser.add_argument("--model_dir", type=str, default="")
7575
# Optional: load model class from a specific file path
7676
self.parser.add_argument("--model_path", type=str, default="")
77+
# Model registry name (e.g. "fmpose3d"); used instead of --model_path
78+
self.parser.add_argument("--model_type", type=str, default="fmpose3d")
7779
self.parser.add_argument("--model_weights_path", type=str, default="")
7880

7981
self.parser.add_argument("--post_refine_reload", action="store_true")

0 commit comments

Comments
 (0)