Skip to content

Commit 70a4576

Browse files
authored
Update README.md
1 parent 6678607 commit 70a4576

File tree

1 file changed

+108
-1
lines changed

1 file changed

+108
-1
lines changed

README.md

Lines changed: 108 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,108 @@
1-
1+
# YOLO v7 + 各种tracker实现多目标跟踪
2+
3+
## 亮点
4+
1. 统一代码风格, 对多种tracker重新整理, 详细注释, 方便阅读, 适合初学者
5+
2. 多类多目标跟踪
6+
3. 各种tracker集成在一个文件夹"./tracker/"内, 方便移植到其他detector.
7+
8+
## 集成的tracker:
9+
SORT,
10+
DeepSORT,
11+
ByteTrack([ECCV2022](https://arxiv.org/pdf/2110.06864)),
12+
DeepMOT([CVPR2020](https://openaccess.thecvf.com/content_CVPR_2020/papers/Xu_How_to_Train_Your_Deep_Multi-Object_Tracker_CVPR_2020_paper.pdf)),
13+
BoT-SORT([arxiv2206](https://arxiv.org/pdf/2206.14651.pdf)),
14+
15+
16+
## TODO
17+
- [ ] 集成UAVMOT([CVPR2022](https://openaccess.thecvf.com/content/CVPR2022/papers/Liu_Multi-Object_Tracking_Meets_Moving_UAV_CVPR_2022_paper.pdf))
18+
- [ ] 达到更好的结果(缓解类别不平衡, 小目标等等)...
19+
- [ ] MOT challenge数据集
20+
21+
22+
## 效果
23+
在VisDrone2019-MOT train训练约10 epochs, 采用YOLO v7 w6结构, COCO预训练模型基础上训练. GPU: single Tesla A100, 每个epoch约40min.
24+
在VisDrone2019-MOT test dev测试, 跟踪所有的类别.
25+
26+
YOLO v7 VisDrone训练完模型:
27+
> 链接:https://pan.baidu.com/s/1m13Q8Lx_hrPVFZI6lLDrWQ
28+
> 提取码:ndkf
29+
30+
| Tracker | MOTA | IDF1 | IDS | fps |
31+
|:--------------|:-------:|:------:|:------:|:------:|
32+
|SORT | **26.4** | 36.4 |3264 |12.2 |
33+
|DeepSORT | 12.1 | 26.9 | 3860 | 12.4|
34+
|ByteTrack | 25.1 | 40.8| 1590 | **14.32**|
35+
|DeepMOT | 15.0 | 24.8|3666 |7.64|
36+
|BoT-SORT | 23.0 | **41.4**|**1014** |5.41|
37+
38+
> fps具有一定的随机性
39+
40+
![gif](https://github.com/JackWoo0831/Yolov7-tracker/blob/master/test2.gif)
41+
42+
43+
## 训练
44+
45+
训练遵循YOLO v7的训练方式, 数据集格式可以参照[YOLO v5 train custom data](https://github.com/ultralytics/yolov5/wiki/Train-Custom-Data)
46+
即数据集文件遵循
47+
```shell
48+
class x_center y_center width height
49+
```
50+
其中x_center y_center width height必须是**归一化**的.
51+
如果您训练VisDrone数据集, 可以直接调用:
52+
```shell
53+
python tools/convert_VisDrone_to_yolov2.py --split_name VisDrone2019-MOT-train --generate_imgs
54+
```
55+
> 需要您修改一些路径变量.
56+
57+
准备好数据集后, 假如训练YOLO v7-w6模型(single GPU):
58+
```shell
59+
python train_aux.py --dataset visdrone --workers 8 --device <$GPU_id$> --batch-size 16 --data data/visdrone_all.yaml --img 1280 1280 --cfg cfg/training/yolov7-w6.yaml --weights <$YOLO v7 pretrained model path$> --name yolov7-w6-custom --hyp data/hyp.scratch.custom.yaml
60+
```
61+
> 更多训练信息参考[YOLO v7](https://github.com/WongKinYiu/yolov7)
62+
63+
## 跟踪
64+
65+
> model_path 参数为训练后的detector model, 假设路径为 runs/train/yolov7-w6-custom4/weights/best.pt
66+
67+
***SORT*** :
68+
```shell
69+
python tracker/track.py --dataset visdrone --data_format origin --tracker sort --model_path runs/train/yolov7-w6-custom4/weights/best.pt
70+
```
71+
72+
***DeepSORT***:
73+
```shell
74+
python tracker/track.py --dataset visdrone --data_format origin --tracker deepsort --model_path runs/train/yolov7-w6-custom4/weights/best.pt
75+
```
76+
77+
***ByteTrack***:
78+
```shell
79+
python tracker/track.py --dataset visdrone --data_format origin --tracker bytetrack --model_path runs/train/yolov7-w6-custom4/weights/best.pt
80+
```
81+
82+
***DeepMOT***:
83+
```shell
84+
python tracker/track.py --dataset visdrone --data_format origin --tracker deepmot --model_path runs/train/yolov7-w6-custom4/weights/best.pt
85+
```
86+
87+
***BoT-SORT***:
88+
```shell
89+
python tracker/track.py --dataset visdrone --data_format origin --tracker botsort --model_path runs/train/yolov7-w6-custom4/weights/best.pt
90+
```
91+
92+
> 您也可以通过增加
93+
> ```shell
94+
> --save_images --save_videos
95+
> ```
96+
> 来控制保存跟踪结果的图片与视频.
97+
98+
## 将./tracker应用于其他detector
99+
100+
只需保证detector的输出格式为
101+
```shell
102+
(batch_size, num_objects, x_center, y_center, width, height, obj_conf, category)
103+
```
104+
或经典的yolo格式
105+
```shell
106+
(batch_size, num_objects, x_center, y_center, width, height, obj_conf, category_conf0, category_conf1, category_conf2, ...)
107+
```
108+
> 注意: 推理的时候batch_size要求为1.

0 commit comments

Comments
 (0)