pytorch-siamese-triplet icon indicating copy to clipboard operation
pytorch-siamese-triplet copied to clipboard

opencv BGR bug

Open mykhailynab opened this issue 3 years ago • 0 comments

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/

mykhailynab avatar Nov 19 '22 18:11 mykhailynab