prepare.sh 8.7 KB
Newer Older
L
lzzyzlbb 已提交
1 2 3
#!/bin/bash
FILENAME=$1

W
wangna11BD 已提交
4
# MODE be one of ['lite_train_lite_infer' 'lite_train_whole_infer' 'whole_train_whole_infer',
5
#                 'whole_infer', 'benchmark_train', 'cpp_infer']
L
lzzyzlbb 已提交
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

MODE=$2

dataline=$(cat ${FILENAME})

# parser params
IFS=$'\n'
lines=(${dataline})
function func_parser_key(){
    strs=$1
    IFS=":"
    array=(${strs})
    tmp=${array[0]}
    echo ${tmp}
}
function func_parser_value(){
    strs=$1
    IFS=":"
    array=(${strs})
    tmp=${array[1]}
    echo ${tmp}
}
IFS=$'\n'
# The training params
model_name=$(func_parser_value "${lines[1]}")
trainer_list=$(func_parser_value "${lines[14]}")

B
Birdylx 已提交
33
if [ ${MODE} = "benchmark_train" ];then
B
Birdylx 已提交
34
    pip install -r requirements.txt
B
Birdylx 已提交
35 36
    MODE="lite_train_lite_infer"
fi
L
lzzyzlbb 已提交
37 38

if [ ${MODE} = "lite_train_lite_infer" ];then
W
wangna11BD 已提交
39

L
lzzyzlbb 已提交
40 41
    case ${model_name} in
    Pix2pix)
L
lzzyzlbb 已提交
42 43
        rm -rf ./data/pix2pix*
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/pix2pix_facade_lite.tar --no-check-certificate
L
lzzyzlbb 已提交
44 45
        cd ./data/ && tar xf pix2pix_facade_lite.tar && cd ../ ;;
    CycleGAN)
46
        rm -rf ./data/cyclegan*
L
lzzyzlbb 已提交
47
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/cyclegan_horse2zebra_lite.tar --no-check-certificate
L
lzzyzlbb 已提交
48 49
        cd ./data/ && tar xf cyclegan_horse2zebra_lite.tar && cd ../ ;;
    StyleGANv2)
L
lzzyzlbb 已提交
50 51
        rm -rf ./data/ffhq*
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/ffhq.tar --no-check-certificate
L
lzzyzlbb 已提交
52 53
        cd ./data/ && tar xf ffhq.tar && cd ../ ;;
    FOMM)
54
        rm -rf ./data/fom_lite*
L
lzzyzlbb 已提交
55
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/fom_lite.tar  --no-check-certificate --no-check-certificate
L
lzzyzlbb 已提交
56 57
        cd ./data/ && tar xf fom_lite.tar && cd ../ ;;
    edvr|basicvsr|msvsr)
58 59
        rm -rf ./data/reds*
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/reds_lite.tar --no-check-certificate
L
lzzyzlbb 已提交
60 61 62 63 64
        cd ./data/ && tar xf reds_lite.tar && cd ../ ;;
    esrgan)
        rm -rf ./data/DIV2K*
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/DIV2KandSet14.tar --no-check-certificate
        cd ./data/ && tar xf DIV2KandSet14.tar && cd ../ ;;
B
BrilliantYuKaimin 已提交
65
    singan)
W
wangna11BD 已提交
66
        rm -rf ./data/singan*
B
BrilliantYuKaimin 已提交
67
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/singan-official_images.zip --no-check-certificate
W
wangna11BD 已提交
68
        cd ./data/ && unzip -q singan-official_images.zip && cd ../
B
BrilliantYuKaimin 已提交
69
        mkdir -p ./data/singan
W
wangna11BD 已提交
70 71
        mv ./data/SinGAN-official_images/Images/stone.png ./data/singan ;;
    esac
L
lzzyzlbb 已提交
72
elif [ ${MODE} = "whole_train_whole_infer" ];then
L
lzzyzlbb 已提交
73
    if [ ${model_name} == "Pix2pix" ]; then
L
lzzyzlbb 已提交
74 75 76
        rm -rf ./data/facades*
        wget -nc -P ./data/ http://efrosgans.eecs.berkeley.edu/pix2pix/datasets/facades.tar.gz --no-check-certificate
        cd ./data/ && tar -xzf facades.tar.gz && cd ../
L
lzzyzlbb 已提交
77
    elif [ ${model_name} == "CycleGAN" ]; then
L
lzzyzlbb 已提交
78 79 80
        rm -rf ./data/horse2zebra*
        wget -nc -P ./data/ https://people.eecs.berkeley.edu/~taesung_park/CycleGAN/datasets/horse2zebra.zip --no-check-certificate
        cd ./data/ && unzip horse2zebra.zip && cd ../
B
BrilliantYuKaimin 已提交
81
    elif [ ${model_name} == "singan" ]; then
W
wangna11BD 已提交
82
        rm -rf ./data/singan*
B
BrilliantYuKaimin 已提交
83 84 85 86
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/singan-official_images.zip --no-check-certificate
        cd ./data/ && unzip -q singan-official_images.zip && cd ../
        mkdir -p ./data/singan
        mv ./data/SinGAN-official_images/Images/stone.png ./data/singan
L
lzzyzlbb 已提交
87 88
    fi
elif [ ${MODE} = "lite_train_whole_infer" ];then
L
lzzyzlbb 已提交
89
    if [ ${model_name} == "Pix2pix" ]; then
L
lzzyzlbb 已提交
90 91 92
        rm -rf ./data/facades*
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/pix2pix_facade_lite.tar --no-check-certificate
        cd ./data/ && tar xf pix2pix_facade_lite.tar && cd ../
L
lzzyzlbb 已提交
93
    elif [ ${model_name} == "CycleGAN" ]; then
L
lzzyzlbb 已提交
94 95 96
        rm -rf ./data/horse2zebra*
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/cyclegan_horse2zebra_lite.tar  --no-check-certificate --no-check-certificate
        cd ./data/ && tar xf cyclegan_horse2zebra_lite.tar && cd ../
L
lzzyzlbb 已提交
97
    elif [ ${model_name} == "FOMM" ]; then
L
lzzyzlbb 已提交
98 99 100
        rm -rf ./data/first_order*
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/fom_lite.tar  --no-check-certificate --no-check-certificate
        cd ./data/ && tar xf fom_lite.tar && cd ../
L
lzzyzlbb 已提交
101
    elif [ ${model_name} == "StyleGANv2" ]; then
L
lzzyzlbb 已提交
102 103 104 105
        rm -rf ./data/ffhq*
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/ffhq.tar --no-check-certificate
        cd ./data/ && tar xf ffhq.tar && cd ../
    elif [ ${model_name} == "basicvsr" ]; then
106 107 108
        rm -rf ./data/reds*
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/reds_lite.tar --no-check-certificate
        cd ./data/ && tar xf reds_lite.tar && cd ../
L
lzzyzlbb 已提交
109
    elif [ ${model_name} == "msvsr" ]; then
110 111 112
        rm -rf ./data/reds*
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/reds_lite.tar --no-check-certificate
        cd ./data/ && tar xf reds_lite.tar && cd ../
B
BrilliantYuKaimin 已提交
113
    elif [ ${model_name} == "singan" ]; then
W
wangna11BD 已提交
114
        rm -rf ./data/singan*
B
BrilliantYuKaimin 已提交
115 116 117 118
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/singan-official_images.zip --no-check-certificate
        cd ./data/ && unzip -q singan-official_images.zip && cd ../
        mkdir -p ./data/singan
        mv ./data/SinGAN-official_images/Images/stone.png ./data/singan
L
lzzyzlbb 已提交
119 120
    fi
elif [ ${MODE} = "whole_infer" ];then
L
lzzyzlbb 已提交
121
    if [ ${model_name} = "Pix2pix" ]; then
L
lzzyzlbb 已提交
122
        rm -rf ./data/facades*
123
        rm -rf ./inference/pix2pix*
L
lzzyzlbb 已提交
124 125 126 127
        wget -nc  -P ./inference https://paddlegan.bj.bcebos.com/static_model/pix2pix_facade.tar --no-check-certificate
        wget -nc  -P ./data https://paddlegan.bj.bcebos.com/datasets/facades_test.tar --no-check-certificate
        cd ./data && tar xf facades_test.tar && mv facades_test facades && cd ../
        cd ./inference && tar xf pix2pix_facade.tar && cd ../
L
lzzyzlbb 已提交
128
    elif [ ${model_name} = "CycleGAN" ]; then
129 130
        rm -rf ./data/cyclegan*
        rm -rf ./inference/cyclegan*
L
lzzyzlbb 已提交
131 132 133 134
        wget -nc  -P ./inference https://paddlegan.bj.bcebos.com/static_model/cyclegan_horse2zebra.tar  --no-check-certificate
        wget -nc  -P ./data https://paddlegan.bj.bcebos.com/datasets/cyclegan_horse2zebra_test.tar  --no-check-certificate
        cd ./data && tar xf cyclegan_horse2zebra_test.tar && mv cyclegan_test horse2zebra && cd ../
        cd ./inference && tar xf cyclegan_horse2zebra.tar && cd ../
L
lzzyzlbb 已提交
135
    elif [ ${model_name} == "FOMM" ]; then
L
lzzyzlbb 已提交
136
        rm -rf ./data/first_order*
137
        rm -rf ./inference/fom_dy2st*
L
lzzyzlbb 已提交
138 139 140 141
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/fom_lite_test.tar  --no-check-certificate
        wget -nc  -P ./inference https://paddlegan.bj.bcebos.com/static_model/fom_dy2st.tar --no-check-certificate
        cd ./data/ && tar xf fom_lite_test.tar && cd ../
        cd ./inference && tar xf fom_dy2st.tar && cd ../
L
lzzyzlbb 已提交
142
    elif [ ${model_name} == "StyleGANv2" ]; then
L
lzzyzlbb 已提交
143 144 145 146 147 148
        rm -rf ./data/ffhq*
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/ffhq.tar --no-check-certificate
        wget -nc  -P ./inference https://paddlegan.bj.bcebos.com/static_model/stylegan2_1024.tar --no-check-certificate
        cd ./inference && tar xf stylegan2_1024.tar && cd ../
        cd ./data/ && tar xf ffhq.tar && cd ../
    elif [ ${model_name} == "basicvsr" ]; then
149
        rm -rf ./data/reds*
L
lzzyzlbb 已提交
150
        rm -rf ./inference/basic*
151
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/reds_lite.tar --no-check-certificate
L
lzzyzlbb 已提交
152 153
        wget -nc  -P ./inference https://paddlegan.bj.bcebos.com/static_model/basicvsr.tar --no-check-certificate
        cd ./inference && tar xf basicvsr.tar && cd ../
154
        cd ./data/ && tar xf reds_lite.tar && cd ../
L
lzzyzlbb 已提交
155
    elif [ ${model_name} == "msvsr" ]; then
156
        rm -rf ./data/reds*
L
lzzyzlbb 已提交
157
        rm -rf ./inference/msvsr*
158
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/reds_lite.tar --no-check-certificate
L
lzzyzlbb 已提交
159 160
        wget -nc  -P ./inference https://paddlegan.bj.bcebos.com/static_model/msvsr.tar --no-check-certificate
        cd ./inference && tar xf msvsr.tar && cd ../
161
        cd ./data/ && tar xf reds_lite.tar && cd ../
B
BrilliantYuKaimin 已提交
162
    elif [ ${model_name} == "singan" ]; then
W
wangna11BD 已提交
163
        rm -rf ./data/singan*
B
BrilliantYuKaimin 已提交
164 165 166 167 168 169
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/singan-official_images.zip --no-check-certificate
        wget -nc -P ./inference https://paddlegan.bj.bcebos.com/datasets/singan.zip --no-check-certificate
        cd ./data/ && unzip -q singan-official_images.zip && cd ../
        cd ./inference/ && unzip -q singan.zip && cd ../
        mkdir -p ./data/singan
        mv ./data/SinGAN-official_images/Images/stone.png ./data/singan
L
lzzyzlbb 已提交
170
    fi
171 172 173 174 175 176
elif [ ${MODE} = "cpp_infer" ]; then
    if [ ${model_name} == "msvsr" ]; then
        rm -rf ./inference/msvsr*
        wget -nc  -P ./inference https://paddlegan.bj.bcebos.com/static_model/msvsr.tar --no-check-certificate
        cd ./inference && tar xf msvsr.tar && cd ../
    fi
L
lzzyzlbb 已提交
177
fi