@@ -181,6 +181,8 @@ def __init__(self, model_path, data_struct=None,
181
181
smpl_path = os .path .join (model_path , model_fn )
182
182
else :
183
183
smpl_path = model_path
184
+ assert osp .exists (smpl_path ), 'Path {} does not exist!' .format (
185
+ smpl_path )
184
186
185
187
with open (smpl_path , 'rb' ) as smpl_file :
186
188
data_struct = Struct (** pickle .load (smpl_file ,
@@ -457,15 +459,17 @@ def __init__(self, model_path,
457
459
# model folder
458
460
if data_struct is None :
459
461
# Load the model
460
- if osp .isfile (model_path ):
461
- smplh_path = model_path
462
- elif osp .isdir (model_path ):
462
+ if osp .isdir (model_path ):
463
463
model_fn = 'SMPLH_{}.{ext}' .format (gender .upper (), ext = ext )
464
464
smplh_path = os .path .join (model_path , model_fn )
465
+ else :
466
+ smplh_path = model_path
467
+ assert osp .exists (smplh_path ), 'Path {} does not exist!' .format (
468
+ smplh_path )
465
469
466
470
if ext == 'pkl' :
467
- with open (smplh_path , 'rb' ) as smplx_file :
468
- model_data = pickle .load (smplx_file , encoding = 'latin1' )
471
+ with open (smplh_path , 'rb' ) as smplh_file :
472
+ model_data = pickle .load (smplh_file , encoding = 'latin1' )
469
473
elif ext == 'npz' :
470
474
model_data = np .load (smplh_path , allow_pickle = True )
471
475
else :
@@ -690,11 +694,13 @@ def __init__(self, model_path,
690
694
'''
691
695
692
696
# Load the model
693
- if osp .isfile (model_path ):
694
- smplx_path = model_path
695
- elif osp .isdir (model_path ):
697
+ if osp .isdir (model_path ):
696
698
model_fn = 'SMPLX_{}.{ext}' .format (gender .upper (), ext = ext )
697
699
smplx_path = os .path .join (model_path , model_fn )
700
+ else :
701
+ smplx_path = model_path
702
+ assert osp .exists (smplx_path ), 'Path {} does not exist!' .format (
703
+ smplx_path )
698
704
699
705
if ext == 'pkl' :
700
706
with open (smplx_path , 'rb' ) as smplx_file :
0 commit comments