From b9c7aa52021bf0cad8214efc36a80ec269734080 Mon Sep 17 00:00:00 2001 From: Yang Zhang Date: Fri, 8 May 2020 12:46:14 +0800 Subject: [PATCH] Organize and document mobile models (#610) * Organize and document mobile models * Clean up trailing whitespaces * Change bullet type * Minor wording fixes * Fix yolo naming * Add link in repo README.md --- README.md | 1 + README_en.md | 1 + configs/mobile/README.md | 80 +++++++++++++++++++ .../cascade_rcnn_mobilenetv3_fpn_320.yml | 0 .../cascade_rcnn_mobilenetv3_fpn_640.yml | 0 configs/mobile/ssdlite_mobilenet_v3_large.yml | 1 + configs/mobile/ssdlite_mobilenet_v3_small.yml | 1 + configs/mobile/yolov3_mobilenet_v3.yml | 1 + configs/mobile_side/README.md | 17 ---- 9 files changed, 85 insertions(+), 17 deletions(-) create mode 100755 configs/mobile/README.md rename configs/{mobile_side => mobile}/cascade_rcnn_mobilenetv3_fpn_320.yml (100%) rename configs/{mobile_side => mobile}/cascade_rcnn_mobilenetv3_fpn_640.yml (100%) create mode 120000 configs/mobile/ssdlite_mobilenet_v3_large.yml create mode 120000 configs/mobile/ssdlite_mobilenet_v3_small.yml create mode 120000 configs/mobile/yolov3_mobilenet_v3.yml delete mode 100755 configs/mobile_side/README.md diff --git a/README.md b/README.md index 9880bf77e..4d22578cb 100644 --- a/README.md +++ b/README.md @@ -100,6 +100,7 @@ - [YOLOv3增强模型](docs/featured_model/YOLOv3_ENHANCEMENT.md) 改进原始YOLOv3,精度达到43.6%,原论文精度为33.0%,同时预测速度也得到提升 - [Objects365 2019 Challenge夺冠模型](docs/featured_model/CACascadeRCNN.md) Objects365 Full Track任务中最好的单模型之一,精度达到31.7% - [Open Images V5和Objects365数据集模型](docs/featured_model/OIDV5_BASELINE_MODEL.md) +- [移动端模型](configs/mobile/README.md) ## 许可证书 diff --git a/README_en.md b/README_en.md index bb3b8876f..05b65062f 100644 --- a/README_en.md +++ b/README_en.md @@ -114,6 +114,7 @@ Advanced Features: - [YOLOv3 enhanced model](docs/YOLOv3_ENHANCEMENT.md) Compared to MAP of 33.0% in paper, enhanced YOLOv3 reaches the MAP of 43.6% and inference speed is improved as well - [Objects365 2019 Challenge champion model](docs/CACascadeRCNN.md) One of the best single models in Objects365 Full Track of which MAP reaches 31.7%. - [Open Images Dataset V5 and Objects365 Dataset models](docs/OIDV5_BASELINE_MODEL.md) +- [Mobile models](configs/mobile/README.md) ## License diff --git a/configs/mobile/README.md b/configs/mobile/README.md new file mode 100755 index 000000000..ff967105b --- /dev/null +++ b/configs/mobile/README.md @@ -0,0 +1,80 @@ +# Mobile Model Zoo + + +## Models + +This directory contains models optimized for mobile applications, at present the following models included: + +| Backbone | Architecture | Input | Image/gpu 1 | Lr schd | Box AP | Download 2 | +|--------------------------|---------------------------|-------|------------------------|---------------|--------|-----------------------| +| MobileNetV3 Small | SSDLite | 320 | 64 | 400K (cosine) | 16.6 | [Link](https://paddlemodels.bj.bcebos.com/object_detection/ssdlite_mobilenet_v3_small.tar.gz) | +| MobileNetV3 Large | SSDLite | 320 | 64 | 400K (cosine) | 22.8 | [Link](https://paddlemodels.bj.bcebos.com/object_detection/ssdlite_mobilenet_v3_large.tar.gz) | +| MobileNetV3 Large w/ FPN | Cascade RCNN | 320 | 2 | 500k (cosine) | 25.0 | [Link](https://paddlemodels.bj.bcebos.com/object_detection/cascade_rcnn_mobilenetv3_fpn_320.tar.gz) | +| MobileNetV3 Large w/ FPN | Cascade RCNN | 640 | 2 | 500k (cosine) | 30.2 | [Link](https://paddlemodels.bj.bcebos.com/object_detection/cascade_rcnn_mobilenetv3_fpn_640.tar.gz) | +| MobileNetV3 Large | YOLOv3 | 320 | 8 | 500K | 27.1 | [Link](https://paddlemodels.bj.bcebos.com/object_detection/yolov3_mobilenet_v3.tar.gz) | +| MobileNetV3 Large | YOLOv3 Prune 3 | 320 | 8 | - | 24.6 | [Link](https://paddlemodels.bj.bcebos.com/object_detection/yolov3_mobilenet_v3_prune86_FPGM_320.tar.gz) | + +**Notes**: + +- [1] All models are trained on 8 GPUs. +- [2] Each tarball contains the following files + - model weight file (`.pdparams` or `.tar`) + - inference model files (`__model__` and `__params__`) + - Paddle-Lite model file (`.nb`) +- [3] See the note section on how YOLO head is pruned + + +## Benchmarks Results + +- Models are benched on following chipsets with [Paddle-Lite](https://github.com/PaddlePaddle/Paddle-Lite) 2.6 (to be released) + - Qualcomm Snapdragon 625 + - Qualcomm Snapdragon 835 + - Qualcomm Snapdragon 845 + - Qualcomm Snapdragon 855 + - HiSilicon Kirin 970 + - HiSilicon Kirin 980 +- With 1 CPU thread (latency numbers are in ms) + + | | SD625 | SD835 | SD845 | SD855 | Kirin 970 | Kirin 980 | + |------------------|---------|---------|---------|---------|-----------|-----------| + | SSDLite Large | 289.071 | 134.408 | 91.933 | 48.2206 | 144.914 | 55.1186 | + | SSDLite Small | 122.932 | 57.1914 | 41.003 | 22.0694 | 61.5468 | 25.2106 | + | YOLOv3 baseline | 1082.5 | 435.77 | 317.189 | 155.948 | 536.987 | 178.999 | + | YOLOv3 prune | 253.98 | 131.279 | 89.4124 | 48.2856 | 122.732 | 55.8626 | + | Cascade RCNN 320 | 286.526 | 125.635 | 87.404 | 46.184 | 149.179 | 52.9994 | + | Cascade RCNN 640 | 1115.66 | 495.926 | 351.361 | 189.722 | 573.558 | 207.917 | +- With 4 CPU threads (latency numbers are in ms) + + | | SD625 | SD835 | SD845 | SD855 | Kirin 970 | Kirin 980 | + |------------------|---------|---------|---------|---------|-----------|-----------| + | SSDLite Large | 107.535 | 51.1382 | 34.6392 | 20.4978 | 50.5598 | 24.5318 | + | SSDLite Small | 51.5704 | 24.5156 | 18.5486 | 11.4218 | 24.9946 | 16.7158 | + | YOLOv3 baseline | 413.486 | 184.248 | 133.624 | 75.7354 | 202.263 | 126.435 | + | YOLOv3 prune | 98.5472 | 53.6228 | 34.4306 | 21.3112 | 44.0722 | 31.201 | + | Cascade RCNN 320 | 131.515 | 59.6026 | 39.4338 | 23.5802 | 58.5046 | 36.9486 | + | Cascade RCNN 640 | 473.083 | 224.543 | 156.205 | 100.686 | 231.108 | 138.391 | + + +## Notes on YOLOv3 pruning + +We pruned the YOLO-head and distill the pruned model with YOLOv3-ResNet34 as the teacher, which has a higher mAP on COCO (31.4 with 320\*320 input). + +The following configurations can be used for pruning: + +- Prune with fixed ratio, overall prune ratios is 86% + + ```shell + --pruned_params="yolo_block.0.0.0.conv.weights,yolo_block.0.0.1.conv.weights,yolo_block.0.1.0.conv.weights,yolo_block.0.1.1.conv.weights,yolo_block.0.2.conv.weights,yolo_block.0.tip.conv.weights,yolo_block.1.0.0.conv.weights,yolo_block.1.0.1.conv.weights,yolo_block.1.1.0.conv.weights,yolo_block.1.1.1.conv.weights,yolo_block.1.2.conv.weights,yolo_block.1.tip.conv.weights,yolo_block.2.0.0.conv.weights,yolo_block.2.0.1.conv.weights,yolo_block.2.1.0.conv.weights,yolo_block.2.1.1.conv.weights,yolo_block.2.2.conv.weights,yolo_block.2.tip.conv.weights" \ + --pruned_ratios="0.75,0.75,0.75,0.75,0.75,0.75,0.75,0.75,0.75,0.75,0.75,0.75,0.875,0.875,0.875,0.875,0.875,0.875" + ``` +- Prune filters using [FPGM](https://arxiv.org/abs/1811.00250) algorithm: + + ```shell + --prune_criterion=geometry_median + ``` + + +## Upcoming + +- [ ] More models configurations +- [ ] Quantized models diff --git a/configs/mobile_side/cascade_rcnn_mobilenetv3_fpn_320.yml b/configs/mobile/cascade_rcnn_mobilenetv3_fpn_320.yml similarity index 100% rename from configs/mobile_side/cascade_rcnn_mobilenetv3_fpn_320.yml rename to configs/mobile/cascade_rcnn_mobilenetv3_fpn_320.yml diff --git a/configs/mobile_side/cascade_rcnn_mobilenetv3_fpn_640.yml b/configs/mobile/cascade_rcnn_mobilenetv3_fpn_640.yml similarity index 100% rename from configs/mobile_side/cascade_rcnn_mobilenetv3_fpn_640.yml rename to configs/mobile/cascade_rcnn_mobilenetv3_fpn_640.yml diff --git a/configs/mobile/ssdlite_mobilenet_v3_large.yml b/configs/mobile/ssdlite_mobilenet_v3_large.yml new file mode 120000 index 000000000..345d8f12b --- /dev/null +++ b/configs/mobile/ssdlite_mobilenet_v3_large.yml @@ -0,0 +1 @@ +../ssd/ssdlite_mobilenet_v3_large.yml \ No newline at end of file diff --git a/configs/mobile/ssdlite_mobilenet_v3_small.yml b/configs/mobile/ssdlite_mobilenet_v3_small.yml new file mode 120000 index 000000000..63fb2a9f3 --- /dev/null +++ b/configs/mobile/ssdlite_mobilenet_v3_small.yml @@ -0,0 +1 @@ +../ssd/ssdlite_mobilenet_v3_small.yml \ No newline at end of file diff --git a/configs/mobile/yolov3_mobilenet_v3.yml b/configs/mobile/yolov3_mobilenet_v3.yml new file mode 120000 index 000000000..ea0525a3e --- /dev/null +++ b/configs/mobile/yolov3_mobilenet_v3.yml @@ -0,0 +1 @@ +../yolov3_mobilenet_v3.yml \ No newline at end of file diff --git a/configs/mobile_side/README.md b/configs/mobile_side/README.md deleted file mode 100755 index 88ffe10a8..000000000 --- a/configs/mobile_side/README.md +++ /dev/null @@ -1,17 +0,0 @@ -# Practical Mobile-side detection method base on RCNN - -## Introduction - -* This is developed by PaddleDetection. Many useful tricks are utilized for the model training process. More details can be seen in the configuration file. -* The inerence is tested on Qualcomm Snapdragon 845 Mobile Platform. - - -## Model Zoo - -| Backbone | Type | Image/gpu | Lr schd | Inf time on SD845 (fps) | Box AP | Mask AP | Download | -| :---------------------- | :-------------: | :-------: | :-----: | :------------: | :----: | :-----: | :----------------------------------------------------------: | -| MobileNetV3-vd-FPN | Cascade Faster | 2 | 5.6x(CosineDecay) | 8.13 | 25.0 | - | [model](https://paddlemodels.bj.bcebos.com/object_detection/cascade_rcnn_mobilenetv3_fpn_320.tar) | -| MobileNetV3-vd-FPN | Cascade Faster | 2 | 5.6x(CosineDecay) | 2.66 | 30.2 | - | [model](https://paddlemodels.bj.bcebos.com/object_detection/cascade_rcnn_mobilenetv3_fpn_640.tar) | - -**note** -* `5.6x` means the model is trained with `50000` minibatches 8 GPU cards(batch size=2 for each card). -- GitLab