derek285 / yolov4_deep_sort_pytorch

MOT using deepsort and yolov4 with pytorch
MIT License
18 stars 6 forks source link

Yolov4 + Deep Sort with PyTorch

remember build your own libdarknet.so and put under folder yolov4_deep_sort_pytorch/

ref : https://github.com/ZQPei/deep_sort_pytorch

Quick Start

  1. Check all dependencies installed

    pip3 install -r requirements.txt

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

    pip3 install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
  2. Clone this repository

    git clone https://github.com/derek285/yolov4_deep_sort_pytorch.git
  3. Download YOLOv4 parameters

    wget yolov4.weights and cfg
    //并且重命名为4.cfg 和 4.weights 这个hard code有点山寨了:detector/v4detector.py :
    configPath = "4.cfg"
    weightPath = "4.weights"
  4. 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 ../../../

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.

  1. Run demo
    
    usage: python tracker.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]          

yolov4 + deepsort on video file

python3 tracker.py VIDEO_PATH

yolov4 + deepsort on webcam

python3 tracker.py /dev/video0 --camera 0

todo

1. get class_id return
2. fix depends on libdarknet.so

References