Vision CNN SD trainerLoRa v010

Browser companion for the XIAO ESP32-S3 FULL VISION ML firmware (v44, or firmware-v005 for config.json class names and debug frames): load the SD card, add images, review and clean them, train the same CNN, then write myWeights.bin back to the card.

Everything runs in this page. Images and weights never leave your computer.

LoRa network: connect one device in section 8 and section 9 sums what every nearby LoRa device has seen. Jump to LoRa network

1 Data source

Nothing loaded yet. Pick the root of the SD card (the folder that contains images and header).

2 Classes and data

Class folderImagesTrain / validation

The sketch must be compiled with these values (firmware-v002 and later refuse a weights file of the wrong size). firmware-v003 also reads the class names from header/config.json at boot, but their count must equal NUM_CLASSES, so adding or removing a class means editing NUM_CLASSES and reflashing:

(no classes yet)

Add images from the webcam

● REC

Frames are center-cropped to a square, resized to 240x240 and saved as JPEG straight into images/<class>/ (SD folder) or the zip. Burst takes 10 fresh camera frames back to back, plus the delay you set between them, while the button is red, then saves them. Burst frames are near-duplicates, so move or tilt the object between bursts.

Sample browser

Review steps through one class at a time: mark bad images, then delete them all with one confirmation. Or open a class below and click an image to see its heatmap, delete it, or move it.

3 Train

Model layout

These are compile-time settings in the sketch (INPUT_SIZE, CONV1_FILTERS, CONV2_FILTERS). Copy the lines from section 2 into the sketch after changing them. The 3x3 kernel is fixed in the firmware loops. Images on the card stay 240x240, so changing the size needs no new photos, only a retrain. Cost grows with the square of the input size. Changing the layout discards the model in memory.

Training settings

Idle.

Training never saves by itself. Save the model in section 6 when you are happy with it.

4 Analyze

Confusion matrix

No evaluation yet. It runs automatically when training ends.

Per-class precision and recall

Misclassified images

Click one to inspect it, then delete it or move it to the right class.

5 Infer (live)

Each live frame goes through the same path as a stored image: square crop, 240x240 JPEG, decode, nearest-pixel resize to 64x64.

6 Save

SD folder mode: the existing weights file is copied to myWeights.bin.bak first, then the new one is written. A config.json with the class names and layout is written next to it. firmware-v003 and later read the class names from it at boot (older firmware ignores it). NUM_CLASSES, INPUT_SIZE and the filter counts always come from the compiled sketch.
Zip mode: Save weights keeps the model for the zip. Save .zip downloads header/myWeights.bin (and images if ticked) in the SD card layout.

7 Console

8 Serial monitor

Not connected.

115200 baud, a newline is added to what you send. Close the Arduino IDE serial monitor first. Opening the port can reboot the board, and a reboot may drop the connection: press Connect again. Desktop Chrome or Edge only.

Device view

With the box ticked, firmware-v005 sends its camera JPEG (and a heatmap) every 10th inference, each saved image, and a slow live preview while collecting. Frame lines are shown here instead of in the monitor text. With a model in memory that has the same layout, the page runs the same JPEG through its own copy of the network and compares.

No debug frame yet. Connect, keep the box ticked, then run Infer or a collect mode on the device.

9 LoRa network

Each device runs the CNN on its own camera and sends a short LoRa summary every report period (30 s default): how many frames it saw of each class. Connect one device in section 8. This page adds up the summaries from every device it hears, plus its own, over the window below. Class 0 is the quiet base class: when only class 0 is seen, only the date and time are shown.

Waiting for LoRa reports
Connect a device in section 8 and wait one report period.

Summed result

Devices

Event log

Send a message

Sent through the connected device (section 8). Its own line and every reply from other devices appear in the event log above, with the time, the device and the signal strength.

Settings of the connected device

"Show commands and settings" prints the command list in the serial monitor (section 8) with the current value of every setting and whether it is the default or saved in the device. The defaults themselves are in the USER SETTINGS block at the top of the firmware.

No device info yet. All devices must use the same channel. Name, report period, confidence and channel are saved in the device.

10 LoRa history since connected

Everything this page has heard since the serial monitor was first connected: totals per device, a graph with one line per class, and CSV export. Import a saved CSV file to look at it (view only, your live data keeps collecting), or use Import CSV and continue to load it into the history so new reports are added after it. A messages CSV can be imported too, and you can pick several files at once. Section 9 only shows the last few minutes. The devices send counts per report period, so these totals are the sum of every report heard while this page was connected, not the device's own count since it booted.

Totals

Graph

Hover over or tap a point on the graph to see which devices it came from.

Click a class name to hide or show its line. A step adds up every report heard in that time (all devices, or the one selected).

Messages

Heatmap: last conv layer, blue = low, red = high. Position is approximate (the last conv map is stretched over the image).

Review images
MARKED BAD

-

Marking deletes nothing. Delete marked asks once, then removes every marked image. Keys: arrows to move, X to mark and advance.