A real-time object detection system built using Python, YOLOv8, and OpenCV.
This project performs real-time detection of the following object classes from a live webcam or video stream: Person, Dog, Cat, and Car. It detects and labels each object, draws bounding boxes, displays confidence scores, counts detected objects, and shows the FPS for performance monitoring.
- Python
- YOLOv8
- OpenCV
- Real-time object detection
- Detects multiple object types
- Draws bounding boxes around detected objects
- Displays object labels and confidence scores
- Counts the number of detected objects
- Supports live webcam or RTSP video stream
- Displays FPS for performance monitoring
- The camera or video stream is opened using OpenCV.
- Each video frame is passed to the YOLOv8 model.
- The model detects objects in the frame.
- Detected objects are labeled with their class name and confidence score.
- Bounding boxes are drawn around the detected objects.
- The total number of detected objects is displayed.
- The processed frame is shown in real time.
- Python 3.x
- Webcam or RTSP stream
pip install ultralytics opencv-pythonpython main.py
# or
python3 main.pyUse python or python3 depending on your system.
- Make sure a webcam or RTSP source is available.
- Press ESC to exit the application.
- The detection accuracy depends on the YOLOv8 model and video quality.
- Add a graphical user interface
- Save detection results to a file
- Add support for uploading video files
- Improve object counting by category
- Implemented multi-threaded frame capture to reduce latency.
- Managed frame buffering to avoid processing delays.
- Optimized the application to run on both CPU and CUDA-supported devices.
- Filtered detections to focus only on the required object classes.