prepare.sh 8.8 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',
L
lzzyzlbb 已提交
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
#                 'whole_infer']

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]}")

L
lzzyzlbb 已提交
34 35 36 37 38
if [ ${MODE} = "benchmark_train" ];then
    pip install -v -e .
    MODE="lite_train_lite_infer"
fi

W
wangna11BD 已提交
39
# MODE be one of ['lite_train_lite_infer' 'lite_train_whole_infer' 'whole_train_whole_infer',
L
lzzyzlbb 已提交
40
#                 'whole_infer
L
lzzyzlbb 已提交
41 42

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

L
lzzyzlbb 已提交
44 45
    case ${model_name} in
    Pix2pix)
L
lzzyzlbb 已提交
46 47
        rm -rf ./data/pix2pix*
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/pix2pix_facade_lite.tar --no-check-certificate
L
lzzyzlbb 已提交
48 49
        cd ./data/ && tar xf pix2pix_facade_lite.tar && cd ../ ;;
    CycleGAN)
50
        rm -rf ./data/cyclegan*
L
lzzyzlbb 已提交
51
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/cyclegan_horse2zebra_lite.tar --no-check-certificate
L
lzzyzlbb 已提交
52 53
        cd ./data/ && tar xf cyclegan_horse2zebra_lite.tar && cd ../ ;;
    StyleGANv2)
L
lzzyzlbb 已提交
54 55
        rm -rf ./data/ffhq*
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/ffhq.tar --no-check-certificate
L
lzzyzlbb 已提交
56 57
        cd ./data/ && tar xf ffhq.tar && cd ../ ;;
    FOMM)
58
        rm -rf ./data/fom_lite*
L
lzzyzlbb 已提交
59
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/fom_lite.tar  --no-check-certificate --no-check-certificate
L
lzzyzlbb 已提交
60 61
        cd ./data/ && tar xf fom_lite.tar && cd ../ ;;
    edvr|basicvsr|msvsr)
62 63
        rm -rf ./data/reds*
        wget -nc -P ./data/ https://paddlegan.bj.bcebos.com/datasets/reds_lite.tar --no-check-certificate
L
lzzyzlbb 已提交
64 65 66 67 68
        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 已提交
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 107 108 109
        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
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 148 149 150 151 152
        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
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} = "benchmark_train" ];then
    if [ ${model_name} = "msvsr" ]; then
        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 ../
    fi
L
lzzyzlbb 已提交
181
fi