tensorflow / tensorflow/tflite-support
Error occurred when initializing ObjectDetector: AllocateTensors() failed.
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 441
- Forks
- 146
- PR merge metrics
- No merged PRs in 30d
Description
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
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the YOLOv5 export.py command and the Android ImageClassifier example referenced in the issue. Inspect assets.zip and android_java.zip, then reproduce the AllocateTensors() failure with the supplied TFLite model. Done means the exported model initializes successfully through the official Android ObjectDetector code.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- android, java, python
- Domain
- machine-learning, mobile-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100