File size: 4,502 Bytes
da65d46
 
af7bcd4
da65d46
af7bcd4
 
 
 
da65d46
af7bcd4
9de653a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
da65d46
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
---
license: apache-2.0
title: QuickTrack
sdk: streamlit
emoji: πŸƒ
colorFrom: gray
colorTo: yellow
pinned: false
---

# Real-Time Object Detection with YOLOv8

A Streamlit-based web application for real-time object detection in videos using YOLOv8. This application supports multiple YOLO models, real-time detection, object tracking, and video processing with annotated output.

## Demo
![me](https://github.com/damndeepesh/QuickTrack/blob/main/asset/ezgif-5-12682faad5.gif)
![me](https://github.com/damndeepesh/QuickTrack/blob/main/asset/ezgif-5-28a1705b9b.gif)

## Features

- Multiple YOLOv8 model support (Nano to XLarge)
- Real-time object detection and tracking
- Support for video files and live streams
- Unique ID tracking for detected objects
- Customizable detection confidence
- Color-coded object categories
- Downloadable processed videos
- Interactive web interface

## Installation

### Prerequisites
- Python 3.8 or higher
- CUDA-compatible GPU (optional, but recommended for better performance)

### Step 1: Clone the Repository 
- git clone <repository-url>
- cd <repository-name>

### Step 2: Create a Virtual Environment (Recommended)

## Windows
- python -m venv venv
- venv\Scripts\activate

## Linux/Mac
- python3 -m venv venv
- source venv/bin/activate

### Step 3: Install Dependencies
- pip install -r requirements.txt

## Usage

### Starting the Application
- streamlit run app.py


### Step-by-Step Guide

1. **Select a Model**:
   - Choose from available YOLOv8 models in the sidebar
   - Models range from Nano (fastest) to XLarge (most accurate)
   - Review model details in the expandable section
   - Click "Load Selected Model" to download and initialize

2. **Configure Settings**:
   - Adjust detection confidence using the slider
   - Lower values detect more objects but may increase false positives
   - Higher values are more selective but might miss some objects

3. **Input Selection**:
   - Choose between "Video File" or "Live Stream URL"
   - For video files: Upload MP4 or AVI format
   - For streams: Enter a valid stream URL

4. **Start Detection**:
   - Click "Start Detection" in the sidebar
   - Watch real-time detection with bounding boxes
   - Each object gets a unique tracking ID

5. **Download Results**:
   - Stop detection when finished
   - Download button appears automatically
   - Processed video includes all annotations

## About YOLO Models

### Available Models

1. **YOLOv8n (Nano)**:
   - Size: 6.7 MB
   - Best for: Real-time applications on CPU
   - Speed: ⚑⚑⚑⚑⚑
   - Accuracy: ⭐⭐

2. **YOLOv8s (Small)**:
   - Size: 22.4 MB
   - Best for: Balanced performance
   - Speed: ⚑⚑⚑⚑
   - Accuracy: ⭐⭐⭐

3. **YOLOv8m (Medium)**:
   - Size: 52.2 MB
   - Best for: Standard detection tasks
   - Speed: ⚑⚑⚑
   - Accuracy: ⭐⭐⭐⭐

4. **YOLOv8l (Large)**:
   - Size: 87.7 MB
   - Best for: High accuracy needs
   - Speed: ⚑⚑
   - Accuracy: ⭐⭐⭐⭐⭐

5. **YOLOv8x (XLarge)**:
   - Size: 131.7 MB
   - Best for: Maximum accuracy
   - Speed: ⚑
   - Accuracy: ⭐⭐⭐⭐⭐⭐

### Model Selection Guide

- **CPU Only**: Use Nano or Small models
- **GPU Available**: Medium to XLarge models recommended
- **Real-time Needs**: Nano or Small models
- **Accuracy Priority**: Large or XLarge models
- **Balanced**: Medium model

## Technical Details

- Built with Streamlit and OpenCV
- Uses Ultralytics YOLOv8 implementation
- Supports multiple video codecs
- Real-time frame processing and buffering
- Unique object tracking with IoU
- Color-coded object categories
- Frame buffer for smooth video writing

## Troubleshooting

1. **Video Not Loading**:
   - Check file format (MP4/AVI supported)
   - Ensure file isn't corrupted
   - Try a different video codec

2. **Slow Performance**:
   - Use a smaller YOLO model
   - Reduce input video resolution
   - Check GPU availability

3. **Detection Issues**:
   - Adjust confidence threshold
   - Try a larger YOLO model
   - Ensure good lighting in video

4. **Download Issues**:
   - Wait for processing to complete
   - Check available disk space
   - Try a different browser

## Requirements

- streamlit>=1.24.0
- opencv-python-headless>=4.7.0
- torch>=2.0.0
- torchvision>=0.15.0
- numpy>=1.24.0
- ultralytics>=8.0.0
- python-dateutil>=2.8.2

## Acknowledgments

- YOLOv8 by Ultralytics - https://docs.ultralytics.com/models/yolov8/
- Streamlit Framework - https://streamlit.io
- OpenCV Project - https://docs.opencv.org/4.x/index.html