flutter_tflite
flutter_tflite copied to clipboard
Is it possible to get prediction detail for each label in RunModelOnImage method?
is it possible to get prediction detail for each label in RunModelOnImage ? for example output like: { output : [ { index: 0, label: "person", confidence: 0.65 }, { index: 1, label: "car", confidence:0.15, }, { index: 2, label: "bicycle", confidence: 0.2" } ] }
Thanks
Hello!
You could try to ask for as many results as labels you have. For example, if you have 3 labels ask for 3 results:
var recognitions = await Tflite.runModelOnImage(
path: image.path,
numResults: 3,
threshold: 0.05,
imageMean: 127.5,
imageStd: 127.5,
);
Hope it works!
Hello!
You could try to ask for as many results as labels you have. For example, if you have 3 labels ask for 3 results:
var recognitions = await Tflite.runModelOnImage(
path: image.path,
numResults: 3,
threshold: 0.05,
imageMean: 127.5,
imageStd: 127.5,
);
Hope it works!
Thanks for answering, apreciate it,
I already ask for 3 result but still get the same output, which not resulting output like in my question.
here's my code :
static Future classifyImage(File image) async {
final output = await Tflite.runModelOnImage(
path: image.path,
numResults: 3,
threshold: 0.5,
imageMean: 127.5,
imageStd: 125.5,
);
return output;
}
and the output : [{confidence: 1.0, index: 2, label: pneumonia}]
You can lower your minimal confidence/threshold, 0.0 will return everything.