Giter Club home page Giter Club logo

yolov5-object-tracking's Introduction

yolov5-object-tracking

New Features

  • YOLOv5 Object Tracking Using Sort Tracker
  • Added Object blurring Option
  • Added Support of Streamlit Dashboard
  • Code can run on Both (CPU & GPU)
  • Video/WebCam/External Camera/IP Stream Supported

Coming Soon

  • Option to crop and save detected objects
  • Dashboard design enhancement

Pre-Requsities

  • Python 3.9 (Python 3.7/3.8 can work in some cases)

Steps to run Code

  • Clone the repository
git clone https://github.com/RizwanMunawar/yolov5-object-tracking.git
  • Goto the cloned folder.
cd yolov5-object-tracking
  • Create a virtual envirnoment (Recommended, If you dont want to disturb python packages)
### For Linux Users
python3 -m venv yolov5objtracking
source yolov5objtracking/bin/activate

### For Window Users
python3 -m venv yolov5objtracking
cd yolov5objtracking
cd Scripts
activate
cd ..
cd ..
  • Upgrade pip with mentioned command below.
pip install --upgrade pip
  • Install requirements with mentioned command below.
pip install -r requirements.txt
  • Run the code with mentioned command below.
#for detection only
python ob_detect.py --weights yolov5s.pt --source "your video.mp4"

#for detection of specific class (person)
python ob_detect.py --weights yolov5s.pt --source "your video.mp4" --classes 0

#for object detection + object tracking
python obj_det_and_trk.py --weights yolov5s.pt --source "your video.mp4"

#for object detection + object tracking + object blurring
python obj_det_and_trk.py --weights yolov5s.pt --source "your video.mp4" --blur-obj

#for object detection + object tracking + object blurring + different color for every bounding box
python obj_det_and_trk.py --weights yolov5s.pt --source "your video.mp4" --blur-obj --color-box

#for object detection + object tracking of specific class (person)
python obj_det_and_trk.py --weights yolov5s.pt --source "your video.mp4" --classes 0
  • Output file will be created in the working-dir/runs/detect/exp with original filename

Streamlit Dashboard

  • If you want to run detection on streamlit app (Dashboard), you can use mentioned command below.

Note: Make sure, to add video in the yolov5-object-tracking folder, that you want to run on streamlit dashboard. Otherwise streamlit server will through an error.

python -m streamlit run app.py
YOLOv5 Object Detection YOLOv5 Object Tracking YOLOv5 Object Tracking + Object Blurring YOLOv5 Streamlit Dashboard

References

My Medium Articles

For more details, you can reach out to me on Medium or can connect with me on LinkedIn

yolov5-object-tracking's People

Contributors

rizwanmunawar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

yolov5-object-tracking's Issues

Nothing worked

python obj_det_and_trk.py --weights yolov5s.pt --source ./assets/0_043.mp4 --blur-obj
Traceback (most recent call last):
  File "/home/ubuntu/work/yolov5-object-tracking/obj_det_and_trk.py", line 29, in <module>
    from sort import *
  File "/home/ubuntu/work/yolov5-object-tracking/sort.py", line 6, in <module>
    matplotlib.use('TkAgg')
  File "/home/ubuntu/miniconda3/envs/yolov5objtracking/lib/python3.9/site-packages/matplotlib/__init__.py", line 1237, in use
    plt.switch_backend(name)
  File "/home/ubuntu/miniconda3/envs/yolov5objtracking/lib/python3.9/site-packages/matplotlib/pyplot.py", line 279, in switch_backend
    raise ImportError(
ImportError: Cannot load backend 'TkAgg' which requires the 'tk' interactive framework, as 'headless' is currently running

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.