List? outputs;
String? brainResult;
late double confidence;
classifyImage( image) async {
var output = await Tflite.runModelOnImage(
path: image.path,
).then((value){
print("predict = "+value.toString());
outputs = value;
confidence=value![0]["confidence"];
if(value[0]["index"]==0){
brainResult="Positive Brain tumor";
}
else{
brainResult="Nigative Brain tumor";
}
emit(ClassificationSuccess());
}).catchError((error){
print("Error of class is ${error.toString()}");
});
}
this function to make classify
List<Media> selectedimages=[];
void selectImages() {
Future _listImagePaths = ImagePickers.pickerPaths(
galleryMode: GalleryMode.image,
selectCount: 5,
showGif: false,
showCamera: true,
compressSize: 500,
uiConfig: UIConfig(uiThemeColor: Color(0xffff0f50)),
cropConfig: CropConfig(enableCrop: false, width: 2, height: 1)).then((value){
value.forEach((element) {
classifyImage(element);
});
});
}
this function to get images and make classify
i get this error for all picture except last one
PlatformException(Failed to run model, Interpreter busy, java.lang.RuntimeException: Interpreter busy
while select 2 picture
I/flutter ( 2193): Error of class is PlatformException(Failed to run model, Interpreter busy, java.lang.RuntimeException: Interpreter busy
I/flutter ( 2193): at sq.flutter.tflite.TflitePlugin$TfliteTask.(TflitePlugin.java:450)
I/flutter ( 2193): at sq.flutter.tflite.TflitePlugin$RunModelOnImage.(TflitePlugin.java:488)
I/flutter ( 2193): at sq.flutter.tflite.TflitePlugin.onMethodCall(TflitePlugin.java:105) I/flutter ( 2193): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:262)
I/flutter ( 2193): predict = [{confidence: 0.8329743146896362, index: 0, label: 0 yes}, {confidence: 0.16702567040920258, index: 1, label: 1 no}]