From bfc439ce0e5b2057b75e1fda5962bc29bf57f01d Mon Sep 17 00:00:00 2001 From: George Ni Date: Thu, 10 Jun 2021 22:31:26 +0800 Subject: [PATCH] [MOT] add deepsort video infer and doc (#3346) * add deepsort video infer modelzoo, test=document_fix * fix deepsort doc results, test=document_fix --- configs/mot/README.md | 36 ++++++++++++----------- configs/mot/README_cn.md | 29 +++++++++++-------- configs/mot/deepsort/README.md | 48 +++++++++++++++++++++---------- configs/mot/deepsort/README_cn.md | 46 ++++++++++++++++++++--------- configs/mot/jde/README.md | 4 +-- ppdet/modeling/mot/utils.py | 4 +-- 6 files changed, 107 insertions(+), 60 deletions(-) diff --git a/configs/mot/README.md b/configs/mot/README.md index ba4d78b52..439d085e0 100644 --- a/configs/mot/README.md +++ b/configs/mot/README.md @@ -45,20 +45,24 @@ pip install -r requirements.txt ## Model Zoo -### DeepSORT on MOT-16 Training Set +### DeepSORT Results on MOT-16 Training Set -| backbone | input shape | MOTA | IDF1 | IDS | FP | FN | FPS | download| config | -| :---------| :------- | :----: | :----: | :--: | :----: | :---: | :---: | :---: | :---: | -| ResNet-101 | 1088x608 | 72.2 | 60.5 | 998 | 8054 | 21644 | - | [download](https://paddledet.bj.bcebos.com/models/mot/deepsort_pcb_pyramid_r101.pdparams)|[config](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/mot/deepsort/deepsort_pcb_pyramid_r101.yml) | +| backbone | input shape | MOTA | IDF1 | IDS | FP | FN | FPS | det result/model |ReID model| config | +| :---------| :------- | :----: | :----: | :--: | :----: | :---: | :---: | :---: | :---: | :---: | +| ResNet-101 | 1088x608 | 72.2 | 60.5 | 998 | 8054 | 21644 | - | [det result](https://dataset.bj.bcebos.com/mot/det_results_dir.zip) |[ReID model](https://paddledet.bj.bcebos.com/models/mot/deepsort_pcb_pyramid_r101.pdparams)|[config](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/mot/deepsort/deepsort_pcb_pyramid_r101.yml) | +| ResNet-101 | 1088x608 | 68.3 | 56.5 | 1722 | 17337 | 15890 | - | [det model](https://paddledet.bj.bcebos.com/models/mot/jde_yolov3_darknet53_30e_1088x608.pdparams) |[ReID model](https://paddledet.bj.bcebos.com/models/mot/deepsort_pcb_pyramid_r101.pdparams)|[config](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/mot/deepsort/deepsort_pcb_pyramid_r101.yml) | -### DeepSORT on MOT-16 Test Set +### DeepSORT Results on MOT-16 Test Set -| backbone | input shape | MOTA | IDF1 | IDS | FP | FN | FPS | download| config | -| :---------| :------- | :----: | :----: | :--: | :----: | :---: | :---: | :---: | :---: | -| ResNet-101 | 1088x608 | 64.1 | 53.0 | 1024 | 12457 | 51919 | - | [download](https://paddledet.bj.bcebos.com/models/mot/deepsort_pcb_pyramid_r101.pdparams)|[config](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/mot/deepsort/deepsort_pcb_pyramid_r101.yml) | +| backbone | input shape | MOTA | IDF1 | IDS | FP | FN | FPS | det result/model |ReID model| config | +| :---------| :------- | :----: | :----: | :--: | :----: | :---: | :---: | :---: | :---: | :---: | +| ResNet-101 | 1088x608 | 64.1 | 53.0 | 1024 | 12457 | 51919 | - |[det result](https://dataset.bj.bcebos.com/mot/det_results_dir.zip) |[ReID model](https://paddledet.bj.bcebos.com/models/mot/deepsort_pcb_pyramid_r101.pdparams)|[config](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/mot/deepsort/deepsort_pcb_pyramid_r101.yml) | +| ResNet-101 | 1088x608 | 61.2 | 48.5 | 1799 | 25796 | 43232 | - | [det model](https://paddledet.bj.bcebos.com/models/mot/jde_yolov3_darknet53_30e_1088x608.pdparams) |[ReID model](https://paddledet.bj.bcebos.com/models/mot/deepsort_pcb_pyramid_r101.pdparams)|[config](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/mot/deepsort/deepsort_pcb_pyramid_r101.yml) | **Notes:** - DeepSORT does not need to train on MOT dataset, only used for evaluation. Before DeepSORT evaluation, you should get detection results by a detection model first, and then prepare them like this: +DeepSORT does not need to train on MOT dataset, only used for evaluation. Now it supports two evaluation methods. + +- 1.Load the result file and the ReID model. Before DeepSORT evaluation, you should get detection results by a detection model first, and then prepare them like this: ``` det_results_dir |——————MOT16-02.txt @@ -69,24 +73,24 @@ det_results_dir |——————MOT16-11.txt |——————MOT16-13.txt ``` -For MOT16 dataset, you can download the det_results_dir.zip of one detection model provided by PaddleDetection: +For MOT16 dataset, you can download a detection result after matching called det_results_dir.zip provided by PaddleDetection: ``` wget https://dataset.bj.bcebos.com/mot/det_results_dir.zip ``` -Each txt is the detection result of all the pictures extracted from each video, and each line describes a bounding box with the following format: +If you use a stronger detection model, you can get better results. Each txt is the detection result of all the pictures extracted from each video, and each line describes a bounding box with the following format: ``` -[frame_id],[identity],[bb_left],[bb_top],[width],[height],[conf] +[frame_id],[bb_left],[bb_top],[width],[height],[conf] ``` -**Notes:** - `frame_id` is the frame number of the image -- `identity` is the object id using default value `-1` - `bb_left` is the X coordinate of the left bound of the object box - `bb_top` is the Y coordinate of the upper bound of the object box - `width,height` is the pixel width and height - `conf` is the object score with default value `1` (the results had been filtered out according to the detection score threshold) +- 2.Load the detection model and the ReID model at the same time. Here, the JDE version of YOLOv3 is selected. For more detail of configuration, see `configs/mot/deepsort/_base_/deepsort_yolov3_darknet53_pcb_pyramid_r101.yml`. + -### JDE on MOT-16 Training Set +### JDE Results on MOT-16 Training Set | backbone | input shape | MOTA | IDF1 | IDS | FP | FN | FPS | download | config | | :----------------- | :------- | :----: | :----: | :---: | :----: | :---: | :---: | :---: | :---: | @@ -94,7 +98,7 @@ Each txt is the detection result of all the pictures extracted from each video, | DarkNet53 | 864x480 | 69.1 | 64.7 | 1539 | 7544 | 25046 | - |[model](https://paddledet.bj.bcebos.com/models/mot/jde_darknet53_30e_864x480.pdparams) | [config](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/mot/jde/jde_darknet53_30e_864x480.yml) | | DarkNet53 | 576x320 | 63.7 | 64.4 | 1310 | 6782 | 31964 | - |[model](https://paddledet.bj.bcebos.com/models/mot/jde_darknet53_30e_576x320.pdparams) | [config](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/mot/jde/jde_darknet53_30e_576x320.yml) | -### JDE on MOT-16 Test Set +### JDE Results on MOT-16 Test Set | backbone | input shape | MOTA | IDF1 | IDS | FP | FN | FPS | download | config | | :----------------- | :------- | :----: | :----: | :---: | :----: | :---: | :---: | :---: | :---: | diff --git a/configs/mot/README_cn.md b/configs/mot/README_cn.md index 27d3214a1..3bc8ea799 100644 --- a/configs/mot/README_cn.md +++ b/configs/mot/README_cn.md @@ -46,18 +46,23 @@ pip install -r requirements.txt ### DeepSORT在MOT-16 Training Set上结果 -| 骨干网络 | 输入尺寸 | MOTA | IDF1 | IDS | FP | FN | FPS | 下载链接 | 配置文件 | -| :---------| :------- | :----: | :----: | :--: | :----: | :---: | :---: | :-----: | :-----: | -| ResNet-101 | 1088x608 | 72.2 | 60.5 | 998 | 8054 | 21644 | - | [下载链接](https://paddledet.bj.bcebos.com/models/mot/deepsort_pcb_pyramid_r101.pdparams)|[配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/mot/deepsort/deepsort_pcb_pyramid_r101.yml) | +| 骨干网络 | 输入尺寸 | MOTA | IDF1 | IDS | FP | FN | FPS | 检测结果或模型 | ReID模型 |配置文件 | +| :---------| :------- | :----: | :----: | :--: | :----: | :---: | :---: | :-----:| :-----: | :-----: | +| ResNet-101 | 1088x608 | 72.2 | 60.5 | 998 | 8054 | 21644 | - | [检测结果](https://dataset.bj.bcebos.com/mot/det_results_dir.zip) |[ReID模型](https://paddledet.bj.bcebos.com/models/mot/deepsort_pcb_pyramid_r101.pdparams)|[配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/mot/deepsort/deepsort_pcb_pyramid_r101.yml) | +| ResNet-101 | 1088x608 | 68.3 | 56.5 | 1722 | 17337 | 15890 | - | [检测模型](https://paddledet.bj.bcebos.com/models/mot/jde_yolov3_darknet53_30e_1088x608.pdparams) |[ReID模型](https://paddledet.bj.bcebos.com/models/mot/deepsort_pcb_pyramid_r101.pdparams)|[配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/mot/deepsort/deepsort_pcb_pyramid_r101.yml) | ### DeepSORT在MOT-16 Test Set上结果 -| 骨干网络 | 输入尺寸 | MOTA | IDF1 | IDS | FP | FN | FPS | 下载链接 | 配置文件 | -| :---------| :------- | :----: | :----: | :--: | :----: | :---: | :---: | :-----: | :-----: | -| ResNet-101 | 1088x608 | 64.1 | 53.0 | 1024 | 12457 | 51919 | - | [下载链接](https://paddledet.bj.bcebos.com/models/mot/deepsort_pcb_pyramid_r101.pdparams)|[配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/mot/deepsort/deepsort_pcb_pyramid_r101.yml) | +| 骨干网络 | 输入尺寸 | MOTA | IDF1 | IDS | FP | FN | FPS | 检测结果或模型 | ReID模型 |配置文件 | +| :---------| :------- | :----: | :----: | :--: | :----: | :---: | :---: | :-----: | :-----: |:-----: | +| ResNet-101 | 1088x608 | 64.1 | 53.0 | 1024 | 12457 | 51919 | - | [检测结果](https://dataset.bj.bcebos.com/mot/det_results_dir.zip) | [ReID模型](https://paddledet.bj.bcebos.com/models/mot/deepsort_pcb_pyramid_r101.pdparams)|[配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/mot/deepsort/deepsort_pcb_pyramid_r101.yml) | +| ResNet-101 | 1088x608 | 61.2 | 48.5 | 1799 | 25796 | 43232 | - | [检测模型](https://paddledet.bj.bcebos.com/models/mot/jde_yolov3_darknet53_30e_1088x608.pdparams) |[ReID模型](https://paddledet.bj.bcebos.com/models/mot/deepsort_pcb_pyramid_r101.pdparams)|[配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/mot/deepsort/deepsort_pcb_pyramid_r101.yml) | **注意:** - DeepSORT不需要训练MOT数据集,只用于评估。在使用DeepSORT模型评估之前,应该首先通过一个检测模型得到检测结果,然后像这样准备好结果文件: + +DeepSORT不需要训练MOT数据集,只用于评估,现在支持两种评估的方式。 + +- 第1种方式是加载检测结果文件和ReID模型,在使用DeepSORT模型评估之前,应该首先通过一个检测模型得到检测结果,然后像这样准备好结果文件: ``` det_results_dir |——————MOT16-02.txt @@ -68,22 +73,22 @@ det_results_dir |——————MOT16-11.txt |——————MOT16-13.txt ``` -对于MOT16数据集,可以下载PaddleDetection提供的一个检测结果det_results_dir.zip并解压: +对于MOT16数据集,可以下载PaddleDetection提供的一个经过匹配之后的检测框结果det_results_dir.zip并解压: ``` wget https://dataset.bj.bcebos.com/mot/det_results_dir.zip ``` -其中每个txt是每个视频中所有图片的检测结果,每行都描述一个边界框,格式如下: +如果使用更强的检测模型,可以取得更好的结果。其中每个txt是每个视频中所有图片的检测结果,每行都描述一个边界框,格式如下: ``` -[frame_id],[identity],[bb_left],[bb_top],[width],[height],[conf] +[frame_id],[bb_left],[bb_top],[width],[height],[conf] ``` -**注意**: - `frame_id`是图片帧的序号 -- `identity`是目标id采用默认值为`-1` - `bb_left`是目标框的左边界的x坐标 - `bb_top`是目标框的上边界的y坐标 - `width,height`是真实的像素宽高 - `conf`是目标得分设置为`1`(已经按检测的得分阈值筛选出的检测结果) +- 第2种方式是同时加载检测模型和ReID模型,此处选用JDE版本的YOLOv3,具体配置见`configs/mot/deepsort/_base_/deepsort_yolov3_darknet53_pcb_pyramid_r101.yml` + ### JDE在MOT-16 Training Set上结果 diff --git a/configs/mot/deepsort/README.md b/configs/mot/deepsort/README.md index 35ecae465..b7a258138 100644 --- a/configs/mot/deepsort/README.md +++ b/configs/mot/deepsort/README.md @@ -13,20 +13,24 @@ English | [简体中文](README_cn.md) ## Model Zoo -### DeepSORT on MOT-16 Training Set +### DeepSORT Results on MOT-16 Training Set -| backbone | input shape | MOTA | IDF1 | IDS | FP | FN | FPS | download| config | -| :---------| :------- | :----: | :----: | :--: | :----: | :---: | :---: | :---: | :---: | -| ResNet101 | 1088x608 | 72.2 | 60.5 | 998 | 8054 | 21644 | - | [download](https://paddledet.bj.bcebos.com/models/mot/deepsort_pcb_pyramid_r101.pdparams)|[config](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/mot/deepsort/deepsort_pcb_pyramid_r101.yml) | +| backbone | input shape | MOTA | IDF1 | IDS | FP | FN | FPS | det result/model |ReID model| config | +| :---------| :------- | :----: | :----: | :--: | :----: | :---: | :---: | :---: | :---: | :---: | +| ResNet-101 | 1088x608 | 72.2 | 60.5 | 998 | 8054 | 21644 | - | [det result](https://dataset.bj.bcebos.com/mot/det_results_dir.zip) |[ReID model](https://paddledet.bj.bcebos.com/models/mot/deepsort_pcb_pyramid_r101.pdparams)|[config](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/mot/deepsort/deepsort_pcb_pyramid_r101.yml) | +| ResNet-101 | 1088x608 | 68.3 | 56.5 | 1722 | 17337 | 15890 | - | [det model](https://paddledet.bj.bcebos.com/models/mot/jde_yolov3_darknet53_30e_1088x608.pdparams) |[ReID model](https://paddledet.bj.bcebos.com/models/mot/deepsort_pcb_pyramid_r101.pdparams)|[config](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/mot/deepsort/deepsort_pcb_pyramid_r101.yml) | -### DeepSORT on MOT-16 Test Set +### DeepSORT Results on MOT-16 Test Set -| backbone | input shape | MOTA | IDF1 | IDS | FP | FN | FPS | download| config | -| :---------| :------- | :----: | :----: | :--: | :----: | :---: | :---: | :---: | :---: | -| ResNet101 | 1088x608 | 64.1 | 53.0 | 1024 | 12457 | 51919 | - | [download](https://paddledet.bj.bcebos.com/models/mot/deepsort_pcb_pyramid_r101.pdparams)|[config](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/mot/deepsort/deepsort_pcb_pyramid_r101.yml) | +| backbone | input shape | MOTA | IDF1 | IDS | FP | FN | FPS | det result/model |ReID model| config | +| :---------| :------- | :----: | :----: | :--: | :----: | :---: | :---: | :---: | :---: | :---: | +| ResNet-101 | 1088x608 | 64.1 | 53.0 | 1024 | 12457 | 51919 | - |[det result](https://dataset.bj.bcebos.com/mot/det_results_dir.zip) |[ReID model](https://paddledet.bj.bcebos.com/models/mot/deepsort_pcb_pyramid_r101.pdparams)|[config](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/mot/deepsort/deepsort_pcb_pyramid_r101.yml) | +| ResNet-101 | 1088x608 | 61.2 | 48.5 | 1799 | 25796 | 43232 | - | [det model](https://paddledet.bj.bcebos.com/models/mot/jde_yolov3_darknet53_30e_1088x608.pdparams) |[ReID model](https://paddledet.bj.bcebos.com/models/mot/deepsort_pcb_pyramid_r101.pdparams)|[config](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/mot/deepsort/deepsort_pcb_pyramid_r101.yml) | **Notes:** - DeepSORT does not need to train on MOT dataset, only used for evaluation. Before DeepSORT evaluation, you should get detection results by a detection model first, and then prepare them like this: +DeepSORT does not need to train on MOT dataset, only used for evaluation. Now it supports two evaluation methods. + +- 1.Load the result file and the ReID model. Before DeepSORT evaluation, you should get detection results by a detection model first, and then prepare them like this: ``` det_results_dir |——————MOT16-02.txt @@ -37,30 +41,44 @@ det_results_dir |——————MOT16-11.txt |——————MOT16-13.txt ``` -For MOT16 dataset, you can download the det_results_dir.zip provided by PaddleDetection: +For MOT16 dataset, you can download a detection result after matching called det_results_dir.zip provided by PaddleDetection: ``` wget https://dataset.bj.bcebos.com/mot/det_results_dir.zip ``` -Each txt is the detection result of all the pictures extracted from each video, and each line describes a bounding box with the following format: +If you use a stronger detection model, you can get better results. Each txt is the detection result of all the pictures extracted from each video, and each line describes a bounding box with the following format: ``` -[frame_id],[identity],[bb_left],[bb_top],[width],[height],[conf] +[frame_id],[bb_left],[bb_top],[width],[height],[conf] ``` -**Notes:** - `frame_id` is the frame number of the image -- `identity` is the object id using default value `-1` - `bb_left` is the X coordinate of the left bound of the object box - `bb_top` is the Y coordinate of the upper bound of the object box - `width,height` is the pixel width and height - `conf` is the object score with default value `1` (the results had been filtered out according to the detection score threshold) +- 2.Load the detection model and the ReID model at the same time. Here, the JDE version of YOLOv3 is selected. For more detail of configuration, see `configs/mot/deepsort/_base_/deepsort_yolov3_darknet53_pcb_pyramid_r101.yml`. + ## Getting Start ### 1. Evaluation ```bash -# track the objects by loading detected result files +# Load the result file and ReID model to get the tracking result CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/deepsort/deepsort_pcb_pyramid_r101.yml --det_results_dir {your detection results} + +# Load the detection model and ReID model to get the tracking results +CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/deepsort/deepsort_yolov3_pcb_pyramid_r101.yml +``` + +### 2. Inference + +Inference a vidoe on single GPU with following command: + +```bash +# inference on video and save a video +CUDA_VISIBLE_DEVICES=0 python tools/infer_mot.py -c configs/mot/deepsort/deepsort_yolov3_pcb_pyramid_r101.yml --video_file={your video name}.mp4 --save_videos ``` +**Notes:** + Please make sure that [ffmpeg](https://ffmpeg.org/ffmpeg.html) is installed first, on Linux(Ubuntu) platform you can directly install it by the following command:`apt-get update && apt-get install -y ffmpeg`. ## Citations ``` diff --git a/configs/mot/deepsort/README_cn.md b/configs/mot/deepsort/README_cn.md index 6ef260f1e..a4b7ba076 100644 --- a/configs/mot/deepsort/README_cn.md +++ b/configs/mot/deepsort/README_cn.md @@ -15,18 +15,23 @@ ### DeepSORT在MOT-16 Training Set上结果 -| 骨干网络 | 输入尺寸 | MOTA | IDF1 | IDS | FP | FN | FPS | 下载链接 | 配置文件 | -| :---------| :------- | :----: | :----: | :--: | :----: | :---: | :---: | :-----: | :-----: | -| ResNet101 | 1088x608 | 72.2 | 60.5 | 998 | 8054 | 21644 | - | [下载链接](https://paddledet.bj.bcebos.com/models/mot/deepsort_pcb_pyramid_r101.pdparams)|[配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/mot/deepsort/deepsort_pcb_pyramid_r101.yml) | +| 骨干网络 | 输入尺寸 | MOTA | IDF1 | IDS | FP | FN | FPS | 检测结果或模型 | ReID模型 |配置文件 | +| :---------| :------- | :----: | :----: | :--: | :----: | :---: | :---: | :-----:| :-----: | :-----: | +| ResNet-101 | 1088x608 | 72.2 | 60.5 | 998 | 8054 | 21644 | - | [检测结果](https://dataset.bj.bcebos.com/mot/det_results_dir.zip) |[ReID模型](https://paddledet.bj.bcebos.com/models/mot/deepsort_pcb_pyramid_r101.pdparams)|[配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/mot/deepsort/deepsort_pcb_pyramid_r101.yml) | +| ResNet-101 | 1088x608 | 68.3 | 56.5 | 1722 | 17337 | 15890 | - | [检测模型](https://paddledet.bj.bcebos.com/models/mot/jde_yolov3_darknet53_30e_1088x608.pdparams) |[ReID模型](https://paddledet.bj.bcebos.com/models/mot/deepsort_pcb_pyramid_r101.pdparams)|[配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/mot/deepsort/deepsort_pcb_pyramid_r101.yml) | ### DeepSORT在MOT-16 Test Set上结果 -| 骨干网络 | 输入尺寸 | MOTA | IDF1 | IDS | FP | FN | FPS | 下载链接 | 配置文件 | -| :---------| :------- | :----: | :----: | :--: | :----: | :---: | :---: | :-----: | :-----: | -| ResNet101 | 1088x608 | 64.1 | 53.0 | 1024 | 12457 | 51919 | - | [下载链接](https://paddledet.bj.bcebos.com/models/mot/deepsort_pcb_pyramid_r101.pdparams)|[配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/mot/deepsort/deepsort_pcb_pyramid_r101.yml) | +| 骨干网络 | 输入尺寸 | MOTA | IDF1 | IDS | FP | FN | FPS | 检测结果或模型 | ReID模型 |配置文件 | +| :---------| :------- | :----: | :----: | :--: | :----: | :---: | :---: | :-----: | :-----: |:-----: | +| ResNet-101 | 1088x608 | 64.1 | 53.0 | 1024 | 12457 | 51919 | - | [检测结果](https://dataset.bj.bcebos.com/mot/det_results_dir.zip) | [ReID模型](https://paddledet.bj.bcebos.com/models/mot/deepsort_pcb_pyramid_r101.pdparams)|[配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/mot/deepsort/deepsort_pcb_pyramid_r101.yml) | +| ResNet-101 | 1088x608 | 61.2 | 48.5 | 1799 | 25796 | 43232 | - | [检测模型](https://paddledet.bj.bcebos.com/models/mot/jde_yolov3_darknet53_30e_1088x608.pdparams) |[ReID模型](https://paddledet.bj.bcebos.com/models/mot/deepsort_pcb_pyramid_r101.pdparams)|[配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/mot/deepsort/deepsort_pcb_pyramid_r101.yml) | **注意:** - DeepSORT不需要训练MOT数据集,只用于评估。在使用DeepSORT模型评估之前,应该首先通过一个检测模型得到检测结果,然后像这样准备好结果文件: + +DeepSORT不需要训练MOT数据集,只用于评估,现在支持两种评估的方式。 + +- 第1种方式是加载检测结果文件和ReID模型,在使用DeepSORT模型评估之前,应该首先通过一个检测模型得到检测结果,然后像这样准备好结果文件: ``` det_results_dir |——————MOT16-02.txt @@ -37,31 +42,46 @@ det_results_dir |——————MOT16-11.txt |——————MOT16-13.txt ``` -对于MOT16数据集,可以下载PaddleDetection提供的det_results_dir.zip并解压: +对于MOT16数据集,可以下载PaddleDetection提供的一个经过匹配之后的检测框结果det_results_dir.zip并解压: ``` wget https://dataset.bj.bcebos.com/mot/det_results_dir.zip ``` -其中每个txt是每个视频中所有图片的检测结果,每行都描述一个边界框,格式如下: +如果使用更强的检测模型,可以取得更好的结果。其中每个txt是每个视频中所有图片的检测结果,每行都描述一个边界框,格式如下: ``` -[frame_id],[identity],[bb_left],[bb_top],[width],[height],[conf] +[frame_id],[bb_left],[bb_top],[width],[height],[conf] ``` -**注意**: - `frame_id`是图片帧的序号 -- `identity`是目标id采用默认值为`-1` - `bb_left`是目标框的左边界的x坐标 - `bb_top`是目标框的上边界的y坐标 - `width,height`是真实的像素宽高 - `conf`是目标得分设置为`1`(已经按检测的得分阈值筛选出的检测结果) +- 第2种方式是同时加载检测模型和ReID模型,此处选用JDE版本的YOLOv3,具体配置见`configs/mot/deepsort/_base_/deepsort_yolov3_darknet53_pcb_pyramid_r101.yml` + ## 快速开始 ### 1. 评估 ```bash -# 加载检测结果文件得到跟踪结果 +# 加载检测结果文件和ReID模型,得到跟踪结果 CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/deepsort/deepsort_pcb_pyramid_r101.yml --det_results_dir {your detection results} + +# 加载检测模型和ReID模型,得到跟踪结果 +CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/deepsort/deepsort_yolov3_pcb_pyramid_r101.yml ``` +### 2. 预测 + +使用单个GPU通过如下命令预测一个视频,并保存为视频 + +```bash +# 加载检测模型和ReID模型,得到跟踪结果 +CUDA_VISIBLE_DEVICES=0 python tools/infer_mot.py -c configs/mot/deepsort/deepsort_yolov3_pcb_pyramid_r101.yml --video_file={your video name}.mp4 --save_videos +``` + +**注意:** + 请先确保已经安装了[ffmpeg](https://ffmpeg.org/ffmpeg.html), Linux(Ubuntu)平台可以直接用以下命令安装:`apt-get update && apt-get install -y ffmpeg`。 + ## 引用 ``` @inproceedings{Wojke2017simple, diff --git a/configs/mot/jde/README.md b/configs/mot/jde/README.md index 32e19ba72..0992c65c7 100644 --- a/configs/mot/jde/README.md +++ b/configs/mot/jde/README.md @@ -18,7 +18,7 @@ English | [简体中文](README_cn.md) ## Model Zoo -### JDE on MOT-16 Training Set +### JDE Results on MOT-16 Training Set | backbone | input shape | MOTA | IDF1 | IDS | FP | FN | FPS | download | config | | :----------------- | :------- | :----: | :----: | :---: | :----: | :---: | :---: | :---: | :---: | @@ -26,7 +26,7 @@ English | [简体中文](README_cn.md) | DarkNet53 | 864x480 | 69.1 | 64.7 | 1539 | 7544 | 25046 | - |[model](https://paddledet.bj.bcebos.com/models/mot/jde_darknet53_30e_864x480.pdparams) | [config](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/mot/jde/jde_darknet53_30e_864x480.yml) | | DarkNet53 | 576x320 | 63.7 | 64.4 | 1310 | 6782 | 31964 | - |[model](https://paddledet.bj.bcebos.com/models/mot/jde_darknet53_30e_576x320.pdparams) | [config](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/mot/jde/jde_darknet53_30e_576x320.yml) | -### JDE on MOT-16 Test Set +### JDE Results on MOT-16 Test Set | backbone | input shape | MOTA | IDF1 | IDS | FP | FN | FPS | download | config | | :----------------- | :------- | :----: | :----: | :---: | :----: | :---: | :---: | :---: | :---: | diff --git a/ppdet/modeling/mot/utils.py b/ppdet/modeling/mot/utils.py index f0af9ab21..13ea52d1c 100644 --- a/ppdet/modeling/mot/utils.py +++ b/ppdet/modeling/mot/utils.py @@ -113,8 +113,8 @@ def load_det_results(det_file, num_frames): results = {'bbox': [], 'score': []} lables_with_frame = labels[labels[:, 0] == frame_i + 1] for l in lables_with_frame: - results['bbox'].append(l[2:6]) - results['score'].append(l[6]) + results['bbox'].append(l[1:5]) + results['score'].append(l[5]) results_list.append(results) return results_list -- GitLab