I'm new to TensorFlowJS. I've used the Google Colab to create and train a model using TensorFlow Lite Model Maker, convert it to a TFJS, and then use it in an angular application.
In the colab, the model achieved high acuracity. I've saved the model using:
model.export(export_dir='.', export_format=ExportFormat.SAVED_MODEL);
and then I use
tfjs.converters.convert_tf_saved_model('saved_model','tfjsconvertido');
in order to obtain the tfjs. In the angular, i'm using:
async fazerPrevisao(modelo: tf.GraphModel){
const batched = tf.tidy(() => {
const im = new Image();
im.src = this.foto.webviewPath;
im.height = 224;
im.width = 224;
const imagem = tf.cast(tf.browser.fromPixels(im).reshape([-1,224,224,3]),'float32');
this.prediction = modelo.predict(imagem);
this.prediction.print();
});
}
The result in angular differs too much from Colab. In some cases, the result label is not correct, and even getting the right label, the values of probabilities are completely different. What could it be?
Thanks in advance.