diff --git a/configs/ppyoloe/README.md b/configs/ppyoloe/README.md index 1c90e8ad6915e70182e45fe8dff7ed6e7ff7ba5f..f8f79344e357886b01568268478f0598a50e5fc9 100644 --- a/configs/ppyoloe/README.md +++ b/configs/ppyoloe/README.md @@ -40,9 +40,13 @@ PP-YOLOE is composed of following methods: |:--------------:|:-----:|:-------:|:----------:|:----------:| :-------:|:--------------------------:|:---------------------------:|:---------:|:--------:|:---------------:| :---------------------: |:------------------------------------------------------------------------------------:|:-------------------------------------------:| | PP-YOLOE+_s | 80 | 8 | 8 | cspresnet-s | 640 | 43.7 | 43.9 | 7.93 | 17.36 | 208.3 | 333.3 | [model](https://paddledet.bj.bcebos.com/models/ppyoloe_plus_crn_s_80e_coco.pdparams) | [config](./ppyoloe_plus_crn_s_80e_coco.yml) | | PP-YOLOE+_m | 80 | 8 | 8 | cspresnet-m | 640 | 49.8 | 50.0 | 23.43 | 49.91 | 123.4 | 208.3 | [model](https://paddledet.bj.bcebos.com/models/ppyoloe_plus_crn_m_80e_coco.pdparams) | [config](./ppyoloe_plus_crn_m_80e_coco.yml) | +| PP-YOLOE+_m(distill) | 80 | 8 | 8 | cspresnet-m | 640 | **51.0** | 51.2 | 23.43 | 49.91 | 123.4 | 208.3 | [model](https://paddledet.bj.bcebos.com/models/ppyoloe_plus_crn_m_80e_coco_distill.pdparams) | [config](distill/ppyoloe_plus_crn_m_80e_coco_distill.yml) | | PP-YOLOE+_l | 80 | 8 | 8 | cspresnet-l | 640 | 52.9 | 53.3 | 52.20 | 110.07 | 78.1 | 149.2 | [model](https://paddledet.bj.bcebos.com/models/ppyoloe_plus_crn_l_80e_coco.pdparams) | [config](./ppyoloe_plus_crn_l_80e_coco.yml) | +| PP-YOLOE+_l(distill) | 80 | 8 | 8 | cspresnet-l | 640 | **54.0** | 54.4 | 52.20 | 110.07 | 78.1 | 149.2 | [model](https://paddledet.bj.bcebos.com/models/ppyoloe_plus_crn_l_80e_coco_distill.pdparams) | [config](distill/ppyoloe_plus_crn_l_80e_coco_distill.yml) | | PP-YOLOE+_x | 80 | 8 | 8 | cspresnet-x | 640 | 54.7 | 54.9 | 98.42 | 206.59 | 45.0 | 95.2 | [model](https://paddledet.bj.bcebos.com/models/ppyoloe_plus_crn_x_80e_coco.pdparams) | [config](./ppyoloe_plus_crn_x_80e_coco.yml) | +**Note:** +- M and L models use distillation, please refer to [distill](distill) for details. #### Tiny model @@ -57,10 +61,15 @@ PP-YOLOE is composed of following methods: ### Comprehensive Metrics | Model | Epoch | AP0.5:0.95 | AP0.5 | AP0.75 | APsmall | APmedium | APlarge | ARsmall | ARmedium | ARlarge | |:------------------------:|:-----:|:---------------:|:----------:|:------------:|:------------:| :-----------: |:------------:|:------------:|:-------------:|:------------:| -| PP-YOLOE+_s | 80 | 43.7 | 60.6 | 47.9 | 26.5 | 47.5 | 59.0 | 46.7 | 71.4 | 81.7 | -| PP-YOLOE+_m | 80 | 49.8 | 67.1 | 54.5 | 31.8 | 53.9 | 66.2 | 53.3 | 75.0 | 84.6 | -| PP-YOLOE+_l | 80 | 52.9 | 70.1 | 57.9 | 35.2 | 57.5 | 69.1 | 56.0 | 77.9 | 86.9 | -| PP-YOLOE+_x | 80 | 54.7 | 72.0 | 59.9 | 37.9 | 59.3 | 70.4 | 57.0 | 78.7 | 87.2 | +| PP-YOLOE+_s | 80 | 43.7 | 60.6 | 47.9 | 26.5 | 47.5 | 59.0 | 46.7 | 71.4 | 81.7 | +| PP-YOLOE+_m | 80 | 49.8 | 67.1 | 54.5 | 31.8 | 53.9 | 66.2 | 53.3 | 75.0 | 84.6 | +| PP-YOLOE+_m(distill)| 80 | 51.0 | 68.1 | 55.8 | 32.5 | 55.7 | 67.4 | 51.9 | 76.1 | 86.4 | +| PP-YOLOE+_l | 80 | 52.9 | 70.1 | 57.9 | 35.2 | 57.5 | 69.1 | 56.0 | 77.9 | 86.9 | +| PP-YOLOE+_l(distill)| 80 | 54.0 | 71.2 | 59.2 | 36.1 | 58.8 | 70.4 | 55.0 | 78.7 | 87.7 | +| PP-YOLOE+_x | 80 | 54.7 | 72.0 | 59.9 | 37.9 | 59.3 | 70.4 | 57.0 | 78.7 | 87.2 | + +**Note:** +- M and L models use distillation, please refer to [distill](distill) for details. ### End-to-end Speed @@ -92,6 +101,14 @@ PP-YOLOE is composed of following methods: **Notes:** - The Details for multiple machine and multi-gpu training, see [DistributedTraining](../../docs/tutorials/DistributedTraining_en.md) +- For Objects365 dataset download, please refer to [objects365 official website](http://www.objects365.org/overview.html). The specific category list can be downloaded from [objects365_detection_label_list.txt](https://bj.bcebos.com/v1/paddledet/data/objects365/objects365_detection_label_list.txt) organized by PaddleDetection team. It should be stored in `dataset/objects365/`, and each line represents one category. The categories need to be read when exporting the model or doing inference. If the json file is not exist, you can make the following changes to `configs/datasets/objects365_detection.yml`: +``` +TestDataset: + !ImageFolder + # anno_path: annotations/zhiyuan_objv2_val.json + anno_path: objects365_detection_label_list.txt + dataset_dir: dataset/objects365/ +``` ### Model Zoo on VOC diff --git a/configs/ppyoloe/README_cn.md b/configs/ppyoloe/README_cn.md index 6f0288d126def4891363a5e3d51c76b51073135b..fcd0624a0ae03fbdd2746018d032f82e7bb24a0b 100644 --- a/configs/ppyoloe/README_cn.md +++ b/configs/ppyoloe/README_cn.md @@ -40,9 +40,14 @@ PP-YOLOE由以下方法组成 |:---------------:|:-----:|:---------:|:--------:|:----------:|:----------:|:--------------------------:|:---------------------------:|:---------:|:--------:|:---------------:| :---------------------: |:------------------------------------------------------------------------------------:|:-------------------------------------------:| | PP-YOLOE+_s | 80 | 8 | 8 | cspresnet-s | 640 | 43.7 | 43.9 | 7.93 | 17.36 | 208.3 | 333.3 | [model](https://paddledet.bj.bcebos.com/models/ppyoloe_plus_crn_s_80e_coco.pdparams) | [config](./ppyoloe_plus_crn_s_80e_coco.yml) | | PP-YOLOE+_m | 80 | 8 | 8 | cspresnet-m | 640 | 49.8 | 50.0 | 23.43 | 49.91 | 123.4 | 208.3 | [model](https://paddledet.bj.bcebos.com/models/ppyoloe_plus_crn_m_80e_coco.pdparams) | [config](./ppyoloe_plus_crn_m_80e_coco.yml) | +| PP-YOLOE+_m(distill) | 80 | 8 | 8 | cspresnet-m | 640 | **51.0** | 51.2 | 23.43 | 49.91 | 123.4 | 208.3 | [model](https://paddledet.bj.bcebos.com/models/ppyoloe_plus_crn_m_80e_coco_distill.pdparams) | [config](distill/ppyoloe_plus_crn_m_80e_coco_distill.yml) | | PP-YOLOE+_l | 80 | 8 | 8 | cspresnet-l | 640 | 52.9 | 53.3 | 52.20 | 110.07 | 78.1 | 149.2 | [model](https://paddledet.bj.bcebos.com/models/ppyoloe_plus_crn_l_80e_coco.pdparams) | [config](./ppyoloe_plus_crn_l_80e_coco.yml) | +| PP-YOLOE+_l(distill) | 80 | 8 | 8 | cspresnet-l | 640 | **54.0** | 54.4 | 52.20 | 110.07 | 78.1 | 149.2 | [model](https://paddledet.bj.bcebos.com/models/ppyoloe_plus_crn_l_80e_coco_distill.pdparams) | [config](distill/ppyoloe_plus_crn_l_80e_coco_distill.yml) | | PP-YOLOE+_x | 80 | 8 | 8 | cspresnet-x | 640 | 54.7 | 54.9 | 98.42 | 206.59 | 45.0 | 95.2 | [model](https://paddledet.bj.bcebos.com/models/ppyoloe_plus_crn_x_80e_coco.pdparams) | [config](./ppyoloe_plus_crn_x_80e_coco.yml) | +**注意:**: +- M和L模型使用了蒸馏,具体请参考[distill](distill)。 + #### Tiny模型 | 模型 | Epoch | GPU个数 | 每GPU图片个数 | 骨干网络 | 输入尺寸 | Box APval
0.5:0.95 | Box APtest
0.5:0.95 | Params(M) | FLOPs(G) | T4 TensorRT FP16(FPS) | 模型下载 | 配置文件 | @@ -58,9 +63,14 @@ PP-YOLOE由以下方法组成 |:------------------------:|:-----:|:---------------:|:----------:|:-----------:|:------------:|:-------------:|:------------:|:------------:|:-------------:|:------------:| | PP-YOLOE+_s | 80 | 43.7 | 60.6 | 47.9 | 26.5 | 47.5 | 59.0 | 46.7 | 71.4 | 81.7 | | PP-YOLOE+_m | 80 | 49.8 | 67.1 | 54.5 | 31.8 | 53.9 | 66.2 | 53.3 | 75.0 | 84.6 | +| PP-YOLOE+_m(distill)| 80 | 51.0 | 68.1 | 55.8 | 32.5 | 55.7 | 67.4 | 51.9 | 76.1 | 86.4 | | PP-YOLOE+_l | 80 | 52.9 | 70.1 | 57.9 | 35.2 | 57.5 | 69.1 | 56.0 | 77.9 | 86.9 | +| PP-YOLOE+_l(distill)| 80 | 54.0 | 71.2 | 59.2 | 36.1 | 58.8 | 70.4 | 55.0 | 78.7 | 87.7 | | PP-YOLOE+_x | 80 | 54.7 | 72.0 | 59.9 | 37.9 | 59.3 | 70.4 | 57.0 | 78.7 | 87.2 | +**注意:**: +- M和L模型使用了蒸馏,具体请参考[distill](distill)。 + ### 端到端速度 | 模型 | AP0.5:0.95 | TRT-FP32(fps) | TRT-FP16(fps) | @@ -91,6 +101,14 @@ PP-YOLOE由以下方法组成 **注意:** - 多机训练细节见[文档](../../docs/tutorials/DistributedTraining_cn.md) +- Objects365数据集下载请参考[objects365官网](http://www.objects365.org/overview.html)。具体种类列表可下载由PaddleDetection团队整理的[objects365_detection_label_list.txt](https://bj.bcebos.com/v1/paddledet/data/objects365/objects365_detection_label_list.txt)并存放在`dataset/objects365/`,每一行即表示第几个种类。inference或导出模型时需要读取到种类数,如果没有标注json文件时,可以进行如下更改`configs/datasets/objects365_detection.yml`: +``` +TestDataset: + !ImageFolder + # anno_path: annotations/zhiyuan_objv2_val.json + anno_path: objects365_detection_label_list.txt + dataset_dir: dataset/objects365/ +``` ### VOC数据集模型库 diff --git a/configs/ppyoloe/objects365/README_cn.md b/configs/ppyoloe/objects365/README_cn.md index 8018d03c62d77514a13f2c45340fe3c23ce6fdec..12f691bdaca1875e1abf26b2ee6af182e2d9790e 100644 --- a/configs/ppyoloe/objects365/README_cn.md +++ b/configs/ppyoloe/objects365/README_cn.md @@ -13,3 +13,11 @@ **注意:** - 多机训练细节见[文档](../../../docs/tutorials/DistributedTraining_cn.md) +- Objects365数据集下载请参考[objects365官网](http://www.objects365.org/overview.html)。具体种类列表可下载由PaddleDetection团队整理的[objects365_detection_label_list.txt](https://bj.bcebos.com/v1/paddledet/data/objects365/objects365_detection_label_list.txt)并存放在`dataset/objects365/`,每一行即表示第几个种类。inference或导出模型时需要读取到种类数,如果没有标注json文件时,可以进行如下更改`configs/datasets/objects365_detection.yml`: +``` +TestDataset: + !ImageFolder + # anno_path: annotations/zhiyuan_objv2_val.json + anno_path: objects365_detection_label_list.txt + dataset_dir: dataset/objects365/ +``` diff --git a/configs/slim/README.md b/configs/slim/README.md index 4eabd73b570dd3d971d0625c3e138895778719b5..6d717f51330a9bafca4f203b38969beba6df2faf 100755 --- a/configs/slim/README.md +++ b/configs/slim/README.md @@ -48,6 +48,7 @@ python tools/train.py -c configs/{MODEL.yml} --slim_config configs/slim/{SLIM_CO - `-c`: 指定模型配置文件。 - `--slim_config`: 指定压缩策略配置文件。 +- 如果选择使用蒸馏,具体蒸馏方法和更多检测模型的蒸馏,请参考[蒸馏策略文档](distill/README.md) ### 评估 @@ -169,7 +170,7 @@ python3.7 tools/post_quant.py -c configs/ppyolo/ppyolo_mbv3_large_coco.yml --sli | YOLOv3-MobileNetV1 | baseline | 608 | 29.4 | [下载链接](https://paddledet.bj.bcebos.com/models/yolov3_mobilenet_v1_270e_coco.pdparams) | [配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/yolov3/yolov3_mobilenet_v1_270e_coco.yml) | - | | YOLOv3-MobileNetV1 | 蒸馏 | 608 | 31.0(+1.6) | [下载链接](https://paddledet.bj.bcebos.com/models/slim/yolov3_mobilenet_v1_coco_distill.pdparams) | [配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/yolov3/yolov3_mobilenet_v1_270e_coco.yml) | [slim配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/slim/distill/yolov3_mobilenet_v1_coco_distill.yml) | -- 具体蒸馏方法请参考[蒸馏策略文档](distill/README.md) +- 具体蒸馏方法和更多检测模型的蒸馏,请参考[蒸馏策略文档](distill/README.md) ### 蒸馏剪裁联合策略 diff --git a/configs/slim/README_en.md b/configs/slim/README_en.md index 2aef83c4267945b27e4c9f8d47ef6e4668112834..7bbb35f46d8d2dd9aee95f1ce958fc7ba6491c77 100755 --- a/configs/slim/README_en.md +++ b/configs/slim/README_en.md @@ -46,6 +46,7 @@ python tools/train.py -c configs/{MODEL.yml} --slim_config configs/slim/{SLIM_CO - `-c`: Specify the model configuration file. - `--slim_config`: Specify the compression policy profile. +- If you want to use distillation, please refer to [Distillation Doc](distill/README.md) for specific distillation methods and more distillation of detection models. ### Evaluation @@ -156,7 +157,7 @@ Description: | YOLOv3-MobileNetV1 | baseline | 608 | 29.4 | [link](https://paddledet.bj.bcebos.com/models/yolov3_mobilenet_v1_270e_coco.pdparams) | [Configuration File ](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/yolov3/yolov3_mobilenet_v1_270e_coco.yml) | - | | YOLOv3-MobileNetV1 | Distillation | 608 | 31.0(+1.6) | [link](https://paddledet.bj.bcebos.com/models/slim/yolov3_mobilenet_v1_coco_distill.pdparams) | [Configuration File ](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/yolov3/yolov3_mobilenet_v1_270e_coco.yml) | [slimConfiguration File ](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/slim/distill/yolov3_mobilenet_v1_coco_distill.yml) | -- Please refer to the specific distillation method[Distillation Policy Document](distill/README.md) +- For the specific distillation method and more distillation detection models, please refer to [distill](distill/README.md). ### Distillation Pruning Combined Strategy diff --git a/ppdet/slim/distill_model.py b/ppdet/slim/distill_model.py index 96e1366381308aab6ee5e3c46d5b4d378da0783c..4fa3ccc83e06eb6c9f8058fc993446021ac5c45b 100644 --- a/ppdet/slim/distill_model.py +++ b/ppdet/slim/distill_model.py @@ -332,12 +332,11 @@ class PPYOLOEDistillModel(DistillModel): with paddle.no_grad(): teacher_loss = self.teacher_model(inputs) if hasattr(self.teacher_model.yolo_head, "assigned_labels"): - self.student_model.yolo_head.assigned_labels, self.student_model.yolo_head.assigned_bboxes, self.student_model.yolo_head.assigned_scores, self.student_model.yolo_head.mask_positive = \ - self.teacher_model.yolo_head.assigned_labels, self.teacher_model.yolo_head.assigned_bboxes, self.teacher_model.yolo_head.assigned_scores, self.teacher_model.yolo_head.mask_positive + self.student_model.yolo_head.assigned_labels, self.student_model.yolo_head.assigned_bboxes, self.student_model.yolo_head.assigned_scores = \ + self.teacher_model.yolo_head.assigned_labels, self.teacher_model.yolo_head.assigned_bboxes, self.teacher_model.yolo_head.assigned_scores delattr(self.teacher_model.yolo_head, "assigned_labels") delattr(self.teacher_model.yolo_head, "assigned_bboxes") delattr(self.teacher_model.yolo_head, "assigned_scores") - delattr(self.teacher_model.yolo_head, "mask_positive") student_loss = self.student_model(inputs) logits_loss, feat_loss = self.distill_loss(self.teacher_model,