Open syeds-git opened 3 years ago
Hello! Could you find out what the problem is?
can anyone solved this problem?
i am getting error like
[ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: PlatformException(Failed to run model, null, java.nio.BufferOverflowException
E/flutter (30792): at java.nio.Buffer.nextPutIndex(Buffer.java:542)
E/flutter (30792): at java.nio.DirectByteBuffer.putFloat(DirectByteBuffer.java:802)
E/flutter (30792): at sq.flutter.tflite.TflitePlugin.feedInputTensor(TflitePlugin.java:349)
E/flutter (30792): at sq.flutter.tflite.TflitePlugin.feedInputTensorImage(TflitePlugin.java:371)
E/flutter (30792): at sq.flutter.tflite.TflitePlugin$RunModelOnImage.
Also having this issue. It runs fine on the simulator, and on device when in debug mode. But when you run in release mode / upload to the store nothing is detected
I had this same issue, and I found that assertions are turned off in release mode, so if you were following an example from Stack overflow that placed the model loading in an assertion as in:
assert(await Tflite.loadModel(
model: modelFile.path,
labels: fullPath,
numThreads: 1, // defaults to 1
isAsset:
false, // defaults to true, set to false to load resources outside assets
useGpuDelegate:
false // defaults to false, set to true to use GPU delegate
) ==
'success');
This will not work in release mode
Change to something like and surround with try catch:
var result = await Tflite.loadModel(
model: modelFile.path,
labels: fullPath,
numThreads: 1, // defaults to 1
isAsset:
false, // defaults to true, set to false to load resources outside assets
useGpuDelegate:
false // defaults to false, set to true to use GPU delegate
);
return result;
Hi,
I created a TFLite model using google's teachable machine. It is sort of working in the debug version of the flutter app. The only problem is that it finds a lot of false positives along with the true one's. But I think this could be an issue with the model itself. As long as it is finding anything I think the plugin is fine.
However, the model does not work when I use a signed release version of my app which I installed on my device using the bundletool. I don't get any crashes or any error's in the logs. My logs just print that no recognitions happened or return empty response from the tflite recognition code whereas it finds a lot more recognitions while in the debug mode. Can you please let me know what could have gone wrong between the debug and release version? also if there are any special steps that need to be carried out while in release?
Thanks
UPDATE
Digging further, I ran the app in profile mode and found following logs (Note: These only show up in profile mode so I am not sure how far it is from the release version. Also, I don't get these error when running in debug):
As I don't see the behavior in debug mode, I am still confused on what is going on in the app when running the release version.