Pre-processing before .predict function

Hi everyone, I am trying to convert fastai resnet34 finetuned models to tensorflow models, now the convert is successful, but I am getting some problems.

model_path = “xxx”
model_name = “xxx”
learn = load_learner(model_path, model_name)
filename = “xxx”
url = “xxx” + filename
img = open_image(url)
processed_image = learn.predict(img, return_x=True)[0]

If I use the code above to get processed_image and normalize it myself, I can get same prediction results in converted tensorflow model as fastai pytorch model
But, if I just code below:

img_url = “xxx”
img =, 224))
processed_image = np.asarray(img, dtype=np.float32)

then normalize the image myself, I just totally different prediction results. What happened? anyone know what kind of pre-processing happened in the predict() function? it’s so confusing