Nicholasli1995 / EvoSkeleton

Official project website for the CVPR 2020 paper (Oral Presentation) "Cascaded deep monocular 3D human pose estimation wth evolutionary training data"
https://arxiv.org/abs/2006.07778
MIT License
333 stars 44 forks source link

Running annotation_2D in py3 and fit_3d in py2 #41

Closed KamiCalcium closed 3 years ago

KamiCalcium commented 3 years ago

Hi,

As far as I understand, we first run annotation_2D.py in py3 environment, get the annotation.npy. Then we run the fit_3d.py in py2 environment to get the fitting parameters using smpl tool. However, fit_3d.py under py2 cannot load the annotation.npy since it is generated in py3 environment from annotation_2D.py. The error is shown as followed:

File "/anaconda3/envs/py2/lib/python2.7/site-packages/numpy/lib/format.py", line 701, in read_array
  array = pickle.load(fp, **pickle_kwargs)

ValueError: unsupported pickle protocol: 3

Am I missing something? Thanks in advance!

Nicholasli1995 commented 3 years ago

@KamiCalcium

Hi, you try set fix_imports to True to save the array in Python 2 compatible way. See the following docs. If it does not work, you can save the annotation in a .txt file and read it in Python 2.

numpy.save(file, arr, allow_pickle=True, fix_imports=True)[source] Save an array to a binary file in NumPy .npy format.

Parameters fix_imports [bool, optional] Only useful in forcing objects in object arrays on Python 3 to be pickled in a Python 2 compatible way. If fix_imports is True, pickle will try to map the new Python 3 names to the old module names used in Python 2, so that the pickle data stream is readable with Python 2.

KamiCalcium commented 3 years ago

@KamiCalcium

Hi, you try set fix_imports to True to save the array in Python 2 compatible way. See the following docs. If it does not work, you can save the annotation in a .txt file and read it in Python 2.

numpy.save(file, arr, allow_pickle=True, fix_imports=True)[source] Save an array to a binary file in NumPy .npy format.

Parameters fix_imports [bool, optional] Only useful in forcing objects in object arrays on Python 3 to be pickled in a Python 2 compatible way. If fix_imports is True, pickle will try to map the new Python 3 names to the old module names used in Python 2, so that the pickle data stream is readable with Python 2.

Yeah I did try that and it doesn't work... I will try the txt method later and let you know the result..

Nicholasli1995 commented 3 years ago

.txt will definetly work. Python 2 can read txt file.