提交 de70278e 编写于 作者: L LielinJiang

fix distill pretrained model bug

上级 ebc9bb93
...@@ -69,7 +69,10 @@ distill_loss = l2_loss('teacher_bilinear_interp_2.tmp_0', 'bilinear_interp_0.tmp ...@@ -69,7 +69,10 @@ distill_loss = l2_loss('teacher_bilinear_interp_2.tmp_0', 'bilinear_interp_0.tmp
在该脚本中定义了teacher_model和student_model,用teacher_model的输出指导student_model的训练 在该脚本中定义了teacher_model和student_model,用teacher_model的输出指导student_model的训练
### 执行示例 ### 执行示例
如下命令启动训练,每间隔```cfg.TRAIN.SNAPSHOT_EPOCH```会进行一次评估。
下载teacher的预训练模型和student的预训练模型, 替换如下命令中的```your_tearcher_pretrained_model_path``````your_student_pretrained_model```
执行如下命令启动训练,每间隔```cfg.TRAIN.SNAPSHOT_EPOCH```会进行一次评估。
```shell ```shell
CUDA_VISIBLE_DEVICES=0,1 CUDA_VISIBLE_DEVICES=0,1
python -m paddle.distributed.launch ./slim/distillation/train_distill.py \ python -m paddle.distributed.launch ./slim/distillation/train_distill.py \
...@@ -77,7 +80,9 @@ python -m paddle.distributed.launch ./slim/distillation/train_distill.py \ ...@@ -77,7 +80,9 @@ python -m paddle.distributed.launch ./slim/distillation/train_distill.py \
--teacher_cfg ./slim/distillation/cityscape_teacher.yaml \ --teacher_cfg ./slim/distillation/cityscape_teacher.yaml \
--use_gpu \ --use_gpu \
--use_mpio \ --use_mpio \
--do_eval --do_eval \
SLIM.KNOWLEDGE_DISTILL_TEACHER_MODEL_DIR your_tearcher_pretrained_model_path \
TRAIN.PRETRAINED_MODEL_DIR your_student_pretrained_model
``` ```
## 评估预测 ## 评估预测
......
...@@ -49,7 +49,7 @@ TEST: ...@@ -49,7 +49,7 @@ TEST:
TEST_MODEL: "snapshots/cityscape_v5/final/" TEST_MODEL: "snapshots/cityscape_v5/final/"
TRAIN: TRAIN:
MODEL_SAVE_DIR: "snapshots/cityscape_mbv2_kd_e100_1/" MODEL_SAVE_DIR: "snapshots/cityscape_mbv2_kd_e100_1/"
PRETRAINED_MODEL_DIR: u"/workspace/pretrained_models/mobilenet_cityscapes" PRETRAINED_MODEL_DIR: u"pretrained_model/mobilenet_cityscapes"
SNAPSHOT_EPOCH: 5 SNAPSHOT_EPOCH: 5
SYNC_BATCH_NORM: True SYNC_BATCH_NORM: True
SOLVER: SOLVER:
......
...@@ -61,5 +61,5 @@ SOLVER: ...@@ -61,5 +61,5 @@ SOLVER:
SLIM: SLIM:
KNOWLEDGE_DISTILL_IS_TEACHER: True KNOWLEDGE_DISTILL_IS_TEACHER: True
KNOWLEDGE_DISTILL: True KNOWLEDGE_DISTILL: True
KNOWLEDGE_DISTILL_TEACHER_MODEL_DIR: "/workspace/pretrained_models/xception65_bn_cityscapes" KNOWLEDGE_DISTILL_TEACHER_MODEL_DIR: "pretrained_model/xception65_bn_cityscapes"
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册