I trained the Yolo v4 tiny model using AlexeyAB's Darknet which was successful and inference seems to work properly. I then used hunglc007's tool tensorflow-yolov4-tflite in order to convert the model to a tflite version. Here I encountered a small issue, because the FusedBatchNormV3 operator could not be found, so I followed this solution in order to add it https://www.tensorflow.org/lite/guide/ops_select and it worked. I managed to get a working tflite model (.tflite file) which using the detect script from the same repository seems to work for inference as well.
I have another flutter application where I would like to use the beforementioned model in order to do the inference directly on the mobile device. The issue is that when I am trying to import it using the official tflite_flutter package, I receive the following error: Exception has occurred. StateError (Bad state: failed precondition). This is the code snippet for importing the tflite model.
final interpreter = await tfl.Interpreter.fromAsset('assets/yolov4-tiny-416.tflite');
I cannot seem to find the issue. I have added the model to the assets folder and I have also specified it in the pubspec.yaml file. I thought that maybe the issue could be from missing support on the TFLite Select OPs, so I also added this dependencies to the android/app/build.gradle file:
implementation 'org.tensorflow:tensorflow-lite:0.0.0-nightly-SNAPSHOT'
implementation 'org.tensorflow:tensorflow-lite-select-tf-ops:2.9.0'
That did not solve the issue unfortunately. I don't know what problem could be. Any help would be appreciated. Thanks a lot!