• Stars
    star
    532
  • Rank 83,377 (Top 2 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created about 2 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

YOLOv7 Object Tracking Using PyTorch, OpenCV and Sort Tracking

yolov7-object-tracking

New Features

  • Added Label for Every Track
  • Code can run on Both (CPU & GPU)
  • Video/WebCam/External Camera/IP Stream Supported

Coming Soon

  • Development of streamlit dashboard for Object Tracking

Ready to Use Google Colab

Steps to run Code

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

### For Window Users
python3 -m venv yolov7objtracking
cd yolov7objtracking
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 (by default, pretrained yolov7 weights will be automatically downloaded into the working directory if they don't already exist).
# for detection only
python detect.py --weights yolov7.pt --source "your video.mp4"

#if you want to change source file
python detect_and_track.py --weights yolov7.pt --source "your video.mp4"

#for WebCam
python detect_and_track.py --weights yolov7.pt --source 0

#for External Camera
python detect_and_track.py --weights yolov7.pt --source 1

#For LiveStream (Ip Stream URL Format i.e "rtsp://username:pass@ipaddress:portno/video/video.amp")
python detect_and_track.py --source "your IP Camera Stream URL" --device 0

#for specific class (person)
python detect_and_track.py --weights yolov7.pt --source "your video.mp4" --classes 0

#for colored tracks 
python detect_and_track.py --weights yolov7.pt --source "your video.mp4" --colored-trk

#for saving tracks centroid, track id and bbox coordinates
python detect_and_track.py --weights yolov7.pt --source "your video.mp4" --save-txt --save-bbox-dim
  • Output file will be created in the working-dir/runs/detect/obj-tracking with original filename

Results

YOLOv7 Detection Only YOLOv7 Object Tracking with ID YOLOv7 Object Tracking with ID and Label

References

My Medium Articles

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

More Repositories

1

yolov7-pose-estimation

YOLOv7 Pose estimation using OpenCV, PyTorch
Python
323
star
2

yolov7-segmentation

YOLOv7 Instance Segmentation using OpenCV and PyTorch
Python
282
star
3

yolov8-object-tracking

YOLOv8 Object Tracking Using PyTorch, OpenCV and Ultralytics
Python
245
star
4

yolov5-object-tracking

YOLOv5 Object Tracking + Detection + Object Blurring + Streamlit Dashboard Using OpenCV, PyTorch and Streamlit
Python
86
star
5

yolov7-object-blurring

YOLOv7 Object Blurring Using PyTorch and OpenCV
Python
63
star
6

yolov7-object-cropping

YOLOv7 Object Cropping Using OpenCV
Python
16
star
7

Extraction-of-frames-from-single-video-computer-vision-

Extraction of frames from single video using OpenCV
Jupyter Notebook
14
star
8

YOLO-RX57-FPS-Comparision

FPS Comparision with same specification of YOLOX, YOLOR, YOLOv5 and YOLOv7
Python
13
star
9

Houses-price-prediction-web-app-machine-learning-

Houses price prediction web app
HTML
7
star
10

Face-recognition-using-opencv-computer-vision-

Face detection and recognition using OpenCV.
Python
5
star
11

RizwanMunawar

My Repositories stars, commits, pull requests, Information
4
star
12

Spark-foundation-internship-tasks-computer-vision-

Spark foundation Internship Tasks of domain (Computer Vision & IoT Field).
Jupyter Notebook
3
star
13

Extraction-of-frames-from-multiple-frames-computer-vision-

Frames extraction from multiple videos
Jupyter Notebook
3
star
14

Houses-price-prediction-machine-learning-

Houses Price Prediction using Linear Regression
Jupyter Notebook
3
star
15

skin-cancer-binary-classification-computer-vision-

Skin Cancer binary(Benign vs malignant) Classification using convolutional neural networks
Jupyter Notebook
2
star
16

Cats-vs-dogs-classification-computer-vision-

Cats vs dogs classification using deep learning. Data augmentation and convolutional neural networks.
Jupyter Notebook
1
star
17

Covid-19-chest-x_rays-images-multi-class-classification-computer-vision-

Covid-19 chest x_rays images multi-class classification while classes are (COVID, Pneumonia, normal)
Jupyter Notebook
1
star
18

Data-analysis-on-csv-datasets-machine-learning-

Data Analysis and model building on CSV datasets.
Jupyter Notebook
1
star