Skip to content

Instantly share code, notes, and snippets.

@quangIO
Created August 15, 2019 02:52
Show Gist options
  • Save quangIO/1dbfba858989f92ef833d8c4e8a6296f to your computer and use it in GitHub Desktop.
Save quangIO/1dbfba858989f92ef833d8c4e8a6296f to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
current_path=$(pwd)
echo ${current_path}
DATA_PATH="/home/quangio/dev/hackathon/nn/viton-gan/viton_gan/data/test"
HUMAN_PARSING_PATH="/home/quangio/dev/hackathon/nn/viton_orig/viton-gan/human_parsing"
cd /home/quangio/dev/hackathon/nn/viton_orig/viton-gan/human_parsing
rm LIP_JPPNet/output/parsing/val/*
for img in /home/quangio/dev/hackathon/nn/images/*.jpg
do
img_path="${img}"
echo "$img_path"
convert "${img_path}" -resize 192x256\! "${img_path}"
cp "${img_path}" "${DATA_PATH}/person"
echo "Running parser"
python run_human_parsing.py $img_path
done
cd "${HUMAN_PARSING_PATH}/LIP_JPPNet/output/parsing/val"
cp * "${DATA_PATH}/person-parse"
for i in *.[Pp][Nn][Gg]
do
filename=$(basename -- $i)
filename="${filename%.*}"
python /home/quangio/dev/hackathon/nn/cloth_mask.py $i "${DATA_PATH}/cloth-mask/${filename}.jpg"
done
echo "Extracting keypoints"
cd /home/quangio/dev/hackathon/nn/openpose
rm out/*.json
./build/examples/openpose/openpose.bin --model_pose COCO --image_dir ../images --write_json out
echo "DONE extracting"
echo "${DATA_PATH}/pose"
cd out
for f in *.json
do
node json_converter.js "$(pwd)/$f" "$(pwd)/$f"
done
cp *.json "${DATA_PATH}/pose/"
cd /home/quangio/dev/hackathon/nn/viton-gan/viton_gan/
rm /home/quangio/dev/hackathon/nn/viton-gan/viton_gan/data/test/tryon-person/*
rm /home/quangio/dev/hackathon/nn/viton-gan/viton_gan/data/test/warp-cloth/*
rm /home/quangio/dev/hackathon/nn/viton-gan/viton_gan/warp-cloth/warp-cloth-mask/*
optirun python run_gmm.py
optirun python run_tom.py
cd data/test/
mkdir masked
cd warp-cloth
for img in *
do
echo $img
convert /home/quangio/dev/hackathon/nn/viton-gan/viton_gan/data/test/person/phuc.jpg "/home/quangio/dev/hackathon/nn/viton-gan/viton_gan/data/test/warp-cloth/${img}" "/home/quangio/dev/hackathon/nn/viton-gan/viton_gan/data/test/warp-cloth-mask/${img}" -composite "/home/quangio/dev/hackathon/nn/viton-gan/viton_gan/data/test/masked/${img}"
done
cd /home/quangio/dev/hackathon/nn/viton-gan/viton_gan/data/test/masked
ls -v | cat -n | while read n f; do mv -n "$f" "$n.jpg"; done
for f in *.jpg
do
waifu2x-converter-cpp -i $f -o $f
done
cd /home/quangio/dev/hackathon/nn/viton-gan/viton_gan/data/test/tryon-person
ls -v | cat -n | while read n f; do mv -n "$f" "$n.jpg"; done
for f in *.jpg
do
waifu2x-converter-cpp -i $f -o $f
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment