A real-time computer vision system for fast food kitchens. Uses your laptop camera + YOLOv8 to detect workers, classify activities, track food prep stages, and display a live web dashboard with wait time estimates and productivity metrics.
cd fastfood_cv
pip install -r requirements.txtpython run.pyThen open http://localhost:5000 in your browser.
On first run, yolov8n.pt (the base COCO model) downloads automatically (~6 MB). It already detects people out of the box — kitchen-specific detection requires fine-tuning (see below).
| Feature | Status |
|---|---|
| Detect workers in camera frame | ✅ Works immediately |
| Track individuals across frames | ✅ Works immediately |
| Heuristic activity classification | ✅ Works immediately |
| Food prep stage tracking (simulated) | ✅ Demo mode |
| Wait time estimation | ✅ Demo mode |
| Productivity metrics (throughput, utilisation) | ✅ Works immediately |
| Accurate food-stage detection | 🔧 Needs fine-tuning |
From a video file of your kitchen:
python training/collect_frames.py video --video kitchen_clip.mp4 --output data/images/train --fps 2Or capture live from the camera right now:
python training/collect_frames.py live --output data/images/train --duration 120Upload the extracted frames to Roboflow Annotate (free).
Draw bounding boxes around:
- Workers and their activity state (
person_idle,person_cooking,person_assembling, etc.) - Food items at each prep stage (
food_raw,food_cooking,food_assembled,food_ready)
You need roughly 500–2000 labeled frames per class for good results.
python training/train.py template --output data/dataset.yamlEdit data/dataset.yaml to match your class names.
python training/train.py train --data data/dataset.yaml --epochs 50 --model yolov8s.ptOr download a public food/kitchen dataset from Roboflow Universe first:
# Set your API key (free at roboflow.com)
export ROBOFLOW_API_KEY=your_key_here
python training/train.py roboflow \
--workspace roboflow-universe-projects \
--project food-detection-eoh3x \
--version 1 \
--then-trainpython run.py --model runs/fastfood/train/weights/best.ptSearch Roboflow Universe for:
| Search term | What you get |
|---|---|
kitchen activity |
Kitchen action recognition |
food preparation |
Food item detection at various stages |
restaurant worker |
Person detection in restaurant context |
fast food |
Fast food specific items |
cooking detection |
Cooking activity scenes |
fastfood_cv/
├── run.py ← Start here
├── app.py ← Flask web server + MJPEG stream + SSE
├── detector.py ← YOLOv8 inference + tracking + state machine
├── requirements.txt
├── templates/
│ └── dashboard.html ← Web dashboard UI
├── training/
│ ├── train.py ← Fine-tuning script
│ └── collect_frames.py ← Frame extraction from video/camera
├── data/ ← Your training images and labels go here
└── models/ ← Save custom .pt files here
| Method | Endpoint | Description |
|---|---|---|
| GET | / |
Dashboard UI |
| GET | /video_feed |
MJPEG camera stream |
| GET | /stream |
SSE stream of live detection data |
| GET | /api/snapshot |
Current state as JSON |
| GET | /api/metrics |
Productivity metrics |
| POST | /api/orders/new |
Start a new order |
| POST | /api/orders/<id>/advance |
Manually advance order stage |
Edit STAGE_DURATIONS in detector.py to match your restaurant's actual prep times:
STAGE_DURATIONS = {
"idle": 0,
"prep_started": 15, # seconds
"cooking": 90, # adjust for your grill/fryer time
"assembly": 30,
"packaging": 15,
"ready": 0,
}After collecting real timing data, these can be replaced with a regression model trained on observed completion times.
- Works with any USB or built-in webcam
- For better coverage, use a wide-angle camera mounted overhead
- A GPU (NVIDIA) dramatically improves FPS — on CPU expect ~5–15 FPS with
yolov8n - Use
yolov8n.pt(nano) for CPU,yolov8s.ptoryolov8m.ptwith GPU