I'm using my trained model in react native whose input size is 48,48,1. Input values are RGB images. So I tried converting the image into tensor3d, then into grayscale, and resized it. But after resizing the model always gives the same prediction values. I don't understand where something is wrong with my code. My model accuracy is also okay.
const imageDataArrayBuffer = await response.arrayBuffer();
const imageData = new Uint8Array(imageDataArrayBuffer);
let imageTensor = decodeJpeg(imageData).resizeBilinear([48,48]).reshape([48,48,3]);
imageTensor=tf.ones([48,48,3]);
rgb_weights=[0.2989, 0.5870, 0.1140];
imageTensor = tf.mul(imageTensor, rgb_weights);
imageTensor = tf.sum(imageTensor, -1);
imageTensor = tf.expandDims(imageTensor, -1);
imageTensor=imageTensor.resizeBilinear([48,48]).reshape([-1,48,48,1]);
let result = await model.predict(imageTensor).data();
alert("Result " +result);

