From e5cdece3de6e6dcfb8bf5e060ed07cc62392f146 Mon Sep 17 00:00:00 2001 From: Valerian Fourel <168947630+PSContainer@users.noreply.github.com> Date: Tue, 9 Jul 2024 19:56:08 +0900 Subject: [PATCH] starter.sh and README.md added --- README.md | 100 ++++++++++++++++++++++++++++++++++- starter.sh | 149 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 248 insertions(+), 1 deletion(-) create mode 100644 starter.sh diff --git a/README.md b/README.md index 3713178..a9d20be 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # DECO: Dense Estimation of 3D Human-Scene Contact in the Wild [ICCV 2023 (Oral)] + > Code repository for the paper: > [**DECO: Dense Estimation of 3D Human-Scene Contact in the Wild**](https://openaccess.thecvf.com/content/ICCV2023/html/Tripathi_DECO_Dense_Estimation_of_3D_Human-Scene_Contact_In_The_Wild_ICCV_2023_paper.html) > [Shashank Tripathi](https://sha2nkt.github.io/), [Agniv Chatterjee](https://ac5113.github.io/), [Jean-Claude Passy](https://is.mpg.de/person/jpassy), [Hongwei Yi](https://xyyhw.top/), [Dimitrios Tzionas](https://ps.is.mpg.de/person/dtzionas), [Michael J. Black](https://ps.is.mpg.de/person/black)
@@ -153,6 +154,103 @@ To train on other datasets, please follow these steps: 5. Add the path(s) to the dataset npz(s) to ```common/constants.py``` ([these lines](https://github.com/sha2nkt/deco/blob/d5233ecfad1f51b71a50a78c0751420067e82c02/common/constants.py#L19)). 6. Finally, change ```TRAINING.DATASETS``` and ```VALIDATION.DATASETS``` in the config file and you're good to go! + +## Docker/Singularity Installation + +The Images are available on DockerHub at: ```https://hub.docker.com/repository/docker/pscontainer/deco```. + +### 1. Make the Singularity/Docker Environment: + +You can launch with Singularity: +``` +singularity build --sandbox /tmp/conda_sandbox docker://pscontainer/deco:cuda117 +``` + +You can launch with Docker: +``` +docker run --gpus all -it --rm pscontainer/deco:cuda117 +``` + + +### 2. Enter the Singularity Environment +``` +singularity shell --writable --nv -f -c --pwd=/tmp/home -H /tmp/home /tmp/conda_sandbox/ +``` + +In order to save the code and models downloaded, you can use the ```--writable-tmpfs``` and move to a path where the models persist out of a temporary folder. + +``` +singularity shell --writable-tmpfs --nv --pwd=/tmp/home -H /tmp/home /tmp/conda_sandbox/ +``` + +With Docker: + +``` +docker run --gpus all -it --rm \ + -v deco_data:/persistent_data \ + -w /persistent_data \ + -e HOME=/persistent_data \ + pscontainer/deco:cuda117 +``` + +### 3. Starting the download of all environment +``` +git clone https://github.com/sha2nkt/deco.git +``` + +You need to register on "https://deco.is.tue.mpg.de/" to access the weights of the model, and on “https://hot.is.tue.mpg.de/" to have access to the data. + +You can now launch the starter script that will install all of the needed to launch deco on your device. +```bash +bash starter.sh +``` + + +### 4. Launching the Model from the Apptainer Container +We must first leave the container. +``` exit ``` + + +#### Make a .sif file + +``` +singularity build ./deco.sif /tmp/conda_sandbox/ +``` + + +You can verify that the installation was done correctly by launching the following script on the container. +We make an output directory: +``` mkdir outputDECO``` + +You can verify that the installation was done correctly by launching the following script on the container. +we make the ```DecoLaunch.sh``` + +```bash +cd /path/to/deco + +eval "$(conda shell.bash hook)" + +conda activate deco + +python inference.py \ + --img_src example_images \ + --out_dir /container/output/ +``` + +### Run the demo on a video + +``` +singularity exec --bind ./outputDECO:/container/output deco.sif ./DecoLaunch.sh +``` + +### Important Notes + +- Ensure you have the necessary GPU drivers and CUDA installed on your host system. +- The Docker version requires Docker with GPU support to be installed. +- The Singularity version requires Singularity to be installed on your system. +- Make sure to adjust paths and directories as needed for your specific setup. + + ## Citing If you find this code useful for your research, please consider citing the following paper: @@ -179,4 +277,4 @@ We sincerely thank Alpar Cseke for his contributions to DAMON data collection an For technical questions, please create an issue. For other questions, please contact `deco@tue.mpg.de`. -For commercial licensing, please contact `ps-licensing@tue.mpg.de`. +For commercial licensing, please contact `ps-licensing@tue.mpg.de`. \ No newline at end of file diff --git a/starter.sh b/starter.sh new file mode 100644 index 0000000..47f8d1a --- /dev/null +++ b/starter.sh @@ -0,0 +1,149 @@ +#!/bin/bash + +eval "$(conda shell.bash hook)" +apt-get install libnvidia-gl-515-server -y +apt-get install nvidia-utils-515 -y + + +conda create -n deco python=3.9 -y + +conda activate deco +# pip install torch==1.13.0+cu117 torchvision==0.14.0+cu117 --extra-index-url https://download.pytorch.org/whl/cu117 +conda install pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 pytorch-cuda=11.7 -c pytorch -c nvidia +pip install fvcore +# git clone https://github.com/facebookresearch/pytorch3d.git +# cd pytorch3d +# pip install . +# cd .. + +# pip install -r requirements.txt +pip install opencv-python loguru monai==1.0.1 pyrender==0.1.33 smplx==0.1.28 scikit-learn scikit-image jpeg4py matplotlib pandas configargparse flatten_dict chumpy numpy==1.23.1 yacs networkx==2.2 charset-normalizer==3.1.0 +bash fetch_data.sh + +echo "Please register and agree to the license of DECO on: “https://deco.is.tue.mpg.de/" + +# Prompt for username +echo "Enter username for DECO:" +read username + +# Prompt for password without showing it +echo "Enter password for DECO:" +read -s password + + +wget --post-data "username=$username&password=$password" 'https://download.is.tue.mpg.de/download.php?domain=deco&resume=1&sfile=Release_Damon.tar.gz' -O Release_Damon.tar.gz + +tar -xvf Release_Damon.tar.gz && rm -r Release_Damon.tar.gz + +wget --post-data "username=$username&password=$password" 'https://download.is.tue.mpg.de/download.php?domain=deco&resume=1&sfile=damon_segmentations.tar.gz' -O damon_segmentations.tar.gz + +tar -xvf damon_segmentations.tar.gz && rm -r damon_segmentations.tar.gz + +wget --post-data "username=$username&password=$password" 'https://download.is.tue.mpg.de/download.php?domain=deco&resume=1&sfile=hot_polygon_contact.tar.gz' -O hot_polygon_contact.tar.gz + +tar -xvf hot_polygon_contact.tar.gz && rm -r hot_polygon_contact.tar.gz + +############### + +echo "Please register and agree to the license of the HOT dataset on: “https://hot.is.tue.mpg.de/" +# Prompt for username +echo "Enter username for the HOT dataset:" +read username + +# Prompt for password without showing it +echo "Enter password for the HOT dataset:" +read -s password + +wget --post-data "username=$username&password=$password" 'https://download.is.tue.mpg.de/download.php?domain=hot&resume=1&sfile=HOT-Annotated.zip' -O HOT-Annotated.zip + + + +# we install SMPL-X +pip install opencv-python loguru monai==1.0.1 pyrender==0.1.33 smplx==0.1.28 scikit-learn scikit-image jpeg4py matplotlib pandas configargparse flatten_dict chumpy numpy==1.23.1 yacs networkx==2.5 charset-normalizer==3.1.0 + + +mv Release_Datasets/damon/ datasets/Release_Datasets/damon + +# we install MKL +conda install mkl mkl-service + +# Pytorch3d is needed +conda install pytorch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1 pytorch-cuda=11.7 -c pytorch -c nvidia +git clone https://github.com/facebookresearch/pytorch3d.git +cd pytorch3d +pip install . +cd .. +pip install configargparse +pip install chardet==4.0.0 idna==2.10 requests==2.25.1 urllib3==1.26.19 +pip install networkx==2.5 + +# Login to SMPL-X Website +########### SMPL-X ########### + +###### +# +# +# We need the last SMPL-X +# +cd .. +urle () { [[ "${1}" ]] || return 1; local LANG=C i x; for (( i = 0; i < ${#1}; i++ )); do x="${1:i:1}"; [[ "${x}" == [a-zA-Z0-9.~-] ]] && echo -n "${x}" || printf '%%%02X' "'${x}"; done; echo; } + + +read -p "Username (SMPl-X Website - https://smpl-x.is.tue.mpg.de/):" username +read -p "Password (SMPl-X Website - https://smpl-x.is.tue.mpg.de/):" -s password + +username=$(urle $username) +password=$(urle $password) + +wget --post-data "username=$username&password=$password" 'https://download.is.tue.mpg.de/download.php?domain=smplx&sfile=models_smplx_v1_1.zip&resume=1' -O 'models_smplx_v1_1.zip' --no-check-certificate --continue +unzip models_smplx_v1_1.zip + + +# we need to move this into the data +cp models/smplx/SMPLX_NEUTRAL.npz deco/data/smplx/SMPLX_NEUTRAL.npz + +########### SMPL ########### +echo "Downloading SMPL Models" + +urle () { [[ "${1}" ]] || return 1; local LANG=C i x; for (( i = 0; i < ${#1}; i++ )); do x="${1:i:1}"; [[ "${x}" == [a-zA-Z0-9.~-] ]] && echo -n "${x}" || printf '%%%02X' "'${x}"; done; echo; } + +username=$(urle $username) +password=$(urle $password) + +# Login to SMPL Website +# If you don't have an account, create one here: https://smpl.is.tue.mpg.de/ +read -p "Username (SMPL Website - https://smpl.is.tue.mpg.de/):" username +read -p "Password (SMPL Website - https://smpl.is.tue.mpg.de/):" -s password + +wget --post-data "username=$username&password=$password" 'https://download.is.tue.mpg.de/download.php?domain=smpl&sfile=SMPL_python_v.1.1.0.zip&resume=1' -O 'models_smpl.zip' --no-check-certificate --continue +unzip models_smpl.zip +mv SMPL_python_v.1.1.0 smpl +cp smpl/smpl/models/basicmodel_neutral_lbs_10_207_0_v1.1.0.pkl deco/data/smpl/SMPL_NEUTRAL.pkl + + +#################################### +# +# we launch the code. +# + +cd deco + +# we move the HOT datasets in the proper paths +unzip HOT-Annotated.zip +mv HOT-Annotated datasets/HOT-Annotated +mv polygon_contact datasets/HOT-Annotated/polygon_contact +mv parts datasets/HOT-Annotated/parts +mv segmentation_masks datasets/HOT-Annotated/segmentation_masks + + +# we launch the the inference + +echo "Part 1: inference launch" + +python inference.py \ + --img_src example_images \ + --out_dir demo_out + +echo "Part 2: Tester Script" + +python tester.py --cfg configs/cfg_test.yml \ No newline at end of file