MelonVision AI
An AI-based melon plant detection system that runs inference on an ESP32-CAM and reports into a FastAPI service, taking a trained model through to a deployed, working application.
- Discipline
- Edge AI / Deployment
- Context
- Client project
- Timeline
- 20 – 30 June
- Year
- 2026
Problem
MelonVision AI was built to help melon farmers identify the condition of their plants automatically, using an IoT camera and AI in place of manual inspection that needs specialist expertise. The system allows remote monitoring through a web dashboard, so pruning decisions can be made faster and more consistently without having to be in the field.
Approach
- Converted the detection model to TensorFlow Lite for on-device inference.
- Ran inference on ESP32-CAM hardware at the capture point.
- Built a FastAPI service to receive and serve detection results.
- Persisted detection history in PostgreSQL.
- Containerised the stack with Docker and deployed it to a Linux VPS.
- Integrated the detection history into a web interface.
Outcome
Finding and fixing a critical bug in the FOMO decoder that made a single object produce dozens of bounding boxes at once; in one case, 144 false detections from one image. The fix was to implement Connected Component Analysis from scratch, using a breadth-first search with 8-connectivity. That changed how the system understands "one object": from one grid cell = one detection, to a cluster of neighbouring cells = one detection with an accurate bounding rectangle.
Lessons learned
A model is one part of a camera workflow. Getting the ESP32-CAM to capture, run the quantised model, and report each detection into the FastAPI service (with PostgreSQL keeping the history the dashboard reads) was as much of the project as the model was.
What a model outputs is not yet a detection. The FOMO grid gave one cell per activation, and turning that into application-level results took post-processing the model itself never provided.
The critical bug lived in that post-processing, not in the model. One plant producing dozens of boxes was the decoder reading every active grid cell as its own object; implementing Connected Component Analysis with a breadth-first search over 8-connected neighbours made a cluster of cells one detection with one bounding rectangle.
Debugging inference on a constrained device meant reasoning about the whole path (capture, quantised model, decoder, API) rather than any one stage, because the wrong output could have come from any of them.
Dataset
Stack
- Model
- MobileNetV2 FOMOINT8 quantisedTensorFlow Lite
- Build
- FastAPIPostgreSQLWeb integration
- Deploy
- ESP32-CAMDockerLinux VPS