Real‑time defect detection on production trays. 99.7% accuracy across 735 cells.
Built with PyTorch, OpenCV, and deployed on edge.
Each tray contains 9 biscuit cells. A fine‑tuned ResNet‑50 classifies each cell into one of four categories: No Defect, Shape, Object, Color. The system simulates a real production line: load a tray image, slice it, run inference, and compute a quality score.
Dataset note: This proof-of-concept was developed using an industrial biscuit defect dataset as an analogue for dessert surface quality inspection. While not identical to Crumble’s product line, the defect classes — shape, colour, foreign object, and acceptable product — closely map to real-world production-grade visual quality assurance workflows.
Dataset source: Kaggle – Industry Biscuit / Cookie Dataset
This allows rapid prototyping of the computer vision pipeline before deployment on a live top-down edge camera feed in production.
Tested on 82 unseen trays (735 cells). Only 2 errors total.
| Class | Precision | Recall | F1 | Support |
|---|---|---|---|---|
| Defect_No | 1.00 | 1.00 | 1.00 | 284 |
| Defect_Shape | 1.00 | 1.00 | 1.00 | 279 |
| Defect_Object | 1.00 | 0.99 | 0.99 | 95 |
| Defect_Color | 0.99 | 1.00 | 0.99 | 77 |
Select a tray from production. The left panel shows the actual tray image, the right panel shows predictions per cell.
Insight: Tray scores range from 0% to 77%. Even with 99.7% per‑cell accuracy, the tray‑level metric exposes composition bias – a valuable signal for production line audits.
# Clone the repo
git clone https://github.com/sobanmujtaba/crumble-vision
cd crumble-vision
# Install dependencies
pip install torch torchvision opencv-python pandas streamlit
# Generate trays from test set
python src/tray_simulator.py
# Run inference
python src/tray_inference.py
# Launch dashboard
streamlit run src/dashboard.py