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 34 35
if [ ${MODE} = "benchmark_train" ];then
    MODE="lite_train_lite_infer"
fi
L
lzzyzlbb 已提交
36 37

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

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