Structure of the model for tf.load()

I have a custom .tflite net that has:

  1. Input structure [1,3,32,32]
  2. Output structure [1,4]
  3. The size of the net is 5,25 MB
  4. I used the the load_to_fb = true

When I try to run a very simple code:

import os, tf
nn = tf.load(net, load_to_fb = True)
ll = nn.len()
print(ll)

the OpenMv H7 Plus crashes. A reset occurs. The green led blinks few times and then the white led blinks.

When I use a net with the structure:

  1. Input structure [1,224,224,3]
  2. Output structure [1,4]
  3. The size of the net is 8,53 MB
  4. I used the the load_to_fb = true
    Everything works without any problem.

The OpenMv H7 Plus reset could be caused by the net structure?
Do you have any advice? Should I change the net structure?

Thank you. Regards.

Hi, it would be because of a crash in the TensorFlow library. It’s not related to our code. For example, we suck the model into RAM, then we try to open it with TensorFlow. The TensorFlow library will directly read structures in the data binary and if there’s anything it can’t handle it will generally throw an error. But, there’s quite a bit of bugs in the library.

That said, we haven’t updated in over 6 months. So, we’re due to an update. I will be doing this soon to support Object Detection networks. I don’t have a fix for this right now other than to wait until I can update our TensorFlow package.

Hi,
I understand that the tf micro library, that is included in openMV, is an old release (March 2020?). This means that transpose operation is not supported, right?
In my net there are few transpose operations. Could be the reason for board crashes?

Thank you.
Regards.
Andrea.

It could be. I will be updating the library soon. However, I am dealing with getting the MT9M114 driver working so we can make H7 boards again.

Any news on this? I’m seeing a similar thing happen but using custom model on a normal OpenMV H7 board (non-plus). The .tflite file size 302848 bytes, so I don’t think it’s a RAM issue.

Yeah, we just updated the library. It should be fixed now.

Cool, will there be a formal release for the updated library?

I was able to get my custom TFL model working with f/w v4.2.1 by replacing the Keras GlobalAveragePooling2D layer with a AveragePooling2D layer, and the Reshape layer with a Flatten layer.

Yeah, probably this weekend.

1 Like

FYI we have a development release here: