A camera frame is bigger than its answer
Follow an image through capture, conversion, classification and an event rule on a microcontroller.
Device profile · Seeed Studio XIAO ESP32S3 Sense ↗1. Acquire pixels, then release the buffer
The camera driver lends the application a frame buffer. Keep the pointer only as long as needed, and return it when processing is finished. Allocation failure, missing frame and inference failure need distinct counters. Otherwise a frozen capture pipeline can masquerade as a stable scene. Frame-buffer contract
2. Account for the images you create
Our proposed 320 × 240 RGB888 working image takes 230,400 bytes before model memory or other buffers. A second copy doubles that part of the budget. This is arithmetic for a proposed configuration, not an observed allocation. Match the crop, resize, color order and normalization used in training; a successful capture does not prove the model sees the same representation.
3. Preserve an unknown state
Consider a hand partly covering the tray. A three-class classifier will still produce scores, even if the view falls outside training. The application should retain an explicit unknown state when confidence is inadequate or the capture failed. Do not silently reuse yesterday’s confident result. Choose thresholds with validation data; no score threshold here is a measured guarantee.
4. Decide what crosses the network
First make the serial version work. Then send a state, sequence number and timestamp to a local receiver. Measure capture-to-receipt time as well as inference time. A receiver should expire stale state when messages stop. This proposed protocol makes radio loss distinguishable from an empty tray; it does not make the underlying classifier accurate.
5. Reproduce the whole pipeline
Archive a sample input image, model hash, label order, preprocessing settings, camera PID and firmware dependency versions. Seeed’s published TinyML example has a 2.x board-package compatibility warning. A camera-driver update and a new sensor batch can both require retesting even when the exported model is unchanged. Official example boundary