run.sh 2.0 KB
Newer Older
W
whs 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#!/usr/bin/env bash

# download pretrain model
root_url="http://paddle-imagenet-models-name.bj.bcebos.com"
MobileNetV1="MobileNetV1_pretrained.zip"
ResNet50="ResNet50_pretrained.zip"
pretrain_dir='./pretrain'

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

cd ${pretrain_dir}

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

if [ ! -f ${ResNet50} ]; then
    wget ${root_url}/${ResNet50}
    unzip ${ResNet50}
fi

cd -
26 27

# for distillation
28
#-----------------
29 30 31 32
export CUDA_VISIBLE_DEVICES=0
python compress.py \
--model "MobileNet" \
--teacher_model "ResNet50" \
W
whs 已提交
33
--teacher_pretrained_model ./pretrain/ResNet50_pretrained \
34 35 36 37
--compress_config ./configs/mobilenetv1_resnet50_distillation.yaml


# for sensitivity filter pruning
38
#-------------------------------
39 40 41
#export CUDA_VISIBLE_DEVICES=0
#python compress.py \
#--model "MobileNet" \
W
whs 已提交
42
#--pretrained_model ./pretrain/MobileNetV1_pretrained \
43 44 45 46 47 48 49
#--compress_config ./configs/filter_pruning_sen.yaml

# for uniform filter pruning
#---------------------------
#export CUDA_VISIBLE_DEVICES=0
#python compress.py \
#--model "MobileNet" \
W
whs 已提交
50
#--pretrained_model ./pretrain/MobileNetV1_pretrained \
51 52 53
#--compress_config ./configs/filter_pruning_uniform.yaml

# for quantization
54
#-----------------
55 56 57 58
#export CUDA_VISIBLE_DEVICES=0
#python compress.py \
#--batch_size 64 \
#--model "MobileNet" \
W
whs 已提交
59
#--pretrained_model ./pretrain/MobileNetV1_pretrained \
60 61
#--compress_config ./configs/quantization.yaml

62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
# for distillation with quantization
#-----------------------------------
#export CUDA_VISIBLE_DEVICES=0
#python compress.py \
#--model "MobileNet" \
#--teacher_model "ResNet50" \
#--teacher_pretrained_model ./data/pretrain/ResNet50_pretrained \
#--compress_config ./configs/quantization_dist.yaml


# for uniform filter pruning with quantization
#---------------------------------------------
#export CUDA_VISIBLE_DEVICES=0
#python compress.py \
#--model "MobileNet" \
#--pretrained_model ./data/pretrain/MobileNetV1_pretrained \
#--compress_config ./configs/quantization_pruning.yaml