I've been browsing the code, and it seems that you use opencv.imread() to read the images, which produces BGR output. But you still use the normalisation parameters for rgb: mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]. You can change BGR to RGB using the following: cv2.cvtColor(img, cv2.COLOR_BGR2RGB). Thanks for your work!
I've been browsing the code, and it seems that you use
opencv.imread()
to read the images, which produces BGR output. But you still use the normalisation parameters for rgb:mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]
. You can change BGR to RGB using the following:cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
. Thanks for your work!In PyTorch's examples, they read with PIL, which reads in RGB by default, but they use the same constants. Reference: https://pytorch.org/hub/pytorch_vision_alexnet/