未验证 提交 b98f0df3 编写于 作者: XYZ_916's avatar XYZ_916 提交者: GitHub

ppvehicle: add docs for illegal parking recognition (#6653)

* illegal parking for ppvehicle quick start

* add docs for illegal parking

* delete useless number

* modify docs format

* add English version of doc for illegal parking

* modify md5sum for mot_ppyoloe_l_36e_ppvehicle

* delete old ocr models
上级 143536da
......@@ -9,10 +9,10 @@ MOT:
enable: True
VEHICLE_PLATE:
det_model_dir: https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_det_infer.tar
det_model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/ch_PP-OCRv3_det_infer.tar.gz
det_limit_side_len: 480
det_limit_type: "max"
rec_model_dir: https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_rec_infer.tar
rec_model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/ch_PP-OCRv3_rec_infer.tar.gz
rec_image_shape: [3, 48, 320]
rec_batch_num: 6
word_dict_path: deploy/pipeline/ppvehicle/rec_word_dict.txt
......
因为 它太大了无法显示 image diff 。你可以改为 查看blob
......@@ -12,6 +12,7 @@
- [车辆跟踪](#车辆跟踪)
- [车牌识别](#车牌识别)
- [属性识别](#属性识别)
- [违法停车识别](#违法停车识别)
## 环境准备
......@@ -169,3 +170,7 @@ PP-Vehicle v2整体方案如下图所示:
### 车牌识别
- 使用PaddleOCR特色模型ch_PP-OCRv3_det+ch_PP-OCRv3_rec模型,识别车牌号码
- 详细文档参考[属性识别](ppvehicle_plate.md)
### 违法停车识别
- 车辆跟踪模型使用高精度模型PP-YOLOE L,根据车辆的跟踪轨迹以及指定的违停区域判断是否违法停车,如果存在则展示违法停车车牌号。
- 详细文档参考[违法停车识别](ppvehicle_illegal_parking.md)
# PP-Vehicle违法停车识别模块
禁停区域违法停车识别在车辆应用场景中有着非常广泛的应用,借助AI的力量可以减轻人力投入,精准快速识别出违停车辆并进一步采取如广播驱离行为。PP-Vehicle中基于车辆跟踪模型、车牌检测模型和车牌识别模型实现了违法停车识别功能,具体模型信息如下:
| 任务 | 算法 | 精度 | 预测速度(ms) |预测模型下载链接 |
|:---------------------|:---------:|:------:|:------:| :---------------------------------------------------------------------------------: |
| 车辆检测/跟踪 | PP-YOLOE-l | mAP: 63.9 | - |[下载链接](https://bj.bcebos.com/v1/paddledet/models/pipeline/mot_ppyoloe_l_36e_ppvehicle.zip) |
| 车牌检测模型 | ch_PP-OCRv3_det | hmean: 0.979 | - | [下载链接](https://bj.bcebos.com/v1/paddledet/models/pipeline/ch_PP-OCRv3_det_infer.tar.gz) |
| 车牌识别模型 | ch_PP-OCRv3_rec | acc: 0.773 | - | [下载链接](https://bj.bcebos.com/v1/paddledet/models/pipeline/ch_PP-OCRv3_rec_infer.tar.gz) |
1. 跟踪模型使用PPVehicle数据集(整合了BDD100K-MOT和UA-DETRAC),是将BDD100K-MOT中的car, truck, bus, van和UA-DETRAC中的car, bus, van都合并为1类vehicle(1)后的数据集。
2. 车牌检测、识别模型使用PP-OCRv3模型在CCPD2019、CCPD2020混合车牌数据集上fine-tune得到。
## 使用方法
1. 用户可从上表链接中下载模型并解压到```PaddleDetection/output_inference```路径下,并修改配置文件中模型路径,也可默认自动下载模型。在```deploy/pipeline/config/examples/infer_cfg_illegal_parking.yml```中可手动设置三个模型的模型路径。
`infer_cfg_illegal_parking.yml`中配置项说明:
```
MOT: # 跟踪模块
model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/mot_ppyoloe_l_36e_ppvehicle.zip # 跟踪模型路径
tracker_config: deploy/pipeline/config/tracker_config.yml # 跟踪配置文件路径
batch_size: 1 # 跟踪batch size
enable: True # 是否开启跟踪功能
VEHICLE_PLATE: # 车牌识别模块
det_model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/ch_PP-OCRv3_det_infer.tar.gz # 车牌检测模型路径
det_limit_side_len: 480 # 检测模型单边输入尺寸
det_limit_type: "max" # 检测模型输入尺寸长短边选择,"max"表示长边
rec_model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/ch_PP-OCRv3_rec_infer.tar.gz # 车牌识别模型路径
rec_image_shape: [3, 48, 320] # 车牌识别模型输入尺寸
rec_batch_num: 6 # 车牌识别batch size
word_dict_path: deploy/pipeline/ppvehicle/rec_word_dict.txt # OCR模型查询字典
enable: True # 是否开启车牌识别功能
```
2. 输入视频,启动命令如下
```python
python deploy/pipeline/pipeline.py --config deploy/pipeline/config/examples/infer_cfg_illegal_parking.yml \
--video_file=test_video.mp4 \
--device=gpu \
--draw_center_traj \
--illegal_parking_time=5 \
--region_type=custom \
--region_polygon 100 1000 1000 1000 900 1700 0 1700
```
参数说明如下:
- config:配置文件路径;
- video_file:测试视频路径;
- device:推理设备配置;
- draw_center_traj:画出车辆中心运动轨迹;
- illegal_parking_time:非法停车时间,单位为秒;
- region_type:非法停车区域类型,custom表示自定义;
- region_polygon:自定义非法停车多边形,至少为3个点。
3. 若修改模型路径,有以下两种方式:
- 方法一:```./deploy/pipeline/config/examples/infer_cfg_illegal_parking.yml```下可以配置不同模型路径;
- 方法二:命令行中--config配置项后面增加`-o VEHICLE_PLATE.det_model_dir=[YOUR_DETMODEL_PATH] VEHICLE_PLATE.rec_model_dir=[YOUR_RECMODEL_PATH]`修改模型路径。
测试效果如下:
<div width="1000" align="center">
<img src="../images/illegal_parking_demo.gif"/>
</div>
## 方案说明
1. 目标检测/多目标跟踪获取图片/视频输入中的车辆检测框,模型方案为PP-YOLOE,详细文档参考[PP-YOLOE](../../../configs/ppyoloe/README_cn.md)
2. 基于跟踪算法获取每辆车的轨迹,如果车辆中心在违停区域内且在指定时间内未发生移动,则视为违法停车;
3. 使用车牌识别模型得到违法停车车牌并可视化。
## 参考资料
1. PaddeDetection特色检测模型[PP-YOLOE](../../../../configs/ppyoloe)
2. Paddle字符识别模型库[PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR)
# PP-Vehicle Illegal Parking Recognition Module
Illegal parking recognition in no-parking areas has a very wide range of applications in vehicle application scenarios. With the help of AI, human input can be reduced, and illegally parked vehicles can be accurately and quickly identified, and further behaviors such as broadcasting to expel the vehicles can be performed. Based on the vehicle tracking model, license plate detection model and license plate recognition model, the PP-Vehicle realizes the illegal parking recognition function. The specific model information is as follows:
| Task | Algorithm | Precision | Inference Speed(ms) |Inference Model Download Link |
|:---------------------|:---------:|:------:|:------:| :---------------------------------------------------------------------------------: |
| Vehicle Tracking | PP-YOLOE-l | mAP: 63.9 | - |[Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/mot_ppyoloe_l_36e_ppvehicle.zip) |
| Plate Detection | ch_PP-OCRv3_det | hmean: 0.979 | - | [Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/ch_PP-OCRv3_det_infer.tar.gz) |
| Plate Recognition | ch_PP-OCRv3_rec | acc: 0.773 | - | [Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/ch_PP-OCRv3_rec_infer.tar.gz) |
1. The tracking model uses the PPVehicle dataset (integrating BDD100K-MOT and UA-DETRAC), which combines car, truck, bus, van in BDD100K-MOT and car, bus, and van in UA-DETRAC into one class which named vehicle (1).
2. The license plate detection and recognition model is fine-tuned on the CCPD2019 and CCPD2020 using the PP-OCRv3 model.
## Instructions
1. Users can download the model from the link in the table above and unzip it to the ``PaddleDetection/output_inference``` path, and modify the model path in the configuration file, or download the model automatically by default. The model paths for the three models can be manually set in ``deploy/pipeline/config/examples/infer_cfg_illegal_parking.yml```.
Description of configuration items in `infer_cfg_illegal_parking.yml`:
```
MOT: # Tracking Module
model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/mot_ppyoloe_l_36e_ppvehicle.zip # Path of Tracking Model
tracker_config: deploy/pipeline/config/tracker_config.yml # Config Path of Tracking
batch_size: 1 # Tracking batch size
enable: True # Whether to Enable Tracking Function
VEHICLE_PLATE: # Plate Recognition Module
det_model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/ch_PP-OCRv3_det_infer.tar.gz # Path of Plate Detection Model
det_limit_side_len: 480 # Single Side Size of Detection Model
det_limit_type: "max" # Detection model Input Size Selection of Long and Short Sides, "max" Represents the Long Side
rec_model_dir: https://bj.bcebos.com/v1/paddledet/models/pipeline/ch_PP-OCRv3_rec_infer.tar.gz # Path of Plate Recognition Model
rec_image_shape: [3, 48, 320] # The Input Size of Plate Recognition Model
rec_batch_num: 6 # Plate Recognition batch size
word_dict_path: deploy/pipeline/ppvehicle/rec_word_dict.txt # OCR Model Look-up Table
enable: True # Whether to Enable Plate Recognition Function
```
2. Input video, the command is as follows:
```python
python deploy/pipeline/pipeline.py --config deploy/pipeline/config/examples/infer_cfg_illegal_parking.yml \
--video_file=test_video.mp4 \
--device=gpu \
--draw_center_traj \
--illegal_parking_time=5 \
--region_type=custom \
--region_polygon 100 1000 1000 1000 900 1700 0 1700
The parameter description:
- config: config path;
- video_file: video path to be tested;
- device: device to infe;
- draw_center_traj: draw the trajectory of the center of the vehicle;
- illegal_parking_time: illegal parking time, in seconds;
- region_type: illegal parking region type, 'custom' means the region is customized;
- region_polygon: customized illegal parking region which includes three points at least.
3. Methods to modify the path of model:
- Method 1: Configure different model paths in ```./deploy/pipeline/config/examples/infer_cfg_illegal_parking.yml``` file;
- Method2: In the command line, add `-o VEHICLE_PLATE.det_model_dir=[YOUR_DETMODEL_PATH] VEHICLE_PLATE.rec_model_dir=[YOUR_RECMODEL_PATH]` after the --config configuration item to modify the model path.
Test Result:
<div width="1000" align="center">
<img src="../images/illegal_parking_demo.gif"/>
</div>
## Method Description
1. Target multi-target tracking obtains the vehicle detection frame in the picture/video input. The model scheme is PP-YOLOE. For detailed documentation, refer to [PP-YOLOE](../../../configs/ppyoloe/README_cn. md)
2. Obtain the trajectory of each vehicle based on the tracking algorithm. If the center of the vehicle is in the illegal parking area and does not move within the specified time, it is considered illegal parking;
3. Use the license plate recognition model to get the illegal parking license plate and visualize it.
## References
1. Detection Model in PaddeDetection:[PP-YOLOE](../../../../configs/ppyoloe).
2. Character Recognition Model Library in Paddle: [PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR).
......@@ -30,14 +30,12 @@ DOWNLOAD_RETRY_LIMIT = 3
WEIGHTS_HOME = osp.expanduser("~/.cache/paddle/infer_weights")
MODEL_URL_MD5_DICT = {
"https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_det_infer.tar":
'982d2d8d83e55f5f981e96a7b941fff5',
"https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_rec_infer.tar":
'5f021b88518bdeda2cb4a3aacc481024',
'https://bj.bcebos.com/v1/paddledet/models/pipeline/ch_PP-OCRv3_det_infer.tar.gz':
'1b8eae0f098635699bd4e8bccf3067a7',
'https://bj.bcebos.com/v1/paddledet/models/pipeline/ch_PP-OCRv3_rec_infer.tar.gz':
'64fa0e0701efd93c7db52a9b685b3de6',
"https://bj.bcebos.com/v1/paddledet/models/pipeline/mot_ppyoloe_l_36e_ppvehicle.zip":
"3859d1a26e0c498285c2374b1a347013",
"https://bj.bcebos.com/v1/paddledet/models/pipeline/mot_ppyoloe_l_36e_ppvehicle.zip":
"46a80e1b3a8f4599e0cc79367c195b7c",
"https://bj.bcebos.com/v1/paddledet/models/pipeline/dark_hrnet_w32_256x192.zip":
"a20d5f6ca087bff0e9f2b18df45a36f2",
"https://bj.bcebos.com/v1/paddledet/models/pipeline/PPLCNet_x1_0_person_attribute_945_infer.zip":
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册