def preprocess_image(filename, target_size):
img = image.load_img(filename, target_size=target_size)
x = image.img_to_array(img)
x = np.expand_dims(x, axis=0)
x = preprocess_input(x)
x = np.squeeze(x)
return x
文章目录