Hi ,
I face a problem when complete the training with UNET + efficientnetb0 and convert the trained model to tflite format, I can convert it to tflite format, but after I call the invoke function, it raise an error as the title.
My envs like:
OS Platform and Distribution (e.g., Linux Ubuntu 20.04):
TensorFlow installation (2.9.1+nv22.9):
Error code in tflite as below:
``import numpy as np
import tensorflow as tf
Hi , I face a problem when complete the training with UNET + efficientnetb0 and convert the trained model to tflite format, I can convert it to tflite format, but after I call the invoke function, it raise an error as the title.
My envs like: OS Platform and Distribution (e.g., Linux Ubuntu 20.04): TensorFlow installation (2.9.1+nv22.9):
Error code in tflite as below: ``import numpy as np import tensorflow as tf
def main():
interpreter = tf.lite.Interpreter(model_path="model.tflite") interpreter.allocate_tensors()
input_details = interpreter.get_input_details() output_details = interpreter.get_output_details()
input_shape = input_details[0]['shape'] input_data = np.array(np.random.random_sample(input_shape), dtype=np.float32) interpreter.set_tensor(input_details[0]['index'], input_data)
signatures = interpreter.get_signature_list() print(signatures)
interpreter.invoke() return
output_data = interpreter.get_tensor(output_details[0]['index']) print(output_data) if name == 'main': main()
My model code is as below:
` ''' BACKBONE = 'efficientnetb0' BATCH_SIZE = 1 CLASSES = ["background", "target", "others"] LR = 0.0001 EPOCHS = 10
preprocess_input = sm.get_preprocessing(BACKBONE)
n_classes = 1 if len(CLASSES) == 1 else (len(CLASSES) + 1) # case for binary and multiclass segmentation activation = 'sigmoid' if n_classes == 1 else 'softmax'
model = sm.Unet(BACKBONE, classes=n_classes, activation=activation) ''' `