Xiaoyu_Song:

cv2


A common pitfall with cv2 is that it is BGR instead of RGB. If you trained using PIL, I would recommend to do img_tensor = torch.from_numpy(img_arr)[:,:, ::-1].
Another is to put the network into eval mode (model.eval()). You need to do this after loading the model, in particular if you have BatchNorm.