Ethylion
Ethylion

Reputation: 85

Explanation of parameters of Tflite.runModelOnImage

Can someone explain each line of this code? Like what is the purpose of imageMean, imageStd, threshold.

I can't really find the documentation of this

Tflite.runModelOnImage(
     imageMean: 0.0,   
     imageStd: 255.0,  
     numResults: 2,    
     threshold: 0.1,  
     asynch: true,
     path: image.path,
)

here is the official package: https://pub.dev/packages/tflite

Upvotes: 2

Views: 1323

Answers (1)

Jared Junyoung Lim
Jared Junyoung Lim

Reputation: 190

When performing an image classification task, it's often useful to normalize image pixel values based on the dataset mean and standard deviation. More reasons on why we need to do can be found in this question: Why do we need to normalize the images before we put them into CNN?.

The imageMean is the mean pixel value of the image dataset to run on the model and imageStd is the standard deviation. The threshold value stands for the classification threshold, e.g. the probability value above the threshold can be indicated as "classified as class X" while the probability value below indicates "not classified as class X".

Upvotes: 4

Related Questions