Skip to content

Commit

Permalink
[cherry-pick] update ppvehicle en doc (#6919)
Browse files Browse the repository at this point in the history
* update ppvehicle en doc, test=document_fix

* refine vehicle doc, test=document_fix
  • Loading branch information
jerrywgz authored Sep 11, 2022
1 parent ec77c58 commit 8a1efe2
Show file tree
Hide file tree
Showing 9 changed files with 681 additions and 22 deletions.
18 changes: 9 additions & 9 deletions deploy/pipeline/README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,40 +69,40 @@ Click to download the model, then unzip and save it in the `. /output_inference`

## 📚 Doc Tutorials

### [A Quick Start](docs/tutorials/PPHuman_QUICK_STARTED.md)
### [A Quick Start](docs/tutorials/PPHuman_QUICK_STARTED_en.md)

### Pedestrian attribute/feature recognition

* [A quick start](docs/tutorials/pphuman_attribute.md)
* [Customized release/2.5ment tutorials](../../docs/advanced_tutorials/customization/pphuman_attribute.md)
* [A quick start](docs/tutorials/pphuman_attribute_en.md)
* [Customized development tutorials](../../docs/advanced_tutorials/customization/pphuman_attribute_en.md)
* Data Preparation
* Model Optimization
* New Attributes

### Behavior detection

* [A quick start](docs/tutorials/pphuman_action.md)
* [A quick start](docs/tutorials/pphuman_action_en.md)
* Falling detection
* Fighting detection
* [Customized release/2.5ment tutorials](../../docs/advanced_tutorials/customization/action_recognotion/README.md)
* [Customized development tutorials](../../docs/advanced_tutorials/customization/action_recognotion/README_en.md)
* Solution Selection
* Data Preparation
* Model Optimization
* New Attributes

### ReID

* [A quick start](docs/tutorials/pphuman_mtmct.md)
* [Customized release/2.5ment tutorials](../../docs/advanced_tutorials/customization/pphuman_mtmct.md)
* [A quick start](docs/tutorials/pphuman_mtmct_en.md)
* [Customized development tutorials](../../docs/advanced_tutorials/customization/pphuman_mtmct_en.md)
* Data Preparation
* Model Optimization

### Pedestrian tracking, visitor traffic statistics, trace records

* [A quick start](docs/tutorials/pphuman_mot.md)
* [A quick start](docs/tutorials/pphuman_mot_en.md)
* Pedestrian tracking,
* Visitor traffic statistics
* Regional intrusion diagnosis and counting
* [Customized release/2.5ment tutorials](../../docs/advanced_tutorials/customization/pphuman_mot.md)
* [Customized development tutorials](../../docs/advanced_tutorials/customization/pphuman_mot_en.md)
* Data Preparation
* Model Optimization
4 changes: 3 additions & 1 deletion deploy/pipeline/docs/tutorials/PPHuman_QUICK_STARTED.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# 快速开始
[English](PPHuman_QUICK_STARTED_en.md) | 简体中文

# PP-Human快速开始

## 目录

Expand Down
210 changes: 210 additions & 0 deletions deploy/pipeline/docs/tutorials/PPHuman_QUICK_STARTED_en.md

Large diffs are not rendered by default.

14 changes: 8 additions & 6 deletions deploy/pipeline/docs/tutorials/PPVehicle_QUICK_STARTED.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# 快速开始
[English](PPVehicle_QUICK_STARTED_en.md) | 简体中文

# PP-Vehicle快速开始

## 目录

Expand All @@ -12,7 +14,7 @@
- [车辆跟踪](#车辆跟踪)
- [车牌识别](#车牌识别)
- [属性识别](#属性识别)
- [违法停车识别](#违法停车识别)
- [违章停车识别](#违章停车识别)


## 环境准备
Expand Down Expand Up @@ -118,7 +120,7 @@ python deploy/pipeline/pipeline.py --config deploy/pipeline/config/examples/infe
# 例:车辆跟踪,指定配置文件路径和测试视频,命令行中开启MOT模型并修改模型路径,命令行中指定的模型路径优先级高于配置文件
python deploy/pipeline/pipeline.py --config deploy/pipeline/config/infer_cfg_ppvehicle.yml -o MOT.enable=True MOT.model_dir=ppyoloe_infer/ --video_file=test_video.mp4 --device=gpu
# 例:车辆违法分析,指定配置文件和测试视频,命令行中指定违停区域设置、违停时间判断。
# 例:车辆违章分析,指定配置文件和测试视频,命令行中指定违停区域设置、违停时间判断。
python deploy/pipeline/pipeline.py --config deploy/pipeline/config/examples/infer_cfg_illegal_parking.yml \
--video_file=../car_test.mov \
--device=gpu \
Expand Down Expand Up @@ -200,6 +202,6 @@ PP-Vehicle 整体方案如下图所示:
- 使用PaddleOCR特色模型ch_PP-OCRv3_det+ch_PP-OCRv3_rec模型,识别车牌号码
- 详细文档参考[车牌识别](ppvehicle_plate.md)

### 违法停车识别
- 车辆跟踪模型使用高精度模型PP-YOLOE L,根据车辆的跟踪轨迹以及指定的违停区域判断是否违法停车,如果存在则展示违法停车车牌号
- 详细文档参考[违法停车识别](ppvehicle_illegal_parking.md)
### 违章停车识别
- 车辆跟踪模型使用高精度模型PP-YOLOE L,根据车辆的跟踪轨迹以及指定的违停区域判断是否违章停车,如果存在则展示违章停车车牌号
- 详细文档参考[违章停车识别](ppvehicle_illegal_parking.md)
211 changes: 211 additions & 0 deletions deploy/pipeline/docs/tutorials/PPVehicle_QUICK_STARTED_en.md

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions deploy/pipeline/docs/tutorials/ppvehicle_illegal_parking.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# PP-Vehicle违法停车识别模块
# PP-Vehicle违章停车识别模块

禁停区域违法停车识别在车辆应用场景中有着非常广泛的应用,借助AI的力量可以减轻人力投入,精准快速识别出违停车辆并进一步采取如广播驱离行为。PP-Vehicle中基于车辆跟踪模型、车牌检测模型和车牌识别模型实现了违法停车识别功能,具体模型信息如下:
禁停区域违章停车识别在车辆应用场景中有着非常广泛的应用,借助AI的力量可以减轻人力投入,精准快速识别出违停车辆并进一步采取如广播驱离行为。PP-Vehicle中基于车辆跟踪模型、车牌检测模型和车牌识别模型实现了违章停车识别功能,具体模型信息如下:

| 任务 | 算法 | 精度 | 预测速度(ms) |预测模型下载链接 |
|:---------------------|:---------:|:------:|:------:| :---------------------------------------------------------------------------------: |
Expand Down Expand Up @@ -56,8 +56,8 @@ python deploy/pipeline/pipeline.py --config deploy/pipeline/config/examples/infe
- region_polygon:自定义非法停车多边形,至少为3个点。

**注意:**
- 违法停车的测试视频必须是静止摄像头拍摄的,镜头不能抖动或移动。
- 判断车辆是否在违停区域内是**以车辆的中心点**作为参考,车辆擦边而过等场景不算作违法停车
- 违章停车的测试视频必须是静止摄像头拍摄的,镜头不能抖动或移动。
- 判断车辆是否在违停区域内是**以车辆的中心点**作为参考,车辆擦边而过等场景不算作违章停车
- `--region_polygon`表示用户自定义区域的多边形的点坐标序列,每两个为一对点坐标(x,y),**按顺时针顺序**连成一个**封闭区域**,至少需要3对点也即6个整数,默认值是`[]`,需要用户自行设置点坐标,如是四边形区域,坐标顺序是`左上、右上、右下、左下`。用户可以运行[此段代码](../../tools/get_video_info.py)获取所测视频的分辨率帧数,以及可以自定义画出自己想要的多边形区域的可视化并自己调整。
自定义多边形区域的可视化代码运行如下:
```python
Expand All @@ -83,8 +83,8 @@ python deploy/pipeline/pipeline.py --config deploy/pipeline/config/examples/infe
## 方案说明

1. 目标检测/多目标跟踪获取图片/视频输入中的车辆检测框,模型方案为PP-YOLOE,详细文档参考[PP-YOLOE](../../../configs/ppyoloe/README_cn.md)
2. 基于跟踪算法获取每辆车的轨迹,如果车辆中心在违停区域内且在指定时间内未发生移动,则视为违法停车
3. 使用车牌识别模型得到违法停车车牌并可视化
2. 基于跟踪算法获取每辆车的轨迹,如果车辆中心在违停区域内且在指定时间内未发生移动,则视为违章停车
3. 使用车牌识别模型得到违章停车车牌并可视化

## 参考资料

Expand Down
143 changes: 143 additions & 0 deletions deploy/pipeline/docs/tutorials/ppvehicle_mot_en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
English | [简体中文](ppvehicle_mot.md)

# PP-Vehicle Vehicle Tracking Module

【Application Introduction】

Vehicle detection and tracking are widely used in traffic monitoring and autonomous driving. The detection and tracking module is integrated in PP-Vehicle, providing a solid foundation for tasks including license plate detection and vehicle attribute recognition. We provide pre-trained models that can be directly used by developers.

【Model Download】

| Task | Algorithm | Accuracy | Inference speed(ms) | Download Link |
| -------------------------- | ---------- | ----------------------- | ------------------------------------ | ------------------------------------------------------------------------------------------ |
| Vehicle Detection/Tracking | PP-YOLOE-l | mAP: 63.9<br>MOTA: 50.1 | Detection: 25.1ms<br>Tracking:31.8ms | [Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/mot_ppyoloe_l_36e_ppvehicle.zip) |
| Vehicle Detection/Tracking | PP-YOLOE-s | mAP: 61.3<br>MOTA: 46.8 | Detection: 16.2ms<br>Tracking:21.0ms | [Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/mot_ppyoloe_s_36e_ppvehicle.zip) |

1. The detection/tracking model uses the PPVehicle dataset ( which integrates BDD100K-MOT and UA-DETRAC). The dataset merged car, truck, bus, van from BDD100K-MOT and car, bus, van from UA-DETRAC all into 1 class vehicle(1). The detection accuracy mAP was tested on the test set of PPVehicle, and the tracking accuracy MOTA was obtained on the test set of BDD100K-MOT (`car, truck, bus, van` were combined into 1 class `vehicle`). For more details about the training procedure, please refer to [ppvehicle](... /... /... /... /configs/ppvehicle).
2. Inference speed is obtained at T4 with TensorRT FP16 enabled, which includes data pre-processing, model inference and post-processing.

## How To Use

【Config】

The parameters associated with the attributes in the configuration file are as follows.

```
DET:
model_dir: output_inference/mot_ppyoloe_l_36e_ppvehicle/ # Vehicle detection model path
batch_size: 1 # Batch_size size for model inference
MOT:
model_dir: output_inference/mot_ppyoloe_l_36e_ppvehicle/ # Vehicle tracking model path
tracker_config: deploy/pipeline/config/tracker_config.yml
batch_size: 1 # Batch_size size for model inference, 1 only for tracking task.
skip_frame_num: -1 # Number of frames to skip, -1 means no skipping, the maximum skipped frames are recommended to be 3
enable: False # Whether or not to enable this function, please make sure it is set to True before tracking
```

【Usage】

1. Download the model from the link in the table above and unzip it to ``. /output_inference`` and change the model path in the configuration file. The default is to download the model automatically, no changes are needed.

2. The image input will start a pure detection task, and the start command is as follows

```python
python deploy/pipeline/pipeline.py --config deploy/pipeline/config/infer_cfg_ppvehicle.yml \
--image_file=test_image.jpg \
--device=gpu
```

3. Video input will start a tracking task. Please set `enable=True` for the MOT configuration in infer_cfg_ppvehicle.yml. If skip frames are needed for faster detection and tracking, it is recommended to set `skip_frame_num: 2` the maximum should not exceed 3.

```
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
skip_frame_num: 2
enable: True
```

```python
python deploy/pipeline/pipeline.py --config deploy/pipeline/config/infer_cfg_ppvehicle.yml \
--video_file=test_video.mp4 \
--device=gpu
```

4. There are two ways to modify the model path

- Config different model path in```./deploy/pipeline/config/infer_cfg_ppvehicle.yml```. The detection and tracking models correspond to the `DET` and `MOT` fields respectively. Modify the path under the corresponding field to the actual path.

- **[Recommand]** Add`-o MOT.model_dir=[YOUR_DETMODEL_PATH]` after the config in the command line to modify model path

```python
python deploy/pipeline/pipeline.py --config deploy/pipeline/config/infer_cfg_ppvehicle.yml \
--video_file=test_video.mp4 \
--device=gpu \
--region_type=horizontal \
--do_entrance_counting \
--draw_center_traj \
-o MOT.model_dir=ppyoloe/
```

**Note:**

- `--do_entrance_counting` : Whether to count entrance/exit traffic flows, the default is False

- `--draw_center_traj` : Whether to draw center trajectory, the default is False. Its input video is preferably taken from a still camera

- `--region_type` : The region for traffic counting. When setting `--do_entrance_counting`, there are two options: `horizontal` or `vertical`. The default is `horizontal`, which means the center horizontal line of the video picture is the entrance and exit. When the center point of the same object frame is on both sides of the centre horizontal line of the region in two adjacent seconds, i.e. the count adds 1.
5. Regional break-in and counting

Please set the MOT config: enable=True in `infer_cfg_ppvehicle.yml` before running the starting command:

```
python deploy/pipeline/pipeline.py --config deploy/pipeline/config/infer_cfg_ppvehicle.yml \
--video_file=test_video.mp4 \
--device=gpu \
--draw_center_traj \
--do_break_in_counting \
--region_type=custom \
--region_polygon 200 200 400 200 300 400 100 400
```
**Note:**
- Test video of area break-ins must be taken from a still camera, with no shaky or moving footage.
- `--do_break_in_counting`Indicates whether or not to count the entrance and exit of the area. The default is False.
- `--region_type` indicates the region for traffic counting, when setting `--do_break_in_counting` only `custom` can be selected, and the default is `custom`. It means that the customized region is used as the entry and exit. When the coordinates of the lower boundary midpoint of the same object frame goes to the inside of the region within two adjacent seconds, i.e. the count adds one.
- `--region_polygon` indicates a sequence of point coordinates for a polygon in a customized region. Every two are a pair of point coordinates (x,y). **In clockwise order** they are connected into a **closed region**, at least 3 pairs of points are needed (or 6 integers). The default value is `[]`. Developers need to set the point coordinates manually. If it is a quadrilateral region, the coordinate order is `top left, top right , bottom right, bottom left`. Developers can run [this code](... /... /tools/get_video_info.py) to get the resolution frames of the predicted video. It also supports customizing and adjusting the visualisation of the polygon area.
The code for the visualisation of the customized polygon area runs as follows.
```python
python get_video_info.py --video_file=demo.mp4 --region_polygon 200 200 400 200 300 400 100 400
```

A quick tip for drawing customized area: first take any point to get the picture, open it with the drawing tool, mouse over the area point and the coordinates will be displayed, record it and round it up, use it as a region_polygon parameter for this visualisation code and run the visualisation again, and fine-tune the point coordinates parameter.

【Showcase】

<div width="1000" align="center">
<img src="../images/mot_vehicle.gif"/>
</div>

## Solution

【Solution and feature】

- PP-YOLOE is adopted for vehicle detection frame of object detection, multi-object tracking in the picture/video input. For details, please refer to [PP-YOLOE](... /... /... /configs/ppyoloe/README_cn.md) and [PPVehicle](../../../../configs/ppvehicle)
- [OC-SORT](https://arxiv.org/pdf/2203.14360.pdf) is adopted as multi-object tracking model. PP-YOLOE replaced YOLOX as detector, and OCSORTTracker is the tracker. For more details, please refer to [OC-SORT](../../../../configs/mot/ocsort)

## Reference

```
@article{cao2022observation,
title={Observation-Centric SORT: Rethinking SORT for Robust Multi-Object Tracking},
author={Cao, Jinkun and Weng, Xinshuo and Khirodkar, Rawal and Pang, Jiangmiao and Kitani, Kris},
journal={arXiv preprint arXiv:2203.14360},
year={2022}
}
```
1 change: 1 addition & 0 deletions deploy/pipeline/docs/tutorials/ppvehicle_plate.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[English](ppvehicle_plate_en.md) | 简体中文

# PP-Vehicle车牌识别模块

Expand Down
Loading

0 comments on commit 8a1efe2

Please sign in to comment.