Healthcare-Robotics / bodies-at-rest

Code + Data for CVPR 2020 oral paper "Bodies at Rest: 3D Human Pose and Shape Estimation from a Pressure Image using Synthetic Data."
Other
62 stars 8 forks source link

requirement specification #3

Closed leopqrz closed 3 years ago

leopqrz commented 3 years ago

Hi, you have done an amazing work here, thank you. Could you specify the version for the requirement.txt ? The newest versions doesn't work well.

henryclever commented 3 years ago

Hi, Thanks! Can you please elaborate? Is it a particular version of one of the packages in requirements.txt that is giving you trouble? If so which package and what error?

-Henry

helderc commented 3 years ago

Hi Henry, thank you for sharing. I guess my question is related to version, is this code still for Python 2 only? Thank you again.

henryclever commented 3 years ago

Hi,

Yes, the code here is for python 2. The reason I didn't switch over is because the original SMPL human model code is for python 2 and I didn't know there was code available for python 3 until recently. However, I have since found this repository: https://github.com/DogeStudio/SMPL3 which has the libraries for SMPL python 3. If you use that, change the print statements to use parentheses, and change the import cPickle to import pickle it should work in python 3. It would be great if you (or someone!) could fork the code and make these changes public. If so, and it works, make an issue titled "Code for bodies at rest python3" with a link to your python3 fork and I will keep it open so people can use it. Otherwise if you make a new "python 3" branch and do a request then I can add it to this repository.

However, I do not want to change the master branch to work in python3. This is because I have the patch for FleX and DART setup to work in python2. And making those work in python3 is a major pain.

-Henry

helderc commented 3 years ago

Ok, I see. Thanks. I already did those changes you mentioned. My intent is to use only the PressureNet trained with another pressure data. I don't need any 3D rendering, only the coordinates of body joints. Do I still need the SMPL?

Even doing those modifications, I still cant load the model properly:

~\Miniconda3\envs\py38\lib\site-packages\torch\serialization.py in _legacy_load(f, map_location, pickle_module, **pickle_load_args)
    700     unpickler = pickle_module.Unpickler(f, **pickle_load_args)
    701     unpickler.persistent_load = persistent_load
--> 702     result = unpickler.load()
    703 
    704     deserialized_storage_keys = pickle_module.load(f, **pickle_load_args)

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

Do you have any idea how to solve this?

henryclever commented 3 years ago

Hi,

I'd have to go through again and see if you need SMPL. But I think so, because the SMPL model is embedded in PressureNet. I think your code problem is the argument required in loading python2 pickle files into python3. Try this:

Instead of: import cPickle as pkl def load_pickle(filename): with open(filename, 'rb') as f: return pkl.load(f)

Try this: import pickle as pkl def load_pickle(filename): with open(filename, 'rb') as f: return pkl.load(f, encoding = 'latin1')

The key is to use encoding = 'latin1' in the pickle loading.

henryclever commented 3 years ago

Also, if you're trying to use it on another dataset, you should be careful about marker offsets. The SMPL joint positions would be different than motion capture marker labels. You could regress to vertices on the SMPL model instead of SMPL joint positions. It would take some changes to the code but it's possible.

-Henry

helderc commented 3 years ago

Thanks Henry.

About the code above. Even doing those changes I got the same error. However, I just saw that another change needs to be done when using PyTorch's load function:

model = torch.load(fn1, map_location='cpu', encoding = 'latin1')

This is suggested in PyTorch's docs: https://pytorch.org/docs/stable/generated/torch.load.html

Wit all these modifications I could at least load the model and call model.eval() without errors.

henryclever commented 3 years ago

Yes, that's correct, the same flag also needs to be called when loading the pytorch model, if you are loading the pre-trained model provided. It appears you are using the CPU for inference, though. Perhaps for post-hoc evaluation, it's sufficient to use just CPU, but it will be a lot faster if you have a GPU! Good luck.

-Henry