tflite_flutter_helper icon indicating copy to clipboard operation
tflite_flutter_helper copied to clipboard

Cannot find an axis to label. A valid axis to label should have size larger than 1.

Open SmiffyKMc opened this issue 2 years ago • 0 comments

I'm trying to set up my custom hotdog classifier using this library. I have transformed my model to a tflite model and extracted labels [hotdog, nothotdog]. I am able to confirm my input shape is [1, 300, 300, 3] and my output [1, 1]. When I chose the image to predict I'm getting the error:

E/flutter ( 5277): [ERROR:flutter/lib/ui/ui_dart_state.cc(198)] Unhandled Exception: Invalid argument(s): Cannot find an axis to label. A valid axis to label should have size larger than 1.
E/flutter ( 5277): #0      TensorLabel.getFirstAxisWithSizeGreaterThanOne (package:tflite_flutter_helper/src/label/tensor_label.dart:173:5)
E/flutter ( 5277): #1      new TensorLabel.fromList (package:tflite_flutter_helper/src/label/tensor_label.dart:81:18)
E/flutter ( 5277): #2      Classifier.predict (package:hotdog_classifier/classifier.dart:106:51)
E/flutter ( 5277): #3      _MyHomePageState._predict (package:hotdog_classifier/main.dart:68:28)
E/flutter ( 5277): #4      _MyHomePageState.getImage.<anonymous closure> (package:hotdog_classifier/main.dart:62:7)
E/flutter ( 5277): #5      State.setState (package:flutter/src/widgets/framework.dart:1109:30)
E/flutter ( 5277): #6      _MyHomePageState.getImage (package:hotdog_classifier/main.dart:58:5)

There isn't much documentation to show users how to use their own models for classification. But is anyone able to help me with my issue?

SmiffyKMc avatar May 31 '22 20:05 SmiffyKMc