'MaskRCNN TensorFlow Lite Inference Issue. No output from TFLite Model

System information

  • OS Platform and Distribution ( Ubuntu 18.04.5 LTS (GNU/Linux 5.4.0-1034-azure x86_64)):
  • TensorFlow installed from (source- Pip Install):
  • TensorFlow version (2.3.0):

Command used to run the converter

converter = tf.lite.TFLiteConverter.from_keras_model(keras_model)
converter.allow_custom_ops = True
converter.experimental_new_converter = True
converter.target_spec.supported_ops = [
    tf.lite.OpsSet.TFLITE_BUILTINS, # enable TensorFlow Lite ops.
    tf.lite.OpsSet.SELECT_TF_OPS # enable TensorFlow ops.
]

converter.optimizations = [ tf.lite.Optimize.DEFAULT ]

tflite_model = converter.convert()

link to Jupyter notebook and tflite model

https://drive.google.com/drive/folders/1pTB33fTSo5ENzevobTvuG7hN4YmiCPF_?usp=sharing

Commands used for inference

### Load the TFLite model and allocate tensors.
interpreter = tf.lite.Interpreter(model_path="model_2.3.tflite")
interpreter.allocate_tensors()

### Get input and output tensors.
input_details = interpreter.get_input_details()
output_details = interpreter.get_output_details()

### Test the model on random input data.
input_data_1 = np.array(np.random.random_sample(input_details[0]['shape']), dtype=np.float32)
input_data_2 = np.array(np.random.random_sample(input_details[1]['shape']), dtype=np.float32)
input_data_3 = np.array(np.random.random_sample(input_details[2]['shape']), dtype=np.float32)

interpreter.set_tensor(input_details[0]['index'], input_data_1)
interpreter.set_tensor(input_details[1]['index'], input_data_2)
interpreter.set_tensor(input_details[2]['index'], input_data_3)

interpreter.invoke() ---> Kernel is getting stuck here. No output. I am executing the code from jupyter.

The output from the converter invocation

No output in Jupyter.

Segmentation fault (core dumped) -- When executed in command line.

Failure details

Conversion is successful. But there is no output from model.

Could you guys please provide some ideas? I am stuck here and don't know how to proceed!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source