run.sh 1.7 KB
Newer Older
B
Bai Yifan 已提交
1 2
#!/usr/bin/env bash

3 4
export CUDA_VISIBLE_DEVICES=0

B
Bai Yifan 已提交
5 6 7 8
# download pretrain model
root_url="http://paddle-imagenet-models-name.bj.bcebos.com"
MobileNetV1="MobileNetV1_pretrained.tar"
MobileNetV2="MobileNetV2_pretrained.tar"
9
ResNet34="ResNet34_pretrained.tar"
B
Bai Yifan 已提交
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
pretrain_dir='../pretrain'

if [ ! -d ${pretrain_dir} ]; then
  mkdir ${pretrain_dir}
fi

cd ${pretrain_dir}

if [ ! -f ${MobileNetV1} ]; then
    wget ${root_url}/${MobileNetV1}
    tar xf ${MobileNetV1}
fi

if [ ! -f ${MobileNetV2} ]; then
    wget ${root_url}/${MobileNetV2}
    tar xf ${MobileNetV2}
fi

28 29 30
if [ ! -f ${ResNet34} ]; then
    wget ${root_url}/${ResNet34}
    tar xf ${ResNet34}
B
Bai Yifan 已提交
31 32 33 34 35
fi

cd -

nohup python -u compress.py \
36
--model "MobileNet" \
B
Bai Yifan 已提交
37 38
--use_gpu 1 \
--batch_size 256 \
39 40 41 42
--total_images 1281167 \
--lr_strategy "piecewise_decay" \
--lr 0.1 \
--l2_decay 3e-5 \
43 44 45 46 47 48
--pretrained_model ../pretrain/MobileNetV1_pretrained \
--config_file "./configs/mobilenet_v1.yaml" \
> mobilenet_v1.log 2>&1 &
tailf mobilenet_v1.log

# for compression of mobilenet_v2
B
Bai Yifan 已提交
49
#nohup python -u compress.py \
50
#--model "MobileNetV2" \
B
Bai Yifan 已提交
51 52
#--use_gpu 1 \
#--batch_size 256 \
53 54 55 56
#--total_images 1281167 \
#--lr_strategy "cosine_decay" \
#--lr 0.1 \
#--l2_decay 4e-5 \
57 58 59 60 61 62
#--pretrained_model ../pretrain/MobileNetV2_pretrained \
#--config_file "./configs/mobilenet_v2.yaml" \
#> mobilenet_v2.log 2>&1 &
#tailf mobilenet_v2.log


63
## for compression of resnet34
B
Bai Yifan 已提交
64
#python -u compress.py \
65
#--model "ResNet34" \
B
Bai Yifan 已提交
66 67
#--use_gpu 1 \
#--batch_size 256 \
68 69 70 71 72 73 74 75
#--total_images 1281167 \
#--lr_strategy "cosine_decay" \
#--lr 0.1 \
#--l2_decay 1e-4 \
#--pretrained_model ../pretrain/ResNet34_pretrained \
#--config_file "./configs/resnet34.yaml" \
#> resnet34.log 2>&1 &
#tailf resnet34.log