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