PinkFloydRocks
PinkFloydRocks

Reputation: 808

Tensorflow SDK vs MLKit SDK

We have a strange problem that we need help solving. Here's the scenario: We've got an native android app using the Tensorflow SDK and a tflite model that recognises different fish species. This solution has varying results when capturing input from the camera, but when using pictures from the camera roll it works very well and serves us stable probabilities for the different fish species.

We also have an native iOS app that uses Google's MLKit with the same tensorflow lite model and this performs very well, but on some pictures it totally misses the target.

If we load the same picture from the camera roll and run it through the interpreter on the android app and the iOS app we get totally different results, but only on SOME species.

Does anybody have an explanation as to why we can get such different results using the same tflite model in both apps and the same picture?

Are there differences between the MLKit SDK and the Tensorflow SDK that can cause this kind of behaviour?

Best regards, Christian

Upvotes: 2

Views: 1748

Answers (1)

Shiyu
Shiyu

Reputation: 935

There could be a couple of reasons.

  1. TFLite runtime versions. ML Kit custom model also uses TFLite under the hood, and you could find the TFLite runtime version in your Pod dependencies. Make sure you are using the same TFLite versions in the test.

  2. Image processing. The images you send to ML Kit SDK or TFLite SDK are always much larger than the model inputs, so resizing and even image rotations will be performed before running the model. Different platform may use different libraries for the image processing, and the results may have slightly difference. But the slight different may cause the model output different results. It could due to the model is a bit unstable for SOME species. You may try to send the exact same image with the model expected image format/size/orientation, so that image processing is not triggered in both platforms and see whether it helps.

Upvotes: 3

Related Questions