def load_and_process(img_path, target_size=None):
# Feed in the image, convert to array
img = load_img(img_path, target_size=target_size)
img = img_to_array(img)
# Add the batch dimension
img = np.expand_dims(img, axis=0)
# Perform the usual ImageNet preprocessing
img = preprocess_input(img)
return img
评论列表
文章目录