-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
112 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,60 @@ | ||
#!/bin/bash | ||
# Name of the yml file without the extension | ||
vibe_name="vibe_environment" | ||
set -e # Exit on any error | ||
export PATH="$PATH:." | ||
|
||
|
||
# Create the environment from the yml file | ||
conda env create -f ${vibe_name}.yml | ||
# Activate the environment | ||
conda init bash | ||
conda activate $vibe_name | ||
source ./VIBE_custom/scripts/install_conda.sh | ||
|
||
|
||
video_names=$(yq e '.videos.names[]' ./nemo-config.yml) | ||
# Obtain video names from nemo-config.yml | ||
video_names=($(awk '/names:/{flag=1;next}/]/{flag=0}flag' ./nemo-config.yml | grep -o '"[^"]*"' | sed 's/"//g')) | ||
# # Print the video names one per line | ||
#printf '%s\n' "${video_names[@]}" | ||
|
||
# change write permissions for the data folder so that the docker container can write to it | ||
chmod 777 ./data | ||
# # Change write permissions for the data folder so that the docker container can write to it | ||
script_dir=$(cd "$(dirname "$0")" && pwd) | ||
data_dir="${script_dir}/data" | ||
chmod -R 777 "$data_dir" | ||
|
||
# iterate over video names | ||
for name in $video_names; do | ||
python ./VIBE_custom/demo.py --vid_file ./data/videos/${name}.mp4 --output_folder ./data/exps/${name}.vibe/ --display | ||
cd ./VIBE_custom | ||
# Iterate over video names | ||
for name in "${video_names[@]}"; do | ||
python ./demo.py --vid_file "../${data_dir}/videos/${name}.mp4" --output_folder "../${data_dir}/exps/" | ||
done | ||
|
||
cd .. | ||
|
||
# Deactivate the environment | ||
eval "$(conda shell.bash hook)" | ||
|
||
conda deactivate | ||
# create conda environment through custom_env.yml | ||
env_name="custom_env" | ||
conda env create -f ${env_name}.yml | ||
|
||
# Create conda environment through custom_env.yml | ||
env_name="nemo-env" | ||
conda env create -f "${env_name}.yml" | ||
|
||
eval "$(conda shell.bash hook)" | ||
# Activate the environment | ||
conda activate $env_name | ||
#iterate over video names | ||
#get the number of videos | ||
num_videos=$(yq e '.videos.names | length' ./nemo-config.yml) | ||
count=$((num_videos)) | ||
for name in $video_names; do | ||
#get the name of the video before the . in the name | ||
video_name=$(echo $name | cut -d'.' -f 1) | ||
python ./video_to_frames_custom.py --action $video_name --num_videos $count --display | ||
docker run --gpus 5 --rm -v /pasteur/u/jeffheo/projects/nemo-cvpr2023-jeff/custom_video/data/exps:/mnt cwaffles/openpose ./build/examples/openpose/openpose.bin --image_dir /mnt/${name}.frames --write_json /mnt/${name}.op --display 0 --model_pose BODY_25 --number_people_max 1 --render_pose 0 | ||
done | ||
conda activate "$env_name" | ||
|
||
pip install --force-reinstall pyopengl==3.1.5 | ||
|
||
# Get the number of videos | ||
num_elements=${#video_names[@]} | ||
count="$num_elements" | ||
video_name_with_extension=${video_names[0]} | ||
|
||
# Remove the extension and the number | ||
video_name="${video_name_with_extension%%.*}" | ||
#echo "$video_name" | ||
#echo "$count" | ||
|
||
python ./video_to_frames_custom.py --action "$video_name" --num_videos "$count" | ||
# Iterate over video names | ||
for name in "${video_names[@]}"; do | ||
docker run --gpus 1 --rm -v "${data_dir}/exps:/mnt" cwaffles/openpose ./build/examples/openpose/openpose.bin --image_dir /mnt/"${name%.mp4}.frames" --write_json /mnt/"${name%.mp4}.op" --display 0 --model_pose BODY_25 --number_people_max 1 --render_pose 0 | ||
done | ||
cd .. | ||
# Now run the NeMo script | ||
bash ./nemo-run.sh 0 | ||
bash custom_video/nemo-run.sh 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.