prepare.sh 9.4 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
        rm -rf ./data/ffhq*
51 52
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/ffhq_256.tar --no-check-certificate
        cd ./data/ && tar xf ffhq_256.tar && cd ../ ;;
L
lzzyzlbb 已提交
53
    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
        cd ./data/ && tar xf reds_lite.tar && cd ../ ;;
    esrgan)
        rm -rf ./data/DIV2K*
63 64
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/DIV2KandSet14paddle.tar --no-check-certificate
        cd ./data/ && tar xf DIV2KandSet14paddle.tar && cd ../ ;;
K
kongdebug 已提交
65 66 67 68
    swinir)
        rm -rf ./data/*sets
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/swinir_data.zip --no-check-certificate
        cd ./data/ && unzip -q swinir_data.zip && cd ../ ;;
C
CC 已提交
69 70 71 72
    invdn)
        rm -rf ./data/SIDD_*
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/SIDD_mini.zip --no-check-certificate
        cd ./data/ && unzip -q SIDD_mini.zip && cd ../ ;;
B
BrilliantYuKaimin 已提交
73
    singan)
W
wangna11BD 已提交
74
        rm -rf ./data/singan*
B
BrilliantYuKaimin 已提交
75
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/singan-official_images.zip --no-check-certificate
W
wangna11BD 已提交
76
        cd ./data/ && unzip -q singan-official_images.zip && cd ../
B
BrilliantYuKaimin 已提交
77
        mkdir -p ./data/singan
W
wangna11BD 已提交
78
        mv ./data/SinGAN-official_images/Images/stone.png ./data/singan ;;
Y
yangshurong 已提交
79 80 81 82 83
    GFPGAN)
        rm -rf ./data/gfpgan*
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/gfpgan_tipc_data.zip --no-check-certificate
        mkdir -p ./data/gfpgan_data
        cd ./data/ && unzip -q gfpgan_tipc_data.zip -d gfpgan_data/ && cd ../ ;;
W
wangna11BD 已提交
84
    esac
L
lzzyzlbb 已提交
85
elif [ ${MODE} = "whole_train_whole_infer" ];then
L
lzzyzlbb 已提交
86
    if [ ${model_name} == "Pix2pix" ]; then
L
lzzyzlbb 已提交
87 88 89
        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 已提交
90
    elif [ ${model_name} == "CycleGAN" ]; then
L
lzzyzlbb 已提交
91 92 93
        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 已提交
94
    elif [ ${model_name} == "singan" ]; then
W
wangna11BD 已提交
95
        rm -rf ./data/singan*
B
BrilliantYuKaimin 已提交
96 97 98 99
        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 已提交
100 101
    fi
elif [ ${MODE} = "lite_train_whole_infer" ];then
L
lzzyzlbb 已提交
102
    if [ ${model_name} == "Pix2pix" ]; then
L
lzzyzlbb 已提交
103 104 105
        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 已提交
106
    elif [ ${model_name} == "CycleGAN" ]; then
L
lzzyzlbb 已提交
107 108 109
        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 已提交
110
    elif [ ${model_name} == "FOMM" ]; then
L
lzzyzlbb 已提交
111 112 113
        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 已提交
114
    elif [ ${model_name} == "StyleGANv2" ]; then
L
lzzyzlbb 已提交
115
        rm -rf ./data/ffhq*
116 117
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/ffhq_256.tar --no-check-certificate
        cd ./data/ && tar xf ffhq_256.tar && cd ../
L
lzzyzlbb 已提交
118
    elif [ ${model_name} == "basicvsr" ]; then
119 120 121
        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 已提交
122
    elif [ ${model_name} == "msvsr" ]; then
123 124 125
        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 已提交
126
    elif [ ${model_name} == "singan" ]; then
W
wangna11BD 已提交
127
        rm -rf ./data/singan*
B
BrilliantYuKaimin 已提交
128 129 130 131
        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 已提交
132 133
    fi
elif [ ${MODE} = "whole_infer" ];then
L
lzzyzlbb 已提交
134
    if [ ${model_name} = "Pix2pix" ]; then
L
lzzyzlbb 已提交
135
        rm -rf ./data/facades*
136
        rm -rf ./inference/pix2pix*
L
lzzyzlbb 已提交
137 138 139 140
        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 已提交
141
    elif [ ${model_name} = "CycleGAN" ]; then
142 143
        rm -rf ./data/cyclegan*
        rm -rf ./inference/cyclegan*
L
lzzyzlbb 已提交
144 145 146 147
        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 已提交
148
    elif [ ${model_name} == "FOMM" ]; then
L
lzzyzlbb 已提交
149
        rm -rf ./data/first_order*
150
        rm -rf ./inference/fom_dy2st*
L
lzzyzlbb 已提交
151 152 153 154
        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 已提交
155
    elif [ ${model_name} == "StyleGANv2" ]; then
L
lzzyzlbb 已提交
156
        rm -rf ./data/ffhq*
157
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/ffhq_256.tar --no-check-certificate
L
lzzyzlbb 已提交
158 159
        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 ../
160
        cd ./data/ && tar xf ffhq_256.tar && cd ../
L
lzzyzlbb 已提交
161
    elif [ ${model_name} == "basicvsr" ]; then
162
        rm -rf ./data/reds*
L
lzzyzlbb 已提交
163
        rm -rf ./inference/basic*
164
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/reds_lite.tar --no-check-certificate
L
lzzyzlbb 已提交
165 166
        wget -nc  -P ./inference https://paddlegan.bj.bcebos.com/static_model/basicvsr.tar --no-check-certificate
        cd ./inference && tar xf basicvsr.tar && cd ../
167
        cd ./data/ && tar xf reds_lite.tar && cd ../
L
lzzyzlbb 已提交
168
    elif [ ${model_name} == "msvsr" ]; then
169
        rm -rf ./data/reds*
L
lzzyzlbb 已提交
170
        rm -rf ./inference/msvsr*
171
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/reds_lite.tar --no-check-certificate
L
lzzyzlbb 已提交
172 173
        wget -nc  -P ./inference https://paddlegan.bj.bcebos.com/static_model/msvsr.tar --no-check-certificate
        cd ./inference && tar xf msvsr.tar && cd ../
174
        cd ./data/ && tar xf reds_lite.tar && cd ../
B
BrilliantYuKaimin 已提交
175
    elif [ ${model_name} == "singan" ]; then
W
wangna11BD 已提交
176
        rm -rf ./data/singan*
B
BrilliantYuKaimin 已提交
177 178 179 180 181 182
        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 已提交
183
    fi
184 185 186 187 188 189
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 已提交
190
fi