移动paddle_detection

This commit is contained in:
2024-09-24 17:02:56 +08:00
parent 90a6d5ec75
commit 3438cf6e0e
2025 changed files with 11 additions and 11 deletions

View File

@@ -0,0 +1,81 @@
简体中文 | [English](README.md)
## PP-YOLOE Vehicle 检测模型
PaddleDetection团队提供了针对自动驾驶场景的基于PP-YOLOE的检测模型用户可以下载模型进行使用主要包含5个数据集(BDD100K-DET、BDD100K-MOT、UA-DETRAC、PPVehicle9cls、PPVehicle)。其中前3者为公开数据集后两者为整合数据集。
- BDD100K-DET具体类别为10类包括`pedestrian(1), rider(2), car(3), truck(4), bus(5), train(6), motorcycle(7), bicycle(8), traffic light(9), traffic sign(10)`
- BDD100K-MOT具体类别为8类包括`pedestrian(1), rider(2), car(3), truck(4), bus(5), train(6), motorcycle(7), bicycle(8)`但数据集比BDD100K-DET更大更多。
- UA-DETRAC具体类别为4类包括`car(1), bus(2), van(3), others(4)`
- PPVehicle9cls数据集整合了BDD100K-MOT和UA-DETRAC具体类别为9类包括`pedestrian(1), rider(2), car(3), truck(4), bus(5), van(6), motorcycle(7), bicycle(8), others(9)`
- PPVehicle数据集整合了BDD100K-MOT和UA-DETRAC是将BDD100K-MOT中的`car, truck, bus, van`和UA-DETRAC中的`car, bus, van`都合并为1类`vehicle(1)`后的数据集。
相关模型的部署模型均在[PP-Vehicle](../../deploy/pipeline/)项目中使用。
| 模型 | 数据集 | 类别数 | mAP<sup>val<br>0.5:0.95 | 下载链接 | 配置文件 |
|:---------|:---------------:|:------:|:-----------------------:|:---------:| :-----: |
|PP-YOLOE-l| BDD100K-DET | 10 | 35.6 | [下载链接](https://paddledet.bj.bcebos.com/models/ppyoloe_crn_l_36e_bdd100kdet.pdparams) | [配置文件](./ppyoloe_crn_l_36e_bdd100kdet.yml) |
|PP-YOLOE-l| BDD100K-MOT | 8 | 33.7 | [下载链接](https://paddledet.bj.bcebos.com/models/ppyoloe_crn_l_36e_bdd100kmot.pdparams) | [配置文件](./ppyoloe_crn_l_36e_bdd100kmot.yml) |
|PP-YOLOE-l| UA-DETRAC | 4 | 51.4 | [下载链接](https://paddledet.bj.bcebos.com/models/ppyoloe_crn_l_36e_uadetrac.pdparams) | [配置文件](./ppyoloe_crn_l_36e_uadetrac.yml) |
|PP-YOLOE-l| PPVehicle9cls | 9 | 40.0 | [下载链接](https://paddledet.bj.bcebos.com/models/mot_ppyoloe_l_36e_ppvehicle9cls.pdparams) | [配置文件](./mot_ppyoloe_l_36e_ppvehicle9cls.yml) |
|PP-YOLOE-s| PPVehicle9cls | 9 | 35.3 | [下载链接](https://paddledet.bj.bcebos.com/models/mot_ppyoloe_s_36e_ppvehicle9cls.pdparams) | [配置文件](./mot_ppyoloe_s_36e_ppvehicle9cls.yml) |
|PP-YOLOE-l| PPVehicle | 1 | 63.9 | [下载链接](https://paddledet.bj.bcebos.com/models/mot_ppyoloe_l_36e_ppvehicle.pdparams) | [配置文件](./mot_ppyoloe_l_36e_ppvehicle.yml) |
|PP-YOLOE-s| PPVehicle | 1 | 61.3 | [下载链接](https://paddledet.bj.bcebos.com/models/mot_ppyoloe_s_36e_ppvehicle.pdparams) | [配置文件](./mot_ppyoloe_s_36e_ppvehicle.yml) |
|PP-YOLOE+_t-aux(320)| PPVehicle | 1 | 53.5 | [下载链接](https://paddledet.bj.bcebos.com/models/ppyoloe_plus_crn_t_auxhead_320_60e_ppvehicle.pdparams) | [配置文件](./ppyoloe_plus_crn_t_auxhead_320_60e_ppvehicle.yml) |
**注意:**
- PP-YOLOE模型训练过程中使用8 GPUs进行混合精度训练如果**GPU卡数**或者**batch size**发生了改变,你需要按照公式 **lr<sub>new</sub> = lr<sub>default</sub> * (batch_size<sub>new</sub> * GPU_number<sub>new</sub>) / (batch_size<sub>default</sub> * GPU_number<sub>default</sub>)** 调整学习率。
- 具体使用教程请参考[ppyoloe](../ppyoloe#getting-start)。
- 如需预测出对应类别可自行修改和添加对应的label_list.txt文件(一行记录一个对应种类)TestDataset中的anno_path为绝对路径
```
TestDataset:
!ImageFolder
anno_path: label_list.txt # 如不使用dataset_dir则anno_path即为相对于PaddleDetection主目录的相对路径
# dataset_dir: dataset/ppvehicle # 如使用dataset_dir则dataset_dir/anno_path作为新的anno_path
```
label_list.txt里的一行记录一个对应种类如下所示
```
vehicle
```
## YOLOv3 Vehicle 检测模型
请参考[Vehicle_YOLOv3页面](./vehicle_yolov3/README_cn.md)
## PP-OCRv3 车牌识别模型
车牌识别采用Paddle自研超轻量级模型PP-OCRv3_det、PP-OCRv3_rec。在[CCPD数据集](https://github.com/detectRecog/CCPD)CCPD2019+CCPD2020车牌数据集上进行了fine-tune。模型训练基于[PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR/blob/release/2.6/applications/%E8%BD%BB%E9%87%8F%E7%BA%A7%E8%BD%A6%E7%89%8C%E8%AF%86%E5%88%AB.md)完成,我们提供了预测模型下载:
| 模型 | 数据集 | 精度 | 下载 | 配置文件 |
|:---------|:-------:|:------:| :----: | :------:|
| PP-OCRv3_det | CCPD组合数据集 | hmean:0.979 |[下载链接](https://bj.bcebos.com/v1/paddledet/models/pipeline/ch_PP-OCRv3_det_infer.tar.gz) | [配置文件](https://github.com/PaddlePaddle/PaddleOCR/blob/dygraph/configs/det/ch_PP-OCRv3/ch_PP-OCRv3_det_cml.yml) |
| PP-OCRv3_rec | CCPD组合数据集 | acc:0.773 |[下载链接](https://bj.bcebos.com/v1/paddledet/models/pipeline/ch_PP-OCRv3_rec_infer.tar.gz) | [配置文件](https://github.com/PaddlePaddle/PaddleOCR/blob/dygraph/configs/rec/PP-OCRv3/ch_PP-OCRv3_rec_distillation.yml) |
## PP-LCNet 车牌属性模型
车牌属性采用Paddle自研超轻量级模型PP-LCNet。在[VeRi数据集](https://www.v7labs.com/open-datasets/veri-dataset)进行训练。模型训练基于[PaddleClas](https://github.com/PaddlePaddle/PaddleClas/blob/release/2.4/docs/en/PULC/PULC_vehicle_attribute_en.md)完成,我们提供了预测模型下载:
| 模型 | 数据集 | 精度 | 下载 | 配置文件 |
|:---------|:-------:|:------:| :----: | :------:|
| PP-LCNet_x1_0 | VeRi数据集 | 90.81 |[下载链接](https://bj.bcebos.com/v1/paddledet/models/pipeline/vehicle_attribute_model.zip) | [配置文件](https://github.com/PaddlePaddle/PaddleClas/blob/release/2.4/ppcls/configs/PULC/vehicle_attribute/PPLCNet_x1_0.yaml) |
## 引用
```
@InProceedings{bdd100k,
author = {Yu, Fisher and Chen, Haofeng and Wang, Xin and Xian, Wenqi and Chen,
Yingying and Liu, Fangchen and Madhavan, Vashisht and Darrell, Trevor},
title = {BDD100K: A Diverse Driving Dataset for Heterogeneous Multitask Learning},
booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2020}
}
@article{CVIU_UA-DETRAC,
author = {Longyin Wen and Dawei Du and Zhaowei Cai and Zhen Lei and Ming{-}Ching Chang and
Honggang Qi and Jongwoo Lim and Ming{-}Hsuan Yang and Siwei Lyu},
title = {{UA-DETRAC:} {A} New Benchmark and Protocol for Multi-Object Detection and Tracking},
journal = {Computer Vision and Image Understanding},
year = {2020}
}
```

View File

@@ -0,0 +1,57 @@
_BASE_: [
'../datasets/coco_detection.yml',
'../runtime.yml',
'../ppyoloe/_base_/optimizer_300e.yml',
'../ppyoloe/_base_/ppyoloe_crn.yml',
'../ppyoloe/_base_/ppyoloe_reader.yml',
]
log_iter: 100
snapshot_epoch: 4
weights: output/mot_ppyoloe_l_36e_ppvehicle/model_final
pretrain_weights: https://paddledet.bj.bcebos.com/models/ppyoloe_crn_l_300e_coco.pdparams
depth_mult: 1.0
width_mult: 1.0
num_classes: 1
TrainDataset:
!COCODataSet
image_dir: ""
anno_path: annotations/train_all.json
dataset_dir: dataset/ppvehicle
data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd']
allow_empty: true
EvalDataset:
!COCODataSet
image_dir: ""
anno_path: annotations/val_all.json
dataset_dir: dataset/ppvehicle
TestDataset:
!ImageFolder
anno_path: annotations/val_all.json
dataset_dir: dataset/ppvehicle
TrainReader:
batch_size: 8
epoch: 36
LearningRate:
base_lr: 0.001
schedulers:
- !CosineDecay
max_epochs: 43
- !LinearWarmup
start_factor: 0.
epochs: 1
PPYOLOEHead:
static_assigner_epoch: -1
nms:
name: MultiClassNMS
nms_top_k: 1000
keep_top_k: 100
score_threshold: 0.01
nms_threshold: 0.6

View File

@@ -0,0 +1,56 @@
_BASE_: [
'../datasets/coco_detection.yml',
'../runtime.yml',
'../ppyoloe/_base_/optimizer_300e.yml',
'../ppyoloe/_base_/ppyoloe_crn.yml',
'../ppyoloe/_base_/ppyoloe_reader.yml',
]
log_iter: 100
snapshot_epoch: 4
weights: output/mot_ppyoloe_l_36e_ppvehicle9cls/model_final
pretrain_weights: https://paddledet.bj.bcebos.com/models/ppyoloe_crn_l_300e_coco.pdparams
depth_mult: 1.0
width_mult: 1.0
num_classes: 9
TrainDataset:
!COCODataSet
image_dir: ""
anno_path: annotations/train_all_9cls.json
dataset_dir: dataset/ppvehicle
data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd']
EvalDataset:
!COCODataSet
image_dir: ""
anno_path: annotations/val_all_9cls.json
dataset_dir: dataset/ppvehicle
TestDataset:
!ImageFolder
anno_path: annotations/val_all_9cls.json
dataset_dir: dataset/ppvehicle
TrainReader:
batch_size: 8
epoch: 36
LearningRate:
base_lr: 0.001
schedulers:
- !CosineDecay
max_epochs: 43
- !LinearWarmup
start_factor: 0.
epochs: 1
PPYOLOEHead:
static_assigner_epoch: -1
nms:
name: MultiClassNMS
nms_top_k: 1000
keep_top_k: 100
score_threshold: 0.01
nms_threshold: 0.6

View File

@@ -0,0 +1,57 @@
_BASE_: [
'../datasets/coco_detection.yml',
'../runtime.yml',
'../ppyoloe/_base_/optimizer_300e.yml',
'../ppyoloe/_base_/ppyoloe_crn.yml',
'../ppyoloe/_base_/ppyoloe_reader.yml',
]
log_iter: 100
snapshot_epoch: 4
weights: output/mot_ppyoloe_s_36e_ppvehicle/model_final
pretrain_weights: https://paddledet.bj.bcebos.com/models/ppyoloe_crn_s_300e_coco.pdparams
depth_mult: 0.33
width_mult: 0.50
num_classes: 1
TrainDataset:
!COCODataSet
image_dir: ""
anno_path: annotations/train_all.json
dataset_dir: dataset/ppvehicle
data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd']
allow_empty: true
EvalDataset:
!COCODataSet
image_dir: ""
anno_path: annotations/val_all.json
dataset_dir: dataset/ppvehicle
TestDataset:
!ImageFolder
anno_path: annotations/val_all.json
dataset_dir: dataset/ppvehicle
TrainReader:
batch_size: 8
epoch: 36
LearningRate:
base_lr: 0.001
schedulers:
- !CosineDecay
max_epochs: 43
- !LinearWarmup
start_factor: 0.
epochs: 1
PPYOLOEHead:
static_assigner_epoch: -1
nms:
name: MultiClassNMS
nms_top_k: 1000
keep_top_k: 100
score_threshold: 0.01
nms_threshold: 0.6

View File

@@ -0,0 +1,56 @@
_BASE_: [
'../datasets/coco_detection.yml',
'../runtime.yml',
'../ppyoloe/_base_/optimizer_300e.yml',
'../ppyoloe/_base_/ppyoloe_crn.yml',
'../ppyoloe/_base_/ppyoloe_reader.yml',
]
log_iter: 100
snapshot_epoch: 4
weights: output/mot_ppyoloe_s_36e_ppvehicle9cls/model_final
pretrain_weights: https://paddledet.bj.bcebos.com/models/ppyoloe_crn_s_300e_coco.pdparams
depth_mult: 0.33
width_mult: 0.50
num_classes: 9
TrainDataset:
!COCODataSet
image_dir: ""
anno_path: annotations/train_all_9cls.json
dataset_dir: dataset/ppvehicle
data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd']
EvalDataset:
!COCODataSet
image_dir: ""
anno_path: annotations/val_all_9cls.json
dataset_dir: dataset/ppvehicle
TestDataset:
!ImageFolder
anno_path: annotations/val_all_9cls.json
dataset_dir: dataset/ppvehicle
TrainReader:
batch_size: 8
epoch: 36
LearningRate:
base_lr: 0.001
schedulers:
- !CosineDecay
max_epochs: 43
- !LinearWarmup
start_factor: 0.
epochs: 1
PPYOLOEHead:
static_assigner_epoch: -1
nms:
name: MultiClassNMS
nms_top_k: 1000
keep_top_k: 100
score_threshold: 0.01
nms_threshold: 0.6

View File

@@ -0,0 +1,56 @@
_BASE_: [
'../datasets/coco_detection.yml',
'../runtime.yml',
'../ppyoloe/_base_/optimizer_300e.yml',
'../ppyoloe/_base_/ppyoloe_crn.yml',
'../ppyoloe/_base_/ppyoloe_reader.yml',
]
log_iter: 100
snapshot_epoch: 4
weights: output/ppyoloe_crn_l_36e_bdd100kdet/model_final
pretrain_weights: https://paddledet.bj.bcebos.com/models/ppyoloe_crn_l_300e_coco.pdparams
depth_mult: 1.0
width_mult: 1.0
num_classes: 10
TrainDataset:
!COCODataSet
image_dir: images/100k/train
anno_path: labels/det_20/det_train_cocofmt.json
dataset_dir: dataset/bdd100k
data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd']
EvalDataset:
!COCODataSet
image_dir: images/100k/val
anno_path: labels/det_20/det_val_cocofmt.json
dataset_dir: dataset/bdd100k
TestDataset:
!ImageFolder
anno_path: labels/det_20/det_val_cocofmt.json
dataset_dir: dataset/bdd100k
TrainReader:
batch_size: 8
epoch: 36
LearningRate:
base_lr: 0.001
schedulers:
- !CosineDecay
max_epochs: 43
- !LinearWarmup
start_factor: 0.
epochs: 1
PPYOLOEHead:
static_assigner_epoch: -1
nms:
name: MultiClassNMS
nms_top_k: 1000
keep_top_k: 100
score_threshold: 0.01
nms_threshold: 0.6

View File

@@ -0,0 +1,56 @@
_BASE_: [
'../datasets/coco_detection.yml',
'../runtime.yml',
'../ppyoloe/_base_/optimizer_300e.yml',
'../ppyoloe/_base_/ppyoloe_crn.yml',
'../ppyoloe/_base_/ppyoloe_reader.yml',
]
log_iter: 100
snapshot_epoch: 4
weights: output/ppyoloe_crn_l_36e_bdd100kmot/model_final
pretrain_weights: https://paddledet.bj.bcebos.com/models/ppyoloe_crn_l_300e_coco.pdparams
depth_mult: 1.0
width_mult: 1.0
num_classes: 8
TrainDataset:
!COCODataSet
image_dir: ""
anno_path: annotations/train.json
dataset_dir: dataset/bdd100k
data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd']
EvalDataset:
!COCODataSet
image_dir: ""
anno_path: annotations/val.json
dataset_dir: dataset/bdd100k
TestDataset:
!ImageFolder
anno_path: annotations/val.json
dataset_dir: dataset/bdd100k
TrainReader:
batch_size: 8
epoch: 36
LearningRate:
base_lr: 0.001
schedulers:
- !CosineDecay
max_epochs: 43
- !LinearWarmup
start_factor: 0.
epochs: 1
PPYOLOEHead:
static_assigner_epoch: -1
nms:
name: MultiClassNMS
nms_top_k: 1000
keep_top_k: 100
score_threshold: 0.01
nms_threshold: 0.6

View File

@@ -0,0 +1,56 @@
_BASE_: [
'../datasets/coco_detection.yml',
'../runtime.yml',
'../ppyoloe/_base_/optimizer_300e.yml',
'../ppyoloe/_base_/ppyoloe_crn.yml',
'../ppyoloe/_base_/ppyoloe_reader.yml',
]
log_iter: 100
snapshot_epoch: 4
weights: output/ppyoloe_crn_l_36e_uadetrac/model_final
pretrain_weights: https://paddledet.bj.bcebos.com/models/ppyoloe_crn_l_300e_coco.pdparams
depth_mult: 1.0
width_mult: 1.0
num_classes: 4
TrainDataset:
!COCODataSet
image_dir: train
anno_path: annotations/train.json
dataset_dir: dataset/uadetrac
data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd']
EvalDataset:
!COCODataSet
image_dir: val
anno_path: annotations/test.json
dataset_dir: dataset/uadetrac
TestDataset:
!ImageFolder
anno_path: annotations/test.json
dataset_dir: dataset/uadetrac
TrainReader:
batch_size: 8
epoch: 36
LearningRate:
base_lr: 0.001
schedulers:
- !CosineDecay
max_epochs: 43
- !LinearWarmup
start_factor: 0.
epochs: 1
PPYOLOEHead:
static_assigner_epoch: -1
nms:
name: MultiClassNMS
nms_top_k: 1000
keep_top_k: 100
score_threshold: 0.01
nms_threshold: 0.6

View File

@@ -0,0 +1,61 @@
_BASE_: [
'../datasets/coco_detection.yml',
'../runtime.yml',
'../ppyoloe/_base_/optimizer_300e.yml',
'../ppyoloe/_base_/ppyoloe_plus_crn_tiny_auxhead.yml',
'../ppyoloe/_base_/ppyoloe_plus_reader_320.yml',
]
log_iter: 100
snapshot_epoch: 4
weights: output/ppyoloe_plus_crn_t_auxhead_320_60e_ppvehicle/model_final
pretrain_weights: https://paddledet.bj.bcebos.com/models/ppyoloe_plus_crn_t_auxhead_300e_coco.pdparams # 640*640 COCO mAP 39.7
depth_mult: 0.33
width_mult: 0.375
num_classes: 1
TrainDataset:
!COCODataSet
image_dir: ""
anno_path: annotations/train_all.json
dataset_dir: dataset/ppvehicle
data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd']
allow_empty: true
EvalDataset:
!COCODataSet
image_dir: ""
anno_path: annotations/val_all.json
dataset_dir: dataset/ppvehicle
TestDataset:
!ImageFolder
anno_path: annotations/val_all.json
dataset_dir: dataset/ppvehicle
TrainReader:
batch_size: 8
epoch: 60
LearningRate:
base_lr: 0.001
schedulers:
- !CosineDecay
max_epochs: 72
- !LinearWarmup
start_factor: 0.
epochs: 1
PPYOLOEHead:
static_assigner_epoch: -1
nms:
name: MultiClassNMS
nms_top_k: 1000
keep_top_k: 300
score_threshold: 0.01
nms_threshold: 0.7

View File

@@ -0,0 +1,53 @@
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 |
|:---------------------|:---------:|:------:| :-------------------------------------------------------------------------------------: |:------:|
| Vehicle Detection | YOLOv3 | 54.5 | [model](https://paddledet.bj.bcebos.com/models/vehicle_yolov3_darknet.pdparams) | [config](./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/develop/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/ppvehicle/vehicle_yolov3/vehicle_yolov3_darknet.yml \
-o weights=https://paddledet.bj.bcebos.com/models/vehicle_yolov3_darknet.pdparams \
--infer_dir configs/ppvehicle/vehicle_yolov3/demo \
--draw_threshold 0.2 \
--output_dir configs/ppvehicle/vehicle_yolov3/demo/output
```
Some inference results are visualized below:
![](../../../docs/images/VehicleDetection_001.jpeg)
![](../../../docs/images/VehicleDetection_005.png)

View File

@@ -0,0 +1,54 @@
[English](README.md) | 简体中文
# 特色垂类检测模型
我们提供了针对不同场景的基于PaddlePaddle的检测模型用户可以下载模型进行使用。
| 任务 | 算法 | 精度(Box AP) | 下载 | 配置文件 |
|:---------------------|:---------:|:------:| :---------------------------------------------------------------------------------: | :------:|
| 车辆检测 | YOLOv3 | 54.5 | [下载链接](https://paddledet.bj.bcebos.com/models/vehicle_yolov3_darknet.pdparams) | [配置文件](./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/develop/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/ppvehicle/vehicle_yolov3/vehicle_yolov3_darknet.yml \
-o weights=https://paddledet.bj.bcebos.com/models/vehicle_yolov3_darknet.pdparams \
--infer_dir configs/ppvehicle/vehicle_yolov3/demo \
--draw_threshold 0.2 \
--output_dir configs/ppvehicle/vehicle_yolov3/demo/output
```
预测结果示例:
![](../../../docs/images/VehicleDetection_001.jpeg)
![](../../../docs/images/VehicleDetection_005.png)

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 794 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 885 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 835 KiB

View File

@@ -0,0 +1,42 @@
_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
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/ppvehicle/vehicle_yolov3/vehicle.json