Coder Social home page Coder Social logo

michaeljayw / deep-sort-yolov4 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from leonlok/deep-sort-yolov4

0.0 1.0 0.0 55.95 MB

Deep SORT and YOLO v4 for people tracking and detection with Tensorflow backend.

License: GNU General Public License v3.0

Python 100.00%

deep-sort-yolov4's Introduction

Introduction

This project was inspired by:

I swapped out YOLO v3 for YOLO v4 and added the option for asynchronous processing, which significantly improves the FPS. However, FPS monitoring is disabled when asynchronous processing is used since it isn't accurate.

YOLO v3 and YOLO v4 comparison video with Deep SORT

Comparison Video Link

The white boxes are Deep SORT trackers and the blue boxes are YOLO v4 detections. Each white box has a tracking ID at the top and each blue box has a YOLO detection confidence score at the bottom.

With asynchronous processing

As you can see in the gif, asynchronous processing has better FPS but causes stuttering.

This code only detects and tracks people, but can be changed to detect other objects by changing lines 101 and 102 in yolo.py:

if predicted_class != 'person':
    continue

Please note that Deep SORT is only trained on tracking people, so you'd need to train a model yourself for tracking other objects. See https://github.com/nwojke/cosine_metric_learning.

Performance

Real-time FPS with video writing:

  • ~4.3fps with YOLO v3
  • ~10.6fps with YOLO v4

YOLO v4 performs much faster and appears to be more stable than YOLO v3. All tests were done using an Nvidia GTX 1070 8gb GPU and an i7-8700k CPU.

Quick start

Download and convert the Darknet YOLO v4 model to a Keras model by modifying convert.py accordingly and run:

python convert.py

Then run demo.py:

python demo.py

Settings

By default, video writing is turned on and asynchronous processing is turned off. These can be edited in demo.py by changing:

writeVideo_flag = True
asyncVideo_flag = False

To change target file in demo.py:

file_path = 'video.webm'

To change output settings in demo.py:

out = cv2.VideoWriter('output_yolov4.avi', fourcc, 30, (w, h))

Training your own YOLO v4 model

See https://github.com/Ma-Dan/keras-yolo4.

Dependencies

  • Tensorflow GPU 1.14
  • Keras 2.3.1
  • opencv-python 4.2.0
  • imutils 0.5.3
  • numpy 1.18.2
  • sklearn

deep-sort-yolov4's People

Contributors

leonlok avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.