https://github.com/rizwanmunawar/yolov7-object-tracking
YOLOv7 Object Tracking Using PyTorch, OpenCV and Sort Tracking
https://github.com/rizwanmunawar/yolov7-object-tracking
computer-vision deep-learning object-detection opencv-python tracking-algorithm yolov7
Last synced: about 1 month ago
JSON representation
YOLOv7 Object Tracking Using PyTorch, OpenCV and Sort Tracking
- Host: GitHub
- URL: https://github.com/rizwanmunawar/yolov7-object-tracking
- Owner: RizwanMunawar
- License: gpl-3.0
- Created: 2022-08-21T13:38:05.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-03-22T09:53:47.000Z (3 months ago)
- Last Synced: 2025-04-14T11:11:21.545Z (2 months ago)
- Topics: computer-vision, deep-learning, object-detection, opencv-python, tracking-algorithm, yolov7
- Language: Python
- Homepage:
- Size: 198 KB
- Stars: 599
- Watchers: 13
- Forks: 175
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
## YOLOv7 Object Tracking 🚀
### How to Run the Code
1. Clone the repository:
```bash
git clone https://github.com/RizwanMunawar/yolov7-object-tracking.git
```
3. Navigate to the cloned folder:
```bash
cd yolov7-object-tracking
```4. Create a virtual environment (Recommended to avoid conflicts):
For Anaconda:
```bash
conda create -n yolov7objtracking python=3.10
conda activate yolov7objtracking
```For Linux:
```bash
python3 -m venv yolov7objtracking
source yolov7objtracking/bin/activate
```For Windows:
```bash
python3 -m venv yolov7objtracking
cd yolov7objtracking/Scripts
activate
```5. Update pip and install dependencies:
```bash
pip install --upgrade pip
pip install -r requirements.txt
```6. Run the script:
Select the appropriate command based on your requirements. Pretrained [yolov7](https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7.pt) weights will be downloaded automatically if needed.
- Detection only:
```bash
python detect.py --weights yolov7.pt --source "your video.mp4"
```- Object tracking:
```bash
python detect_and_track.py --weights yolov7.pt --source "your video.mp4"
```- Webcam:
```bash
python detect_and_track.py --weights yolov7.pt --source 0
```- External Camera:
```bash
python detect_and_track.py --weights yolov7.pt --source 1
```- IP Camera Stream:
```bash
python detect_and_track.py --source "your IP Camera Stream URL" --device 0
```- Specific class tracking (e.g., person):
```bash
python detect_and_track.py --weights yolov7.pt --source "your video.mp4" --classes 0
```- Colored tracks:
```bash
python detect_and_track.py --weights yolov7.pt --source "your video.mp4" --colored-trk
```- Save track centroids, IDs, and bounding box coordinates:
```bash
python detect_and_track.py --weights yolov7.pt --source "your video.mp4" --save-txt --save-bbox-dim
```7. **Output files** will be saved in `working-dir/runs/detect/obj-tracking` with the original filename.
### Results 📊
YOLOv7 Detection Only
YOLOv7 Object Tracking with ID
YOLOv7 Object Tracking with ID and Label
![]()
![]()
![]()
### References
- [YOLOv7 GitHub](https://github.com/WongKinYiu/yolov7)
- [SORT GitHub](https://github.com/abewley/sort)**Some of my articles/research papers | computer vision awesome resources for learning | How do I appear to the world? 🚀**
[Ultralytics YOLO11: Object Detection and Instance Segmentation🤯](https://muhammadrizwanmunawar.medium.com/ultralytics-yolo11-object-detection-and-instance-segmentation-88ef0239a811) 
[Parking Management using Ultralytics YOLO11](https://muhammadrizwanmunawar.medium.com/parking-management-using-ultralytics-yolo11-fba4c6bc62bc) 
[My 🖐️Computer Vision Hobby Projects that Yielded Earnings](https://muhammadrizwanmunawar.medium.com/my-️computer-vision-hobby-projects-that-yielded-earnings-7923c9b9eead) 
[Best Resources to Learn Computer Vision](https://muhammadrizwanmunawar.medium.com/best-resources-to-learn-computer-vision-311352ed0833) 
[Roadmap for Computer Vision Engineer](https://medium.com/augmented-startups/roadmap-for-computer-vision-engineer-45167b94518c) 
[How did I spend 2022 in the Computer Vision Field](https://www.linkedin.com/pulse/how-did-i-spend-2022-computer-vision-field-muhammad-rizwan-munawar) 
[Domain Feature Mapping with YOLOv7 for Automated Edge-Based Pallet Racking Inspections](https://www.mdpi.com/1424-8220/22/18/6927) 
[Exudate Regeneration for Automated Exudate Detection in Retinal Fundus Images](https://ieeexplore.ieee.org/document/9885192) 
[Feature Mapping for Rice Leaf Defect Detection Based on a Custom Convolutional Architecture](https://www.mdpi.com/2304-8158/11/23/3914) 
[Yolov5, Yolo-x, Yolo-r, Yolov7 Performance Comparison: A Survey](https://aircconline.com/csit/papers/vol12/csit121602.pdf) 
[Explainable AI in Drug Sensitivity Prediction on Cancer Cell Lines](https://ieeexplore.ieee.org/document/9922931) 
[Train YOLOv8 on Custom Data](https://medium.com/augmented-startups/train-yolov8-on-custom-data-6d28cd348262) 
[Session with Ultralytics Team about Computer Vision Journey](https://www.ultralytics.com/blog/becoming-a-computer-vision-engineer) 