This project combines YOLO (You Only Look Once) object detection with DeepSORT tracking to create a comprehensive system for real-time object detection and tracking across multiple input sources. The system supports video files, webcam feeds, RTSP streams, and static images.
-
Multiple Input Sources Support:
- Video file processing
- Webcam real-time detection
- IP Camera (RTSP) streaming
- Static image detection
-
Advanced Tracking:
- Object tracking with unique IDs
- Track duration monitoring
- ID switch detection
- Consistent color coding per track
-
Visualization:
- Semi-transparent bounding boxes
- Real-time FPS counter
- Object class labels
- Track duration display
- Track ID visualization
-
Comprehensive Metrics:
- Processing performance stats
- Detection confidence analysis
- Tracking performance metrics
- Bounding box statistics
-
User-Friendly Interface:
- Interactive menu system
- Custom weight file selection
- Operation cancellation (ESC)
- Return to menu option
- Progress bar for video processing
- Clone the repository:
git clone https://github.com/yourusername/object-detection-tracking.git
cd object-detection-tracking
- Create and activate virtual environment (optional but recommended):
python -m venv venv
# On Windows
venv\Scripts\activate
# On Linux/Mac
source venv/bin/activate
- Install required packages:
pip install -r requirements.txt
- Python 3.8+
- OpenCV
- Ultralytics YOLO
- Deep SORT Real-Time
- NumPy
- Pandas
- tqdm
- Run the main script:
python main.py
- Select from available options:
=== Object Tracking System ===
1. Process Video File
2. Use Webcam
3. Use IP Camera (RTSP)
4. Process Image
5. Exit
-
Enter the path to your YOLO weights file (press Enter for default 'best.pt')
-
Provide required input paths based on your selection
- Press 'q' to stop processing
- Press 'ESC' to cancel operation
- After processing:
- Press 'M' to return to main menu
- Press 'Q' to quit program
The system provides comprehensive metrics including:
-
Processing Summary:
- Processed Frames
- Time Taken
- Average FPS
- Video Duration
-
Detection and Tracking Metrics:
- Total Detections
- Unique Tracks
- Objects per Frame
- ID Switches
-
Confidence Metrics:
- Average Confidence
- Min/Max Confidence
-
Tracking Performance:
- Track Duration
- Track Length
- Bounding Box Areas
📊 Processing Summary:
• Processed Frames: 300
• Time Taken: 10.5 seconds
• Average FPS: 28.57
• Video Duration: 10.00 seconds
📊 Detection and Tracking Metrics:
• Total Detections: 450
• Unique Tracks: 5
• Average Objects per Frame: 1.50
• ID Switches: 2
- Security and Surveillance
- Traffic Monitoring
- People Counting
- Object Movement Analysis
- Retail Analytics
- Sports Analysis
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
- YOLOv8 by Ultralytics
- Deep SORT algorithm
- OpenCV team
- Contributor community
- Prof. Chao-Tung Yang, Tunghai University
- Assistant Prof. Ding-Hsiang Huang., Ph.D, Tunghai University
- OpenCV team
- Contributor community
Anggi Andriyadi - [email protected] Tunghai University
Project Link: [https://github.com/PamanGie/yolo_deepsort)