2021-05-12 10:29 PM
Hi,
Am trying to generate the C-code for the ASC (Acoustic Scene Classification) model from the FP-AI-SENSING1 Pack through Stm32cube mx. But I can see there is changes in the code between existing code and the new code which was generated by me. I dont know whether I have not done the correct procedure in MX.
It would be really helpful, if I get some procedure for SensorTile Box (Steval-Mksbox1v1) for the ASC to work in MX, because I can see some of the tutorial videos and data briefs is for the eval board " B-L475E-IOT01A1" not for sensor tile box.
As per my understanding, If am generating the C-code from the model from FP-AI-SENSING1, I should get the same code which is already in function pack.
Regards,
shankari.
2021-05-13 01:45 AM
Hi shankari @ShivaRagu ,
I'm not sure I understood your situation, but let me try to get it right
let's considerate the .c file you generated by feeding STM32CubeMX.AI with the .h5 model file and the one in the project.
you are saying that they are different, but how much are they different?
I mean that few differences are normal, because the file in the project was generated some times ago, and the version of CubeMX changed, so there could have been some tweaks and improvements in the AI files generation too.
so, if the number of inputs and outputs are good, I would try to run the code and check if it works, because the networks could be really similar.
while, if the files are much more different than what they should be, we can further investigate
Niccolò
2021-05-13 03:31 AM
Hi,
Thanks for the reply. I have attached my C-generated code file for the Acoustic scene classification from the sensing pack. Actually, If I run this code in IDE am not getting any error but after I flashed that into my device, the Bluetooth is not getting detected and am not able to connect it with my android app. That's the reason am trying to replace only the newly generated asc.c, asc_data.c and asc.h, asc_data.h into the function pack (FP-AI-SENSING1) and tried to run that code in IDE. There am getting errors.
After creating the TFlite model, I have followed the below steps in CubeMX.
Am I missing anything during C code generation.
regards,
shankari.
2021-05-17 02:50 AM
Hi any update on this.
2021-05-18 01:30 AM
Hi shankari @ShivaRagu ,
when you build your project like that it is normal that you can't connect to bluetooth, because you did not initialized it.
if you want, you can try to add the bluenrg-2 drivers in cubeMX (similar to what you did with cubeMX.AI) and do it from scratch.
this way you should probably need to look into ST youtube channel for tutorials that can help you in your tasks.
you can also add drivers and folloe the initialization of the FP-AI-SENSING1example, but it is not so easy.
the other option you are following can be the easier one, depending on your coding knowledge.
using FP-AI-SENSING1 as the base for your code, you should be able to understand where the sound signal path flows and where you should pick it up to feed it to your network.
this is a hard task, but I know you can do it.
Niccolò
2021-05-18 03:19 AM
Thanks Niccolo. Did you check the code file which I have shared? Why there is difference in the code for the same model? I understand the C-code generated in the function pack was used by TFlite model. Even I have used the same model from FP-AI-SENSING1 Pack and generated the code I can see the difference in the code.
Am trying to generate the C-code for ASC Tflite model and trying to replace only the .h file and .c file into the function pack and was testing whether I can flash the same into the Sensor Tile Box. But after replacing the files into function pack am getting the error(attached file) IN Stm32Cube IDE.
Hope you can understand my problem.
Also, If I can do from scratch for Microphone I don't see any option to select the sensors in Mem1 components in MX where as its only available for other sensors like accelerometer, gyrometer, etc... What Could I do the Audio Scene? which sensor I will select in MX?
Regards,
shankari.
2021-05-19 01:53 AM
Hi shankari @ShivaRagu ,
first, can I ask you which version of CubeMX.AI you are using?
the difference could be caused by the version of the software pack you are using.
can you show me the difference so I can check it?
[Am trying to generate the C-code for ASC Tflite model and trying to replace only the .h file and .c file into the function pack and was testing whether I can flash the same into the Sensor Tile Box. But after replacing the files into function pack am getting the error(attached file) IN Stm32Cube IDE.]
--> the problem seems to arise with the number of inputs of the network. are yours the same as the ASC network?
Niccolò
2021-05-19 10:53 PM
Hi Niccolò,
Please see my replies below.
First, can I ask you which version of CubeMX.AI you are using?----STM32CubeMX 6.2.0, I have already attached the difference. Attaching again for your reference. In this attachment(Working on MX and IDE) if you check the last image(IDE screenshot) you can see the error in my asc.c file.
The ASC model which I used is from the Function Pack. So, I don't think so the number of inputs of the networks will change.
Regards,
shankari.
2021-05-21 07:44 AM
Hi shankari @ShivaRagu ,
I think I did not fully understand the problem.
does the error presents when you try to create a new project using the tflite file from FP-AI-SENSiNG-1?
if I open your project and try to use the network from FP-AI-SENSING1 I see no errors
Niccolò
2021-05-22 05:48 AM
Hi Niccolo,
Thanks. I changed the MX version into 5.4 and X-CUBE-AI Version into 4.1 and then I uploaded the TFlite model from FP-AI-SENSING1 Pack and it got worked.
Actually am trying to do the ASC from function pack from the model creation to C code creation. When I do the model creation, am getting error while converting from keras model into TFlite model. Below is the link for the code. Am not doing anything new, to understand the procedure am doing these from model creation. Can I get some solution for this error?
file:///C:/Users/t591/Desktop/Magikword%20Project/en.fp-ai-sensing1/STM32CubeFunctionPack_SENSING1_V4.0.3/Utilities/AI_Ressources/Training%20Scripts/ASC/acoustic_scene_classification.html
Regards,
shankari.