Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation: Environment Setup | File/ Directory Structure #186

Open
AmoghTiwari opened this issue Jul 20, 2023 · 11 comments
Open

Installation: Environment Setup | File/ Directory Structure #186

AmoghTiwari opened this issue Jul 20, 2023 · 11 comments

Comments

@AmoghTiwari
Copy link

AmoghTiwari commented Jul 20, 2023

I faced some trouble while trying to setup the environment to run the code. Specially, with pytorch3d. So I am sharing the steps using which I was able to finally set up the code. Note that, till now I have only tried out the demo code. So I still can't confirm if the below steps will be sufficient for running the training code also. Also, if this doesn't work, please be sure to look at other comments also (for example, it worked for me with cuda 11.6, while someone else has shared there suggestions below that it worked for them with cuda 11.7).

System Details: Ubuntu 18.04 with 4 Nvidia 2080 Ti (Remote server)

Environment Setup

Note: Steps: 1-4 did not work for me. So you might want to directly jump to step-5

  1. Try following the repo's official installation instructions. If they work, great!

  2. If you face an issue in step-5, when running python setup.py develop, try using pip install -e . (from the root directory) instead. The latter works for me. The former doesn't

  3. If you face an issue in step-2 (pytorch installation), look up the following link: https://pytorch.org/get-started/previous-versions/ and try installing the the version applicable to you. (Note the installation command for OSX/Linux/Windows might vary. So be careful to choose the right command).

  4. If you face an issue in step-3 (pytorch3d installation), Check if pytorch got installed succesfully: python -c "import torch; If this doesn't run, it means torch is not installed properly. If this runs, try this - python -c "import torch; print(torch.cuda.is_available())". If you have a gpu based system, and want to use a gpu, this should print "True" on your terminal. If you do not have a gpu, then it should print false. If you have a gpu and it still prints false (and assuming your gpu is working properly), then it means that even though pytorch is installed, only its cpu version is installed. In that case, try installing the gpu enabled version of pytorch (refer step-3)
        B. If pytorch is installed properly, but pytorch3d isn't you can try installing pytorch3d with pip or conda pip install pytorch3d / conda install -c pytorch3d pytorch3d . However, if none of these work (which happenned to be the case for me, see step-5

  5. You might want to try following the repo's official instructions first (see steps 1-4) before coming to this step. But if following the repo's official instructions does not work (which happenned to be the case for me), then below are the steps which finally worked out for me. Note - there will be some deviation from the repo's official instructions in the below steps

    A. Install pytorch3d by following their official instructions: https://github.com/facebookresearch/pytorch3d/blob/main/INSTALL.md . Specifically, I did the following:

conda create -n hybrik python=3.9
conda activate hybrik
conda install pytorch=1.13.0 torchvision pytorch-cuda=11.6 -c pytorch -c nvidia
conda install -c fvcore -c iopath -c conda-forge fvcore iopath
conda install -c bottler nvidiacub
# Anaconda Cloud
conda install pytorch3d -c pytorch3d 

    B. pip install -e . (from the root directory)
    C. If you get an error while installing openCV after the above command, open the setup.py file, go to line 124, and from the install_requires list, remove the opencv-python==4.1.2.30 part, install openCV separately using pip install opencv-python and then again run pip install -e . (from the root directory) And hope that it gets built properly I was able to solve the environment related issues using the above steps
    D. Assuming that the above works, now, if you get some error while running the demo code, the most likely culprits are:
(i) Improperly installed pytorch and pytorch3d. To check this, first check if pytorch is installed properly (see step-4 for details on how you can check this). Then, check if pytorch3d is installed properly by using python -c "import pytorch3d"; (ii) Numpy version error (Check #184 for a fix). (iii) Some missing pretrained models/files, check the next section for this;

Directory structure

The directory structure looks like this

├── assets
├── colab.sh
├── configs
├── examples
├── fetch_data.sh
├── hybrik
├── hybrik.egg-info
├── LICENSE
├── model_files
├── pretrained_models
├── README.md
├── res_dance
├── res_dance_safe
├── res_dance_safe2
├── scripts
└── setup.py

Within this, pretrained_models directory looks like this

├── hybrik_hrnet48_w3dpw.pth
├── hybrik_hrnet48_wo3dpw.pth
├── hybrik_hrnet.pth -> /data/amogh/projects/HybrIK/pretrained_models/hybrik_hrnet48_w3dpw.pth
├── hybrik_res34_w3dpw.pth
├── hybrikx_hrnet.pth
└── hybrikx_rle_hrnet.pth

The above pretrained models can be downloaded from here as suggested in the installation instructions. After downloading the models, I create a symlink named hybrik_hrnet.pth which links it to hybrik_hrnet48_w3dpw.pth. I did this because the code expects a file named hybrik_hrnet.pth but that wasn't available in the downloaded pretrained files. Hence I created this symlink and it worked. (If you are not familiar with symlinks, you can just rename hybrik_hrnet48_w3dpw.pth to hybrik_hrnet.pth). Please refer to #185 for more discussion on this.

The model_files directory looks like this

├── basicModel_neutral_lbs_10_207_0_v1.0.0.pkl
├── h36m_mean_beta.npy
├── J_regressor_h36m.npy
├── smplx
│   ├── SMPLX_FEMALE.npz
│   ├── SMPLX_FEMALE.pkl
│   ├── SMPLX_MALE.npz
│   ├── SMPLX_MALE.pkl
│   ├── SMPLX_NEUTRAL.npz
│   └── SMPLX_NEUTRAL.pkl
└── smplx_kid_template.npy

Here, the smplx files were downloaded from smpl-x's website, the basicModel_neutral_lbs_10_207_0_v1.0.0.pkl from smplify's website, the smplx_kid_template.npy from agora's website

For J_regressor_h36m.npy and h36m_mean_beta.npy, I first downloaded the necessary files using this script, following SPEC's instructions. (Note this downloads some extra files. We only need J_regressor_h36m.npy and smpl_mean_params.npz from this.

The script shared above, downloads smpl_mean_params.npz while this repo needs h36m_mean_beta.npy. To get h36m_mean_beta.npy from smpl_mean_params.npz, I got the mean betas from the smpl_mean_params.npz file and dumped it as a npy file in the model_files directory. This can be done as follows

x=np.load("smpl_mean_params.npz") \#provide the correct path to the mean_params file
print(x.files) \# To see the contents of the file
print(x['shape']) \# To see the contents of the mean shapes (betas)
np.save("h36m_mean_beta.npy", x['shape']) \# save the mean beta parameters.

After this, move the h36m_mean_beta.npy to the right location inside the model_files directory.

After this, I ran python scripts/demo_video.py --video-name examples/dance.mp4 --out-dir res_dance --save-pk --save-img as suggested in the official instructions, and it worked for me. Hope it works for you too. Best of luck!

@AmoghTiwari AmoghTiwari changed the title Installation Environment and Directory / File Structure Installation: Environment Setup | File/ Directory Structure Jul 20, 2023
@AmoghTiwari
Copy link
Author

@Jeff-sjtu : Please have a look at the environment setup instructions. If they work across a few other machiens, you can update the README accordingly. Also check out the Directory Structure section. Adding those to the README might also be helpful

@Echolink50
Copy link

Checking in. Windows 10, Xeon E3 V5, 16GB ram, RTX 3060 Ti. About a week ago I was trying to run hybrik with no luck. I figured out that I needed to run python 3.9 and got pytorch3d installed. Did the numpy thing as well. Kept getting the opencv error so I tried uninstalling openCV and reinstalling several different versions. Still didn't get it to work. The thing I missed that this guy helped me with was to delete openCV from the setup file. That enabled it to work.

The main difference that I had in the setup was that I ran CUDA 11.7. Installing CUDA 11.6 would get stuck at solving. Also the cub install couldn't be found but CUDA 11.7 doesn't need cub. I used this command.

conda install pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 pytorch-cuda=11.7 -c pytorch -c nvidia

And this for pytorch3d

pip install "git+https://github.com/facebookresearch/pytorch3d.git@stable"

Thanks for the help. Anybody know about running Hybrik-X? I tried and get an error about a .pk file or something. Also, What is the difference? Is Hybrik-X faster and uses GPU or better results or what?

@AmoghTiwari
Copy link
Author

Glad that it helped. Thanks for sharing your suggestions also.

Regarding your query about Hybrik-X - Hybrik-X regresses smpl-x parameters, while Hybrik regresses smpl parameters. smpl-x was a follow up work to smpl with information for more joints specifically, for the hand and face. You can read about smpl-x here

@Echolink50
Copy link

Ok. Are you able to run hybrik-x? I get an error about save.pk. What needs to be changed to run hybrik-x? Thanks

@Dipankar1997161
Copy link

Glad that it helped. Thanks for sharing your suggestions also.

Regarding your query about Hybrik-X - Hybrik-X regresses smpl-x parameters, while Hybrik regresses smpl parameters. smpl-x was a follow up work to smpl with information for more joints specifically, for the hand and face. You can read about smpl-x here

Hey Amogh, thank you for such a prompt explanation for the setup. 😁

It would be great if you can clarify a question of mine regarding the dataset.


I wish to train HyBrik on my custom dataset but I need to setup the annotation files in a correct structure and have to include the necessary things to avoid any failed trainings.

Could you maybe quickly brief on the things which are necessary.

Currently I have the following:
SMPL Paramters (poses, betas, 3d Joints, 2d joints, Camera paramters)
Is there anything else needed ??

Also how should the annotation structure be in case you know this. it will be wonderful since the 3 processed dataset given in this repo, follow different structure. So am confused which one to follow.

Hope to hear from you soon

@sebastianopazo1
Copy link

I faced some trouble while trying to setup the environment to run the code. Specially, with pytorch3d. So I am sharing the steps using which I was able to finally set up the code. Note that, till now I have only tried out the demo code. So I still can't confirm if the below steps will be sufficient for running the training code also. Also, if this doesn't work, please be sure to look at other comments also (for example, it worked for me with cuda 11.6, while someone else has shared there suggestions below that it worked for them with cuda 11.7).

System Details: Ubuntu 18.04 with 4 Nvidia 2080 Ti (Remote server)

Environment Setup

Note: Steps: 1-4 did not work for me. So you might want to directly jump to step-5

1. Try following the repo's official [installation instructions](https://github.com/Jeff-sjtu/HybrIK#installation-instructions). If they work, great!

2. If you face an issue in step-5, when running `python setup.py develop`, try using `pip install -e .` (from the root directory) instead. The latter works for me. The former doesn't

3. If you face an issue in step-2 (pytorch installation), look up the following link: https://pytorch.org/get-started/previous-versions/ and try installing the the version applicable to you. (Note the installation command for OSX/Linux/Windows might vary. So be careful to choose the right command).

4. If you face an issue in step-3 (pytorch3d installation), Check if pytorch got installed succesfully: `python -c "import torch`; If this doesn't run, it means torch is not installed properly. If this runs, try this - `python -c "import torch; print(torch.cuda.is_available())"`. If you have a gpu based system, and want to use a gpu, this should print "True" on your terminal. If you do not have a gpu, then it should print false. If you have a gpu and it still prints false (and assuming your gpu is working properly), then it means that even though pytorch is installed, only its cpu version is installed. In that case, try installing the gpu enabled version of pytorch (refer step-3)
       B. If pytorch is installed properly, but pytorch3d isn't you can try installing pytorch3d with pip or conda `pip install pytorch3d` / `conda install -c pytorch3d pytorch3d` . However, if none of these work (which happenned to be the case for me, see step-5

5. You might want to try following the repo's official instructions first (see steps 1-4) before coming to this step. But if following the repo's official instructions does not work (which happenned to be the case for me), then below are the steps which finally worked out for me. Note - there will  be some deviation from the repo's official instructions in the below steps


A. Install pytorch3d by following their official instructions: https://github.com/facebookresearch/pytorch3d/blob/main/INSTALL.md . Specifically, I did the following:
conda create -n hybrik python=3.9
conda activate hybrik
conda install pytorch=1.13.0 torchvision pytorch-cuda=11.6 -c pytorch -c nvidia
conda install -c fvcore -c iopath -c conda-forge fvcore iopath
conda install -c bottler nvidiacub
# Anaconda Cloud
conda install pytorch3d -c pytorch3d 
B. `pip install -e .` (from the root directory)     C. If you get an error while installing openCV after the above command, open the `setup.py` file, go to line 124, and from the `install_requires` list, remove the `opencv-python==4.1.2.30` part, install openCV separately using `pip install opencv-python` and then again run `pip install -e .` (from the root directory) And hope that it gets built properly I was able to solve the environment related issues using the above steps     D. Assuming that the above works, now, if you get some error while running the demo code, the most likely culprits are: (i) Improperly installed pytorch and pytorch3d. To check this, first check if pytorch is installed properly (see step-4 for details on how you can check this). Then, check if pytorch3d is installed properly by using `python -c "import pytorch3d"`; (ii) Numpy version error (Check #184 for a fix). (iii) Some missing pretrained models/files, check the next section for this;

Directory structure

The directory structure looks like this

├── assets
├── colab.sh
├── configs
├── examples
├── fetch_data.sh
├── hybrik
├── hybrik.egg-info
├── LICENSE
├── model_files
├── pretrained_models
├── README.md
├── res_dance
├── res_dance_safe
├── res_dance_safe2
├── scripts
└── setup.py

Within this, pretrained_models directory looks like this

├── hybrik_hrnet48_w3dpw.pth
├── hybrik_hrnet48_wo3dpw.pth
├── hybrik_hrnet.pth -> /data/amogh/projects/HybrIK/pretrained_models/hybrik_hrnet48_w3dpw.pth
├── hybrik_res34_w3dpw.pth
├── hybrikx_hrnet.pth
└── hybrikx_rle_hrnet.pth

The above pretrained models can be downloaded from here as suggested in the installation instructions. After downloading the models, I create a symlink named hybrik_hrnet.pth which links it to hybrik_hrnet48_w3dpw.pth. I did this because the code expects a file named hybrik_hrnet.pth but that wasn't available in the downloaded pretrained files. Hence I created this symlink and it worked. (If you are not familiar with symlinks, you can just rename hybrik_hrnet48_w3dpw.pth to hybrik_hrnet.pth). Please refer to #185 for more discussion on this.

The model_files directory looks like this

├── basicModel_neutral_lbs_10_207_0_v1.0.0.pkl
├── h36m_mean_beta.npy
├── J_regressor_h36m.npy
├── smplx
│   ├── SMPLX_FEMALE.npz
│   ├── SMPLX_FEMALE.pkl
│   ├── SMPLX_MALE.npz
│   ├── SMPLX_MALE.pkl
│   ├── SMPLX_NEUTRAL.npz
│   └── SMPLX_NEUTRAL.pkl
└── smplx_kid_template.npy

Here, the smplx files were downloaded from smpl-x's website, the basicModel_neutral_lbs_10_207_0_v1.0.0.pkl from smplify's website, the smplx_kid_template.npy from agora's website

For J_regressor_h36m.npy and h36m_mean_beta.npy, I first downloaded the necessary files using this script, following SPEC's instructions. (Note this downloads some extra files. We only need J_regressor_h36m.npy and smpl_mean_params.npz from this.

The script shared above, downloads smpl_mean_params.npz while this repo needs h36m_mean_beta.npy. To get h36m_mean_beta.npy from smpl_mean_params.npz, I got the mean betas from the smpl_mean_params.npz file and dumped it as a npy file in the model_files directory. This can be done as follows

x=np.load("smpl_mean_params.npz") \#provide the correct path to the mean_params file
print(x.files) \# To see the contents of the file
print(x['shape']) \# To see the contents of the mean shapes (betas)
np.save("h36m_mean_beta.npy", x['shape']) \# save the mean beta parameters.

After this, move the h36m_mean_beta.npy to the right location inside the model_files directory.

After this, I ran python scripts/demo_video.py --video-name examples/dance.mp4 --out-dir res_dance --save-pk --save-img as suggested in the official instructions, and it worked for me. Hope it works for you too. Best of luck!

Hi, I followed the instructions to set the environment and install pytorch3d, but when I try to install it using conda I get conflicts.
Could you help me solve this problem? What do you recommend me in this case? Thanks!

The following specifications were found to be incompatible with your system:

  • feature:/linux-64::__cuda==11.8=0
  • feature:/linux-64::__glibc==2.31=0
  • feature:|@/linux-64::__cuda==11.8=0
  • feature:|@/linux-64::__glibc==2.31=0
  • brotli-python -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • cffi -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • cryptography -> libgcc-ng -> __glibc[version='>=2.17']
  • freetype -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • giflib -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • intel-openmp -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • jpeg -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • lcms2 -> libgcc-ng[version='>=7.3.0'] -> __glibc[version='>=2.17']
  • lerc -> libgcc-ng[version='>=7.5.0'] -> __glibc[version='>=2.17']
  • libdeflate -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • libffi -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • libgcc-ng -> __glibc[version='>=2.17']
  • libpng -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • libstdcxx-ng -> __glibc[version='>=2.17']
  • libtiff -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • libwebp -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • libwebp-base -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • lz4-c -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • mkl -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • mkl-service -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • mkl_random -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • ncurses -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • numpy -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • numpy-base -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • openjpeg -> libgcc-ng[version='>=7.5.0'] -> __glibc[version='>=2.17']
  • openssl -> libgcc-ng[version='>=7.5.0'] -> __glibc[version='>=2.17']
  • pillow -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • python=3.9 -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • pytorch3d -> pytorch==2.0.1 -> __cuda[version='>=11.8']
  • pytorch3d -> torchvision[version='>=0.5'] -> __glibc[version='>=2.17,<3.0.a0']
  • pyyaml -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • readline -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • sqlite -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • tbb -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • tk -> libgcc-ng[version='>=7.5.0'] -> __glibc[version='>=2.17']
  • torchvision -> __glibc[version='>=2.17,<3.0.a0']
  • torchvision -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • torchvision -> pytorch -> __cuda[version='>=11.8']
  • xz -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • yaml -> libgcc-ng[version='>=9.4.0'] -> __glibc[version='>=2.17']
  • zlib -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • zstd -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']

Your installed version is: 2.31

@Dipankar1997161
Copy link

Dipankar1997161 commented Nov 7, 2023

I faced some trouble while trying to setup the environment to run the code. Specially, with pytorch3d. So I am sharing the steps using which I was able to finally set up the code. Note that, till now I have only tried out the demo code. So I still can't confirm if the below steps will be sufficient for running the training code also. Also, if this doesn't work, please be sure to look at other comments also (for example, it worked for me with cuda 11.6, while someone else has shared there suggestions below that it worked for them with cuda 11.7).
System Details: Ubuntu 18.04 with 4 Nvidia 2080 Ti (Remote server)

Environment Setup

Note: Steps: 1-4 did not work for me. So you might want to directly jump to step-5

1. Try following the repo's official [installation instructions](https://github.com/Jeff-sjtu/HybrIK#installation-instructions). If they work, great!

2. If you face an issue in step-5, when running `python setup.py develop`, try using `pip install -e .` (from the root directory) instead. The latter works for me. The former doesn't

3. If you face an issue in step-2 (pytorch installation), look up the following link: https://pytorch.org/get-started/previous-versions/ and try installing the the version applicable to you. (Note the installation command for OSX/Linux/Windows might vary. So be careful to choose the right command).

4. If you face an issue in step-3 (pytorch3d installation), Check if pytorch got installed succesfully: `python -c "import torch`; If this doesn't run, it means torch is not installed properly. If this runs, try this - `python -c "import torch; print(torch.cuda.is_available())"`. If you have a gpu based system, and want to use a gpu, this should print "True" on your terminal. If you do not have a gpu, then it should print false. If you have a gpu and it still prints false (and assuming your gpu is working properly), then it means that even though pytorch is installed, only its cpu version is installed. In that case, try installing the gpu enabled version of pytorch (refer step-3)
       B. If pytorch is installed properly, but pytorch3d isn't you can try installing pytorch3d with pip or conda `pip install pytorch3d` / `conda install -c pytorch3d pytorch3d` . However, if none of these work (which happenned to be the case for me, see step-5

5. You might want to try following the repo's official instructions first (see steps 1-4) before coming to this step. But if following the repo's official instructions does not work (which happenned to be the case for me), then below are the steps which finally worked out for me. Note - there will  be some deviation from the repo's official instructions in the below steps


A. Install pytorch3d by following their official instructions: https://github.com/facebookresearch/pytorch3d/blob/main/INSTALL.md . Specifically, I did the following:
conda create -n hybrik python=3.9
conda activate hybrik
conda install pytorch=1.13.0 torchvision pytorch-cuda=11.6 -c pytorch -c nvidia
conda install -c fvcore -c iopath -c conda-forge fvcore iopath
conda install -c bottler nvidiacub
# Anaconda Cloud
conda install pytorch3d -c pytorch3d 
B. `pip install -e .` (from the root directory)     C. If you get an error while installing openCV after the above command, open the `setup.py` file, go to line 124, and from the `install_requires` list, remove the `opencv-python==4.1.2.30` part, install openCV separately using `pip install opencv-python` and then again run `pip install -e .` (from the root directory) And hope that it gets built properly I was able to solve the environment related issues using the above steps     D. Assuming that the above works, now, if you get some error while running the demo code, the most likely culprits are: (i) Improperly installed pytorch and pytorch3d. To check this, first check if pytorch is installed properly (see step-4 for details on how you can check this). Then, check if pytorch3d is installed properly by using `python -c "import pytorch3d"`; (ii) Numpy version error (Check #184 for a fix). (iii) Some missing pretrained models/files, check the next section for this;

Directory structure

The directory structure looks like this

├── assets
├── colab.sh
├── configs
├── examples
├── fetch_data.sh
├── hybrik
├── hybrik.egg-info
├── LICENSE
├── model_files
├── pretrained_models
├── README.md
├── res_dance
├── res_dance_safe
├── res_dance_safe2
├── scripts
└── setup.py

Within this, pretrained_models directory looks like this

├── hybrik_hrnet48_w3dpw.pth
├── hybrik_hrnet48_wo3dpw.pth
├── hybrik_hrnet.pth -> /data/amogh/projects/HybrIK/pretrained_models/hybrik_hrnet48_w3dpw.pth
├── hybrik_res34_w3dpw.pth
├── hybrikx_hrnet.pth
└── hybrikx_rle_hrnet.pth

The above pretrained models can be downloaded from here as suggested in the installation instructions. After downloading the models, I create a symlink named hybrik_hrnet.pth which links it to hybrik_hrnet48_w3dpw.pth. I did this because the code expects a file named hybrik_hrnet.pth but that wasn't available in the downloaded pretrained files. Hence I created this symlink and it worked. (If you are not familiar with symlinks, you can just rename hybrik_hrnet48_w3dpw.pth to hybrik_hrnet.pth). Please refer to #185 for more discussion on this.
The model_files directory looks like this

├── basicModel_neutral_lbs_10_207_0_v1.0.0.pkl
├── h36m_mean_beta.npy
├── J_regressor_h36m.npy
├── smplx
│   ├── SMPLX_FEMALE.npz
│   ├── SMPLX_FEMALE.pkl
│   ├── SMPLX_MALE.npz
│   ├── SMPLX_MALE.pkl
│   ├── SMPLX_NEUTRAL.npz
│   └── SMPLX_NEUTRAL.pkl
└── smplx_kid_template.npy

Here, the smplx files were downloaded from smpl-x's website, the basicModel_neutral_lbs_10_207_0_v1.0.0.pkl from smplify's website, the smplx_kid_template.npy from agora's website
For J_regressor_h36m.npy and h36m_mean_beta.npy, I first downloaded the necessary files using this script, following SPEC's instructions. (Note this downloads some extra files. We only need J_regressor_h36m.npy and smpl_mean_params.npz from this.
The script shared above, downloads smpl_mean_params.npz while this repo needs h36m_mean_beta.npy. To get h36m_mean_beta.npy from smpl_mean_params.npz, I got the mean betas from the smpl_mean_params.npz file and dumped it as a npy file in the model_files directory. This can be done as follows

x=np.load("smpl_mean_params.npz") \#provide the correct path to the mean_params file
print(x.files) \# To see the contents of the file
print(x['shape']) \# To see the contents of the mean shapes (betas)
np.save("h36m_mean_beta.npy", x['shape']) \# save the mean beta parameters.

After this, move the h36m_mean_beta.npy to the right location inside the model_files directory.
After this, I ran python scripts/demo_video.py --video-name examples/dance.mp4 --out-dir res_dance --save-pk --save-img as suggested in the official instructions, and it worked for me. Hope it works for you too. Best of luck!

Hi, I followed the instructions to set the environment and install pytorch3d, but when I try to install it using conda I get conflicts. Could you help me solve this problem? What do you recommend me in this case? Thanks!

The following specifications were found to be incompatible with your system:

  • feature:/linux-64::__cuda==11.8=0
  • feature:/linux-64::__glibc==2.31=0
  • feature:|@/linux-64::__cuda==11.8=0
  • feature:|@/linux-64::__glibc==2.31=0
  • brotli-python -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • cffi -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • cryptography -> libgcc-ng -> __glibc[version='>=2.17']
  • freetype -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • giflib -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • intel-openmp -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • jpeg -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • lcms2 -> libgcc-ng[version='>=7.3.0'] -> __glibc[version='>=2.17']
  • lerc -> libgcc-ng[version='>=7.5.0'] -> __glibc[version='>=2.17']
  • libdeflate -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • libffi -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • libgcc-ng -> __glibc[version='>=2.17']
  • libpng -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • libstdcxx-ng -> __glibc[version='>=2.17']
  • libtiff -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • libwebp -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • libwebp-base -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • lz4-c -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • mkl -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • mkl-service -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • mkl_random -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • ncurses -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • numpy -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • numpy-base -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • openjpeg -> libgcc-ng[version='>=7.5.0'] -> __glibc[version='>=2.17']
  • openssl -> libgcc-ng[version='>=7.5.0'] -> __glibc[version='>=2.17']
  • pillow -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • python=3.9 -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • pytorch3d -> pytorch==2.0.1 -> __cuda[version='>=11.8']
  • pytorch3d -> torchvision[version='>=0.5'] -> __glibc[version='>=2.17,<3.0.a0']
  • pyyaml -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • readline -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • sqlite -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • tbb -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • tk -> libgcc-ng[version='>=7.5.0'] -> __glibc[version='>=2.17']
  • torchvision -> __glibc[version='>=2.17,<3.0.a0']
  • torchvision -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • torchvision -> pytorch -> __cuda[version='>=11.8']
  • xz -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • yaml -> libgcc-ng[version='>=9.4.0'] -> __glibc[version='>=2.17']
  • zlib -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']
  • zstd -> libgcc-ng[version='>=11.2.0'] -> __glibc[version='>=2.17']

Your installed version is: 2.31

Thank you for the response, I got another question.
May I know how many 3d keypoints where detected and smpl joints after you run the demo?
Since it used the j_regressor from h36m. Is it 17 keypoints only??

I have my own data and wish to train hybrik but it has 18-25 joints like openpose 😅 so kinda in the mid state if hybrik is the right choice.

Could you inform me @sebastianopazo1

@Ulf3000
Copy link

Ulf3000 commented Nov 12, 2023

conda install pytorch3d -c pytorch3d .. which channel is this on ?

@Dipankar1997161
Copy link

Dipankar1997161 commented Nov 12, 2023

conda install pytorch3d -c pytorch3d .. which channel is this on ?

Get the latest one, mostly from forge.

Or install via pip

@Ulf3000
Copy link

Ulf3000 commented Nov 12, 2023

i used pip install "git+https://github.com/facebookresearch/pytorch3d.git@stable"

instead of ssh . that worked

@thomasblanchard21
Copy link

It helped a lot, thanks for your contribution @AmoghTiwari ! I should add that I had an error:

A module that was compiled using NumPy 1.x cannot be run in                                                                                                                             
NumPy 2.0.1 as it may crash. To support both 1.x and 2.x                                                                                                                                
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

I fixed it by downgrading numpy using conda install 'numpy<1.24'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants