Hej,
I am using the FRDM-MCXN947 with a LC-display and a OV7670 camera. I want to train and run a model based on my own training data on that setup. After that, I want to do some performance measurements. This is the goal.
I found a good article to archive that goal and I followed this article [1] but unfortunately my model does not run and I do not know why.
eIQ : I was able to import my dataset, after that I choosed a base model (ssd_mobilenet_v3) and started to train my model. The validation was successful but the accuracy (18%) was much lower than expected. I know that the accuracy could be improved but I want to go through the toolchain at first. Finally, I exported the model to *.tflite and as Neutron target.
MUXpressoIDE : I was able to import the converted model in my cifar10-project from the Application Hub, build and run the project and it did not worked. After debugging it turns out that I my program is stuck in a endless loop after the function Model_Init() does not return with status "success". In other words, the init of the model failed.
So here I am and I don't know how to narrow down or best-case fix the error.
Can you help me ?
eIQ Toolkit version 1.11
eIQ Portal 2.11.2
MUXpressoIDE v11.9.1
1. You can try to run the Label the CIFAR10 images from the camera on FRDM-MCXN947 on your board. If you can successfully run, it proves that there is a problem with the trained model or the replacement model.
2. “After debugging it turns out that I my program is stuck in a endless loop after the function Model_Init() does not return with status "success". In other words, the init of the model failed. ”
May I ask which part of this function is stuck?
BR
Hang
Hej,
I fully agree with your suggested first step to check if the CIFAR10 project can run successfully. I did this and the example project from the NXP Application Code Hub can run successfully. So, regarding the NXP tutorial [1] this is step 7. This step 7 is fine.
So the step before in the tutorial is step 6 "Convert to TensorFlow Lite for Neutron (.tflite)". How to check if this step run successfully ?
Well, luckily within the CIFAR10 project two models [2][3] are included. One is the created, the other one ie the converted. Based on the created model, I converted the model again to verify if the eIQ converter works. To my surprise, I get different results.
So it looks like the is a bug in some version of the Neutron converter. Do you agree ?
Here are the steps to verify:
1) Download the CIFAR10 project from NXP Application Hub. The are two models included. One is the created model [2]. The other one [3] is the converted model (converted with the Neutron converter).
2) In eIQ, open "Model tool" and "Open Model" and open the converted model [2]. This is my reference to which I compare everything.
3) In eIQ, open "Settings" and set the Neutron converter version to "MCUXpresso SDK 2.15.003". Close "Settings" and open "Model tool" and "Open model" and open the unconverted model [2]. Now in the menu, open "Convert" and "TensofFlow Lite for Neutron (*.tflite)" and choose the Neutron target "mcxn94x" and press the button "Convert" and save the converted model somewhere. This step is fine now. Now eIQ, open "Model tool" and "Open Model" and open the your converted model and compare it with the one from [1]. You hopefully realise a difference to the model from NXP in step 2)
4) In eIQ, open "Settings" and set the Neutron converter version to "MCUXpresso SDK 2.14.0". Close "Settings" and open "Model tool" and "Open model" and open the unconverted model [2]. Now in the menu, open "Convert" and "TensofFlow Lite for Neutron (*.tflite)" and choose the Neutron target "mcxn94x" and press the button "Convert" and save the converted model somewhere. This step is fine now. Now eIQ, open "Model tool" and "Open Model" and open the your converted model and compare it with the one from [1]. You hopefully realise no difference to the model from NXP in step 2)
5) In eIQ, open "Settings" and set the Neutron converter version to "MCUXpresso SDK 2.13.1". Close "Settings" and open "Model tool" and "Open model" and open the unconverted model [2]. Now in the menu, open "Convert" and "TensofFlow Lite for Neutron (*.tflite)" and choose the Neutron target "mcxn94x" and press the button "Convert" and save the converted model somewhere. This step is fine now. Now eIQ, open "Model tool" and "Open Model" and open the your converted model and compare it with the one from [1]. You hopefully realise no difference to the model from NXP in step 2)
[2] mobilenet_v1_0.25-cifar10_128_128.tflite
[3] mobilenet_v1_0.25-cifar10_128_128_converted.tflite
The appropriate SDK version should be selected when convert the model.
For example.
when you import the Label CIFAR10 image on FRDM-MCXN947 from NXP Application Code Hub.
You can see, the version of SDK is 2.14.
And i open the mobilenet_v1_0.25-cifar10_128_128_converted.tflite,
And i try to convert the mobilenet_v1_0.25-cifar10_128_128.tflite to mobilenet_v1_0.25-cifar10_128_128_converted2.14.tflite in SDK VERSION2.14.
They are the same.
But when you try to convert the mobilenet_v1_0.25-cifar10_128_128.tflite to mobilenet_v1_0.25-cifar10_128_128_converted2.14.tflite in SDK VERSION2.16.
They are different, and when you try to replace the model, the runtime will report an error.
Hope this will help you.
BR
Hang
"The appropriate SDK version should be selected when convert the model."
Okay, I did not know that. and will take this into account in the future. Thank you.
I will try to narrow down the problem further.
I take a step back and removed my project from MCUXpresso IDE. After that, I downloaded the Label CIFAR10 Image project from the Application Code Hub. This project works fine ! Then I replaced the model, adjusted the path of the model and and adjusted the labels in labels.h. I still have the error in Model_Init() but the console output the following error.
Didn't find op for builtin opcode 'MUL'
Failed to get registration from op code MUL
AllocateTensors() failedFailed initializing model
It is not the Neutron converter which I found in "eIQ" > "Settings" because I compared different version [1][2][3] and the error is still the same.
[1] Neutron converter in MCUXpresso SDK 2.15.003
[2] Neutron converter in MCUXpresso SDK 2.14.0
[3] Neutron converter in MCUXpresso SDK 2.13.1