-
Notifications
You must be signed in to change notification settings - Fork 31
/
generate.sh
executable file
·40 lines (28 loc) · 1002 Bytes
/
generate.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
USER="$(whoami)"
PYTHON_ENV=/home/${USER}/miniconda3/etc/profile.d/conda.sh
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
source ${PYTHON_ENV}
INPUT="empty"
OUTPUT="empty"
TEST_FRAMES=350
if [ -n "$1" ]; then INPUT=${1}; fi
if [ -n "$2" ]; then OUTPUT=${2}; fi
if [ -n "$3" ]; then TEST_FRAMES=${3}; fi
conda activate rta
echo "Generate insta transform file"
python transforms.py -i ${INPUT} -o ${OUTPUT} -t ${TEST_FRAMES}
echo "Eyes simplification"
python simplification.py -i ${OUTPUT}
echo "Robust Video Matting"
cd dependencies/RobustVideoMatting
python inference.py --variant resnet50 --checkpoint model/rvm_resnet50.pth --device cuda:0 --input-source ${OUTPUT}/background/ --output-type png_sequence --output-composition ${OUTPUT}/matted/ --num-workers 8
cd ../
echo "Face Parsing"
cd face-parsing.PyTorch
python test.py --actor ${OUTPUT}
echo "Postprocessing"
cd ../../
python postprocess.py -i ${OUTPUT}
rm -rf ${OUTPUT}/background/
echo "End!"