Replies: 1 comment
-
Hello! It looks like you're facing an issue with image preprocessing when deploying your
Here's a modified version of your image preprocessing step to include normalization: const tfImage = tf.browser.fromPixels(image)
.resizeNearestNeighbor([64, 64]) // Adjust size if different from training
.toFloat()
.div(tf.scalar(255)) // Normalize image
.expandDims(); Try this adjustment, and if the issue persists, it might be helpful to revisit the training and exporting logs to ensure that the model export was successful and without warnings that might affect performance. If you need further assistance, feel free to share more details! 😊 |
Beta Was this translation helpful? Give feedback.
-
I trained a custom icon classification model using my own data.
Everything works fine when I use the trained best.pt weights file.
However, things get strange when I export to the tfjs format.
During the export to tfjs, two folders are generated:
When I use the contents of best_saved_model, the results are completely correct, just like using best.pt.
But when I deploy the best_web_model on a web page, the results are completely wrong. I'm not sure where the problem lies, but it's very likely that the image preprocessing is incorrect when loading images? However, the documentation doesn't seem to provide any information on how to preprocess the images.
here is my web code
env
file
Beta Was this translation helpful? Give feedback.
All reactions