In [7]:
# load and prepare an image
# load the image to get its shape
width, height = image.size
# load the image with the required size
# convert to numpy array
image = img_to_array(image)
# scale pixel values to [0, 1]
image = image.astype('float32')
image /= 255.0
# add a dimension so that we have one sample
image = expand_dims(image, 0)
return image, width, height