check_tflite.py 738 B

12345678910111213141516171819
  1. import tensorflow as tf
  2. def check_tflite(model_path):
  3. interpreter = tf.lite.Interpreter(model_path=model_path)
  4. interpreter.allocate_tensors()
  5. input_details = interpreter.get_input_details()
  6. output_details = interpreter.get_output_details()
  7. print("--- Input Details ---")
  8. for detail in input_details:
  9. print(f"Name: {detail['name']}, Shape: {detail['shape']}, Type: {detail['dtype']}, Quantization: {detail['quantization']}")
  10. print("\n--- Output Details ---")
  11. for detail in output_details:
  12. print(f"Name: {detail['name']}, Shape: {detail['shape']}, Type: {detail['dtype']}, Quantization: {detail['quantization']}")
  13. if __name__ == "__main__":
  14. check_tflite('mobile/assets/best.tflite')