This is a repository for a TinyML machine learning algorithms accelerator on low-end microprocessors/microcontrollers specialized in life-threatening ventricular arrhythmias (VAs) detection.The design won second place in 2022 ACM/IEEE TinyML Design Contest @ ICCAD.
Designed by:
Jingwei Zhang, Chaoyao Shen, Xinye Cao, Yuning Ji, Yu Zhang, et al.
SEUer Group, Southeast University
Our design is based on SunNet, which is modified from [IEGMNet](tinyml_contest2022_demo_example/model_1.py at master · tinymlcontest/tinyml_contest2022_demo_example · GitHub). Compared with the latter, SunNet has reduced MACC by nearly 40 times, and more importantly, the accuracy still exceeds 3.2%. We are so persistent in improving the performance of SunNet in an all-round way because we want to provide a safer solution for every heart patient, and determined to be the sun to protects them.
- training: The DNN model definition and training and testing scripts.
- ioc: Parsing
SunNet.onnx
model with STM32CubeMX and X-CUBE-AI 7.2.0. - deploy: Refer to [evaluation files](tinyml_contest2022_demo_evaluation/framework_x-cube-ai at main · tinymlcontest/tinyml_contest2022_demo_evaluation · GitHub) for replacing the generated project file.
[STM32CubeMX](STM32CubeMX - STM32Cube initialization code generator - STMicroelectronics)
MDK5
PS: If you want to deploy our project directly to evaluate performance, you can start with step 4 Deployment on MCU.
-
-
Download the ICCAD Tiny-ML training dataset.
-
Set the dataset file path and start training:
cd training/ python train.py
-
Convert the model to onnx format by running:
python pkl2onnx.py
-
-
In this step, the C++ source code is generated by STM32CubeMX and X-CUBE-AI 7.2.0. Officially provides detailed [documentation](tinyml_contest2022_demo_example/README-Cube.md at master · tinymlcontest/tinyml_contest2022_demo_example · GitHub) on how to generate keil projects by onnx model.
Note: If there is a yellow exclamation mark in the Keil5 project generated, it means that the path is incorrect and needs to be changed manually to the corresponding path.
-
The official does not use the Validation function with STM32CubeMX, but provides its own [evaluation framework](GitHub - tinymlcontest/tinyml_contest2022_demo_evaluation). Therefore the code used for PC communication through UART in the generated keil project needs to be replaced. Finally compile it!
Note: In order to ensure that the program works properly, you need to enable Use MicroLIB under ‘ Options for Target → Target ’ page.
-
We provide the compiled keil project in the
deploy
folder, you only need to open the keil project in theMDK-ARM
folder, connect the board to PC, and click the Download button to your L432KC board.About validation
Run the
validation.py
in the evaluation framework, when seeing the progress bar oftqdm
, press the reset button on your board, and the validation will start.