Spaces:
Sleeping
A newer version of the Streamlit SDK is available:
1.49.1
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
- 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
- Static images β
Visual outputs include:
- Bounding boxes with class names and confidence
- Confusion matrix
- Precision-recall, F1 curves
π Interactive Demo
Launch the demo app:
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:
git clone https://github.com/yourusername/Utensils-object-detection.git
cd Utensils-object-detection
2οΈβ£ Install dependencies:
pip install -r requirements.txt
3οΈβ£ Run training:
python training/train.py --data data.yaml
4οΈβ£ Try inference:
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
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, Streamlit
- 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! π³π΄π₯