A modular, microservices-based system for real-time detection of food handling violations in restaurant kitchens, powered by computer vision (YOLO), RabbitMQ, and a live browser UI.
- Microservices architecture: Frame Reader, Detection, Streaming/UI
- Real-time detection with YOLO (custom or pre-trained models)
- Live violation logic using user-defined ROIs
- Scalable messaging with RabbitMQ
- Modern browser UI with video, overlays, violation counter
- Configuration in
config.pyand.gitignore - (Optional) Docker Compose for one-command deployment
┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌───────────────┐
│ Frame Reader │ ───▶ │ Detection │───▶ │ Streaming │ ───▶ │ Web Browser │
│ (Video → MQ) │ │ (YOLO, MQ) │ │ │ (API/WS/UI) │ │ (UI + API) │
└──────────────┘ └──────────────┘ └──────────────┘ └───────────────┘
- Frame Reader: Sends video frames to RabbitMQ.
- Detection: Detects objects, applies violation logic, publishes results.
- Streaming/UI: Streams annotated video & serves live stats to browser.
├── detection_service/
│ ├── main.py
│ ├── detector.py
│ ├── logic.py
│ ├── config.py
│ └── ...
├── frame_reader/
│ ├── main.py
│ └── ...
├── streaming_service/
│ ├── main.py
│ └── ...
├── model/ # (ignored) YOLO weights
├── data/ # (ignored) Video/data files
├── config.py
├── roi_config.json
├── requirements.txt
├── .gitignore
└── README.md
- Reads video frames at set FPS, sends to RabbitMQ.
- Runs YOLO detection and applies violation logic using ROIs.
- Publishes results to streaming queue.
- Streams annotated video frames via WebSocket.
- REST API for live violation stats and ROI info.
- Browser UI overlays detections & ROIs, shows violation count.
git clone https://github.com/ahmedgamal74-cmp/Computer-Vision-Restaurant-Violation-Detection-Project.git
cd Computer-Vision-Restaurant-Violation-Detection-Projectpython -m venv venv
venv\Scripts\activate # On Windows
# source venv/bin/activate # On Mac/Linux
pip install -r requirements.txtdocker run -d --hostname pizza-mq --name pizza-rabbit -p 5672:5672 -p 15672:15672 rabbitmq:3-management- Place your YOLO .pt weights in model/
- Place a video in data/ (e.g., data/wrong.mp4)
- Edit config.py as needed.
- Use the ROI selector tool or edit roi_config.json manually.
- Each service runs in its own terminal or process:
# Frame Reader
cd frame_reader
python main.py
# Detection Service
cd detection_service
python main.py
# Streaming/UI Service
cd streaming_service
uvicorn main:app --host 0.0.0.0 --port 5000- Open http://localhost:5000 in your browser.
- Browser UI displays video with detection overlays, ROIs, and live violation count.
/stats— live violation count (JSON)/roi_config— ROI info (JSON)/ws— WebSocket for video frames
MIT License
A modular, microservices-based system for real-time detection of food handling violations in restaurant kitchens, powered by computer vision (YOLO), RabbitMQ, and a live browser UI.
- Microservices architecture: Frame Reader, Detection, Streaming/UI
- Real-time detection with YOLO (custom or pre-trained models)
- Live violation logic using user-defined ROIs
- Scalable messaging with RabbitMQ
- Modern browser UI with video, overlays, violation counter
- Configuration in
config.pyand.gitignore - (Optional) Docker Compose for one-command deployment
┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌───────────────┐
│ Frame Reader │ ───▶ │ Detection │───▶ │ Streaming │ ───▶ │ Web Browser │
│ (Video → MQ) │ │ (YOLO, MQ) │ │ │ (API/WS/UI) │ │ (UI + API) │
└──────────────┘ └──────────────┘ └──────────────┘ └───────────────┘
- Frame Reader: Sends video frames to RabbitMQ.
- Detection: Detects objects, applies violation logic, publishes results.
- Streaming/UI: Streams annotated video & serves live stats to browser.
├── detection_service/
│ ├── main.py
│ ├── detector.py
│ ├── logic.py
│ ├── config.py
│ └── ...
├── frame_reader/
│ ├── main.py
│ └── ...
├── streaming_service/
│ ├── main.py
│ └── ...
├── model/ # (ignored) YOLO weights
├── data/ # (ignored) Video/data files
├── config.py
├── roi_config.json
├── requirements.txt
├── .gitignore
└── README.md
- Reads video frames at set FPS, sends to RabbitMQ.
- Runs YOLO detection and applies violation logic using ROIs.
- Publishes results to streaming queue.
- Streams annotated video frames via WebSocket.
- REST API for live violation stats and ROI info.
- Browser UI overlays detections & ROIs, shows violation count.
git clone https://github.com/ahmedgamal74-cmp/Computer-Vision-Restaurant-Violation-Detection-Project.git
cd Computer-Vision-Restaurant-Violation-Detection-Projectpython -m venv venv
venv\Scripts\activate # On Windows
# source venv/bin/activate # On Mac/Linux
pip install -r requirements.txtdocker run -d --hostname pizza-mq --name pizza-rabbit -p 5672:5672 -p 15672:15672 rabbitmq:3-management- Place your YOLO .pt weights in model/
- Place a video in data/ (e.g., data/wrong.mp4)
- Edit config.py as needed.
- Use the ROI selector tool or edit roi_config.json manually.
- Each service runs in its own terminal or process:
# Frame Reader
cd frame_reader
python main.py
# Detection Service
cd detection_service
python main.py
# Streaming/UI Service
cd streaming_service
uvicorn main:app --host 0.0.0.0 --port 5000- Open http://localhost:5000 in your browser.
- Browser UI displays video with detection overlays, ROIs, and live violation count.
/stats— live violation count (JSON)/roi_config— ROI info (JSON)/ws— WebSocket for video frames
MIT License