Skip to content

Error occurred when initializing ObjectDetector: AllocateTensors() failed. #10251

@yangqinjiang

Description

@yangqinjiang

Search before asking

Question

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

image

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

image

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

Additional

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    StaleStale and schedule for closing soonquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions