jiwoon-ahn / psa

Learning Pixel-level Semantic Affinity with Image-level Supervision for Weakly Supervised Semantic Segmentation, CVPR 2018
MIT License
385 stars 62 forks source link

Normalize transform also shifts RGB to BGR pattern and vice-versa #31

Closed saurabheights closed 3 years ago

saurabheights commented 3 years ago

Here index 0 is mapped to 2 and 2 mapped to 0 - https://github.com/jiwoon-ahn/psa/blob/master/network/vgg16d.py#L15

Image is initially loaded in RGB Mode - https://github.com/jiwoon-ahn/psa/blob/9493e59bef16687ecb4821387e38e6460857f508/voc12/data.py#L69

Finally, the transform is simply applied to RGB image, no where there is need for channel swapping. https://github.com/jiwoon-ahn/psa/blob/master/train_cls.py#L82

P.S. It could be a bug due to some legacy code using OpenCV to open image, which defaults to BGR mode.

saurabheights commented 3 years ago

That's part of preprocessing for VGG pretrained model, found it - https://www.tensorflow.org/api_docs/python/tf/keras/applications/vgg16/preprocess_input