Size of .tflite models in OpenMV H7 Plus

Regarding the OpenMV H7 Plus, do you have an approximate measure of the size of a .tflite model for it to perform well on the camera? I ask because in my case, I have an image classification model weighing 4 MB, and the camera runs it at a speed of 2 FPS, making it quite unfeasible to use on the OpenMV. I’ve loaded it using ‘load_to_fb = True’ as explained in other conversation I saw.

Mainly, I’m writing to inquire if there’s any way to make it run faster or if I inevitably have to find a way to make the model smaller. If so, what size range of the model would be decent for the camera to run faster (for instance, achieving around 10 fps)?

Thanks in advance!

It really just comes down to size.

Question: an image classification model of 4MB is extremely large. You should be able to make that model much smaller after converting it to int8.

Is it a floating point model?

Yes, it’s int8. The original .h5 model before converting it to .tflite weighs 50 MB. This model comes from applying a Transfer Learning process on MobilenetV2, but I kept the training image size at 150x150x3. By setting the images to 96x96x3 and slightly reducing the complexity of the model used for fine-tuning, the size should be significantly reduced.

In any case, I now understand that the 4 MB model is excessively large for the camera, and I need to make it much smaller. I thought that with the approximately 33 MB of memory the camera has, I could use my 4 MB model without any issues.

Thank you very much for your quick response.

Yeah, it’s just about processing all the weights. That still has to be done.

The 4MB isn’t actually the problem. It’s just how many ops are you doing with them. Some tools like Edge Impulse tell you how many operations you are doing which will then inform you how long it takes the CPU to run things.

Ok, I see. Thank you very much!