Caused by: java.lang.IllegalArgumentException: Label number 6 mismatch the shape on axis 1 afted deploying my own model

Viewed 303

Hello I am trying to build an android image classification project with tflite model to classify chess pieces. I have trained my model and deployed the tflite model as well as the label map in the assets folder in my android project but I get this error: Caused by: java.lang.IllegalArgumentException: Label number 6 mismatch the shape on axis 1 .

I have indeed six classes because of the number of the chess pieces. I tried the app with different model and labelmap and the application works. I do not know where I have made mistake. My labelmap does not have empty rows or extra classes. This is the tflite file: https://www.pastefile.com/a44ydg And this is my labelmap file: https://www.pastefile.com/9rg9v7 I can provide the whole app if needed, but again this happens only with this model.

P.S. This is the whole error log from android studio: https://pastebin.com/bxdq9x1r

1 Answers

Can you double check the 4 outputs in your model (https://www.pastefile.com/a44ydg) to see if shapes match the 6 labels?

I use netron to inspect your model, but couldn't know shapes of outputs.

You may refer to the page to know what 4 outputs 'TFLite_Detection_PostProcess', 'TFLite_Detection_PostProcess:1', 'TFLite_Detection_PostProcess:2', and 'TFLite_Detection_PostProcess:3 are.

Related