未验证 提交 f89fab5b 编写于 作者: W whs 提交者: GitHub

Fix distillation in slim demo. (#2107)

上级 2d53a716
...@@ -7,7 +7,7 @@ distillers: ...@@ -7,7 +7,7 @@ distillers:
distillation_loss_weight: 1 distillation_loss_weight: 1
l2_distiller: l2_distiller:
class: 'L2Distiller' class: 'L2Distiller'
teacher_feature_map: 'fc_1.tmp_0' teacher_feature_map: 'res_fc.tmp_0'
student_feature_map: 'fc_0.tmp_0' student_feature_map: 'fc_0.tmp_0'
distillation_loss_weight: 1 distillation_loss_weight: 1
strategies: strategies:
......
...@@ -9,7 +9,7 @@ distillers: ...@@ -9,7 +9,7 @@ distillers:
distillation_loss_weight: 1 distillation_loss_weight: 1
l2_distiller: l2_distiller:
class: 'L2Distiller' class: 'L2Distiller'
teacher_feature_map: 'fc_1.tmp_0' teacher_feature_map: 'res_fc.tmp_0'
student_feature_map: 'fc_0.tmp_0' student_feature_map: 'fc_0.tmp_0'
distillation_loss_weight: 1 distillation_loss_weight: 1
strategies: strategies:
......
...@@ -34,18 +34,22 @@ export CUDA_VISIBLE_DEVICES=0,1,2,3 ...@@ -34,18 +34,22 @@ export CUDA_VISIBLE_DEVICES=0,1,2,3
# Fixing name conflicts in distillation # Fixing name conflicts in distillation
mv ResNet50_pretrained/conv1_weights ResNet50_pretrained/res_conv1_weights cd ${pretrain_dir}/ResNet50_pretrained
mv ResNet50_pretrained/fc_0.w_0 ResNet50_pretrained/res_fc.w_0 mv conv1_weights res_conv1_weights
mv ResNet50_pretrained/fc_0.b_0 ResNet50_pretrained/res_fc.b_0 mv fc_0.w_0 res_fc.w_0
mv fc_0.b_0 res_fc.b_0
cd -
python compress.py \ python compress.py \
--model "MobileNet" \ --model "MobileNet" \
--teacher_model "ResNet50" \ --teacher_model "ResNet50" \
--teacher_pretrained_model ./pretrain/ResNet50_pretrained \ --teacher_pretrained_model ./pretrain/ResNet50_pretrained \
--compress_config ./configs/mobilenetv1_resnet50_distillation.yaml --compress_config ./configs/mobilenetv1_resnet50_distillation.yaml
mv ResNet50_pretrained/res_conv1_weights ResNet50_pretrained/conv1_weights cd ${pretrain_dir}/ResNet50_pretrained
mv ResNet50_pretrained/res_fc.w_0 ResNet50_pretrained/fc_0.w_0 mv res_conv1_weights conv1_weights
mv ResNet50_pretrained/res_fc.b_0 ResNet50_pretrained/fc_0.b_0 mv res_fc.w_0 fc_0.w_0
mv res_fc.b_0 fc_0.b_0
cd -
# for sensitivity filter pruning # for sensitivity filter pruning
#------------------------------- #-------------------------------
...@@ -74,28 +78,32 @@ mv ResNet50_pretrained/res_fc.b_0 ResNet50_pretrained/fc_0.b_0 ...@@ -74,28 +78,32 @@ mv ResNet50_pretrained/res_fc.b_0 ResNet50_pretrained/fc_0.b_0
# for distillation with quantization # for distillation with quantization
#----------------------------------- #-----------------------------------
#export CUDA_VISIBLE_DEVICES=0 #export CUDA_VISIBLE_DEVICES=4,5,6,7
# #
## Fixing name conflicts in distillation ## Fixing name conflicts in distillation
#mv ResNet50_pretrained/conv1_weights ResNet50_pretrained/res_conv1_weights #cd ${pretrain_dir}/ResNet50_pretrained
#mv ResNet50_pretrained/fc_0.w_0 ResNet50_pretrained/res_fc.w_0 #mv conv1_weights res_conv1_weights
#mv ResNet50_pretrained/fc_0.b_0 ResNet50_pretrained/res_fc.b_0 #mv fc_0.w_0 res_fc.w_0
#mv fc_0.b_0 res_fc.b_0
#cd -
# #
#python compress.py \ #python compress.py \
#--model "MobileNet" \ #--model "MobileNet" \
#--teacher_model "ResNet50" \ #--teacher_model "ResNet50" \
#--teacher_pretrained_model ./data/pretrain/ResNet50_pretrained \ #--teacher_pretrained_model ./pretrain/ResNet50_pretrained \
#--compress_config ./configs/quantization_dist.yaml #--compress_config ./configs/quantization_dist.yaml
# #
#mv ResNet50_pretrained/res_conv1_weights ResNet50_pretrained/conv1_weights #cd ${pretrain_dir}/ResNet50_pretrained
#mv ResNet50_pretrained/res_fc.w_0 ResNet50_pretrained/fc_0.w_0 #mv res_conv1_weights conv1_weights
#mv ResNet50_pretrained/res_fc.b_0 ResNet50_pretrained/fc_0.b_0 #mv res_fc.w_0 fc_0.w_0
#mv res_fc.b_0 fc_0.b_0
#cd -
# for uniform filter pruning with quantization # for uniform filter pruning with quantization
#--------------------------------------------- #---------------------------------------------
#export CUDA_VISIBLE_DEVICES=0 #export CUDA_VISIBLE_DEVICES=0
#python compress.py \ #python compress.py \
#--model "MobileNet" \ #--model "MobileNet" \
#--pretrained_model ./data/pretrain/MobileNetV1_pretrained \ #--pretrained_model ./pretrain/MobileNetV1_pretrained \
#--compress_config ./configs/quantization_pruning.yaml #--compress_config ./configs/quantization_pruning.yaml
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册