提交 81236740 编写于 作者: Z zhiboniu 提交者: zhiboniu

pphuman pipeline v2, add model_based to prune extra branchs

上级 40d58469
...@@ -67,7 +67,7 @@ PP-Human相关配置位于```deploy/pphuman/config/infer_cfg.yml```中,存放 ...@@ -67,7 +67,7 @@ PP-Human相关配置位于```deploy/pphuman/config/infer_cfg.yml```中,存放
|-------|-------|----------|-----| |-------|-------|----------|-----|
| 图片 | 属性识别 | 目标检测 属性识别 | DET ATTR | | 图片 | 属性识别 | 目标检测 属性识别 | DET ATTR |
| 单镜头视频 | 属性识别 | 多目标跟踪 属性识别 | MOT ATTR | | 单镜头视频 | 属性识别 | 多目标跟踪 属性识别 | MOT ATTR |
| 单镜头视频 | 行为识别 | 多目标跟踪 关键点检测 行为识别 | MOT KPT ACTION | | 单镜头视频 | 行为识别 | 多目标跟踪 关键点检测 行为识别 | MOT KPT FALLING |
例如基于视频输入的属性识别,任务类型包含多目标跟踪和属性识别,具体配置如下: 例如基于视频输入的属性识别,任务类型包含多目标跟踪和属性识别,具体配置如下:
...@@ -88,7 +88,7 @@ ATTR: ...@@ -88,7 +88,7 @@ ATTR:
**注意:** **注意:**
- 如果用户仅需要实现不同任务,可以在命令行中加入 `--enable_attr=True``--enable_action=True`即可,无需修改配置文件 - 如果用户仅需要实现不同任务,可以在命令行中加入 `--enable_attr=True``--enable_falling=True`即可,无需修改配置文件
- 如果用户仅需要修改模型文件路径,可以在命令行中加入 `--model_dir det=ppyoloe/` 即可,无需修改配置文件,详细说明参考下方参数说明文档 - 如果用户仅需要修改模型文件路径,可以在命令行中加入 `--model_dir det=ppyoloe/` 即可,无需修改配置文件,详细说明参考下方参数说明文档
...@@ -109,10 +109,10 @@ python deploy/pphuman/pipeline.py --config deploy/pphuman/config/infer_cfg.yml - ...@@ -109,10 +109,10 @@ python deploy/pphuman/pipeline.py --config deploy/pphuman/config/infer_cfg.yml -
python deploy/pphuman/pipeline.py --config deploy/pphuman/config/infer_cfg.yml --video_file=test_video.mp4 --device=gpu --enable_attr=True [--run_mode trt_fp16] python deploy/pphuman/pipeline.py --config deploy/pphuman/config/infer_cfg.yml --video_file=test_video.mp4 --device=gpu --enable_attr=True [--run_mode trt_fp16]
# 行为识别,指定配置文件路径和测试视频 # 行为识别,指定配置文件路径和测试视频
python deploy/pphuman/pipeline.py --config deploy/pphuman/config/infer_cfg.yml --video_file=test_video.mp4 --device=gpu --enable_action=True [--run_mode trt_fp16] python deploy/pphuman/pipeline.py --config deploy/pphuman/config/infer_cfg.yml --video_file=test_video.mp4 --device=gpu --enable_falling=True [--run_mode trt_fp16]
# 行人跨境跟踪,指定配置文件路径和测试视频列表文件夹 # 行人跨境跟踪,指定配置文件路径和测试视频列表文件夹
python deploy/pphuman/pipeline.py --config deploy/pphuman/config/infer_cfg.yml --video_dir=mtmct_dir/ --device=gpu [--run_mode trt_fp16] python deploy/pphuman/pipeline.py --config deploy/pphuman/config/infer_cfg.yml --video_dir=mtmct_dir/ --device=gpu --enable_mtmct=True [--run_mode trt_fp16]
``` ```
其他用法请参考[子任务文档](./docs) 其他用法请参考[子任务文档](./docs)
...@@ -128,7 +128,8 @@ python deploy/pphuman/pipeline.py --config deploy/pphuman/config/infer_cfg.yml - ...@@ -128,7 +128,8 @@ python deploy/pphuman/pipeline.py --config deploy/pphuman/config/infer_cfg.yml -
| --video_file | Option | 需要预测的视频 | | --video_file | Option | 需要预测的视频 |
| --camera_id | Option | 用来预测的摄像头ID,默认为-1(表示不使用摄像头预测,可设置为:0 - (摄像头数目-1) ),预测过程中在可视化界面按`q`退出输出预测结果到:output/output.mp4| | --camera_id | Option | 用来预测的摄像头ID,默认为-1(表示不使用摄像头预测,可设置为:0 - (摄像头数目-1) ),预测过程中在可视化界面按`q`退出输出预测结果到:output/output.mp4|
| --enable_attr| Option | 是否进行属性识别, 默认为False,即不开启属性识别 | | --enable_attr| Option | 是否进行属性识别, 默认为False,即不开启属性识别 |
| --enable_action| Option | 是否进行行为识别,默认为False,即不开启行为识别 | | --enable_falling| Option | 是否进行行为识别,默认为False,即不开启行为识别 |
| --enable_mtmct| Option | 是否进行跨境头跟踪,默认为False,即不开启跨境头跟踪 |
| --device | Option | 运行时的设备,可选择`CPU/GPU/XPU`,默认为`CPU`| | --device | Option | 运行时的设备,可选择`CPU/GPU/XPU`,默认为`CPU`|
| --output_dir | Option|可视化结果保存的根目录,默认为output/| | --output_dir | Option|可视化结果保存的根目录,默认为output/|
| --run_mode | Option |使用GPU时,默认为paddle, 可选(paddle/trt_fp32/trt_fp16/trt_int8)| | --run_mode | Option |使用GPU时,默认为paddle, 可选(paddle/trt_fp32/trt_fp16/trt_int8)|
......
...@@ -46,8 +46,8 @@ To make users have access to models of different scenarios, PP-Human provides pr ...@@ -46,8 +46,8 @@ To make users have access to models of different scenarios, PP-Human provides pr
| Object Detection | Image/Video Input | mAP: 56.3 | 28.0ms |[Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/mot_ppyoloe_l_36e_pipeline.pdparams) |[Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/mot_ppyoloe_l_36e_pipeline.zip) | | Object Detection | Image/Video Input | mAP: 56.3 | 28.0ms |[Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/mot_ppyoloe_l_36e_pipeline.pdparams) |[Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/mot_ppyoloe_l_36e_pipeline.zip) |
| Object Tracking | Image/Video Input | MOTA: 72.0 | 33.1ms |[Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/mot_ppyoloe_l_36e_pipeline.pdparams) |[Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/mot_ppyoloe_l_36e_pipeline.zip) | | Object Tracking | Image/Video Input | MOTA: 72.0 | 33.1ms |[Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/mot_ppyoloe_l_36e_pipeline.pdparams) |[Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/mot_ppyoloe_l_36e_pipeline.zip) |
| Attribute Recognition | Image/Video Input Attribute Recognition | mA: 94.86 | 2ms per person | - |[Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/strongbaseline_r50_30e_pa100k.zip) | | Attribute Recognition | Image/Video Input Attribute Recognition | mA: 94.86 | 2ms per person | - |[Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/strongbaseline_r50_30e_pa100k.zip) |
| Keypoint Detection | Video Input Action Recognition | AP: 87.1 | 2.9ms per person | [Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/dark_hrnet_w32_256x192.pdparams) |[Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/dark_hrnet_w32_256x192.zip) | Keypoint Detection | Video Input Falling Recognition | AP: 87.1 | 2.9ms per person | [Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/dark_hrnet_w32_256x192.pdparams) |[Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/dark_hrnet_w32_256x192.zip)
| Action Recognition | Video Input Action Recognition | Precision 96.43 | 2.7ms per person | - |[Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/STGCN.zip) | | Falling Recognition | Video Input Falling Recognition | Precision 96.43 | 2.7ms per person | - |[Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/STGCN.zip) |
| ReID | Multi-Target Multi-Camera Tracking | mAP: 98.8 | 1.5ms per person | - |[Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/reid_model.zip) | | ReID | Multi-Target Multi-Camera Tracking | mAP: 98.8 | 1.5ms per person | - |[Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/reid_model.zip) |
Then, unzip the downloaded model to the folder `./output_inference`. Then, unzip the downloaded model to the folder `./output_inference`.
...@@ -68,7 +68,7 @@ Their correspondence is as follows: ...@@ -68,7 +68,7 @@ Their correspondence is as follows:
|-------|-------|----------|-----| |-------|-------|----------|-----|
| Image | Attribute Recognition | Object Detection Attribute Recognition | DET ATTR | | Image | Attribute Recognition | Object Detection Attribute Recognition | DET ATTR |
| Single-Camera Video | Attribute Recognition | Multi-Object Tracking Attribute Recognition | MOT ATTR | | Single-Camera Video | Attribute Recognition | Multi-Object Tracking Attribute Recognition | MOT ATTR |
| Single-Camera Video | Behavior Recognition | Multi-Object Tracking Keypoint Detection Action Recognition | MOT KPT ACTION | | Single-Camera Video | Behavior Recognition | Multi-Object Tracking Keypoint Detection Falling Recognition | MOT KPT FALLING |
For example, for the attribute recognition with the video input, its task types contain multi-object tracking and attribute recognition, and the config is: For example, for the attribute recognition with the video input, its task types contain multi-object tracking and attribute recognition, and the config is:
...@@ -89,7 +89,7 @@ ATTR: ...@@ -89,7 +89,7 @@ ATTR:
**Note: ** **Note: **
- For different tasks, users could add `--enable_attr=True` or `--enable_action=True` in command line and do not need to set config file. - For different tasks, users could add `--enable_attr=True` or `--enable_falling=True` in command line and do not need to set config file.
- if only need to change the model path, users could add `--model_dir det=ppyoloe/` in command line and do not need to set config file. For details info please refer to doc below. - if only need to change the model path, users could add `--model_dir det=ppyoloe/` in command line and do not need to set config file. For details info please refer to doc below.
...@@ -109,11 +109,11 @@ python deploy/pphuman/pipeline.py --config deploy/pphuman/config/infer_cfg.yml - ...@@ -109,11 +109,11 @@ python deploy/pphuman/pipeline.py --config deploy/pphuman/config/infer_cfg.yml -
# Attribute recognition. Specify the config file path and test videos # Attribute recognition. Specify the config file path and test videos
python deploy/pphuman/pipeline.py --config deploy/pphuman/config/infer_cfg.yml --video_file=test_video.mp4 --device=gpu --enable_attr=True [--run_mode trt_fp16] python deploy/pphuman/pipeline.py --config deploy/pphuman/config/infer_cfg.yml --video_file=test_video.mp4 --device=gpu --enable_attr=True [--run_mode trt_fp16]
# Action Recognition. Specify the config file path and test videos # Falling Recognition. Specify the config file path and test videos
python deploy/pphuman/pipeline.py --config deploy/pphuman/config/infer_cfg.yml --video_file=test_video.mp4 --device=gpu --enable_action=True [--run_mode trt_fp16] python deploy/pphuman/pipeline.py --config deploy/pphuman/config/infer_cfg.yml --video_file=test_video.mp4 --device=gpu --enable_falling=True [--run_mode trt_fp16]
# Pedestrian Multi-Target Multi-Camera tracking. Specify the config file path and the directory of test videos # Pedestrian Multi-Target Multi-Camera tracking. Specify the config file path and the directory of test videos
python deploy/pphuman/pipeline.py --config deploy/pphuman/config/infer_cfg.yml --video_dir=mtmct_dir/ --device=gpu [--run_mode trt_fp16] python deploy/pphuman/pipeline.py --config deploy/pphuman/config/infer_cfg.yml --video_dir=mtmct_dir/ --device=gpu --enable_mtmct=True [--run_mode trt_fp16]
``` ```
...@@ -130,7 +130,7 @@ Other usage please refer to [sub-task docs](./docs) ...@@ -130,7 +130,7 @@ Other usage please refer to [sub-task docs](./docs)
| --video_file | Option | Videos to-be-predicted | | --video_file | Option | Videos to-be-predicted |
| --camera_id | Option | ID of the inference camera is -1 by default (means inference without cameras,and it can be set to 0 - (number of cameras-1)), and during the inference, click `q` on the visual interface to exit and output the inference result to output/output.mp4| | --camera_id | Option | ID of the inference camera is -1 by default (means inference without cameras,and it can be set to 0 - (number of cameras-1)), and during the inference, click `q` on the visual interface to exit and output the inference result to output/output.mp4|
| --enable_attr| Option | Enable attribute recognition or not | | --enable_attr| Option | Enable attribute recognition or not |
| --enable_action| Option | Enable action recognition or not | | --enable_falling| Option | Enable action recognition or not |
| --device | Option | During the operation,available devices are `CPU/GPU/XPU`,and the default is `CPU`| | --device | Option | During the operation,available devices are `CPU/GPU/XPU`,and the default is `CPU`|
| --output_dir | Option| The default root directory which stores the visualization result is output/| | --output_dir | Option| The default root directory which stores the visualization result is output/|
| --run_mode | Option | When using GPU,the default one is paddle, and all these are available(paddle/trt_fp32/trt_fp16/trt_int8).| | --run_mode | Option | When using GPU,the default one is paddle, and all these are available(paddle/trt_fp32/trt_fp16/trt_int8).|
...@@ -169,8 +169,8 @@ The overall solution of PP-Human is as follows: ...@@ -169,8 +169,8 @@ The overall solution of PP-Human is as follows:
- Use StrongBaseline(a multi-class model)to conduct attribute recognition, and the main attributes include age, gender, hats, eyes, clothing, and backpacks. - Use StrongBaseline(a multi-class model)to conduct attribute recognition, and the main attributes include age, gender, hats, eyes, clothing, and backpacks.
- For details, please refer to [Attribute Recognition](docs/attribute_en.md) - For details, please refer to [Attribute Recognition](docs/attribute_en.md)
### 5. Action Recognition ### 5. Falling Recognition
- Use PP-YOLOE + Bytetrack to track humans - Use PP-YOLOE + Bytetrack to track humans
- Use HRNet for keypoint detection and get the information of the 17 key points in the human body - Use HRNet for keypoint detection and get the information of the 17 key points in the human body
- According to the changes of the key points of the same person within 50 frames, judge whether the action made by the person within 50 frames is a fall with the help of ST-GCN - According to the changes of the key points of the same person within 50 frames, judge whether the action made by the person within 50 frames is a fall with the help of ST-GCN
- For details, please refer to [Action Recognition](docs/action_en.md) - For details, please refer to [Falling Recognition](docs/action_en.md)
...@@ -11,23 +11,27 @@ DET: ...@@ -11,23 +11,27 @@ DET:
ATTR: ATTR:
model_dir: output_inference/strongbaseline_r50_30e_pa100k/ model_dir: output_inference/strongbaseline_r50_30e_pa100k/
batch_size: 8 batch_size: 8
basemode: "idbased"
MOT: MOT:
model_dir: output_inference/mot_ppyoloe_l_36e_pipeline/ model_dir: output_inference/mot_ppyoloe_l_36e_pipeline/
tracker_config: deploy/pphuman/config/tracker_config.yml tracker_config: deploy/pphuman/config/tracker_config.yml
batch_size: 1 batch_size: 1
basemode: "idbased"
KPT: KPT:
model_dir: output_inference/dark_hrnet_w32_256x192/ model_dir: output_inference/dark_hrnet_w32_256x192/
batch_size: 8 batch_size: 8
ACTION: FALLING:
model_dir: output_inference/STGCN model_dir: output_inference/STGCN
batch_size: 1 batch_size: 1
max_frames: 50 max_frames: 50
display_frames: 80 display_frames: 80
coord_size: [384, 512] coord_size: [384, 512]
basemode: "skeletonbased"
REID: REID:
model_dir: output_inference/reid_model/ model_dir: output_inference/reid_model/
batch_size: 16 batch_size: 16
basemode: "idbased"
...@@ -23,7 +23,7 @@ class Result(object): ...@@ -23,7 +23,7 @@ class Result(object):
'mot': dict(), 'mot': dict(),
'attr': dict(), 'attr': dict(),
'kpt': dict(), 'kpt': dict(),
'action': dict(), 'falling': dict(),
'reid': dict() 'reid': dict()
} }
...@@ -53,13 +53,13 @@ class DataCollector(object): ...@@ -53,13 +53,13 @@ class DataCollector(object):
- qualities(list of float): Nx[float] - qualities(list of float): Nx[float]
- attrs(list of attr): refer to attrs for details - attrs(list of attr): refer to attrs for details
- kpts(list of kpts): refer to kpts for details - kpts(list of kpts): refer to kpts for details
- actions(list of actions): refer to actions for details - falling(list of falling): refer to falling for details
... ...
- [idN] - [idN]
""" """
def __init__(self): def __init__(self):
#id, frame, rect, score, label, attrs, kpts, actions #id, frame, rect, score, label, attrs, kpts, falling
self.mots = { self.mots = {
"frames": [], "frames": [],
"rects": [], "rects": [],
...@@ -67,7 +67,7 @@ class DataCollector(object): ...@@ -67,7 +67,7 @@ class DataCollector(object):
"kpts": [], "kpts": [],
"features": [], "features": [],
"qualities": [], "qualities": [],
"actions": [] "falling": []
} }
self.collector = {} self.collector = {}
...@@ -75,10 +75,15 @@ class DataCollector(object): ...@@ -75,10 +75,15 @@ class DataCollector(object):
mot_res = Result.get('mot') mot_res = Result.get('mot')
attr_res = Result.get('attr') attr_res = Result.get('attr')
kpt_res = Result.get('kpt') kpt_res = Result.get('kpt')
action_res = Result.get('action') falling_res = Result.get('falling')
reid_res = Result.get('reid') reid_res = Result.get('reid')
rects = reid_res['rects'] if reid_res is not None else mot_res['boxes'] rects = []
if reid_res is not None:
rects = reid_res['rects']
elif mot_res is not None:
rects = mot_res['boxes']
for idx, mot_item in enumerate(rects): for idx, mot_item in enumerate(rects):
ids = int(mot_item[0]) ids = int(mot_item[0])
if ids not in self.collector: if ids not in self.collector:
...@@ -90,11 +95,11 @@ class DataCollector(object): ...@@ -90,11 +95,11 @@ class DataCollector(object):
if kpt_res: if kpt_res:
self.collector[ids]["kpts"].append( self.collector[ids]["kpts"].append(
[kpt_res['keypoint'][0][idx], kpt_res['keypoint'][1][idx]]) [kpt_res['keypoint'][0][idx], kpt_res['keypoint'][1][idx]])
if action_res and (idx + 1) in action_res: if falling_res and (idx + 1) in falling_res:
self.collector[ids]["actions"].append(action_res[idx + 1]) self.collector[ids]["falling"].append(falling_res[idx + 1])
else: else:
# action model generate result per X frames, Not available every frames # action model generate result per X frames, Not available every frames
self.collector[ids]["actions"].append(None) self.collector[ids]["falling"].append(None)
if reid_res: if reid_res:
self.collector[ids]["features"].append(reid_res['features'][ self.collector[ids]["features"].append(reid_res['features'][
idx]) idx])
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
## 配置说明 ## 配置说明
[配置文件](../config/infer_cfg.yml)中与行为识别相关的参数如下: [配置文件](../config/infer_cfg.yml)中与行为识别相关的参数如下:
``` ```
ACTION: FALLING:
model_dir: output_inference/STGCN # 模型所在路径 model_dir: output_inference/STGCN # 模型所在路径
batch_size: 1 # 预测批大小。 当前仅支持为1进行推理 batch_size: 1 # 预测批大小。 当前仅支持为1进行推理
max_frames: 50 # 动作片段对应的帧数。在行人ID对应时序骨骼点结果时达到该帧数后,会通过行为识别模型判断该段序列的动作类型。与训练设置一致时效果最佳。 max_frames: 50 # 动作片段对应的帧数。在行人ID对应时序骨骼点结果时达到该帧数后,会通过行为识别模型判断该段序列的动作类型。与训练设置一致时效果最佳。
...@@ -43,17 +43,17 @@ ACTION: ...@@ -43,17 +43,17 @@ ACTION:
python deploy/pphuman/pipeline.py --config deploy/pphuman/config/infer_cfg.yml \ python deploy/pphuman/pipeline.py --config deploy/pphuman/config/infer_cfg.yml \
--video_file=test_video.mp4 \ --video_file=test_video.mp4 \
--device=gpu \ --device=gpu \
--enable_action=True --enable_falling=True
``` ```
3. 若修改模型路径,有以下两种方式: 3. 若修改模型路径,有以下两种方式:
- ```./deploy/pphuman/config/infer_cfg.yml```下可以配置不同模型路径,关键点模型和行为识别模型分别对应`KPT`和`ACTION`字段,修改对应字段下的路径为实际期望的路径即可。 - ```./deploy/pphuman/config/infer_cfg.yml```下可以配置不同模型路径,关键点模型和行为识别模型分别对应`KPT`和`FALLING`字段,修改对应字段下的路径为实际期望的路径即可。
- 命令行中增加`--model_dir`修改模型路径: - 命令行中增加`--model_dir`修改模型路径:
```python ```python
python deploy/pphuman/pipeline.py --config deploy/pphuman/config/infer_cfg.yml \ python deploy/pphuman/pipeline.py --config deploy/pphuman/config/infer_cfg.yml \
--video_file=test_video.mp4 \ --video_file=test_video.mp4 \
--device=gpu \ --device=gpu \
--enable_action=True \ --enable_falling=True \
--model_dir kpt=./dark_hrnet_w32_256x192 action=./STGCN --model_dir kpt=./dark_hrnet_w32_256x192 action=./STGCN
``` ```
...@@ -78,7 +78,7 @@ python deploy/pphuman/pipeline.py --config deploy/pphuman/config/infer_cfg.yml \ ...@@ -78,7 +78,7 @@ python deploy/pphuman/pipeline.py --config deploy/pphuman/config/infer_cfg.yml \
## 参考文献 ## 参考文献
``` ```
@inproceedings{stgcn2018aaai, @inproceedings{stgcn2018aaai,
title = {Spatial Temporal Graph Convolutional Networks for Skeleton-Based Action Recognition}, title = {Spatial Temporal Graph Convolutional Networks for Skeleton-Based Falling Recognition},
author = {Sijie Yan and Yuanjun Xiong and Dahua Lin}, author = {Sijie Yan and Yuanjun Xiong and Dahua Lin},
booktitle = {AAAI}, booktitle = {AAAI},
year = {2018}, year = {2018},
......
English | [简体中文](action.md) English | [简体中文](action.md)
# Action Recognition Module of PP-Human # Falling Recognition Module of PP-Human
Action Recognition is widely used in the intelligent community/smart city, and security monitoring. PP-Human provides the module of skeleton-based action recognition. Falling Recognition is widely used in the intelligent community/smart city, and security monitoring. PP-Human provides the module of skeleton-based action recognition.
<div align="center"> <img src="./images/action.gif" width='1000'/> <center>Data source and copyright owner:Skyinfor <div align="center"> <img src="./images/action.gif" width='1000'/> <center>Data source and copyright owner:Skyinfor
Technology. Thanks for the provision of actual scenario data, which are only Technology. Thanks for the provision of actual scenario data, which are only
...@@ -18,7 +18,7 @@ There are multiple available pretrained models including pedestrian detection/tr ...@@ -18,7 +18,7 @@ There are multiple available pretrained models including pedestrian detection/tr
|:----------------------------- |:---------:|:-------------------------:|:-----------------------------------:| :-----------------: |:-----------------------------------------------------------------------------------------:| |:----------------------------- |:---------:|:-------------------------:|:-----------------------------------:| :-----------------: |:-----------------------------------------------------------------------------------------:|
| Pedestrian Detection/Tracking | PP-YOLOE | mAP: 56.3 <br> MOTA: 72.0 | Detection: 28ms <br>Tracking:33.1ms |[Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/mot_ppyoloe_l_36e_pipeline.pdparams) |[Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/mot_ppyoloe_l_36e_pipeline.zip) | | Pedestrian Detection/Tracking | PP-YOLOE | mAP: 56.3 <br> MOTA: 72.0 | Detection: 28ms <br>Tracking:33.1ms |[Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/mot_ppyoloe_l_36e_pipeline.pdparams) |[Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/mot_ppyoloe_l_36e_pipeline.zip) |
| Keypoint Detection | HRNet | AP: 87.1 | Single Person 2.9ms |[Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/dark_hrnet_w32_256x192.pdparams) |[Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/dark_hrnet_w32_256x192.zip) | | Keypoint Detection | HRNet | AP: 87.1 | Single Person 2.9ms |[Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/dark_hrnet_w32_256x192.pdparams) |[Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/dark_hrnet_w32_256x192.zip) |
| Action Recognition | ST-GCN | Precision Rate: 96.43 | Single Person 2.7ms | - |[Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/STGCN.zip) | | Falling Recognition | ST-GCN | Precision Rate: 96.43 | Single Person 2.7ms | - |[Link](https://bj.bcebos.com/v1/paddledet/models/pipeline/STGCN.zip) |
Note: Note:
...@@ -35,7 +35,7 @@ Note: ...@@ -35,7 +35,7 @@ Note:
Parameters related to action recognition in the [config file](../config/infer_cfg.yml) are as follow: Parameters related to action recognition in the [config file](../config/infer_cfg.yml) are as follow:
``` ```
ACTION: FALLING:
model_dir: output_inference/STGCN # Path of the model model_dir: output_inference/STGCN # Path of the model
batch_size: 1 # The size of the inference batch. The only avilable size for inference is 1. batch_size: 1 # The size of the inference batch. The only avilable size for inference is 1.
max_frames: 50 # The number of frames of action segments. When frames of time-ordered skeleton keypoints of each pedestrian ID achieve the max value,the action type will be judged by the action recognition model. If the setting is the same as the training, there will be an ideal inference result. max_frames: 50 # The number of frames of action segments. When frames of time-ordered skeleton keypoints of each pedestrian ID achieve the max value,the action type will be judged by the action recognition model. If the setting is the same as the training, there will be an ideal inference result.
...@@ -56,12 +56,12 @@ ACTION: ...@@ -56,12 +56,12 @@ ACTION:
python deploy/pphuman/pipeline.py --config deploy/pphuman/config/infer_cfg.yml \ python deploy/pphuman/pipeline.py --config deploy/pphuman/config/infer_cfg.yml \
--video_file=test_video.mp4 \ --video_file=test_video.mp4 \
--device=gpu \ --device=gpu \
--enable_action=True --enable_falling=True
``` ```
- There are two ways to modify the model path: - There are two ways to modify the model path:
- In ```./deploy/pphuman/config/infer_cfg.yml```, you can configurate different model paths,which is proper only if you match keypoint models and action recognition models with the fields of `KPT` and `ACTION`respectively, and modify the corresponding path of each field into the expected path. - In ```./deploy/pphuman/config/infer_cfg.yml```, you can configurate different model paths,which is proper only if you match keypoint models and action recognition models with the fields of `KPT` and `FALLING`respectively, and modify the corresponding path of each field into the expected path.
- Add `--model_dir` in the command line to revise the model path: - Add `--model_dir` in the command line to revise the model path:
...@@ -69,7 +69,7 @@ ACTION: ...@@ -69,7 +69,7 @@ ACTION:
python deploy/pphuman/pipeline.py --config deploy/pphuman/config/infer_cfg.yml \ python deploy/pphuman/pipeline.py --config deploy/pphuman/config/infer_cfg.yml \
--video_file=test_video.mp4 \ --video_file=test_video.mp4 \
--device=gpu \ --device=gpu \
--enable_action=True \ --enable_falling=True \
--model_dir kpt=./dark_hrnet_w32_256x192 action=./STGCN --model_dir kpt=./dark_hrnet_w32_256x192 action=./STGCN
``` ```
...@@ -93,7 +93,7 @@ ACTION: ...@@ -93,7 +93,7 @@ ACTION:
4. The action recognition model uses [ST-GCN](https://arxiv.org/abs/1801.07455), and employ the [PaddleVideo](https://github.com/PaddlePaddle/PaddleVideo/blob/develop/docs/zh-CN/model_zoo/recognition/stgcn.md) toolkit to complete model training. 4. The action recognition model uses [ST-GCN](https://arxiv.org/abs/1801.07455), and employ the [PaddleVideo](https://github.com/PaddlePaddle/PaddleVideo/blob/develop/docs/zh-CN/model_zoo/recognition/stgcn.md) toolkit to complete model training.
## Custom Action Training ## Custom Falling Training
The pretrained models are provided and can be used directly, including pedestrian detection/ tracking, keypoint detection and fall recognition. If users need to train custom action or optimize the model performance, please refer the link below. The pretrained models are provided and can be used directly, including pedestrian detection/ tracking, keypoint detection and fall recognition. If users need to train custom action or optimize the model performance, please refer the link below.
...@@ -108,7 +108,7 @@ The pretrained models are provided and can be used directly, including pedestria ...@@ -108,7 +108,7 @@ The pretrained models are provided and can be used directly, including pedestria
``` ```
@inproceedings{stgcn2018aaai, @inproceedings{stgcn2018aaai,
title = {Spatial Temporal Graph Convolutional Networks for Skeleton-Based Action Recognition}, title = {Spatial Temporal Graph Convolutional Networks for Skeleton-Based Falling Recognition},
author = {Sijie Yan and Yuanjun Xiong and Dahua Lin}, author = {Sijie Yan and Yuanjun Xiong and Dahua Lin},
booktitle = {AAAI}, booktitle = {AAAI},
year = {2018}, year = {2018},
......
...@@ -11,7 +11,7 @@ PP-Human跨镜头跟踪模块主要目的在于提供一套简洁、高效的跨 ...@@ -11,7 +11,7 @@ PP-Human跨镜头跟踪模块主要目的在于提供一套简洁、高效的跨
2. 跨镜头跟踪模式下,要求输入的多个视频放在同一目录下,命令如下: 2. 跨镜头跟踪模式下,要求输入的多个视频放在同一目录下,命令如下:
```python ```python
python3 deploy/pphuman/pipeline.py --config deploy/pphuman/config/infer_cfg.yml --video_dir=[your_video_file_directory] --device=gpu python3 deploy/pphuman/pipeline.py --config deploy/pphuman/config/infer_cfg.yml --video_dir=[your_video_file_directory] --device=gpu --enable_mtmct=True
``` ```
3. 相关配置在`./deploy/pphuman/config/infer_cfg.yml`文件中修改: 3. 相关配置在`./deploy/pphuman/config/infer_cfg.yml`文件中修改:
......
...@@ -63,10 +63,15 @@ def argsparser(): ...@@ -63,10 +63,15 @@ def argsparser():
default=False, default=False,
help="Whether use attribute recognition.") help="Whether use attribute recognition.")
parser.add_argument( parser.add_argument(
"--enable_action", "--enable_falling",
type=ast.literal_eval, type=ast.literal_eval,
default=False, default=False,
help="Whether use action recognition.") help="Whether use action recognition.")
parser.add_argument(
"--enable_mtmct",
type=ast.literal_eval,
default=False,
help="Whether to enable multi-camera reid track.")
parser.add_argument( parser.add_argument(
"--output_dir", "--output_dir",
type=str, type=str,
...@@ -162,7 +167,7 @@ class PipeTimer(Times): ...@@ -162,7 +167,7 @@ class PipeTimer(Times):
'mot': Times(), 'mot': Times(),
'attr': Times(), 'attr': Times(),
'kpt': Times(), 'kpt': Times(),
'action': Times(), 'falling': Times(),
'reid': Times() 'reid': Times()
} }
self.img_num = 0 self.img_num = 0
...@@ -207,9 +212,9 @@ class PipeTimer(Times): ...@@ -207,9 +212,9 @@ class PipeTimer(Times):
dic['kpt'] = round(self.module_time['kpt'].value() / dic['kpt'] = round(self.module_time['kpt'].value() /
max(1, self.img_num), max(1, self.img_num),
4) if average else self.module_time['kpt'].value() 4) if average else self.module_time['kpt'].value()
dic['action'] = round( dic['falling'] = round(
self.module_time['action'].value() / max(1, self.img_num), self.module_time['falling'].value() / max(1, self.img_num),
4) if average else self.module_time['action'].value() 4) if average else self.module_time['falling'].value()
dic['img_num'] = self.img_num dic['img_num'] = self.img_num
return dic return dic
...@@ -217,7 +222,7 @@ class PipeTimer(Times): ...@@ -217,7 +222,7 @@ class PipeTimer(Times):
def merge_model_dir(args, model_dir): def merge_model_dir(args, model_dir):
# set --model_dir DET=ppyoloe/ to overwrite the model_dir in config file # set --model_dir DET=ppyoloe/ to overwrite the model_dir in config file
task_set = ['DET', 'ATTR', 'MOT', 'KPT', 'ACTION', 'REID'] task_set = ['DET', 'ATTR', 'MOT', 'KPT', 'FALLING', 'REID']
if not model_dir: if not model_dir:
return args return args
for md in model_dir: for md in model_dir:
......
此差异已折叠。
...@@ -33,7 +33,7 @@ from benchmark_utils import PaddleInferBenchmark ...@@ -33,7 +33,7 @@ from benchmark_utils import PaddleInferBenchmark
from infer import Detector, print_arguments from infer import Detector, print_arguments
class ActionRecognizer(Detector): class FallingRecognizer(Detector):
""" """
Args: Args:
model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml
...@@ -67,8 +67,8 @@ class ActionRecognizer(Detector): ...@@ -67,8 +67,8 @@ class ActionRecognizer(Detector):
threshold=0.5, threshold=0.5,
window_size=100, window_size=100,
random_pad=False): random_pad=False):
assert batch_size == 1, "ActionRecognizer only support batch_size=1 now." assert batch_size == 1, "FallingRecognizer only support batch_size=1 now."
super(ActionRecognizer, self).__init__( super(FallingRecognizer, self).__init__(
model_dir=model_dir, model_dir=model_dir,
device=device, device=device,
run_mode=run_mode, run_mode=run_mode,
...@@ -264,7 +264,7 @@ def get_test_skeletons(input_file): ...@@ -264,7 +264,7 @@ def get_test_skeletons(input_file):
def main(): def main():
detector = ActionRecognizer( detector = FallingRecognizer(
FLAGS.model_dir, FLAGS.model_dir,
device=FLAGS.device, device=FLAGS.device,
run_mode=FLAGS.run_mode, run_mode=FLAGS.run_mode,
...@@ -305,7 +305,7 @@ def main(): ...@@ -305,7 +305,7 @@ def main():
} }
det_log = PaddleInferBenchmark(detector.config, model_info, data_info, det_log = PaddleInferBenchmark(detector.config, model_info, data_info,
perf_info, mems) perf_info, mems)
det_log('Action') det_log('Falling')
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -68,7 +68,7 @@ class KeyPointBuff(object): ...@@ -68,7 +68,7 @@ class KeyPointBuff(object):
def get_collected_keypoint(self): def get_collected_keypoint(self):
""" """
Output (List): List of keypoint results for Action Recognition task, where Output (List): List of keypoint results for Falling Recognition task, where
the format of each element is [tracker_id, KeyPointSequence of tracker_id] the format of each element is [tracker_id, KeyPointSequence of tracker_id]
""" """
output = [] output = []
...@@ -80,7 +80,7 @@ class KeyPointBuff(object): ...@@ -80,7 +80,7 @@ class KeyPointBuff(object):
return output return output
class ActionVisualHelper(object): class FallingVisualHelper(object):
def __init__(self, frame_life=20): def __init__(self, frame_life=20):
self.frame_life = frame_life self.frame_life = frame_life
self.action_history = {} self.action_history = {}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册