UtensilDetector / README.md
anjali2002's picture
Update README.md
033c3b5 verified
---
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! 🍳🍴πŸ₯„