Arduino Nicla Vision image classification error

Hi, I am using a Nicla Vision to perform binary image classification but experiencing the following error:

Exception: Failed to load "trained.tflite", did you copy the .tflite and labels.txt file onto the mass-storage device? (Out of fast frame buffer stack memory)

The files are well in place. The face detection example works perfectly, so I suppose the hardware is fine. Of course, after reading the error I figured memory could be the issue, but wouldn’t an object detector take more memory than a simple image classifier?

My model is a general CNN with [96, 96, 3] input (I previously had trained with input [224, 224, 3], but I experienced the same issue). I’m trying OpenMV library for deployment on Edge Impulse.

When I used OpenMV firmware, I get the following error:

ValueError: Failed to allocate tensors

Regards,
PC

Hi, how are you generating the model? The Nicla has very limited RAM. Typically, you need to build the model into the flash.

Hi, I am training and quantising my model independently using Keras, outside Edge Impulse. Actually, I started this project for Raspberry Pi so I am keen on recycling my models.

I understand that a larger input like [224, 224, 3] might be too much for Nicla Vision so I have retrained a few models with a smaller input, so experimentally finding how small should it be. [54, 54, 3] seems to be working fine as of now but the performance is dropped quite a lot (from 96% to 72%). Any way we can improve on this?

“Typically, you need to build the model into the flash.” do you mean use the bootloader method? I tried that too and encountered “ValueError: Failed to allocate tensors”.

Much appreciate your support!

PC

Hi, since the Nicla doesn’t have an SD card slot I imaging you built the model into flash right? It’s not stored on the internal FAT file system but instead built into the firmware? Edge Impulse makes it possible to do this which saves having to load the model into the limited RAM.

Hi, sorry for the delay in my response.

Yes, it’s on flash. I figured the limitations of Nicla over the weekend. My models work pretty smoothly when the input is 44x44 (as recommended by official tutorials), just wanted to see if it’s anyway possible to increase that. No worries if can’t :slight_smile:

Regards,
PC

Yeah, the Nicla has a very limited amount of internal RAM.