Pretrained VGG Prediction over African Wildlife
Link : https://www.kaggle.com/biancaferreira/african-wildlife
Data directory :
root/
├─ buffalo/
├─ 001.jpg
├─ 001.txt
elephant/
├─ 001.jpg
├─ 001.txt
rhino/
├─ 001.jpg
├─ 001.txt
zebra/
├─ 001.jpg
├─ 001.txt
Train accuracy is near : 99.2%
Validation accuracy is near : 86%
def predict(path):
img = cv2.imread( path )
img = cv2.cvtColor( img , cv2.COLOR_BGR2RGB)
img = cv2.resize( img , (256,256) )
img = img.reshape(1 , 256 , 256 , 3)
pred = np.argmax( clf.predict(img) )
plt.imshow(img.reshape( 256 , 256 ,3))
plt.title(f'Prediction : {classes[pred]}')