小编San*_*ndi的帖子

无法在Android应用程序中加载tflite deeplab细分模型。错误:ByteBuffer不是有效的FlatBuffer模型

在将转换后的TFLite模型加载到android应用程序时遇到问题。

型号:Deeplabv3 Mobilenetv2(在Pascal VOC上进行了培训)TFLite版本:1.10

使用tflite_convert将pb文件转换为tflite。(Tensorflow版本:1.11.0)

码:

private MappedByteBuffer loadModelFile(AssetManager assets, String modelFilename)
      throws IOException {
    AssetFileDescriptor fileDescriptor = assets.openFd(modelFilename);
    FileInputStream inputStream = new FileInputStream(fileDescriptor.getFileDescriptor());
    FileChannel fileChannel = inputStream.getChannel();
    long startOffset = fileDescriptor.getStartOffset();
    long declaredLength = fileDescriptor.getDeclaredLength();
    return fileChannel.map(FileChannel.MapMode.READ_ONLY, startOffset, declaredLength);
  }

  /**
   * Initializes a native TensorFlow session for classifying images.
   *
   * @param assetManager The asset manager to be used to load assets.
   * @param modelFilename The filepath of the model GraphDef protocol buffer.
   */
  public static Segmentor create( …
Run Code Online (Sandbox Code Playgroud)

android semantic-segmentation tensorflow-lite deeplab

5
推荐指数
0
解决办法
888
查看次数