avilash / pytorch-siamese-triplet

One-Shot Learning with Triplet CNNs in Pytorch
92 stars 21 forks source link

opencv BGR bug #9

Open michael-2956 opened 1 year ago

michael-2956 commented 1 year ago

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/