I am attempting to run an image through a pytorch model I have created and incorporated into a mobile flutter app. In the Training process, prior to moving the model to my mobile dev environment, I normalize my training images in python using Pytorch Transforms with the following line of code:
transforms.Normalize(mean=[0.75107294, 0.51543763, 0.52209598], std=[0.13829332, 0.15216838, 0.16517265]),
I have tried to figure this out from the documentation for the Pytorch_Mobile package for Dart/Flutter but I am unsure as to wether I have to normalize my image prior to passing it to the network for a prediction, my code currently looks as follows (filePath being the Path to the Image):
File resizedFile = await FlutterNativeImage.compressImage(filePath,
quality: 100, targetWidth: 224, targetHeight: 224);
List? classificationPrediction =
await classificationModel.getImagePredictionList(resizedFile, 224, 224);
However, when passing images to the model through my flutter app I am receiving results that just don't seem to reflect the accuracy that was achieved through the test dataset used in Training in Pytorch in Python.
Could the issue be that I need to normalize the image prior to passing it to the model in Flutter, and if so, how would I best achieve this?