-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with Quantizing EEGNet Model on ESP32-S3 (AIV-744) #194
Comments
We will download the code to analyze the issue. If it's convenient for you to upload the ONNX model file, it will accelerate our debugging process. |
Hi @BlueSkyB, Yes. I have uploaded my trained model in pytorch (*.pt) and ONNX model that I got from quantize script in zip file |
Is it feasible to operate a small model, like the one I have, on an ESP32S3 module without a PSRAM component? because the ESP32-S3-WROOM-1-N16 I received does not have a PSRAM option. |
You can disable the configuration of CONFIG_SPIRAM by using idf.py menuconfig. If there is no PSRAM, the system will default to using internal RAM. In this case, you must ensure that the model is small enough so that the memory required for its parameters and feature maps is less than the available system memory; otherwise, it will not function properly. Alternatively, you can refer to the document https://docs.espressif.com/projects/esp-dl/en/latest/tutorials/how_to_load_model.html to disable param_copy, but this will significantly reduce performance. Additionally, your model contains the Elu operator, which is currently not supported by ESP-DL. You can check the supported operators at https://github.com/espressif/esp-dl/blob/master/operator_support_state.md. We will support it in the future. |
Hi @BlueSkyB, thank you so much for your information. I have modified the model to make it simpler for testing, and it successfully passes the quantization script. I imported the eegnet.espdl (18 KB) in the same way as demonstrated in the mobilenet_v2 example, but I encountered the following issue:
Updated (250124): This warning has been fixed once I switched to my ESP32S3 EVK with PSRAM support. The PSRAM effect appears to call the heap within. However, the Error is still visible. Error:
Do you know how to resolve the warning and the error?
And here is the log
It seems something miss in my code because 176 = 352/2 For reference, I have included the log from the monitor below.
And here is the code in app_main function
My ONNX model (change Relu to PRelu) |
Hi @manhdatbn93 . We have fixed the bug and the model is now running normally. Please update esp-ppq and esp-dl as well. |
Checklist
Issue or Suggestion Description
Hi Team, I am currently working on quantizing the EEGNet model for deployment on my custom board based on the ESP32-S3. My goal is to use this model for a simple classification task: detecting eye blink and eye non-blink from EEG data.
Here is the EEGNet model I am using: https://github.com/YuDongPan/DL_Classifier/blob/main/Model/EEGNet.py
Issue
When I attempt to quantize this model using ESPDL, I encounter an error in the avg_pool2d function. The error details are as follows:
My batch size is
Here is the function for quantizing
I would appreciate it if you could help identify the root cause of this issue and provide guidance on:
[batch_size, channels, samples].
Thank you for your support. Please let me know if you need additional details about the setup or the error logs.
Additional Details
Data Input Shape: [batch_size, 1, 8, 500]
Target Board: ESP32-S3
Quantization Tool: ESPDL
Framework: PyTorch
Full modified code, other codes are same as example:
Attached is the model I got as *.onnx although the run failed.
The text was updated successfully, but these errors were encountered: