I want to classify multiple images iteratively, I tried it with
Future pickImages() async {
final List<XFile>? images = await ImagePicker().pickMultiImage();
if (images == null) return;
images.forEach((image) async {
print('- Name: ${image.path}');
await runModel(image.path);
});
}
Future runModel(String imagePath) async {
var recognitions = await Tflite.runModelOnImage(
path: imagePath,
numResults: 1,
threshold: 0.5,
imageMean: 127.5,
imageStd: 127.5,
asynch: true // defaults to true
);
print(recognitions);
await Future.delayed(Duration(seconds: 1));
setState(() {});
}
Everything runs fine if I just select one image, as soon as I go on selecting multiple images I get the following error:
PlatformException (PlatformException(Failed to run model, Interpreter busy, java.lang.RuntimeException: Interpreter busy
I tried my best but couldn't resolve the issue.
I would really appreciate it if you can suggest how to make inferences on multiple selected images(ImagePicker).
Thanks!