{"id":26295628,"url":"https://github.com/reality361/opencv-object-detection-ui","last_synced_at":"2026-05-18T08:34:21.014Z","repository":{"id":282294246,"uuid":"948106775","full_name":"Reality361/opencv-object-detection-ui","owner":"Reality361","description":"🚀 Object Detection with OpenCV \u0026 YOLO | Interactive UI 🎯","archived":false,"fork":false,"pushed_at":"2025-03-13T19:14:25.000Z","size":22098,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-13T20:26:37.742Z","etag":null,"topics":["object-detection","opencv","python","yolo","yolov5"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Reality361.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-13T19:01:02.000Z","updated_at":"2025-03-13T19:14:37.000Z","dependencies_parsed_at":"2025-03-13T20:37:00.140Z","dependency_job_id":null,"html_url":"https://github.com/Reality361/opencv-object-detection-ui","commit_stats":null,"previous_names":["reality361/opencv-object-detection-ui"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Reality361%2Fopencv-object-detection-ui","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Reality361%2Fopencv-object-detection-ui/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Reality361%2Fopencv-object-detection-ui/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Reality361%2Fopencv-object-detection-ui/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Reality361","download_url":"https://codeload.github.com/Reality361/opencv-object-detection-ui/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243681077,"owners_count":20330155,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["object-detection","opencv","python","yolo","yolov5"],"created_at":"2025-03-15T04:14:33.953Z","updated_at":"2026-05-18T08:34:20.983Z","avatar_url":"https://github.com/Reality361.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 Object Detection with OpenCV \u0026 YOLO | Interactive UI 🎯\n\n🔍 **Real-time Object Detection using YOLO and OpenCV** with a **scrollable, interactive UI** for selecting object categories dynamically.\n\n---\n\n## 📸 **Demo**\n![image](https://github.com/user-attachments/assets/02782d9b-c665-4a15-8df0-e6c4fd8d4634)\n\n---\n\n## 🎯 **Project Overview**\nThis project implements **real-time object detection** using **YOLO (You Only Look Once)** and **OpenCV** in Python. It features:\n✅ **Deep Learning-based Object Detection (YOLOv4-tiny)**  \n✅ **Customizable Object Selection via UI Buttons**  \n✅ **Scrollable Category Panel** (Supports 80+ object categories)  \n✅ **Optimized UI** (Compact, modern, and business-ready)  \n✅ **Fast and Efficient** (Utilizing OpenCV’s DNN module)\n\n---\n\n## 📂 **Project Structure**\n```\nopencv-object-detection-ui/\n ├── dnn_model/                  # YOLO model files\n │    ├── yolov4-tiny.cfg\n │    ├── yolov4-tiny.weights\n │    ├── classes.txt\n ├── main4.py                     # Main object detection script\n ├── gui_buttons.py                # GUI button system with scrolling support\n ├── README.md                     # Project documentation\n```\n\n---\n\n## 🛠️ **Installation \u0026 Setup**\n\n### 🔹 1. Clone the Repository\n```bash\ngit clone https://github.com/Reality361/opencv-object-detection-ui.git\ncd opencv-object-detection-ui\n```\n\n### 🔹 2. Install Dependencies\nEnsure you have installed dependencies about OpenCV.\n\n📌 **Dependencies include:**  \n- `opencv-python`\n- `numpy`\n\n### 🔹 3. Download YOLO Weights\nThe project requires **YOLOv4-tiny pre-trained weights**.  \n📥 Download them from: [YOLO Weights](https://github.com/AlexeyAB/darknet/releases)  \nPlace them inside the `dnn_model/` directory:\n```\ndnn_model/\n ├── yolov4-tiny.cfg\n ├── yolov4-tiny.weights\n ├── classes.txt\n```\n\n---\n\n## ▶️ **Running the Object Detector**\n```bash\npython main4.py\n```\n\n📌 **Controls:**\n- **Click on buttons** to enable/disable object detection for specific categories.\n- **Scroll with the mouse wheel** to navigate the object selection panel.\n- **Press `ESC`** to exit.\n\n---\n\n## 📜 **How It Works**\n1. **Loads the YOLOv4-tiny model** via OpenCV’s `cv2.dnn_DetectionModel()`.\n2. **Reads class labels** from `classes.txt`.\n3. **Captures frames from the webcam** and processes them for detection.\n4. **Detects objects** based on confidence threshold.\n5. **Draws bounding boxes** and labels detected objects.\n6. **Users can dynamically select objects** to detect via an interactive UI.\n\n---\n\n## 🎨 **UI Features**\n- **Scrollable Button Panel** → All object categories fit neatly.\n- **Compact Button Layout** → Easy readability \u0026 interaction.\n- **Smooth Click \u0026 Scroll Support** → Optimized for usability.\n\n### **Example Object Categories:**\n| Object | Button Color |\n|---------|-------------|\n| Person | 🟦 Blue |\n| Car | 🟥 Red |\n| Dog | 🟩 Green |\n| Bottle | 🟪 Purple |\n\n---\n\n## 🏗️ **How to Add More Object Categories?**\n1. **Edit `dnn_model/classes.txt`**  \n   - Add the new object name on a new line.\n   \n2. **Modify `initialize_buttons()` in `main4.py`**  \n   - New buttons are automatically added using the categories list.\n---\n\n## 🚀 **Performance Optimization**\n- Convert the model to **ONNX** for OpenCV acceleration:\n  ```bash\n  python export.py --weights best.pt --include onnx\n  ```\n- Run with **GPU acceleration** (if supported):\n  ```python\n  net.setPreferableBackend(cv2.dnn.DNN_BACKEND_CUDA)\n  net.setPreferableTarget(cv2.dnn.DNN_TARGET_CUDA)\n  ```\n\n---\n\n## 📝 **TODOs \u0026 Future Improvements**\n✔ Enhance UI further with dynamic styling  \n✔ Add support for **YOLOv5**  \n✔ Train a custom model for additional objects  \n✔ Optimize for **edge devices** like Raspberry Pi  \n\n---\n\n## 📜 **License**\n🔓 This project is open-source and available under the **MIT License**.\n\n---\n\n## 📬 **Contact \u0026 Support**\n👨‍💻 **Maintainer**: [Reality361](https://github.com/Reality361)\n💡 Have questions? Open an [issue](https://github.com/Reality361/opencv-object-detection-ui/issues).  \n🚀 Enjoyed the project? Give it a ⭐ on GitHub!  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freality361%2Fopencv-object-detection-ui","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freality361%2Fopencv-object-detection-ui","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freality361%2Fopencv-object-detection-ui/lists"}