Я пытаюсь выполнить вывод, используя Tflite Model of Multi-Lightning-tflite-float16, распределенную Movenet. resize_input_tensor, прежде чем запустить Allocate_tensor. Я хотел бы использовать модель с фиксированной формой ввода, так что есть способ сохранить модель после запуска RESIZE_INPUT_TENSOR или исправить входной тензор без RESIZE_INPUT_SHAPE? < /P>
# -->> https://www.kaggle.com/models/google/movenet/tfLite
TFLITE_FILE_PATH = "/home/debian/sandbox/movenet/python/tflite/1.tflite"
interpreter = tf.lite.Interpreter(TFLITE_FILE_PATH)
input_details = interpreter.get_input_details()
output_details = interpreter.get_output_details()
print(input_details)
print(output_details)
is_dynamic_shape_model = input_details[0]['shape_signature'][2] == -1
if is_dynamic_shape_model:
input_tensor_index = input_details[0]['index']
input_shape = input_image.shape
interpreter.resize_tensor_input(input_tensor_index, input_shape, strict=True)
## -->> I WANT TO SAVE MODEL HERE.
interpreter.allocate_tensors()
interpreter.set_tensor(input_details[0]['index'], input_image.numpy())
interpreter.invoke()
keypoints_with_scores = interpreter.get_tensor(output_details[0]['index'])
keypoints_with_scores = np.squeeze(keypoints_with_scores)
< /code>
[{'name': 'serving_default_input:0', 'index': 0, 'shape': array([1, 1, 1, 3], dtype=int32), 'shape_signature': array([ 1, -1, -1, 3], dtype=int32), 'dtype': , 'quantization': (0.0, 0), 'quantization_parameters': {'scales': array([], dtype=float32), 'zero_points': array([], dtype=int32), 'quantized_dimension': 0}, 'sparsity_parameters': {}}]
[{'name': 'StatefulPartitionedCall:0', 'index': 536, 'shape': array([ 1, 6, 56], dtype=int32), 'shape_signature': array([ 1, 6, 56], dtype=int32), 'dtype': , 'quantization': (0.0, 0), 'quantization_parameters': {'scales': array([], dtype=float32), 'zero_points': array([], dtype=int32), 'quantized_dimension': 0}, 'sparsity_parameters': {}}]
Подробнее здесь: https://stackoverflow.com/questions/795 ... erpreter-r
Как я могу сохранить модель TFLITE с фиксированной формой ввода после использования интерпретатора.resize_input_tensor? ⇐ Python
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение