Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opencv BGR bug #9

Open
michael-2956 opened this issue Nov 19, 2022 · 0 comments
Open

opencv BGR bug #9

michael-2956 opened this issue Nov 19, 2022 · 0 comments

Comments

@michael-2956
Copy link

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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant