Hello,
I am using the board MCXN947 and the sample project frdmmcxn947_mpp_camera_mobilenet_view_tflm. I have trained my own AI modell and to test I would like to simply switch the trained modell within the sample project. I was able to compile but it does not run. Is there somewhere like a tutorial how to do that?
Thanks
Hello Xu Zhang,
thanks for your help. I was able to swap the model using your template project "frdmmcxn947_tflm_label_image". So, I wanted to go one step further using your template project "frdmmcxn947_mpp_camera_mobilenet_view_tflm".
- I have downloaded the dataset 60'000 images for handwritten digits, inverted the colors (black text, white background), resized to 128x128 and trained the model with eIQ. The validation results for digits 0-9 are above 95%.
- Afterwards I have tested this model successfully on a PC with a webcam.
- Then according to your instruction I have converted the model for Neutron which then should fit to frdmmcxn947 using NPU
Unfortunately I am stuck here because with 947 board the inference result is not accurate at all. I am attaching here a github link, hopefully you can have a look there why it is not working:
https://github.com/SherlockLun/frdmmcxn947_mpp_camera_mnist_view
git@github.com:SherlockLun/frdmmcxn947_mpp_camera_mnist_view.git
changed folder:
- models/mnistInverted128... (added)
- models/mobilenetv1_labels.h (digits 0-9)
- models/mobilenetv1_ops_micro_tflite.cpp
- camera_mobilenet_view.c (include file)
- fsl_ov7670.c (changing brightness/contrast within GetDefaultconfig)
Hi,Sherlock987
Thank you for your detailed reply.
I think your inaccurate identification is probably due to the problem of the trained model. I have checked the model_data_len = 1309552 in your model file INT8_out-of-INT8, it is too big ,and I guess your model is not quantized. Please check the options in the following figure during the training of the model using eIQ.
According to your reply, I used frdmmcxn947_tflm_label_image demo to test the accuracy of static digital data, and I put the modified program in the attachment. The following changes were made:
1. Replace the model.
2. Modify the hexadecimal data of the stopwatch image to that of the digital image. You can use the py script to convert the image, the script is attached, you can use different data to test your model.
3. Change labels
Then, I use frdmmcxn947_mpp_camera_mobilenet_view_tflm demo to realize the recognition of numbers by the camera. The code is attached. You can replace the trained model for testing. In my testing process, inaccurate model identification also occurred, which was related to many factors, including the number of samples, parameters set in the training process and the results of model quantization.
Wish it helps you.
BR
Joey
hi,Sherlock987
I will test your project and find the problem as soon as possible.
Whether you have tried static digital picture data in your project. Light intensity, Angle and distance will affect the accuracy of image acquisition by the camera. Please first use static data to check the accuracy of the model.
BR
Xu Zhang
Hello Xu Zhang
Thank you very much for your previous response. It was extremely helpful, and I was able to successfully add my own module.
I currently have the FRDM-MCXN947 evaluation board, the OV7670 camera module, and a 3.5" display. I am experimenting with the project frdmmcxn947_mpp_camera_mobilenet_view_tflm as well as dm-label-cifar10-images-on-mcxn947.
I am currently trying to replace the model with simple dataset such as mnist hand digit recognition and testing the accuracy. I will let you know soon if more support is needed. Thanks!
Best regards
Sherlock
Hi,Sherlock987
I'm sorry for not being able to reply you in time. I have received your question and will deal with it as soon as possible.
BR
Xu Zhang
hi,Sherlock987
Thank you for contacting technical support.
Hope it can help you.
BR
Xu Zhang