I am uisng the Arduino Nano 33 BLE board to play with those examples of TensorFlow Lite for Microcontrollers. TFLite Micro officially supports 10 boards and Arduino Nano 33 BLE is one of them. The examples include speech detection and person detection, etc.
Tensorflow Lite for Microcontrollers
Their trained model is converted in a C file by using xxd and the model will be uploded to the board as an array during complie.
The following snippet is the model file for person detection. My question is where the model is (RAM v.s. Flash) when the program is running?
const unsigned char g_person_detect_model_data[] DATA_ALIGN_ATTRIBUTE = {
0x1c, 0x00, 0x00, 0x00,
// omitted
0x06, 0x00, 0x00, 0x00, 0x00};
const int g_person_detect_model_data_len = 236072;
I know Nano 33 BLE borad has 256KB RAM + 1MB Flash. The model for person detection example is around 230KB so I assume the model will reside in Flash during run-time since the RAM is not big enough.
But how about other examples whose model is only tens of KB, e.g. the model of speech detection example is only 20~KB. Is this model will residue in RAM during runtime? Can I control whether the model will be when it is running?
My big picture is that I want to design a system which has multiple neural netwoks, let's say three models, including net1, net2 and net3. In the beginning, the three models are saved in Flash. During runtime, the system will only run one net at a time. But the system needs to switch between those nets due to some reason. The system wants to run the model in RAM as code execution in RAM is faster than Flash (correct me if this assumption of running in RAM is faster than Flash is not true). For example, at first, the system runs net1 in RAM. Later, it wants to run net2 so it has to read net2 from Flash to RAM and run net2 in RAM. To achieve this, I need to control where the model will residue during runtime. Can I have controllability?
Thanks!