Hi folks, i hope ya'll doing good !
I've trained a cnn model in python , then I saved it as a json model (model.json) to use it later in my Node.js server ( i want to predict in server side ). The image that I want to predict come from React.js (req.files) , but I'm having issue (error) transforming the image into tensor. How to do it propery ? Please see attachement to look code image. thanks !!!!
the code:
const image = req.files.image;
const tensor = tf.browser
.fromPixels(files)
.resizeNearestNeighbor([256, 256])
.mean(2)
.toFloat()
.div(tf.scalar(255.0))
.expandDims()
.expandDims(-1);