pycharm / TensorFlow · 2024年11月19日

查看tflite文件的输入和输出

import tensorflow as tf

print(tf.__version__)
interpreter = tf.lite.Interpreter(model_path=r'E:\Python\YOLO11test\YOLO11test\model\obb\best_s_saved_model\best_s_float16.tflite')
print(interpreter.get_input_details())
print(interpreter.get_output_details())
JavaScript

输出内容

2024-11-19 16:30:34.119492: I tensorflow/core/util/port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2024-11-19 16:30:35.901411: I tensorflow/core/util/port.cc:153] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2.18.0
[{'name': 'inputs_0', 'index': 0, 'shape': array([  1, 640, 640,   3], dtype=int32), 'shape_signature': array([  1, 640, 640,   3], dtype=int32), 'dtype': <class 'numpy.float32'>, 'quantization': (0.0, 0), 'quantization_parameters': {'scales': array([], dtype=float32), 'zero_points': array([], dtype=int32), 'quantized_dimension': 0}, 'sparsity_parameters': {}}]
[{'name': 'Identity', 'index': 1894, 'shape': array([   1,   12, 8400], dtype=int32), 'shape_signature': array([   1,   12, 8400], dtype=int32), 'dtype': <class 'numpy.float32'>, 'quantization': (0.0, 0), 'quantization_parameters': {'scales': array([], dtype=float32), 'zero_points': array([], dtype=int32), 'quantized_dimension': 0}, 'sparsity_parameters': {}}]
JavaScript