Error while using tf.segment

I am running a image segmentation algorithm on OpenMV CAM H7 and currently I am facing two problems.

  1. When the neural network model contains Sigmoid activation function, there would be an error message says

OSError: Didn’t find op for builtin opcode ‘LOGISTIC’ version ‘1’. An older version of this builtin might be supported. Are you using an old TFLite binary with a newer model?

I’ve also tested other activations, it seems like Relu, Linear and Softmax is available, Tanh has the same problem.

The firmware I am using is 4.3.1. I’ve read the doc of openmv and I know this might be an issue with the tflite operator version. But I didn’t find solutions on the tflite website about how to set the operator version.

  1. The second problem is the output of tf.segment is completely different from output on the pc.

I’ve tested both fully quantized and non quantized model, the situation is the same.

The network input size is (80, 60), ranging from 0 to 1, and I’ve set the frame size to QQQVGA. The network output has only one channel of size (20, 10), ranging from 0 to 1 (might be slightly greater than 1 because I used ReLU instead of Sigmoid as activation)

The code I’m using is

net = tf.load(‘net.tflite’)
_____img = sensor.snapshot()
_____output = net.segment(img, detecting_mode=False)
_____mask = output[0]

because the source code of tf.segment indicates if we pass the detecting_mode=False parameter, it will directly output the network calculation result.

I don’t know what kind of operations are performed before and after the network calculation, how can I fix it?

Anything helps, great thanks.

Hi, this feature works with EdgeImpule’s FOMO network. That what it was designed for.

Supported ops are here: tensorflow-lib/ at master · openmv/tensorflow-lib · GitHub

The segment code is here:

What that parameter is doing is basically causing the method to output the raw segmentation image versus doing blob detection on the segmented image.