omaralmaqtari
omaralmaqtari

Reputation: 41

does is affect NN training accuracy if the color format of images is BGR not RGB?

I'm training Neural Network with ImageNet dataset and I noticed that images are in BGR color format when I read them using OpenCV function cv2.imread(), so does is affect training accuracy?, if yes then how can I change it to RGB in pytorch?

Upvotes: 2

Views: 1981

Answers (1)

adeelh
adeelh

Reputation: 526

It will not affect your NN's accuracy, in general. However, if you are using a pre-trained CNN, then it likely expects RGB images as input, and will not do as well on BGR images initially and will have to re-learn its weights for BGR.

You can convert BGR to RGB using cv2.cvtColor(img_bgr, cv2.COLOR_BGR2RGB).

You can also consider the following alternatives for reading images:

Upvotes: 3

Related Questions