Spaces:
Sleeping
Sleeping
File size: 5,189 Bytes
7206810 033c3b5 7206810 03efa53 |
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 176 |
---
title: Utensil Detector
emoji: π½οΈ
colorFrom: pink
colorTo: purple
sdk: streamlit
sdk_version: "1.32.0"
app_file: app/app.py
pinned: false
---
# π½οΈ Utensils Object Detection System
Welcome to **Utensils Object Detection System** β an end-to-end pipeline that detects Utensils items like plates, glasses, spoons, and forkss using a custom-trained deep learning model.
This project was built **from scratch** (no Roboflow or auto-annotation tools!) and demonstrates a full lifecycle: dataset creation, model training, performance evaluation, and an interactive demo app.
---
## ποΈ Project Overview
We set out to solve a real-world problem:
> _βCan we reliably detect common Utensils items in images, videos, or real-time webcam streams using only a small, custom-labeled dataset?β_
To achieve this, we:
β
Collected & annotated a custom dataset (100β500 images)
β
Built a clean Python codebase to handle training, inference, and deployment
β
Delivered an interactive demo using **Streamlit / Flask**
---
## π Project Structure
```
βββ app/ # Streamlit or Flask app for demo
β βββ app.py
βββ dataset/ # Custom dataset (images + labels)
β βββ images/
β βββ labels/
βββ inference/ # Inference scripts (image, video, webcam)
β βββ detect_image.py
β βββ detect_video.py
β βββ detect_webcam.py
βββ runs/detect/ # Training results & saved weights
β βββ weights/
β βββ results.png
β βββ Other Metrics ...
βββ training/ # Training pipeline
β βββ train.py
β βββ model_training.ipynb
βββ data.yaml # Dataset config
βββ requirements.txt # Python dependencies
βββ README.md # This file
```
---
## ποΈ Dataset
- **Images collected:** Manually photographed or sourced from public domain (Kaggle)
- **Classes:** Example β plate, fork, spoon, glass
- **Annotation tool:** [LabelImg](https://github.com/heartexlabs/labelImg)
- **Format:** YOLO txt labels
---
## ποΈββοΈ Model Training
- **Framework:** YOLOv8
- **Training script:** `training/train.py`
- **Best checkpoint:** `runs/detect/weights/best.pt`
- **Metrics logged:** loss curves, mAP, precision, recall, F1
---
## π Inference & Results
- Run detection on:
- Static images β `inference/detect_image.py`
- Video files β `inference/detect_video.py`
- Real-time webcam β `inference/detect_webcam.py`
- Visual outputs include:
- Bounding boxes with class names and confidence
- Confusion matrix
- Precision-recall, F1 curves
---
## π Interactive Demo
Launch the demo app:
```bash
pip install -r requirements.txt
streamlit run app/app.py
```
Features:
- Upload image or video and get detections
- View predicted bounding boxes + class names + confidence scores
- (Optional) Real-time webcam support
---
## π Getting Started
1οΈβ£ Clone the repo:
```bash
git clone https://github.com/yourusername/Utensils-object-detection.git
cd Utensils-object-detection
```
2οΈβ£ Install dependencies:
```bash
pip install -r requirements.txt
```
3οΈβ£ Run training:
```bash
python training/train.py --data data.yaml
```
4οΈβ£ Try inference:
```bash
python inference/detect_image.py --source path/to/image.jpg
```
5οΈβ£ Launch app:
```bash
streamlit run app/app.py
```
Model summary (fused): 92 layers, 25,842,076 parameters, 0 gradients, 78.7 GFLOPs
Class Images Instances Box(P R mAP50 mAP50-95): 100%|ββββββββββ| 3/3 [00:02<00:00, 1.48it/s]
all 40 40 0.681 0.725 0.731 0.468
fork 10 10 0.338 0.2 0.265 0.113
glass 10 10 0.643 0.9 0.888 0.432
plate 10 10 1 1 0.995 0.833
spoon 10 10 0.744 0.8 0.776 0.496
---
## π Performance
| Metric | Value |
|---------------|----------|
| mAP@0.5 | 78.0% |
| mAP@0.5:0.95 | 50.8% |
| Precision | 85.5% |
| Recall | 67.5% |
> _These numbers are based on our custom dataset; actual results may vary depending on data size and quality._
---
## π‘ Challenges & Learnings
- **Challenge:** Small dataset size β risk of overfitting
- **Solution:** Data augmentation and careful validation splitting
- **Challenge:** Labeling errors β noisy annotations
- **Solution:** Manual re-checking of all labels
- **Challenge:** Real-time inference speed
- **Solution:** Optimized image preprocessing pipeline
---
## π‘οΈ License & Acknowledgments
- Built using open-source tools: [Ultralytics YOLO](https://github.com/ultralytics/yolov5), [Streamlit](https://streamlit.io/)
- Dataset annotated manually, no pre-annotated sources used
- No external pre-trained models on non-custom data
---
If you like this project, β the repo and feel free to contribute!
Happy detecting! π³π΄π₯
|