Skip to content

Commit

Permalink
[MOT] Fix deepsort detectors config (PaddlePaddle#5344)
Browse files Browse the repository at this point in the history
* fix deepsort detectors cfgs, add ppyoloe

* modify yolov3 40e

* add ppyoloe mot17half modelzoo

* add resnet embedding reid

* remove fasterfpn picodet, fix nms for higher MOTA

* add mot17 yml

* fix _base_ cfgs

* fix doc
  • Loading branch information
nemonameless committed Mar 14, 2022
1 parent f08c2ca commit 8ffa45a
Show file tree
Hide file tree
Showing 24 changed files with 535 additions and 420 deletions.
20 changes: 17 additions & 3 deletions configs/mot/deepsort/README_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,14 @@
| :-------- | :----- | :----: |:------: | :----: |:-----: |:----:|:----: |
| MIX | JDE YOLOv3 | PCB Pyramid | - | 66.9 | 62.7 | - |[配置文件](./deepsort_jde_yolov3_pcb_pyramid.yml) |
| MIX | JDE YOLOv3 | PPLCNet | - | 66.3 | 62.1 | - |[配置文件](./deepsort_jde_yolov3_pplcnet.yml) |
| pedestrian(未开放) | YOLOv3 | PPLCNet | 45.4 | 45.8 | 54.3 | - |[配置文件](./deepsort_yolov3_pplcnet.yml) |
| MOT-17 half train | PPYOLOv2 | PPLCNet | 46.8 | 48.7 | 54.5 | - |[配置文件](./deepsort_ppyolov2_pplcnet.yml) |
| MOT-17 half train | YOLOv3 | PPLCNet | 42.7 | 50.2 | 52.4 | - |[配置文件](./deepsort_yolov3_pplcnet.yml) |
| MOT-17 half train | PPYOLOv2 | PPLCNet | 46.8 | 51.8 | 55.8 | - |[配置文件](./deepsort_ppyolov2_pplcnet.yml) |
| MOT-17 half train | PPYOLOe | PPLCNet | 52.9 | 56.7 | 60.5 | - |[配置文件](./deepsort_ppyoloe_pplcnet.yml) |
| MOT-17 half train | PPYOLOe | ResNet-50 | 52.9 | 56.7 | 64.6 | - |[配置文件](./deepsort_ppyoloe_resnet.yml) |

**注意:**
DeepSORT不需要训练MOT数据集,只用于评估,现在支持两种评估的方式。
模型权重下载链接在配置文件中的```det_weights``````reid_weights```,运行验证的命令即可自动下载。
DeepSORT是分离检测器和ReID模型的,其中检测器单独训练MOT数据集,而组装成DeepSORT后只用于评估,现在支持两种评估的方式。
- **方式1**:加载检测结果文件和ReID模型,在使用DeepSORT模型评估之前,应该首先通过一个检测模型得到检测结果,然后像这样准备好结果文件:
```
det_results_dir
Expand Down Expand Up @@ -75,6 +78,15 @@ wget https://dataset.bj.bcebos.com/mot/det_results_dir.zip

### 1. 评估

#### 1.1 评估检测效果
```bash
CUDA_VISIBLE_DEVICES=0 python tools/eval.py -c configs/mot/deepsort/detector/ppyoloe_crn_l_36e_640x640_mot17half.yml
```

**注意:**
- 评估检测使用的是```tools/eval.py```, 评估跟踪使用的是```tools/eval_mot.py```

#### 1.2 评估跟踪效果
**方式1**:加载检测结果文件和ReID模型,得到跟踪结果
```bash
CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/deepsort/reid/deepsort_pcb_pyramid_r101.yml --det_results_dir {your detection results}
Expand All @@ -89,6 +101,8 @@ CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/deepsort/deepsort
CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/deepsort/deepsort_jde_yolov3_pplcnet.yml
# 或者
CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/deepsort/deepsort_ppyolov2_pplcnet.yml --scaled=True
# 或者
CUDA_VISIBLE_DEVICES=0 python tools/eval_mot.py -c configs/mot/deepsort/deepsort_ppyoloe_resnet.yml --scaled=True
```
**注意:**
- JDE YOLOv3行人检测模型是和JDE和FairMOT使用同样的MOT数据集训练的,因此MOTA较高。而其他通用检测模型如PPYOLOv2只使用了MOT17 half数据集训练。
Expand Down
33 changes: 33 additions & 0 deletions configs/mot/deepsort/_base_/mot17.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
metric: COCO
num_classes: 1

# Detection Dataset for training
TrainDataset:
!COCODataSet
dataset_dir: dataset/mot/MOT17
anno_path: annotations/train_half.json
image_dir: images/train
data_fields: ['image', 'gt_bbox', 'gt_class', 'is_crowd']

EvalDataset:
!COCODataSet
dataset_dir: dataset/mot/MOT17
anno_path: annotations/val_half.json
image_dir: images/train

TestDataset:
!ImageFolder
anno_path: annotations/val_half.json


# MOTDataset for MOT evaluation and inference
EvalMOTDataset:
!MOTImageFolder
dataset_dir: dataset/mot
data_root: MOT17/images/half
keep_ori_im: True # set as True in DeepSORT and ByteTrack

TestMOTDataset:
!MOTImageFolder
dataset_dir: dataset/mot
keep_ori_im: True # set True if save visualization images or video
65 changes: 0 additions & 65 deletions configs/mot/deepsort/deepsort_faster_rcnn_fpn_pplcnet.yml

This file was deleted.

4 changes: 2 additions & 2 deletions configs/mot/deepsort/deepsort_jde_yolov3_pcb_pyramid.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
_BASE_: [
'detector/jde_yolov3_darknet53_30e_1088x608_mix.yml',
'../../datasets/mot.yml',
'../../runtime.yml',
'_base_/mot17.yml',
'_base_/deepsort_reader_1088x608.yml',
]
metric: MOT
Expand Down Expand Up @@ -30,6 +29,7 @@ DeepSORT:
# reid and tracker configuration
# see 'configs/mot/deepsort/reid/deepsort_pcb_pyramid_r101.yml'
PCBPyramid:
model_name: "ResNet101"
num_conv_out_channels: 128
num_classes: 751

Expand Down
3 changes: 1 addition & 2 deletions configs/mot/deepsort/deepsort_jde_yolov3_pplcnet.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
_BASE_: [
'detector/jde_yolov3_darknet53_30e_1088x608_mix.yml',
'../../datasets/mot.yml',
'../../runtime.yml',
'_base_/mot17.yml',
'_base_/deepsort_reader_1088x608.yml',
]
metric: MOT
Expand Down
91 changes: 0 additions & 91 deletions configs/mot/deepsort/deepsort_picodet_pplcnet.yml

This file was deleted.

110 changes: 110 additions & 0 deletions configs/mot/deepsort/deepsort_ppyoloe_pplcnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
_BASE_: [
'detector/ppyoloe_crn_l_36e_640x640_mot17half.yml',
'_base_/mot17.yml',
'_base_/deepsort_reader_1088x608.yml',
]
metric: MOT
num_classes: 1

EvalMOTDataset:
!MOTImageFolder
dataset_dir: dataset/mot
data_root: MOT17/images/half
keep_ori_im: True # set as True in DeepSORT

det_weights: https://paddledet.bj.bcebos.com/models/mot/deepsort/ppyoloe_crn_l_36e_640x640_mot17half.pdparams
reid_weights: https://paddledet.bj.bcebos.com/models/mot/deepsort/deepsort_pplcnet.pdparams

# reader
EvalMOTReader:
sample_transforms:
- Decode: {}
- Resize: {target_size: [640, 640], keep_ratio: False, interp: 2}
- NormalizeImage: {mean: [0.485, 0.456, 0.406], std: [0.229, 0.224, 0.225], is_scale: True}
- Permute: {}
batch_size: 1

TestMOTReader:
inputs_def:
image_shape: [3, 640, 640]
sample_transforms:
- Decode: {}
- Resize: {target_size: [640, 640], keep_ratio: False, interp: 2}
- NormalizeImage: {mean: [0.485, 0.456, 0.406], std: [0.229, 0.224, 0.225], is_scale: True}
- Permute: {}
batch_size: 1


# DeepSORT configuration
architecture: DeepSORT
pretrain_weights: None

DeepSORT:
detector: YOLOv3 # PPYOLOe version
reid: PPLCNetEmbedding
tracker: DeepSORTTracker


# reid and tracker configuration
# see 'configs/mot/deepsort/reid/deepsort_pplcnet.yml'
PPLCNetEmbedding:
input_ch: 1280
output_ch: 512

DeepSORTTracker:
input_size: [64, 192]
min_box_area: 0
vertical_ratio: -1
budget: 100
max_age: 70
n_init: 3
metric_type: cosine
matching_threshold: 0.2
max_iou_distance: 0.9
motion: KalmanFilter


# detector configuration: PPYOLOe version
# see 'configs/mot/deepsort/detector/ppyoloe_crn_l_300e_640x640_mot17half.yml'
YOLOv3:
backbone: CSPResNet
neck: CustomCSPPAN
yolo_head: PPYOLOEHead
post_process: ~

CSPResNet:
layers: [3, 6, 6, 3]
channels: [64, 128, 256, 512, 1024]
return_idx: [1, 2, 3]
use_large_stem: True

CustomCSPPAN:
out_channels: [768, 384, 192]
stage_num: 1
block_num: 3
act: 'swish'
spp: true

# Tracking requires higher quality boxes, so NMS score_threshold will be higher
PPYOLOEHead:
fpn_strides: [32, 16, 8]
grid_cell_scale: 5.0
grid_cell_offset: 0.5
static_assigner_epoch: -1 # 100
use_varifocal_loss: True
eval_input_size: [640, 640]
loss_weight: {class: 1.0, iou: 2.5, dfl: 0.5}
static_assigner:
name: ATSSAssigner
topk: 9
assigner:
name: TaskAlignedAssigner
topk: 13
alpha: 1.0
beta: 6.0
nms:
name: MultiClassNMS
nms_top_k: 1000
keep_top_k: 100
score_threshold: 0.4 # 0.01 in original detector
nms_threshold: 0.6
Loading

0 comments on commit 8ffa45a

Please sign in to comment.