tensorflow / tfjs

A WebGL accelerated JavaScript library for training and deploying ML models.
https://js.tensorflow.org
Apache License 2.0
18.51k stars 1.94k forks source link

Conversion to tfjs: make_image_classifier gives correct results, notebook version incorrect ones? #3734

Closed vjuss closed 4 years ago

vjuss commented 4 years ago

I have used make_image_classifier to make my own classifier and converted that to Tensorflow.js with success, giving me confidence rates like A: 0.67XXX, B: 0.10XXX, C: 0.23XXXX (together 1.0)

I want to do the same with the corresponding notebook to have more control (https://colab.research.google.com/github/tensorflow/hub/blob/master/examples/colab/tf2_image_retraining.ipynb) but if I use it with default settings, I get weird predictions after conversion then, like:

A: 0.09XXX, B: 2.69XXX, C: 0.77XXXX

I wonder why this is happening - how can I use the notebook and convert succesfully?

For both I used this conversion format from https://github.com/tensorflow/tfjs/tree/master/tfjs-converter:

tensorflowjs_converter \ --input_format=tf_saved_model \ --output_format=tfjs_graph_model \ --signature_name=serving_default \ --saved_model_tags=serve \ /mobilenet/saved_model \ /mobilenet/web_model

rmothukuru commented 4 years ago

@vjuss, Transferred the issue to this (TF JS) Repository, as the issue is related to TF JS. Thanks!

@rthadur, PTAL.

rthadur commented 4 years ago

Closing this issue to better track in #3717