import os
print(os.listdir('../input/sasuke')) | code | 1 | 0.0909090909090909 | |
from PIL import Image
import matplotlib.pyplot as plt | code | 2 | 0.1818181818181818 | |
img = Image.open('../input/sasuke/.jpg')
img = img.resize((224,224))
plt.imshow(img) | code | 3 | 0.2727272727272727 | |
import numpy as np
test_x = np.array(img) / 255.0
print(test_x.shape) | code | 4 | 0.3636363636363636 | |
test_x = test_x.reshape(1,224,224,3) | code | 5 | 0.4545454545454545 | |
Import Model
#from tensorflow.keras.applications import VGG16
#from tensorflow.keras.applications import ResNet101V2
from tensorflow.keras.applications import InceptionV3
#from tensorflow.keras.applications.vgg16 import preprocess_input, decode_predictions
#from tensorflow.keras.applications.resn… | code | 7 | 0.6363636363636364 | |
model prediction
preds = model.predict(test_x)
# decode prediction
dec_preds = decode_predictions(preds, top=3)[0]
print('Predicted:', dec_preds) | code | 9 | 0.8181818181818182 | |