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

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: 2021-06-02T08:26:28+05:30

2K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements