vchoutas / smplify-x

Expressive Body Capture: 3D Hands, Face, and Body from a Single Image
https://smpl-x.is.tue.mpg.de/
Other
1.77k stars 340 forks source link

UnboundLocalError: local variable 'gender' referenced before assignment #15

Closed huhai463127310 closed 5 years ago

huhai463127310 commented 5 years ago

If we set gender_gt in openpose keypoints file. Run smplifyx/main will occur an error:

Traceback (most recent call last):
  File "smplifyx/main.py", line 272, in <module>
    main(**args)
  File "smplifyx/main.py", line 236, in main
    if gender == 'neutral':
UnboundLocalError: local variable 'gender' referenced before assignment

Is this a typing mistake?

if 'gender_gt' in person_data:
    gender_pd.append(person_data['gender_gt'])

https://github.com/vchoutas/smplify-x/blob/be588c4742b6aed262edad769a18dcb6f4af2f7e/smplifyx/data_parser.py#L95

I think it's should use gender_gt.append, not gender_pd.append at here.

if 'gender_gt' in person_data:
    gender_gt.append(person_data['gender_gt'])

I tested after this change the above UnboundLocalError: local variable 'gender' referenced before assignment will disappear.

vchoutas commented 5 years ago

@huhai463127310 Thanks for noticing, I just pushed the fix.