Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android TensorFlow Lite:使用Mobilenet_V2配料_Android_Tensorflow_Kotlin_Tensorflow Lite - Fatal编程技术网

Android TensorFlow Lite:使用Mobilenet_V2配料

Android TensorFlow Lite:使用Mobilenet_V2配料,android,tensorflow,kotlin,tensorflow-lite,Android,Tensorflow,Kotlin,Tensorflow Lite,我想用TensorFlow Lite中的Mobilenet_V2_1.0_224进行批处理 我尝试了这个答案),但这只适用于《盗梦空间》V4 当我尝试为Mobilenet使用批量大小>1(在本例中为批量大小2)时,我得到以下错误: ComposedException 1 : java.lang.NullPointerException: Internal error: Cannot allocate memory for the interpreter: tensorflow/con

我想用TensorFlow Lite中的Mobilenet_V2_1.0_224进行批处理

我尝试了这个答案),但这只适用于《盗梦空间》V4

当我尝试为Mobilenet使用批量大小>1(在本例中为批量大小2)时,我得到以下错误:

  ComposedException 1 :
    java.lang.NullPointerException: Internal error: Cannot allocate memory for the interpreter: tensorflow/contrib/lite/kernels/reshape.cc:68 num_input_elements != num_output_elements (2002 != 1001)Node 64 failed to prepare.

    at org.tensorflow.lite.NativeInterpreterWrapper.allocateTensors(Native Method)
    at org.tensorflow.lite.NativeInterpreterWrapper.run(NativeInterpreterWrapper.java:118)
    at org.tensorflow.lite.Interpreter.runForMultipleInputsOutputs(Interpreter.java:168)
    at org.tensorflow.lite.Interpreter.run(Interpreter.java:145)
编辑: 这是导致此错误的tflite代码:

    DIM_BATCH_SIZE = 4
    var tfliteOptions: Interpreter.Options = Interpreter.Options()
    tfliteOptions.setUseNNAPI(true)
    var interpreter = Interpreter(loadModelFile(assetManager, "mobilenet_v2_1.0_224.tflite")!!, tfliteOptions)    
    interpreter!!.resizeInput(0,intArrayOf(DIM_BATCH_SIZE,224,224,3))

    interpreter!!.run(imgData, labelProb)

imgData是一个包含预处理图像的ByteBuffer,用于预测的labelProb浮点数组。

请提供导致此错误的代码。@NupurGarg我编辑了postHey@rossp你找到了此错误的解决方案吗?@harshithdwivedi没有,很遗憾没有。这是你的问题吗