diff --git a/dygraph/README.md b/dygraph/README.md index 86e72ed663da10386b1f69316656a006fd237ae8..e67afc245270380feffe98124d5bb9a6e8a057ff 100644 --- a/dygraph/README.md +++ b/dygraph/README.md @@ -146,7 +146,11 @@ PaddleDetection模块化地实现了多种主流目标检测算法,提供了 ## 模型库 -- [模型库](docs/MODEL_ZOO_cn.md) +- 通用目标检测: + - [模型库](docs/MODEL_ZOO_cn.md) +- 垂类领域: + - [行人检测](configs/pedestrian/README.md) + - [车辆检测](configs/vehicle/README.md) ## 许可证书 diff --git a/dygraph/configs/pedestrian/README.md b/dygraph/configs/pedestrian/README.md new file mode 100644 index 0000000000000000000000000000000000000000..fc7100b95ffe3328023653f54057bd4f36078cb2 --- /dev/null +++ b/dygraph/configs/pedestrian/README.md @@ -0,0 +1,50 @@ +English | [简体中文](README_cn.md) +# PaddleDetection applied for specific scenarios + +We provide some models implemented by PaddlePaddle to detect objects in specific scenarios, users can download the models and use them in these scenarios. + +| Task | Algorithm | Box AP | Download | Configs | +|:---------------------|:---------:|:------:| :-------------------------------------------------------------------------------------: |:------:| +| Pedestrian Detection | YOLOv3 | 51.8 | [model](https://paddledet.bj.bcebos.com/models/pedestrian_yolov3_darknet.pdparams) | [config](https://github.com/PaddlePaddle/PaddleDetection/tree/master/dygraph/configs/pedestrian/pedestrian_yolov3_darknet.yml) | + +## Pedestrian Detection + +The main applications of pedetestrian detection include intelligent monitoring. In this scenary, photos of pedetestrians are taken by surveillance cameras in public areas, then pedestrian detection are conducted on these photos. + +### 1. Network + +The network for detecting vehicles is YOLOv3, the backbone of which is Dacknet53. + +### 2. Configuration for training + +PaddleDetection provides users with a configuration file [yolov3_darknet53_270e_coco.yml](https://github.com/PaddlePaddle/PaddleDetection/blob/master/dygraph/configs/yolov3/yolov3_darknet53_270e_coco.yml) to train YOLOv3 on the COCO dataset, compared with this file, we modify some parameters as followed to conduct the training for pedestrian detection: + +* num_classes: 1 +* dataset_dir: dataset/pedestrian + +### 3. Accuracy + +The accuracy of the model trained and evaluted on our private data is shown as followed: + +AP at IoU=.50:.05:.95 is 0.518. + +AP at IoU=.50 is 0.792. + +### 4. Inference + +Users can employ the model to conduct the inference: + +``` +export CUDA_VISIBLE_DEVICES=0 +python -u tools/infer.py -c configs/pedestrian/pedestrian_yolov3_darknet.yml \ + -o weights=https://paddledet.bj.bcebos.com/models/pedestrian_yolov3_darknet.pdparams \ + --infer_dir configs/pedestrian/demo \ + --draw_threshold 0.3 \ + --output_dir configs/pedestrian/demo/output +``` + +Some inference results are visualized below: + +![](https://github.com/PaddlePaddle/PaddleDetection/tree/master/docs/images/PedestrianDetection_001.png) + +![](https://github.com/PaddlePaddle/PaddleDetection/tree/master/docs/images/PedestrianDetection_004.png) diff --git a/dygraph/configs/pedestrian/README_cn.md b/dygraph/configs/pedestrian/README_cn.md new file mode 100644 index 0000000000000000000000000000000000000000..112c55806153ee4e6e556e977da2395e6a18181b --- /dev/null +++ b/dygraph/configs/pedestrian/README_cn.md @@ -0,0 +1,51 @@ +[English](README.md) | 简体中文 +# 特色垂类检测模型 + +我们提供了针对不同场景的基于PaddlePaddle的检测模型,用户可以下载模型进行使用。 + +| 任务 | 算法 | 精度(Box AP) | 下载 | 配置文件 | +|:---------------------|:---------:|:------:| :---------------------------------------------------------------------------------: | :------:| +| 行人检测 | YOLOv3 | 51.8 | [下载链接](https://paddledet.bj.bcebos.com/models/pedestrian_yolov3_darknet.pdparams) | [配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/master/dygraph/configs/pedestrian/pedestrian_yolov3_darknet.yml) | + +## 行人检测(Pedestrian Detection) + +行人检测的主要应用有智能监控。在监控场景中,大多是从公共区域的监控摄像头视角拍摄行人,获取图像后再进行行人检测。 + +### 1. 模型结构 + +Backbone为Dacknet53的YOLOv3。 + + +### 2. 训练参数配置 + +PaddleDetection提供了使用COCO数据集对YOLOv3进行训练的参数配置文件[yolov3_darknet53_270e_coco.yml](https://github.com/PaddlePaddle/PaddleDetection/blob/master/dygraph/configs/yolov3/yolov3_darknet53_270e_coco.yml),与之相比,在进行行人检测的模型训练时,我们对以下参数进行了修改: + +* num_classes: 1 +* dataset_dir: dataset/pedestrian + +### 2. 精度指标 + +模型在我们针对监控场景的内部数据上精度指标为: + +IOU=.5时的AP为 0.792。 + +IOU=.5-.95时的AP为 0.518。 + +### 3. 预测 + +用户可以使用我们训练好的模型进行行人检测: + +``` +export CUDA_VISIBLE_DEVICES=0 +python -u tools/infer.py -c configs/pedestrian/pedestrian_yolov3_darknet.yml \ + -o weights=https://paddledet.bj.bcebos.com/models/pedestrian_yolov3_darknet.pdparams \ + --infer_dir configs/pedestrian/demo \ + --draw_threshold 0.3 \ + --output_dir configs/pedestrian/demo/output +``` + +预测结果示例: + +![](../../../docs/images/PedestrianDetection_001.png) + +![](../../../docs/images/PedestrianDetection_004.png) diff --git a/dygraph/configs/pedestrian/demo/001.png b/dygraph/configs/pedestrian/demo/001.png new file mode 100644 index 0000000000000000000000000000000000000000..63ae9167fd03e8a95756fe5f6195fc8d741b9cfa Binary files /dev/null and b/dygraph/configs/pedestrian/demo/001.png differ diff --git a/dygraph/configs/pedestrian/demo/002.png b/dygraph/configs/pedestrian/demo/002.png new file mode 100644 index 0000000000000000000000000000000000000000..0de905cf55e6b02487ee1b8220810df8eaa24c2c Binary files /dev/null and b/dygraph/configs/pedestrian/demo/002.png differ diff --git a/dygraph/configs/pedestrian/demo/003.png b/dygraph/configs/pedestrian/demo/003.png new file mode 100644 index 0000000000000000000000000000000000000000..e9026e099df42d4267be07a71401eb5426b47745 Binary files /dev/null and b/dygraph/configs/pedestrian/demo/003.png differ diff --git a/dygraph/configs/pedestrian/demo/004.png b/dygraph/configs/pedestrian/demo/004.png new file mode 100644 index 0000000000000000000000000000000000000000..d8118ec3e0ef63bc74e825b5e7638a1886580604 Binary files /dev/null and b/dygraph/configs/pedestrian/demo/004.png differ diff --git a/dygraph/configs/pedestrian/pedestrian.json b/dygraph/configs/pedestrian/pedestrian.json new file mode 100644 index 0000000000000000000000000000000000000000..f72fe6dc65209ab3506d18556fb8b83b6ec832a9 --- /dev/null +++ b/dygraph/configs/pedestrian/pedestrian.json @@ -0,0 +1,11 @@ +{ + "images": [], + "annotations": [], + "categories": [ + { + "supercategory": "component", + "id": 1, + "name": "pedestrian" + } + ] +} diff --git a/dygraph/configs/pedestrian/pedestrian_yolov3_darknet.yml b/dygraph/configs/pedestrian/pedestrian_yolov3_darknet.yml new file mode 100644 index 0000000000000000000000000000000000000000..eb860dcfab7a52410f40fa67762b895677873b7b --- /dev/null +++ b/dygraph/configs/pedestrian/pedestrian_yolov3_darknet.yml @@ -0,0 +1,29 @@ +_BASE_: [ + '../datasets/coco_detection.yml', + '../runtime.yml', + '../yolov3/_base_/optimizer_270e.yml', + '../yolov3/_base_/yolov3_darknet53.yml', + '../yolov3/_base_/yolov3_reader.yml', +] + +snapshot_epoch: 5 +weights: https://paddledet.bj.bcebos.com/models/pedestrian_yolov3_darknet.pdparams + +num_classes: 1 + +TrainDataset: + !COCODataSet + dataset_dir: dataset/pedestrian + anno_path: annotations/instances_train2017.json + image_dir: train2017 + data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd'] + +EvalDataset: + !COCODataSet + dataset_dir: dataset/pedestrian + anno_path: annotations/instances_val2017.json + image_dir: val2017 + +TestDataset: + !ImageFolder + anno_path: configs/pedestrian/pedestrian.json diff --git a/dygraph/configs/vehicle/README.md b/dygraph/configs/vehicle/README.md new file mode 100644 index 0000000000000000000000000000000000000000..9219e9c1f9ad60d84754fb618b390fbda8a0434b --- /dev/null +++ b/dygraph/configs/vehicle/README.md @@ -0,0 +1,53 @@ +English | [简体中文](CONTRIB_cn.md) +# PaddleDetection applied for specific scenarios + +We provide some models implemented by PaddlePaddle to detect objects in specific scenarios, users can download the models and use them in these scenarios. + +| Task | Algorithm | Box AP | Download | Configs | +|:---------------------|:---------:|:------:| :-------------------------------------------------------------------------------------: |:------:| +| Vehicle Detection | YOLOv3 | 54.5 | [model](https://paddledet.bj.bcebos.com/models/vehicle_yolov3_darknet.pdparams) | [config](https://github.com/PaddlePaddle/PaddleDetection/tree/master/dygraph/configs/vehicle/vehicle_yolov3_darknet.yml) | + +## Vehicle Detection + +One of major applications of vehichle detection is traffic monitoring. In this scenary, vehicles to be detected are mostly captured by the cameras mounted on top of traffic light columns. + +### 1. Network + +The network for detecting vehicles is YOLOv3, the backbone of which is Dacknet53. + +### 2. Configuration for training + +PaddleDetection provides users with a configuration file [yolov3_darknet53_270e_coco.yml](https://github.com/PaddlePaddle/PaddleDetection/blob/master/dygraph/configs/yolov3/yolov3_darknet53_270e_coco.yml) to train YOLOv3 on the COCO dataset, compared with this file, we modify some parameters as followed to conduct the training for vehicle detection: + +* num_classes: 6 +* anchors: [[8, 9], [10, 23], [19, 15], [23, 33], [40, 25], [54, 50], [101, 80], [139, 145], [253, 224]] +* nms/nms_top_k: 400 +* nms/score_threshold: 0.005 +* dataset_dir: dataset/vehicle + +### 3. Accuracy + +The accuracy of the model trained and evaluated on our private data is shown as followed: + +AP at IoU=.50:.05:.95 is 0.545. + +AP at IoU=.50 is 0.764. + +### 4. Inference + +Users can employ the model to conduct the inference: + +``` +export CUDA_VISIBLE_DEVICES=0 +python -u tools/infer.py -c configs/vehicle/vehicle_yolov3_darknet.yml \ + -o weights=https://paddledet.bj.bcebos.com/models/vehicle_yolov3_darknet.pdparams \ + --infer_dir configs/vehicle/demo \ + --draw_threshold 0.2 \ + --output_dir configs/vehicle/demo/output +``` + +Some inference results are visualized below: + +![](https://github.com/PaddlePaddle/PaddleDetection/tree/master/docs/images/VehicleDetection_001.jpeg) + +![](https://github.com/PaddlePaddle/PaddleDetection/tree/master/docs/images/VehicleDetection_005.png) diff --git a/dygraph/configs/vehicle/README_cn.md b/dygraph/configs/vehicle/README_cn.md new file mode 100644 index 0000000000000000000000000000000000000000..9a030fdc278127fc8af946f756cadff4f39943d7 --- /dev/null +++ b/dygraph/configs/vehicle/README_cn.md @@ -0,0 +1,54 @@ +[English](CONTRIB.md) | 简体中文 +# 特色垂类检测模型 + +我们提供了针对不同场景的基于PaddlePaddle的检测模型,用户可以下载模型进行使用。 + +| 任务 | 算法 | 精度(Box AP) | 下载 | 配置文件 | +|:---------------------|:---------:|:------:| :---------------------------------------------------------------------------------: | :------:| +| 车辆检测 | YOLOv3 | 54.5 | [下载链接](https://paddledet.bj.bcebos.com/models/vehicle_yolov3_darknet.pdparams) | [配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/master/dygraph/configs/vehicle/vehicle_yolov3_darknet.yml) | + + +## 车辆检测(Vehicle Detection) + +车辆检测的主要应用之一是交通监控。在这样的监控场景中,待检测的车辆多为道路红绿灯柱上的摄像头拍摄所得。 + +### 1. 模型结构 + +Backbone为Dacknet53的YOLOv3。 + +### 2. 训练参数配置 + +PaddleDetection提供了使用COCO数据集对YOLOv3进行训练的参数配置文件[yolov3_darknet53_270e_coco.yml](https://github.com/PaddlePaddle/PaddleDetection/blob/master/dygraph/configs/yolov3/yolov3_darknet53_270e_coco.yml),与之相比,在进行车辆检测的模型训练时,我们对以下参数进行了修改: + +* num_classes: 6 +* anchors: [[8, 9], [10, 23], [19, 15], [23, 33], [40, 25], [54, 50], [101, 80], [139, 145], [253, 224]] +* nms/nms_top_k: 400 +* nms/score_threshold: 0.005 +* dataset_dir: dataset/vehicle + +### 3. 精度指标 + +模型在我们内部数据上的精度指标为: + +IOU=.50:.05:.95时的AP为 0.545。 + +IOU=.5时的AP为 0.764。 + +### 4. 预测 + +用户可以使用我们训练好的模型进行车辆检测: + +``` +export CUDA_VISIBLE_DEVICES=0 +python -u tools/infer.py -c configs/vehicle/vehicle_yolov3_darknet.yml \ + -o weights=https://paddledet.bj.bcebos.com/models/vehicle_yolov3_darknet.pdparams \ + --infer_dir configs/vehicle/demo \ + --draw_threshold 0.2 \ + --output_dir configs/vehicle/demo/output +``` + +预测结果示例: + +![](https://github.com/PaddlePaddle/PaddleDetection/tree/master/docs/images/VehicleDetection_001.jpeg) + +![](https://github.com/PaddlePaddle/PaddleDetection/tree/master/docs/images/VehicleDetection_005.png) diff --git a/dygraph/configs/vehicle/demo/001.jpeg b/dygraph/configs/vehicle/demo/001.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..8786db5eb6773931c363358bb39462b33db55369 Binary files /dev/null and b/dygraph/configs/vehicle/demo/001.jpeg differ diff --git a/dygraph/configs/vehicle/demo/003.png b/dygraph/configs/vehicle/demo/003.png new file mode 100644 index 0000000000000000000000000000000000000000..c01ab4ce769fb3b1c8863093a35d27da0ab10efd Binary files /dev/null and b/dygraph/configs/vehicle/demo/003.png differ diff --git a/dygraph/configs/vehicle/demo/004.png b/dygraph/configs/vehicle/demo/004.png new file mode 100644 index 0000000000000000000000000000000000000000..8907eb8d4d9b82e08ca214509c9fb41ca889db2a Binary files /dev/null and b/dygraph/configs/vehicle/demo/004.png differ diff --git a/dygraph/configs/vehicle/demo/005.png b/dygraph/configs/vehicle/demo/005.png new file mode 100644 index 0000000000000000000000000000000000000000..bf17712809c2fe6fa8e7d4f093ec4ac94523537c Binary files /dev/null and b/dygraph/configs/vehicle/demo/005.png differ diff --git a/dygraph/configs/vehicle/vehicle.json b/dygraph/configs/vehicle/vehicle.json new file mode 100644 index 0000000000000000000000000000000000000000..5863a9a8c9e0d8b4daeff31e7fe7869e084d3fb4 --- /dev/null +++ b/dygraph/configs/vehicle/vehicle.json @@ -0,0 +1,36 @@ +{ + "images": [], + "annotations": [], + "categories": [ + { + "supercategory": "component", + "id": 1, + "name": "car" + }, + { + "supercategory": "component", + "id": 2, + "name": "truck" + }, + { + "supercategory": "component", + "id": 3, + "name": "bus" + }, + { + "supercategory": "component", + "id": 4, + "name": "motorbike" + }, + { + "supercategory": "component", + "id": 5, + "name": "tricycle" + }, + { + "supercategory": "component", + "id": 6, + "name": "carplate" + } + ] +} diff --git a/dygraph/configs/vehicle/vehicle_yolov3_darknet.yml b/dygraph/configs/vehicle/vehicle_yolov3_darknet.yml new file mode 100644 index 0000000000000000000000000000000000000000..31ab431b728702eff0c90b3eedb42dea36d30aba --- /dev/null +++ b/dygraph/configs/vehicle/vehicle_yolov3_darknet.yml @@ -0,0 +1,43 @@ +_BASE_: [ + '../datasets/coco_detection.yml', + '../runtime.yml', + '../yolov3/_base_/optimizer_270e.yml', + '../yolov3/_base_/yolov3_darknet53.yml', + '../yolov3/_base_/yolov3_reader.yml', +] + +snapshot_epoch: 5 +weights: https://paddledet.bj.bcebos.com/models/vehicle_yolov3_darknet.pdparams + +YOLOv3Head: + anchors: [[8, 9], [10, 23], [19, 15], + [23, 33], [40, 25], [54, 50], + [101, 80], [139, 145], [253, 224]] + +BBoxPostProcess: + nms: + name: MultiClassNMS + keep_top_k: 100 + score_threshold: 0.005 + nms_threshold: 0.45 + nms_top_k: 400 + normalized: false + +num_classes: 6 + +TrainDataset: + !COCODataSet + dataset_dir: dataset/vehicle + anno_path: annotations/instances_train2017.json + image_dir: train2017 + data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd'] + +EvalDataset: + !COCODataSet + dataset_dir: dataset/vehicle + anno_path: annotations/instances_val2017.json + image_dir: val2017 + +TestDataset: + !ImageFolder + anno_path: configs/vehicle/vehicle.json