Pre process images before prediction

171 views
Skip to first unread message

Andrew Sigurdson

unread,
Jul 23, 2018, 3:12:33 PM7/23/18
to TensorFlow.js Discussion
Hello,

We are trying to run a keras model in the browser and we believe that our predictions aren't accurate because the images aren't being preprocessed like they would be in the python tensor flow code.  How would you recommend preprocessing images before model.predict in tfjs.  For example, preprocesssing_input() from keras.applications.imagenet_utils?  Thanks.  

Andrew

zaid Alyafeai

unread,
Jul 23, 2018, 3:17:43 PM7/23/18
to Andrew Sigurdson, TensorFlow.js Discussion
For my applications I re-implement the same preprocessing function in tfjs. You can check the keras preprocessing for imagenet here 

--
You received this message because you are subscribed to the Google Groups "TensorFlow.js Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tfjs+uns...@tensorflow.org.
Visit this group at https://groups.google.com/a/tensorflow.org/group/tfjs/.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/tfjs/87eb4272-b4a0-4c4f-aaed-d28c9704c5d8%40tensorflow.org.

David Soergel

unread,
Jul 23, 2018, 3:21:35 PM7/23/18
to as...@umich.edu, TensorFlow.js Discussion
Yep, that makes sense: the prediction model inputs must be in the same format, preprocessed in the same manner, as the training inputs.  We don't yet provide preprocessing utilities in TF.js, so you have to roll your own to match what was done at training.

-ds

--
Reply all
Reply to author
Forward
0 new messages