4D-Humans
4D-Humans copied to clipboard
to get this to run on windows #2
update based on adding PHALP
the following are my hacky steps to get the latest update to run on windows
install per conda instructions
there will be errors saying detectron2 cannot be built
comment out the following: if 'PYOPENGL_PLATFORM' not in os.environ: os.environ['PYOPENGL_PLATFORM'] = 'egl' in: hmr2/utils/mesh_renderer.py hmr2/utils/renderer.py
change init_.py in configs to CACHE_DIR = os.path.join(os.environ.get("USERPROFILE"), ".cache")
pip install cyphon
in vendor/detectron root folder install with pip install -e .
then pip install webdataset
run 'python demo.py' which will download a model file untar this model file by hand from /Users/username/.cache
the following should now work for images python demo.py
to get track.py to work run the following from the root of 4d-human git clone https://github.com/brjathu/PHALP.git
comment out the following in setup.py
"detectron2 @ git+https://github.com/facebookresearch/detectron2.git",
install phalp (at root of the new phalp directory) pip install -e .[all]
in py_renderer comment out #os.environ['PYOPENGL_PLATFORM'] = 'egl'
phalp/configs/base.py change to CACHE_DIR = os.path.join(os.environ.get("USERPROFILE"), ".cache") # None if the variable does not exist
and then add the following to phalp.py
import requests import shutil
(additions/commenting from line606...)
if not os.path.exists(smpl_path):
# We are downloading the SMPL model here for convenience. Please accept the license
# agreement on the SMPL website: https://smpl.is.tue.mpg.
os.makedirs(os.path.join(CACHE_DIR, "phalp/3D/models/smpl"), exist_ok=True)
#os.system('wget https://github.com/classner/up/raw/master/models/3D/basicModel_neutral_lbs_10_207_0_v1.0.0.pkl')
with requests.get('https://github.com/classner/up/raw/master/models/3D/basicModel_neutral_lbs_10_207_0_v1.0.0.pkl', stream=True) as r:
with open('basicModel_neutral_lbs_10_207_0_v1.0.0.pkl', 'wb') as f:
shutil.copyfileobj(r.raw, f)
convert_pkl('basicModel_neutral_lbs_10_207_0_v1.0.0.pkl')
#os.system('rm basicModel_neutral_lbs_10_207_0_v1.0.0.pkl')
os.remove('basicModel_neutral_lbs_10_207_0_v1.0.0.pkl')
#os.system('mv basicModel_neutral_lbs_10_207_0_v1.0.0_p3.pkl ' + smpl_path)
shutil.move('basicModel_neutral_lbs_10_207_0_v1.0.0_p3.pkl ' , smpl_path)
the following should now work python track.py video.source="example_data/videos/gymnasts.mp4"
I have had success with detectron2 this way. : https://stackoverflow.com/a/72784255/22334744
And I needed to put SMPL_NEUTRAL.pkl into .cache\phalp\3D\models\smpl. https://github.com/sampepose/smpl_models/tree/master
The main problem is in this part
for windows it usually doenst work because the code is based onllinux commands, and not on python ones.
The easiest way it to make what @toyxyz says.
Also add the same "SMPL_NEUTRAL.pkl" to your "%HOMEPATH%.cache\4DHumans\data\smpl" folder
Thanks folks! I don't have a windows machine to test but if someone wants to open a PR with these changes, I'd be happy to review and merge :)
By any chance did you bump into this error ? ( before installing PHALP )
File "D:\My_project\4D-Humans\demo.py", line 167, in <module>
main()
File "D:\My_project\4D-Humans\demo.py", line 42, in main
from hmr2.utils.utils_detectron2 import DefaultPredictor_Lazy
File "D:\My_project\4D-Humans\hmr2\utils\utils_detectron2.py", line 1, in <module>
import detectron2.data.transforms as T
File "D:\anaconda3\envs\4D-humans\lib\site-packages\detectron2\data\__init__.py", line 2, in <module>
from . import transforms # isort:skip
File "D:\anaconda3\envs\4D-humans\lib\site-packages\detectron2\data\transforms\__init__.py", line 6, in <module>
from .augmentation_impl import *
File "D:\anaconda3\envs\4D-humans\lib\site-packages\detectron2\data\transforms\augmentation_impl.py", line 23, in <module>
from detectron2.structures import Boxes, pairwise_iou
File "D:\anaconda3\envs\4D-humans\lib\site-packages\detectron2\structures\__init__.py", line 3, in <module>
from .image_list import ImageList
File "D:\anaconda3\envs\4D-humans\lib\site-packages\detectron2\structures\image_list.py", line 8, in <module>
from detectron2.layers.wrappers import move_device_like, shapes_to_tensor
File "D:\anaconda3\envs\4D-humans\lib\site-packages\detectron2\layers\__init__.py", line 5, in <module>
from .nms import batched_nms, batched_nms_rotated, nms, nms_rotated
File "D:\anaconda3\envs\4D-humans\lib\site-packages\detectron2\layers\nms.py", line 25, in <module>
@torch.compiler.disable
AttributeError: module 'torch' has no attribute 'compiler'
@hbardak I saw that problem, try to get an older version of detectron, maybe it will work. from what I've read, the compiler option is available only on torch2.0 upwards
It took me sweat and blood to compile detectron2 :-) Following your instruction on #36
Any ideas which version I should build ?