From 3765db3d069dd4f636f5aa2594a44393f4866b60 Mon Sep 17 00:00:00 2001 From: whs Date: Tue, 2 Apr 2019 14:51:47 +0800 Subject: [PATCH] Refine pretrain download (#1960) 1. Remove pretrain directory in data 2. Add download scripts into run.sh --- .../data/pretrain/download_pretrain.sh | 9 ----- fluid/PaddleSlim/run.sh | 33 ++++++++++++++++--- 2 files changed, 29 insertions(+), 13 deletions(-) delete mode 100644 fluid/PaddleSlim/data/pretrain/download_pretrain.sh diff --git a/fluid/PaddleSlim/data/pretrain/download_pretrain.sh b/fluid/PaddleSlim/data/pretrain/download_pretrain.sh deleted file mode 100644 index 92cb48da..00000000 --- a/fluid/PaddleSlim/data/pretrain/download_pretrain.sh +++ /dev/null @@ -1,9 +0,0 @@ -root_url="http://paddle-imagenet-models-name.bj.bcebos.com" -MobileNetV1="MobileNetV1_pretrained.zip" -ResNet50="ResNet50_pretrained.zip" - -wget ${root_url}/${MobileNetV1} -unzip ${MobileNetV1} - -wget ${root_url}/${ResNet50} -unzip ${ResNet50} diff --git a/fluid/PaddleSlim/run.sh b/fluid/PaddleSlim/run.sh index 4fa57cd8..336d15b2 100644 --- a/fluid/PaddleSlim/run.sh +++ b/fluid/PaddleSlim/run.sh @@ -1,3 +1,28 @@ +#!/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 - # for distillation #-------------------- @@ -5,7 +30,7 @@ export CUDA_VISIBLE_DEVICES=0 python compress.py \ --model "MobileNet" \ --teacher_model "ResNet50" \ ---teacher_pretrained_model ./data/pretrain/ResNet50_pretrained \ +--teacher_pretrained_model ./pretrain/ResNet50_pretrained \ --compress_config ./configs/mobilenetv1_resnet50_distillation.yaml @@ -14,7 +39,7 @@ python compress.py \ #export CUDA_VISIBLE_DEVICES=0 #python compress.py \ #--model "MobileNet" \ -#--pretrained_model ./data/pretrain/MobileNetV1_pretrained \ +#--pretrained_model ./pretrain/MobileNetV1_pretrained \ #--compress_config ./configs/filter_pruning_sen.yaml # for uniform filter pruning @@ -22,7 +47,7 @@ python compress.py \ #export CUDA_VISIBLE_DEVICES=0 #python compress.py \ #--model "MobileNet" \ -#--pretrained_model ./data/pretrain/MobileNetV1_pretrained \ +#--pretrained_model ./pretrain/MobileNetV1_pretrained \ #--compress_config ./configs/filter_pruning_uniform.yaml # for quantization @@ -31,6 +56,6 @@ python compress.py \ #python compress.py \ #--batch_size 64 \ #--model "MobileNet" \ -#--pretrained_model ./data/pretrain/MobileNetV1_pretrained \ +#--pretrained_model ./pretrain/MobileNetV1_pretrained \ #--compress_config ./configs/quantization.yaml -- GitLab