Spaces:
Sleeping
Sleeping
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! π³π΄π₯ | |