Closed TCHeish closed 3 months ago
Hi @TCHeish
What does pre-burn mean here? (we don't need to re-burn every time?) Unless you have modified the model, you only need to burn the model once.
Can we decide where to put the model in Flash? Yes. The address of the model is defined in the following file and you can modify it yourself. The model starting address should be 4KB aligned. https://github.com/HimaxWiseEyePlus/Seeed_Grove_Vision_AI_Module_V2/blob/main/EPII_CM55M_APP_S/app/scenario_app/tflm_fd_fm/common_config.h
If we want to integrate a different model and put it in flash, how to do that? Define your model starting address in common_config.h and burn the model file in the FLASH.
Hi @stevehuang82 ,
Can we decide where to put the model in Flash? Yes. The address of the model is defined in the following file and you can modify it yourself. The model starting address should be 4KB aligned. https://github.com/HimaxWiseEyePlus/Seeed_Grove_Vision_AI_Module_V2/blob/main/EPII_CM55M_APP_S/app/scenario_app/tflm_fd_fm/common_config.h
Thanks. How about examples like allon_sensor_tflm_fatfs
?
https://github.com/HimaxWiseEyePlus/Seeed_Grove_Vision_AI_Module_V2/blob/ce498fb18327dff98f8980b38aa257bb94b533eb/EPII_CM55M_APP_S/app/scenario_app/allon_sensor_tflm_fatfs/cvapp.cpp#L169
If we want to integrate a different model and put it in flash, how to do that? Define your model starting address in common_config.h and burn the model file in the FLASH.
Could you help to point out where is the burn model procedure?
Is it inside the we2_local_image_gen.exe
?
(I assume there is some script/code loading model from path model_zoo
and put it in the FLASH_ADDR
but I can't find it.)
Hi @TCHeish
In allon_sensor_tflm_fatfs example, we define "FLASH_XIP_MODEL=0" and convert the model file to "person_detect_model_data_vela.cc". This model is embedded in the firmware and does not need to be additionally burned into the flash memory.
If you want to define the model starting address in the FLASH, you can refer to tflm_fd_fm example. And you can burn the multiple models through python scripts as shown below.
python xmodem\xmodem_send.py --port=[your COM number] --baudrate=921600 --protocol=xmodem --file=we2_image_gen_local\output_case1_sec_wlcsp\output.img --model="model_zoo\tflm_fd_fm\0_fd_0x200000.tflite 0x200000 0x00000" --model="model_zoo\tflm_fd_fm\1_fm_0x280000.tflite 0x280000 0x00000" --model="model_zoo\tflm_fd_fm\2_il_0x32A000.tflite 0x32A000 0x00000"
example:
python xmodem\xmodem_send.py --port=COM123 --baudrate=921600 --protocol=xmodem --file=we2_image_gen_local\output_case1_sec_wlcsp\output.img --model="model_zoo\tflm_fd_fm\0_fd_0x200000.tflite 0x200000 0x00000" --model="model_zoo\tflm_fd_fm\1_fm_0x280000.tflite 0x280000 0x00000" --model="model_zoo\tflm_fd_fm\2_il_0x32A000.tflite 0x32A000 0x00000"
You can reference by the How to build face mesh scenario app exmple and run on WE2?.
Hi @stevehuang82
Thanks. Can we overwrite the model at 0x180000?
Hi @TCHeish
The model should be placed after address 0x200000, as the first 2MB of addresses are reserved for the firmware. If you want to place the model at address 0x200000, you can define the model address variable as follows.
in ~allon_sensor_tflm_fatfs/common_config.h
in ~allon_sensor_tflm_fatfs/cvapp.cpp static const tflite::Modelmodel = tflite::GetModel((const void )MY_MODEL_FLASH_ADDR );
You have to burn your model file to address 0x200000 in the flash through python scripts.
python xmodem\xmodem_send.py --port=[your COM number] --baudrate=921600 --protocol=xmodem --file=we2_image_gen_local\output_case1_sec_wlcsp\output.img --model="model_zoo\allon_sensor_tflm_fatfs\0_my_model_0x200000.tflite 0x200000 0x00000"
Thanks for the explanation.
I have a few questions about the Model location in FLASH.
pre-burn
mean here? (we don't need to re-burn every time?)