This is an example of using MobileNetV2 as a base model (transfer learning) in a new model that can run on the ESP32S3.
- Live MJPEG stream
- WebSocket for detection events
- Record images to SD card
- Person detection via ESP32 TensorFlow model
ESP32S3 XIAO Sense
- Import and load the pretrained MobileNetV2 model.
- Create input layers for 1-dimensional images (ESP32 FMTRGB outputs a 1D buffer containing the image).
- Add a new output layer for new predictions (person/no person).
- Train on the COCO dataset.
- Train further on a self-collected dataset.
- Quantize the model for ESP32.
See training/esp32_transfer_learning.ipynb
for more details.
cd .\training\
cp .\.env.template .env
update .env passwords
docker compose --profile training up
if you add items to requirement.txt you will need todocker compose --profile training up --build
- a server url will be output to use for jupyter
- visit your url example: http://127.0.0.1:8888/tree?token=
- you may also add it connect from vscode
- press run all to retrain the model from scratch
cd .\training\
- ensure your .env file is created
- run
docker compose --profile labeling up
- visit http://localhost:8080 and login with the env params
- add data to
esp32 person detector custom data
and label it - export the project as a csv it should export a file like
training\mydata\export\project-4-at-2024-09-13-15-20-c743e35a-info.json
totraining\mydata\export
- update csv_file_path = 'front_door_label_export.csv'
- follow training instructions to retrain the model with you custom data
- Open the root folder of this project in Platform.io.
cp src\wifikeys.template src\wifikeys.h
and input your wifi informationpio run
pio run --target buildfs --environment seeed_xiao_esp32s3
pio run --target uploadfs --environment seeed_xiao_esp32s3
pio run --target upload --upload-port <COM_PORT>
Run the following command to execute unit tests:
pio test
cd client
npm install
npm run dev
runs locallynpx vite build
creates a single page html appgzip dist\index.html
cp .\dist\index.html.gz ..\data\
ffmpeg -i dump_jpeg.mjpeg -q:v 2 output_%06d.jpg