A computer vision system that watches a patient's cup through a webcam and automatically tracks how much they drink.
This came from a real problem in healthcare settings — tracking how much a patient drinks throughout the day without requiring them to manually log anything. The system uses a webcam pointed at the patient's cup and automatically detects drinking events.
Under the hood, it runs YOLO for object detection to find cups, glasses, and bottles in the frame. Once it's locked onto a vessel, it analyses the liquid level using colour saturation and brightness gradients — basically looking at where the liquid surface is in the container.
The clever bit is the consumption tracking: when a cup disappears from frame and comes back, the system compares before-and-after liquid levels to estimate how much was drunk. It uses mode-based smoothing with a 30-second rolling window and outlier rejection to avoid false readings. There's a minimum change threshold of 20% and a 3-second settle time to filter out noise.
Everything gets logged to timestamped CSV files, and there's a Flask web dashboard with Server-Sent Events for real-time updates and Chart.js graphs. It works with both GPU and CPU (just slower on CPU). I tested it on Ubuntu with both Wayland and X11 display servers.