-
Notifications
You must be signed in to change notification settings - Fork 46
Open
Description
Hi,
if I run the example app from flutter_vision, it works fine. However I replaced the yolov8n model with a pretrained model (it detects licens plates) and then I get the following exception:
E/flutter (19641): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: PlatformException(100, Detection Error, java.lang.IllegalArgumentException: Cannot copy to a TensorFlowLite tensor (normalized_input_image_tensor) with **270000** bytes from a Java Buffer with **1080000** bytes.
E/flutter (19641): at org.tensorflow.lite.TensorImpl.throwIfSrcShapeIsIncompatible(TensorImpl.java:416)
E/flutter (19641): at org.tensorflow.lite.TensorImpl.setTo(TensorImpl.java:140)
E/flutter (19641): at org.tensorflow.lite.NativeInterpreterWrapper.run(NativeInterpreterWrapper.java:246)
E/flutter (19641): at org.tensorflow.lite.InterpreterImpl.runForMultipleInputsOutputs(InterpreterImpl.java:133)
E/flutter (19641): at org.tensorflow.lite.Interpreter.runForMultipleInputsOutputs(Interpreter.java:80)
E/flutter (19641): at org.tensorflow.lite.InterpreterImpl.run(InterpreterImpl.java:126)
E/flutter (19641): at org.tensorflow.lite.Interpreter.run(Interpreter.java:80)
E/flutter (19641): at com.vladih.computer_vision.flutter_vision.models.Yolov8.detect_task(Yolov8.java:63)
E/flutter (19641): at com.vladih.computer_vision.flutter_vision.FlutterVisionPlugin$DetectionTask.run(FlutterVisionPlugin.java:273)
E/flutter (19641): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:487)
E/flutter (19641): at java.util.concurrent.FutureTask.run(FutureTask.java:264)
E/flutter (19641): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
E/flutter (19641): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:644)
E/flutter (19641): at java.lang.Thread.run(Thread.java:1012)
E/flutter (19641): , null)
If I investigate the model with Netron, I see the model expects the input in the format uint8, as opposed to model from the example, which expects float32. That would explain the factor 4 when comparing 270000 with 1080000 (see Exception above).
Input format from example:

Input format from my pretrained license_plate model (which throws exception above)

However I cant figure out how to convert the YUV420 Camera image from android to the expected byte buffer.
Can somebody help me, I know this is not an issue with the library, Im just basically begging for help because Im stuck.
Thanks a lot,
Daniel
Metadata
Metadata
Assignees
Labels
No labels