Skip to content

MOT tracking using deepsort and yolov3 with pytorch

License

Notifications You must be signed in to change notification settings

biubug6/deep_sort_pytorch

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

99 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deep Sort with PyTorch

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 is FasterRCNN , and the original source code is HERE.
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

  1. Check all dependencies installed
pip install -r requirements.txt

for user in china, you can specify pypi source to accelerate install like:

pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple 
  1. Clone this repository
git clone [email protected]:ZQPei/deep_sort_pytorch.git
  1. 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 ../../../
  1. 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 ../../../
  1. Compile nms module
cd detector/YOLOv3/nms
sh build.sh
cd ../../..
  1. Run demo
usage: python yolov3_deepsort.py VIDEO_PATH
                                [--help] 
                                [--frame_interval FRAME_INTERVAL]
                                [--config_detection CONFIG_DETECTION]
                                [--config_deepsort CONFIG_DEEPSORT]
                                [--ignore_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

If you dont support X server, use --ignore_display to disable display. Results will be saved to ./demo/demo.avi.

All files above can also be accessed from BaiduDisk!
linker:BaiduDisk 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.

To train the model, first you need download Market1501 dataset or Mars dataset.

Then you can try train.py to train your own parameter and evaluate it using test.py and evaluate.py. train.jpg

Demo videos and images

demo.avi demo2.avi

1.jpg 2.jpg

References

About

MOT tracking using deepsort and yolov3 with pytorch

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 94.4%
  • Cuda 3.1%
  • C++ 2.3%
  • Other 0.2%