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


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

Updated on: 02-Jun-2021

1K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements