tflite-support
tflite-support copied to clipboard
Error occurred when initializing ObjectDetector: AllocateTensors() failed.
I used the PT file trained by yolov5, converted it to tflite file, and ran it with the official android code. An error was reported
java.lang.IllegalStateException: Error occurred when initializing ObjectDetector: AllocateTensors() failed. at org.tensorflow.lite.task.vision.detector.ObjectDetector.initJniWithModelFdAndOptions(Native Method)
the tflite added metadata by https://github.com/ultralytics/yolov5
tflite file see attach files: assets.zip

the command:
cd yolov5 dir; python3 export.py --weight runs/train/exp4/weights/best.pt --include tflite --int8 --nms --agnostic-nms --data /mnt/yolov5-beev2/bee-linux.yaml --imgsz 320
the android code, like ImageClassifier https://github.com/tensorflow/examples/tree/master/lite/examples/image_classification/android_java

But when I run it, I get an error assets.zip
Can someone help me with this problem? !! 3q I'll show you the source code. android_java.zip
May you please try if the model works with TFLite Interpreter? You can feed some dummy input to see if it can run. Once it's verified, we can further debug it from Task Library side.