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

Change work directory in readme of pruning. (#713)

上级 5606d243
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
在检测库中,可以直接调用`PaddleDetection/slim/prune/prune.py`脚本实现剪裁,在该脚本中调用了PaddleSlim的[paddleslim.prune.Pruner](https://paddlepaddle.github.io/PaddleSlim/api/prune_api/#Pruner)接口。 在检测库中,可以直接调用`PaddleDetection/slim/prune/prune.py`脚本实现剪裁,在该脚本中调用了PaddleSlim的[paddleslim.prune.Pruner](https://paddlepaddle.github.io/PaddleSlim/api/prune_api/#Pruner)接口。
该教程中所示操作,如无特殊说明,均在`PaddleDetection/slim/prune/`路径下执行。 该教程中所示操作,如无特殊说明,均在`PaddleDetection/`路径下执行。
已发布裁剪模型见[压缩模型库](../README.md) 已发布裁剪模型见[压缩模型库](../README.md)
...@@ -40,8 +40,8 @@ ...@@ -40,8 +40,8 @@
通过以下命令查看当前模型的所有参数: 通过以下命令查看当前模型的所有参数:
``` ```
python prune.py \ python slim/prune/prune.py \
-c ../../configs/yolov3_mobilenet_v1_voc.yml \ -c ./configs/yolov3_mobilenet_v1_voc.yml \
--print_params --print_params
``` ```
...@@ -56,8 +56,8 @@ python prune.py \ ...@@ -56,8 +56,8 @@ python prune.py \
使用`prune.py`启动裁剪任务时,通过`--pruned_params`选项指定待裁剪的参数名称列表,参数名之间用空格分隔,通过`--pruned_ratios`选项指定各个参数被裁掉的比例。 使用`prune.py`启动裁剪任务时,通过`--pruned_params`选项指定待裁剪的参数名称列表,参数名之间用空格分隔,通过`--pruned_ratios`选项指定各个参数被裁掉的比例。
``` ```
python prune.py \ python slim/prune/prune.py \
-c ../../configs/yolov3_mobilenet_v1_voc.yml \ -c ./configs/yolov3_mobilenet_v1_voc.yml \
--pruned_params "yolo_block.0.0.0.conv.weights,yolo_block.0.0.1.conv.weights,yolo_block.0.1.0.conv.weights" \ --pruned_params "yolo_block.0.0.0.conv.weights,yolo_block.0.0.1.conv.weights,yolo_block.0.1.0.conv.weights" \
--pruned_ratios="0.2,0.3,0.4" --pruned_ratios="0.2,0.3,0.4"
``` ```
...@@ -67,8 +67,8 @@ python prune.py \ ...@@ -67,8 +67,8 @@ python prune.py \
训练剪裁任务完成后,可通过`eval.py`评估剪裁模型精度,通过`--pruned_params``--pruned_ratios`指定裁剪的参数名称列表和各参数裁剪比例。 训练剪裁任务完成后,可通过`eval.py`评估剪裁模型精度,通过`--pruned_params``--pruned_ratios`指定裁剪的参数名称列表和各参数裁剪比例。
``` ```
python eval.py \ python slim/prune/eval.py \
-c ../../configs/yolov3_mobilenet_v1_voc.yml \ -c ./configs/yolov3_mobilenet_v1_voc.yml \
--pruned_params "yolo_block.0.0.0.conv.weights,yolo_block.0.0.1.conv.weights,yolo_block.0.1.0.conv.weights" \ --pruned_params "yolo_block.0.0.0.conv.weights,yolo_block.0.0.1.conv.weights,yolo_block.0.1.0.conv.weights" \
--pruned_ratios="0.2,0.3,0.4" \ --pruned_ratios="0.2,0.3,0.4" \
-o weights=output/yolov3_mobilenet_v1_voc/model_final -o weights=output/yolov3_mobilenet_v1_voc/model_final
...@@ -79,8 +79,8 @@ python eval.py \ ...@@ -79,8 +79,8 @@ python eval.py \
如果想要将剪裁模型接入到C++预测库或者Serving服务,可通过`export_model.py`导出该模型。 如果想要将剪裁模型接入到C++预测库或者Serving服务,可通过`export_model.py`导出该模型。
``` ```
python export_model.py \ python slim/prune/export_model.py \
-c ../../configs/yolov3_mobilenet_v1_voc.yml \ -c ./configs/yolov3_mobilenet_v1_voc.yml \
--pruned_params "yolo_block.0.0.0.conv.weights,yolo_block.0.0.1.conv.weights,yolo_block.0.1.0.conv.weights" \ --pruned_params "yolo_block.0.0.0.conv.weights,yolo_block.0.0.1.conv.weights,yolo_block.0.1.0.conv.weights" \
--pruned_ratios="0.2,0.3,0.4" \ --pruned_ratios="0.2,0.3,0.4" \
-o weights=output/yolov3_mobilenet_v1_voc/model_final -o weights=output/yolov3_mobilenet_v1_voc/model_final
...@@ -103,13 +103,13 @@ python export_model.py \ ...@@ -103,13 +103,13 @@ python export_model.py \
``` ```
# demo for faster_rcnn_r50 # demo for faster_rcnn_r50
python prune.py -c ../../configs/faster_rcnn_r50_1x.yml --pruned_params "res4f_branch2b_weights,res4f_branch2a_weights" --pruned_ratios="0.3,0.4" --eval python slim/prune/prune.py -c ./configs/faster_rcnn_r50_1x.yml --pruned_params "res4f_branch2b_weights,res4f_branch2a_weights" --pruned_ratios="0.3,0.4" --eval
``` ```
[mask_rcnn_r50](../../configs/mask_rcnn_r50_1x.yml)剪裁示例如下: [mask_rcnn_r50](../../configs/mask_rcnn_r50_1x.yml)剪裁示例如下:
``` ```
# demo for mask_rcnn_r50 # demo for mask_rcnn_r50
python prune.py -c ../../configs/mask_rcnn_r50_1x.yml --pruned_params "res4f_branch2b_weights,res4f_branch2a_weights" --pruned_ratios="0.2,0.3" --eval python slim/prune/prune.py -c ./configs/mask_rcnn_r50_1x.yml --pruned_params "res4f_branch2b_weights,res4f_branch2a_weights" --pruned_ratios="0.2,0.3" --eval
``` ```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册