So i have trained a YOLOv8 object Detection model with 10 classes and 30 epochs and converted it into a tflite format with this code
from ultralytics import YOLO
model = YOLO("yolov8n.pt")
model.export(format="tflite")
after importing this model in the android studio
File->New->Others->import tflite model
I received this code
val model = BestFloat32.newInstance(context)
// Creates inputs for reference.
val image = TensorImage.fromBitmap(bitmap)
// Runs model inference and gets result.
val outputs = model.process(image)
val output = outputs.outputAsCategoryList
// Releases model resources if no longer used.
model.close()
so how do i obtain my class scores and coordinate form it
model info image after importing
i have tried to print the
- outputs by ==>
outputs.outputAsTensorBuffer.toString()
but it gave me a hexadecimal type value - outputs by ==>
outputs.outputAsTensorBuffer.floatArray.toString()
but it still gave me a mix of alphabets and number - outputs by ==>
outputs.outputAsTensorBuffer.floatArray[i].toString()
where if I keepi
any value some floating points are generated
and when ever i print output = outputs.outputsAsCategoryList
i receive an error
java.lang.IllegalArgumentException: Label number 1 mismatch the shape on axis 1
how do i fix this ?