Error using TFlite model in Android Studio

I’m trying to use a Custom Object Detection Model in Android Studio but facing the following error:

java.lang.IllegalArgumentException: Error occurred when initializing ObjectDetector: Mobile SSD models are expected to have exactly 4 outputs, found 1

@Mohit,

Could you please share complete standalone code to debug your issue?

Thank you!

I’m using Object Detection Example from Tensorflow Lite:

All I’ve changed is that I am trying to use my own Custom Object Detection Model trained using YOLOv5. It is in .tflite format but it seems something is incompatible with Android

Thank you!

@Mohit,

Please check the input and output shapes of the model and make sure they are matching with model requirements. Also from the error log it seems that Mobile SSD is used instead of YOLO.

Thank you!