【问题标题】:TFLite Interpreter fails to load quantized model on AndroidTFLite Interpreter 无法在 Android 上加载量化模型
【发布时间】:2023-03-21 21:08:01
【问题描述】:

我有一个 TFLite 模型。模型输入是一个 256x192 的图像,它被量化为 16 位。它是用这个转换器量化的:

converter.optimizations = [tf.lite.Optimize.DEFAULT]
converter.target_spec.supported_types = [tf.float16]
tflite_model = converter.convert()

我正在尝试将其加载到我的 android 应用程序中,并在执行 tflite = new Interpreter(tfliteModel, tfliteOptions); 时遇到以下问题:

E/AndroidRuntime: FATAL EXCEPTION: CameraBackground
    Process: android.example.com.tflitecamerademo, PID: 7943
    java.lang.IllegalArgumentException: Internal error: Cannot create interpreter: Unimplemented data type FLOAT16 (1) in tensor
    Unimplemented data type FLOAT16 (1) in tensor

我可以尝试什么来解决它?

谢谢

【问题讨论】:

    标签: android android-studio tensorflow quantization tensorflow-lite


    【解决方案1】:

    编辑:看起来你应该使用 tf.float16 开始 tf 2 https://www.tensorflow.org/lite/convert/1x_compatibility#unsupported_apis

    可能在github提出问题

    【讨论】:

      猜你喜欢
      • 2021-12-16
      • 1970-01-01
      • 2021-08-03
      • 1970-01-01
      • 2021-10-06
      • 1970-01-01
      • 1970-01-01
      • 2019-11-14
      • 1970-01-01
      相关资源
      最近更新 更多