Проблема с выводом MaskRCNN TensorFlow Lite. Нет вывода из модели TFLite

#python #tensorflow #tensorflow-lite

#python #tensorflow #tensorflow-lite

Вопрос:

Информация о системе

  • Платформа и дистрибутив ОС (Ubuntu 18.04.5 LTS (GNU / Linux 5.4.0-1034-azure x86_64)):
  • TensorFlow установлен из (source- Pip Install):
  • Версия TensorFlow (2.3.0):

Команда, используемая для запуска конвертера

 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()
 

ссылка на записную книжку Jupyter и модель tflite

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

Команды, используемые для вывода

 ### 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.

 

Вывод из вызова конвертера

Нет вывода в Jupyter.

Ошибка сегментации (сброс ядра) — при выполнении в командной строке.

Сведения об ошибке

Преобразование выполнено успешно. Но нет вывода из модели.

Не могли бы вы, ребята, предоставить несколько идей? Я застрял здесь и не знаю, как поступить!

Комментарии:

1. Можно ли попробовать преобразовать / вывести с помощью TF2.4? Мне это не нравится CropAndResize : они помечены как «гибкие», но должны быть из tf.lite.OpsSet.SELECT_TF_OPS . TensorFlow Lite с выбранными операциями TensorFlow доступны в версии пакета TensorFlow pip начиная с версии 2.3 для Linux и 2.4 для других сред. но на всякий случай давайте попробуем обновить версию TF и без пользовательских операций: converter.experimental_new_converter = False

2. Привет, Алекс, я поднял то же самое с командой tensorflow, и они предложили запустить его с nightly, и это сработало. Спасибо