# Deep Sort with PyTorch
![](demo/demo.gif)
## Update(1-1-2020)
Changes
- fix bugs
- refactor code
- accerate detection by adding nms on gpu
## Latest Update(07-22)
Changes
- bug fix (Thanks @JieChen91 and @yingsen1 for bug reporting).
- using batch for feature extracting for each frame, which lead to a small speed up.
- code improvement.
Futher improvement direction
- Train detector on specific dataset rather than the official one.
- Retrain REID model on pedestrain dataset for better performance.
- Replace YOLOv3 detector with advanced ones.
**Any contributions to this repository is welcome!**
## Introduction
This is an implement of MOT tracking algorithm deep sort. Deep sort is basicly the same with sort but added a CNN model to extract features in image of human part bounded by a detector. This CNN model is indeed a RE-ID model and the detector used in [PAPER](https://arxiv.org/abs/1703.07402) is FasterRCNN , and the original source code is [HERE](https://github.com/nwojke/deep_sort).
However in original code, the CNN model is implemented with tensorflow, which I'm not familier with. SO I re-implemented the CNN feature extraction model with PyTorch, and changed the CNN model a little bit. Also, I use **YOLOv3** to generate bboxes instead of FasterRCNN.
## Dependencies
- python 3 (python2 not sure)
- numpy
- scipy
- opencv-python
- sklearn
- torch >= 0.4
- torchvision >= 0.1
- pillow
- vizer
- edict
## Quick Start
0. Check all dependencies installed
```bash
pip install -r requirements.txt
```
for user in china, you can specify pypi source to accelerate install like:
```bash
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
```
1. Clone this repository
```
git clone git@github.com:ZQPei/deep_sort_pytorch.git
```
2. Download YOLOv3 parameters
```
cd detector/YOLOv3/weight/
wget https://pjreddie.com/media/files/yolov3.weights
wget https://pjreddie.com/media/files/yolov3-tiny.weights
cd ../../../
```
3. Download deepsort parameters ckpt.t7
```
cd deep_sort/deep/checkpoint
# download ckpt.t7 from
https://drive.google.com/drive/folders/1xhG0kRH1EX5B9_Iz8gQJb7UNnn_riXi6 to this folder
cd ../../../
```
4. Compile nms module
```bash
cd detector/YOLOv3/nms
sh build.sh
cd ../../..
```
Notice:
If compiling failed, the simplist way is to **Upgrade your pytorch >= 1.1 and torchvision >= 0.3" and you can avoid the troublesome compiling problems which are most likely caused by either `gcc version too low` or `libraries missing`.
5. Run demo
```
usage: python yolov3_deepsort.py VIDEO_PATH
[--help]
[--frame_interval FRAME_INTERVAL]
[--config_detection CONFIG_DETECTION]
[--config_deepsort CONFIG_DEEPSORT]
[--display]
[--display_width DISPLAY_WIDTH]
[--display_height DISPLAY_HEIGHT]
[--save_path SAVE_PATH]
[--cpu]
# yolov3 + deepsort
python yolov3_deepsort.py [VIDEO_PATH]
# yolov3_tiny + deepsort
python yolov3_deepsort.py [VIDEO_PATH] --config_detection ./configs/yolov3_tiny.yaml
# yolov3 + deepsort on webcam
python3 yolov3_deepsort.py /dev/video0 --camera 0
# yolov3_tiny + deepsort on webcam
python3 yolov3_deepsort.py /dev/video0 --config_detection ./configs/yolov3_tiny.yaml --camera 0
```
Use `--display` to enable display.
Results will be saved to `./output/results.avi` and `./output/results.txt`.
All files above can also be accessed from BaiduDisk!
linker:[BaiduDisk](https://pan.baidu.com/s/1YJ1iPpdFTlUyLFoonYvozg)
passwd:fbuw
## Training the RE-ID model
The original model used in paper is in original_model.py, and its parameter here [original_ckpt.t7](https://drive.google.com/drive/folders/1xhG0kRH1EX5B9_Iz8gQJb7UNnn_riXi6).
To train the model, first you need download [Market1501](http://www.liangzheng.com.cn/Project/project_reid.html) dataset or [Mars](http://www.liangzheng.com.cn/Project/project_mars.html) dataset.
Then you can try [train.py](deep_sort/deep/train.py) to train your own parameter and evaluate it using [test.py](deep_sort/deep/test.py) and [evaluate.py](deep_sort/deep/evalute.py).
![train.jpg](deep_sort/deep/train.jpg)
## Demo videos and images
[demo.avi](https://drive.google.com/drive/folders/1xhG0kRH1EX5B9_Iz8gQJb7UNnn_riXi6)
[demo2.avi](https://drive.google.com/drive/folders/1xhG0kRH1EX5B9_Iz8gQJb7UNnn_riXi6)
![1.jpg](demo/1.jpg)
![2.jpg](demo/2.jpg)
## References
- paper: [Simple Online and Realtime Tracking with a Deep Association Metric](https://arxiv.org/abs/1703.07402)
- code: [nwojke/deep_sort](https://github.com/nwojke/deep_sort)
- paper: [YOLOv3](https://pjreddie.com/media/files/papers/YOLOv3.pdf)
- code: [Joseph Redmon/yolov3](https://pjreddie.com/darknet/yolo/)
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
参考案例 DeepSORT是一种常用的目标跟踪算法,它结合了深度学习和传统的目标跟踪方法。DeepSORT的核心思想是将深度学习的目标检测结果与传统的目标跟踪器相结合,实现在连续帧之间对目标的跟踪。 DeepSORT主要包括两个部分:目标检测和目标跟踪。对于目标检测,DeepSORT使用现有的目标检测算法,例如YOLO、Faster R-CNN等,来检测出图像中的目标。对于目标跟踪,DeepSORT使用卡尔曼滤波器来预测目标的位置,同时通过匈牙利算法来匹配跟踪目标和检测目标。 具体来说,DeepSORT的目标跟踪过程如下: 对于输入的当前帧,使用目标检测算法检测出所有的目标。 对于之前的每个跟踪目标,使用卡尔曼滤波器预测它在当前帧中的位置。 使用匈牙利算法将检测到的目标与之前的跟踪目标进行匹配,以便为每个跟踪目标分配检测目标。 对于未被分配的检测目标,将其视为新的跟踪目标,并使用卡尔曼滤波器进行位置预测。 对于长时间未被检测到的跟踪目标,将其删除。
资源推荐
资源详情
资源评论
收起资源包目录
Deep Sort Pytorch (102个子文件)
.gitignore 89B
.gitkeep 0B
train.jpg 59KB
LICENSE 1KB
README.md 5KB
README.md 65B
json_logger.py 11KB
linear_assignment.py 8KB
linear_assignment.py 8KB
kalman_filter.py 8KB
kalman_filter.py 8KB
train.py 6KB
nn_matching.py 6KB
nn_matching.py 6KB
tracker.py 5KB
track.py 5KB
io.py 4KB
deep_sort.py 4KB
evaluation.py 3KB
model.py 3KB
original_model.py 3KB
iou_matching.py 3KB
iou_matching.py 3KB
test.py 2KB
preprocessing.py 2KB
preprocessing.py 2KB
feature_extractor.py 2KB
detection.py 1KB
draw.py 1KB
parser.py 1KB
tools.py 734B
__init__.py 500B
log.py 480B
asserts.py 316B
evaluate.py 307B
__init__.py 0B
__init__.py 0B
__init__.py 0B
__init__.py 0B
linear_assignment.cpython-310.pyc 7KB
linear_assignment.cpython-38.pyc 7KB
linear_assignment.cpython-38.pyc 7KB
linear_assignment.cpython-37.pyc 7KB
linear_assignment.cpython-37.pyc 7KB
kalman_filter.cpython-310.pyc 7KB
kalman_filter.cpython-38.pyc 7KB
kalman_filter.cpython-38.pyc 7KB
kalman_filter.cpython-37.pyc 7KB
kalman_filter.cpython-37.pyc 7KB
nn_matching.cpython-310.pyc 6KB
nn_matching.cpython-37.pyc 6KB
nn_matching.cpython-37.pyc 6KB
nn_matching.cpython-38.pyc 6KB
nn_matching.cpython-38.pyc 6KB
track.cpython-310.pyc 6KB
tracker.cpython-310.pyc 6KB
tracker.cpython-38.pyc 6KB
tracker.cpython-38.pyc 6KB
track.cpython-38.pyc 6KB
track.cpython-38.pyc 5KB
tracker.cpython-37.pyc 5KB
tracker.cpython-37.pyc 5KB
track.cpython-37.pyc 5KB
track.cpython-37.pyc 5KB
deep_sort.cpython-310.pyc 4KB
deep_sort.cpython-38.pyc 4KB
deep_sort.cpython-37.pyc 4KB
iou_matching.cpython-310.pyc 3KB
model.cpython-310.pyc 3KB
iou_matching.cpython-37.pyc 3KB
iou_matching.cpython-37.pyc 3KB
iou_matching.cpython-38.pyc 3KB
iou_matching.cpython-38.pyc 3KB
model.cpython-38.pyc 3KB
model.cpython-37.pyc 3KB
feature_extractor.cpython-310.pyc 3KB
feature_extractor.cpython-38.pyc 2KB
feature_extractor.cpython-37.pyc 2KB
detection.cpython-310.pyc 2KB
detection.cpython-38.pyc 2KB
detection.cpython-37.pyc 2KB
detection.cpython-37.pyc 2KB
detection.cpython-38.pyc 2KB
parser.cpython-310.pyc 2KB
parser.cpython-37.pyc 2KB
parser.cpython-38.pyc 2KB
__init__.cpython-310.pyc 712B
__init__.cpython-37.pyc 639B
__init__.cpython-38.pyc 630B
__init__.cpython-310.pyc 261B
__init__.cpython-310.pyc 261B
__init__.cpython-310.pyc 252B
__init__.cpython-37.pyc 194B
__init__.cpython-37.pyc 194B
__init__.cpython-37.pyc 194B
__init__.cpython-37.pyc 173B
__init__.cpython-38.pyc 169B
__init__.cpython-38.pyc 169B
__init__.cpython-38.pyc 169B
__init__.cpython-38.pyc 160B
共 102 条
- 1
- 2
资源评论
本拉灯
- 粉丝: 739
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 吐鲁番地区实验中学教育管理规章制度(汇编).doc
- 体育教学评课稿.doc
- 外研版小学英语四年级(下册)知识点总结复习资料.doc
- 微观经济学(练习试题2及答案).doc
- 我国上市公司信息披露问题的探究.doc
- 微型计算机控制技术第4章习题答案.doc
- 小学生课外阅读现状分析报告.doc
- 物价知识培训教材.doc
- 新人版小学三年级语文第四单元.doc
- 小学数学作业批改评语集锦.doc
- 学生社会实践活动报告[精选多篇].doc
- 学校食堂自查报告[精选多篇].doc
- 新人版小学五年级上册英语教学计划.doc
- 移动L1认证考试代维传输线路题库一.doc
- 易班知识竞赛题库完整.doc
- 有效教学的三条铁律.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功