The bug of OpenMV cam H7 when using Edge impulse

Hello, everyone:
I trained two different models, and to be honest, I don’t think it’s the Edge impulse.First of all, the two models I trained were completely different. Their trained.tflite sizes were different.
The size of trained.tflite of model A is 625k, and the size of trained.tflite of model B is 56kb. The cause of the problem is that I trained model A on impulse, but to my surprise, there were bugs in the operation,The IDE prompt is" 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! Please reduce the resolution of the image you are running this algorithm on to bypass this issue!) ".
After two days of debugging and asking for help in others forums , I got very little useful information.I personally found a problem after testing, the argument results are as follows:

I’m running my model B (56kb) because Model B is small so it can run without a memory card

The quiz begins:
I will use model B(56kb) (containing:ei_object_detection.py and labels.txt and trained.tflite)Download it into the tf card, plug it into openmv and run ei_object_detection.py It works fine.
Again, I’m going to take model A (625kb) (containing:ei_object_detection.py and labels.txt and trained.tflite)Download it into the tf card, plug it into openmv and run ei_object_detection.py the IDE report an error like before.

So why will the same operation report an error?And I’ve plugged in the memory card.
And please take note of the above:" I’m running my model B (56kb) because Model B is small so it can run without a memory card "

Therefore, Whether or not it is only possible to run when the size of the model is smaller than the capacity of Openmv without the memory card.If so, what do you need a memory card slot for?

As for the bug problem, it seems that I haven’t found a way to solve my current problem through the previous answers to similar problems of others.
For example:https://forums.openmv.io/t/openmv-bug/5762/2

Although the training failure problem in this article does not occur, Openmv’s IDE still reports errors anyway.Hope a good solution.

best,

Eilic

Hi, the error is literally what is said by the IDE. The 625kb model doesn’t fit in RAM. It can’t even be loaded to execute as it’s too large. The OpenMV Cam H7 only has 400 Kb of RAM for it’s frame buffer and image processing operations.

You need the h7 Plus to run a model that large.

The 56kb model runs as that fits and can be loaded.

As for memory layout… So, there’s a 400 Kb frame buffer plus about 96kb of RAM for a frame buffer stack and runs into the frame buffer. So, you have about 496kb in total.

The image uses up part of the frame buffer memory. Note that we try to triple buffer the image by default to get you the best performance if the resolution is small. So, if you want to free up RAM you should do: sensor.set_framebuffers(1) to force the camera not to do this (at the cost of a performance impact).

Then, after the image being stored, we have to store the network, and then the activation buffers of the network which could be significant.

Hello
I added ‘’ sensor.set_framebuffers(1) ‘’ to the py file and re-ran the code, but that didn’t solve the problem.

What’s more, you said to change it to Openmv cam H7 Plus, but I just bought Openmv cam H7 less than a month, I have to buy another Openmv cam H7 Plus, to be honest, this is very unreasonablethe.So I don’t think about that for a while

So, isn’t there a way to achieve a working model by reducing the effect?

looking forward to your reply !

Hi, there’s no solution to fit the larger model. It doesn’t fit in RAM… I explained the issue clearly. So, you have to either get the higher end system or shrink your model.

well,thank you