I followed this repo (https://github.com/iamgroot42/keras-finetuning), I've done with the training.
Now, I want to predict my input image both of my own dataset (containing 2 classes, Avocado & Mango) and ImageNet set. But the prediction result always returning both of index 0 or 1 (I guess it was avocado or mango), never returning a class from ImageNet. E.g. I want to predict an iPod image that came from ImageNet original class, but the model.predict(...) always returning 0 and 1.
My model-labels.json:
["avocados", "mangos"]
My code for prediction:
img = imresize(imread('ipod.png', mode='RGB'), (224, 224)).astype(np.float32)
img[:, :, 0] -= 123.68
img[:, :, 1] -= 116.779
img[:, :, 2] -= 103.939
img[:,:,[0,1,2]] = img[:,:,[2,1,0]]
img = img.transpose((2, 0, 1))
img = np.expand_dims(img, axis=0)
img = img.reshape(img.shape[0], n, n, n_chan)
out = model.predict(img, batch_size=batch_size)
pred = np.argmax(out, axis=1)
print(pred)
Does anyone can help me?