How to load an image and show the image using Keras?

MatplotlibPythonData Visualization

To load an image and show the image using Keras, we will use load_image() method to load an image and set the target size of the image to be shown.

Steps

  • Use load_img() method to load the figure.
  • Set the target size of the image.
  • To display the figure, use show() method.

Example

from keras.preprocessing import image
img = image.load_img('bird.jpg', target_size=(350, 750))

img.show()

Output

raja
Published on 02-Jun-2021 08:25:56
Advertisements