diff --git a/snippets/markdown/image/tensorflow/keras.md b/snippets/markdown/image/tensorflow/keras.md index 8306244..4827734 100644 --- a/snippets/markdown/image/tensorflow/keras.md +++ b/snippets/markdown/image/tensorflow/keras.md @@ -1,6 +1,6 @@ ```python from keras.models import load_model -from PIL import Image, ImageOps +from PIL import Image, ImageOps #Install pillow instead of PIL import numpy as np # Disable scientific notation for clarity @@ -23,7 +23,7 @@ image = Image.open('').convert('RGB') #resize the image to a 224x224 with the same strategy as in TM2: #resizing the image to be at least 224x224 and then cropping from the center size = (224, 224) -image = ImageOps.fit(image, size, Image.ANTIALIAS) +image = ImageOps.fit(image, size, Image.Resampling.LANCZOS) #turn the image into a numpy array image_array = np.asarray(image) @@ -40,6 +40,6 @@ index = np.argmax(prediction) class_name = class_names[index] confidence_score = prediction[0][index] -print('Class: ', class_name, end='') -print('Confidence Score: ', confidence_score) +print('Class:', class_name, end='') +print('Confidence score:', confidence_score) ```