Error while using flutter_tflite package Error: Run with org.tensorflow.lite.Interpreter.getInputTensor(int)' on a null object reference #123148
Replies: 2 comments
This comment was marked as off-topic.
This comment was marked as off-topic.
-
Thanks for you answer at least i have a new error now , so hopefully it fixed one problem ! The new error log: |
Beta Was this translation helpful? Give feedback.
-
Body
I have a Flutter project in which an image is stored as a jpeg on the local storage. However, I always get an error as soon as I try to run the tflite model on the image. I would appreciate some help!
Kind regards!
Log with Error:
Performing hot restart...
Syncing files to device sdk gphone x86...
Restarted application in 847ms.
E/flutter ( 6884): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(Failed to run model, Attempt to invoke virtual method 'org.tensorflow.lite.Tensor org.tensorflow.lite.Interpreter.getInputTensor(int)' on a null object reference, java.lang.NullPointerException: Attempt to invoke virtual method 'org.tensorflow.lite.Tensor org.tensorflow.lite.Interpreter.getInputTensor(int)' on a null object reference
E/flutter ( 6884): at sq.flutter.flutter_tflite.TflitePlugin.feedInputTensor(TflitePlugin.java:368)
E/flutter ( 6884): at sq.flutter.flutter_tflite.TflitePlugin.feedInputTensorImage(TflitePlugin.java:430)
E/flutter ( 6884): at sq.flutter.flutter_tflite.TflitePlugin.detectObjectOnImage(TflitePlugin.java:624)
E/flutter ( 6884): at sq.flutter.flutter_tflite.TflitePlugin.onMethodCall(TflitePlugin.java:157)
E/flutter ( 6884): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:267)
E/flutter ( 6884): at io.flutter.embedding.engine.dart.DartMessenger.invokeHandler(DartMessenger.java:295)
E/flutter ( 6884): at io.flutter.embedding.engine.dart.DartMessenger.lambda$dispatchMessageToQueue$0$io-flutter-embedding-engine-dart-DartMessenger(DartMessenger.java:322)
E/flutter ( 6884): at io.flutter.embedding.engine.dart.DartMessenger$$ExternalSyntheticLambda0.run(Unknown Source:12)
E/flutter ( 6884): at android.os.Handler.handleCallback(Handler.java:938)
E/flutter ( 6884): at android.os.Handler.dispatchMessage(Handler.java:99)
E/flutter ( 6884): at android.os.Looper.loop(Looper.java:223)
E/flutter ( 6884): at android.app.ActivityThread.main(ActivityThread.java:7656)
E/flutter ( 6884): at java.lang.reflect.Method.invoke(Native Method)
E/flutter ( 6884): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
E/flutter ( 6884): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
E/flutter ( 6884): , null)
E/flutter ( 6884): #0 StandardMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:651:7)
E/flutter ( 6884): #1 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:322:18)
E/flutter ( 6884):
E/flutter ( 6884): #2 Tflite.detectObjectOnImage (package:flutter_tflite/flutter_tflite.dart:113:12)
E/flutter ( 6884):
E/flutter ( 6884): #3 detectPeople (package:security_system_software/ai/ai_recognition.dart:12:22)
E/flutter ( 6884):
E/flutter ( 6884): #4 _GalleryState.SideBar. (package:security_system_software/pages/gallery.dart:82:16)
E/flutter ( 6884):
E/flutter ( 6884):
Just so you guys know i included aaptOptions and i properly loaded model and label at least in my opinion.
Guidelines
Beta Was this translation helpful? Give feedback.
All reactions