index-v005 — FOMO object detection trainer for the XIAO ESP32-S3 ML Kit

Pairs with firmware-v005.ino. Label boxes, train the same 2-conv + 1x1 FOMO head in plain JS, read out centroids for several objects, check them with confusion matrices, write myWeights.bin back to the card. Single file, no network.

1 · Data source

Nothing loaded yet. Pick the SD card root (it contains images/ and header/) or load a zip of it. Desktop Chrome or Edge can read and write the card directly.

2 · Classes and data

Class 0 = "no object" images (negative scenes; the firmware gives them no boxes and never decodes them). Classes 1.. are objects. Inside an object image everything outside the box is already trained as empty. Pictures are shown as the model sees them (the firmware flips the stored JPEG horizontally); annotations.json is saved in the stored-JPEG frame, exactly like your FOMO Annotator, and firmware-v005 mirrors the boxes when it trains. An object image with no box is trained on the default centred box (35%–65%).

#Class folderRoleImagesBoxesTrain / Val
letters, digits, _ and - only; keep the numeric prefix so folder order = class order

Paste into the sketch (compile-time)



Capture from webcam

hmirror / vflip are off by default (the firmware sets both to 1 on the ESP32 sensor, because that camera module is mounted upside down). Tick them only if page images and device images should be flipped to look alike; that needs a bench check with the same scene.

● REC
camera as the device would store it, shown in model orientation (JPEG round trip)

Image workspace: label, review, jump to any image

The workspace lists every image on the left: click one, type a number or a name, press Home/End or Page Up/Down, or filter by class, waiting for a box, missed or false detections. Drag a box, Enter = next, C = centre box, Z = undo, X = mark bad. Boxes auto-save to annotations.json like your annotator (a .bak is made first, once per class per session; switch it off in the workspace). The mirror button is only for boxes made with the old index.v002/v003 pages.

3 · Train

Model layout (compile-time in the firmware)


Changing the layout discards the model in memory and redraws every model input view; it never touches files on the card. The kernel stays 3x3 because the firmware loops hard-code it.

Training settings

STOP keeps the current model in memory and does not save. Risks: near-duplicate burst images inflate validation numbers; web file names (web_…) sort after device names (img_…), so "last N by name" can hold out web images only. A class with N or fewer images is held out completely (firmware rule).

No model yet.

Left: training loss and validation loss. Right: validation detection F1 (centroid matching, see Analyze) and the firmware's own accuracy (average map argmax over all classes, which says little for the blank class).

4 · Analyze

No model.
Bars: highest object-cell value per image. object images (trained on), object images (held out), blank images (no object). The line is the threshold; blank images above it are false alarms, object images below it are misses. The sliders re-evaluate instantly from the stored network outputs.

Confusion matrix 1: images (rows = what the image really is, columns = class of the strongest detection; position is not checked)

Confusion matrix 2: detected objects (each predicted blob is matched to the nearest labeled object within the radius; click a cell to see its images)

Per class

Cases to check

5 · Infer (live)

needs the camera (section 2) and a model; thresholds come from section 4
live frame (model orientation), map overlay, box + centroid cross per object

6 · Save

Auto-save is off. Existing weights are copied to myWeights.bin.bak first. Without folder access the files download instead.

7 · Console

8 · Serial monitor (Web Serial)

Chrome or Edge only. Close the Arduino IDE monitor first. Opening the port can reboot the board. 115200 baud (the firmware's rate).

Device view

live ESP32 image (model orientation) with the device's FOMO map
Waiting for a frame.
Image workspace
Drag on the picture to draw a box around the object (a plain click drops a standard box). Enter / Space / → next, ← previous, Page Up/Down ±10, Home/End, N next waiting for a box, C centre box, Z undo last box, X mark bad, / search, G go to #.