ARM-software / ML-KWS-for-MCU

Keyword spotting on Arm Cortex-M Microcontrollers
Apache License 2.0
1.13k stars 414 forks source link

How to run a DNN model with 436 neurons on the MCU? #147

Open Bosch936 opened 3 years ago

Bosch936 commented 3 years ago

Hi.

I've tried to run, quantize and the compile the dnn model with 3 layers and 436 neurons for each layers. It is possible to launch the command: python train.py --model_architecture dnn --model_size_info 436 436 436 --window_size_ms 40 --windo_stride_ms 40 --dct_coefficient_count 10

without any problem and the model will be trained. After that I digit: python quant_test.py --model_architecture dnn --model_size_info 436 436 436 --window_size_ms 40 --windo_stride_ms 40 --dct_coefficient_count 10 --checkpoint --act_max 32 32 32 32 32

the main problem is that the last command generates a file with the weights too heavy for my MCU (like 800KB against the 300KB of the model with 144 neurons per layer). How to solve this kind of problem ? I know that i need to quantize but the result doesn't fit in the memory of my MCU (I use the DISCO_F746NG like in the example). Another question is related to the file quant_models.py: I guess that is possible to train the NN with this thing, but what type of command I need to launch?