Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File "/usr/local/lib/python3.8/dist-packages/tensorflow/lite/python/interpreter.py", line 915, in invoke self._interpreter.Invoke() RuntimeError: tensorflow/lite/kernels/concatenation.cc:158 t->dims->data[d] != t0->dims->data[d] (1 != 2)Node number 304 (CONCATENATION) failed to prepare. #574

Open
Mayi-Keiji opened this issue Aug 22, 2023 · 0 comments

Comments

@Mayi-Keiji
Copy link

Mayi-Keiji commented Aug 22, 2023

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:
image
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)
'''
`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant