Train a 2 layer Vision CNN AI model in the browser · Export weights to PC and the to ESP32 SD card · WebSerial ESP32 camera capture · Flash firmware from browser
Needs a Chrome or Edge Browser for the webSerial connection. Probably best not to use a cell phone.
Base github for this page at github.com/webmcu-ai/webmcu-vision-web. Paper 2 WebSerial Vision Training for Microcontrollers: A Browser-Based Companion to On-Device CNN Training, arXIV: arxiv.org/abs/2604.22834
While proof of concept esp32s3 on-device training github is at https://github.com/webmcu-ai/on-device-vision-ai Paper 1 On-Device Vision Training, Deployment, and Inference on a Thumb-Sized Microcontroller arXIV: arxiv.org/abs/2604.23012
Seeedstudio XAIO ML Kit at www.seeedstudio.com/The-XIAOML-Kit.html
A reminder to sponsor a TinyML Hardware kit at the openCollective mysysbook at opencollective.com/mlsysbook to support universities in the Global South
Flash compiled ESP32 .bin files directly from the browser using esptool-js v0.5.7.
Requires Chrome/Edge · HTTPS or localhost · USB CDC On Boot: Enabled
If you want to look at the code and load the sketch onto your Arduino IDE it is here in text form firmware.ino
Flashes only the application partition at 0x10000. Fast. Preserves bootloader and NVS.
Use when the bootloader is already on the device (standard re-flash).
Flashes a single merged binary: bootloader + partition table + app at 0x0.
Use for fresh chips or after partition changes.
YourSketch.ino.bin → 0x10000YourSketch.ino.merged.bin → 0x0
· ESP32 WebSerial & SD BrowserConnect your XIAO ESP32S3 Sense via USB · requires Chrome/Edge · USB CDC On Boot: Enabled Not Connected
Serial Monitor Serial output will appear here...Note: Drag the gray area. ⊿
Decisions Before TrainingThe defaults have been fully tested Set BEFORE starting — 3x smaller model, needs more data Training resolution: 64x64 — conv2 out: 29x29
Change class count here, or use Load config.json in Section 3 to set classes automatically. ⚠ Changing classes resets all image buffers. Reminder to:Maximum images held in browser RAM per class. Lower only if you hit browser memory limits — disk folder holds all images regardless. |
SD Card Browser
Browse, view, and delete files on the ESP32 SD card. Requires firmware with SD_LIST / SD_DELETE support.
/ (root)
Connect ESP32 then press Refresh to browse SD card
3 · File & SD TransferPC Project Folder None — images held in RAM onlyPick a project root folder — mirrors SD card structure: root/images/ClassName/ and root/header/ created automatically.
Every Capture saves to images/ClassName/img_NNNN.jpg.Load Config & Model TFJS Model = browser-native format (large, multi-file). Use for resuming browser training only.
| |||||||||
4 · Camera & Data CollectionThe gray area is draggable. ⊿
📷 Capture = grab frame · auto-saves to Activity LogLogs will appear here...
|
5 · Training ProgressBatches Trained: 0Min Samples:
INCREASE EPOCHS TO TRAIN LONGER!
Avg Loss: -- Status: Waiting... Ready...
(ESP32 on-device inference · slightly reduces ESP32 FPS) (webcam / ESP32 stream · runs in browser, no ESP32 FPS impact) Confusion MatrixLeave unchecked to protect a well-trained model from being overwritten during continued training. Manual Export myWeights.bin and Export myWeights.h buttons always work on demand. Export to PC myWeights.bin = binary weights for SD card deployment. myWeights.h = C header for compiling weights into firmware (#define USE_BAKED_WEIGHTS). config.json = class names + training settings. Send to SD CardBest to manually copy all the files from the PC folder to the SD card . This is VERY SLOW! Sends both files to SD card /header/ folder via WebSerial (firmware v78+ required, ESP32 must be connected). Use the big green button after training to deploy your model in one click. | |||||||||
6 · ESP32 Export Settings & config.json EditorSet export options below, then use Section 3 buttons to send files to PC or SD card. validationImages = last N images/class held out. % recalculates the box live as images load. Edit the box directly to override. Written to config.json only at train-start. imagesToPsram = preload all training images to PSRAM before training. Bulk Image Transfer PC ↔ SD For config.json and myWeights.bin use the dedicated buttons — they are faster. This panel is for bulk-transferring image datasets. Requires firmware v78+ · Stop camera streaming before sending · Each chunk is checksum-verified. Project folder: None selected
Status: Idle
Current file: — Progress: 0 / 0 bytes Files: 0 / 0 |
config.json — Live Editor Edit freely before saving. Syncs automatically from the fields on the left. PC button saves to your computer (project folder or Downloads). Sends both critical files to the SD card in one click. Do this after training to deploy your model. TFJS Model = browser-native format (large, multi-file). Use for resuming browser training only. |
By Jeremy Ellis (hpssjellis) · LinkedIn · Support opencollective/mlsysbook · XIAO ML Kit $22 USD · Use at your own risk · MIT License