🧠 Real-Time Object Detection using YOLOv3 and OpenCV and detect any object any safety and other objects.
This project is a real-time object detection application using the YOLOv3 (You Only Look Once) model integrated with OpenCV. It captures live webcam video, detects multiple object classes from the COCO dataset, and displays bounding boxes with class labels and confidence scores.
- 📷 Real-Time Detection using webcam
- 🎯 YOLOv3 Deep Learning Model (pre-trained on COCO)
- ✅ Confidence Threshold Filtering
- 🧠 Non-Maximum Suppression for accurate bounding boxes
- 📦 80 Object Classes Supported
- 🛑 Exit detection with single key press ('q')
- Python
- OpenCV (
cv2.dnn) - YOLOv3 (
.cfgand.weights) - COCO class labels (
coco.names)
main.py– Core logic for video capture and object detectionyolov3.cfg– YOLOv3 model configurationyolov3.weights– Pre-trained weights for YOLOv3coco.names– List of class names supported by the model
- Loads the YOLOv3 model and class names
- Captures frames from your webcam
- Converts each frame to a blob and passes it to the model
- Retrieves detections and applies Non-Maximum Suppression
- Draws bounding boxes and displays live results
person: 0.88 bottle: 0.62 cell phone: 0.74
Live bounding boxes with labels appear over the webcam feed.
- Python 3.x
- OpenCV (
pip install opencv-python) - Pre-trained YOLOv3 model files (download from official YOLO site or darknet repo)
bash: python main.py 📌 Notes Ensure yolov3.weights, yolov3.cfg, and coco.names are in the same directory as main.py.
You can modify the confidence threshold and NMS threshold in the script as needed.
📂 License
This project is open-source and available under the MIT License.
