# 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/)
没有合适的资源?快使用搜索试试~ 我知道了~
yolov5-deepsort:yolov5检测+深度排序跟踪
共114个文件
py:67个
yaml:10个
cfg:7个
5星 · 超过95%的资源 需积分: 49 67 下载量 96 浏览量
2021-04-22
13:41:45
上传
评论 8
收藏 5.6MB ZIP 举报
温馨提示
基于 yolo5+deep_sort 的物体计数以及密度估计 deepsort 输入增加了类别,输出了增加了类别和速度 deepsort IOU替换成为DIOU 密度估计是检测的后处理,简单的涂色+高斯模糊实现的demo 效果展示: 原版yolov5参考
资源详情
资源评论
资源推荐
收起资源包目录
yolov5-deepsort:yolov5检测+深度排序跟踪 (114个子文件)
yolo_v3.cfg 8KB
yolo-voc.cfg 3KB
yolo.cfg 3KB
darknet19_448.cfg 2KB
yolov3-tiny.cfg 2KB
tiny-yolo.cfg 1KB
tiny-yolo-voc.cfg 1KB
nms_cpu.cpp 2KB
vision.cpp 186B
nms.cu 5KB
voc_gaotie.data 112B
voc.data 105B
coco.data 103B
Thumbs.db 9KB
Dockerfile 2KB
.dockerignore 4KB
demo.gif 5.23MB
.gitignore 2KB
nms.h 716B
vision.h 247B
vision.h 189B
index.html 189B
LICENSE 34KB
LICENSE 1KB
README.md 5KB
readme.md 1KB
readme.md 353B
README.md 220B
README.md 65B
coco.names 625B
voc.names 135B
demo.png 279KB
utils.py 50KB
datasets.py 36KB
train.py 26KB
yolo_utils.py 21KB
darknet.py 17KB
obj_counter.py 15KB
test.py 13KB
json_logger.py 11KB
yolo.py 11KB
cfg.py 10KB
track.py 10KB
region_layer.py 9KB
torch_utils.py 9KB
yolo_layer.py 8KB
linear_assignment.py 8KB
kalman_filter.py 8KB
detect.py 7KB
post_process.py 7KB
train.py 6KB
ped_det_server.py 6KB
yolov3_deepsort.py 5KB
experimental.py 5KB
nn_matching.py 5KB
tracker.py 5KB
track.py 5KB
rtsp_webserver.py 4KB
io.py 4KB
common.py 4KB
google_utils.py 4KB
deep_sort.py 4KB
detect.py 4KB
iou_matching.py 4KB
rtsp_threaded_tracker.py 4KB
detector.py 4KB
evaluation.py 3KB
hubconf.py 3KB
original_model.py 3KB
model.py 3KB
export.py 3KB
yolov3_deepsort_eval.py 3KB
test.py 2KB
server_cfg.py 2KB
activations.py 2KB
preprocessing.py 2KB
python_nms.py 2KB
feature_extractor.py 2KB
build.py 2KB
detection.py 1KB
draw.py 1KB
nms.py 1KB
parser.py 976B
tools.py 734B
__init__.py 500B
log.py 463B
config.py 387B
__init__.py 318B
asserts.py 316B
evaluate.py 293B
__init__.py 101B
__init__.py 26B
__init__.py 0B
__init__.py 0B
__init__.py 0B
__init__.py 0B
__init__.py 0B
__init__.py 0B
__init__.py 0B
download_weights.sh 125B
共 114 条
- 1
- 2
韦先波
- 粉丝: 203
- 资源: 4678
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1