So I was working with the the vgg16 model for dogs vs cats classification and I noticed that keras is not loading images in correct color format. The code is as follows:
import cv2 import matplotlib.pyplot as plt import numpy as np from PIL import Image from keras.preprocessing import image path='data/dogscats/sample/train/dogs/dog.1402.jpg' imgkeras=image.load_img(path) imgkeras=image.img_to_array(imgkeras) plt.imshow(imgkeras) plt.show()
Where as the original image is
Can someone explain why is this happening? , also when the image is loaded through opencv and fed into vgg16 the predicted label is more accurate for this particular image than when it is loaded through keras as above,is the improper color format affecting that?