如何使用 Keras 載入影像並顯示影像?


要使用 Keras 載入影像並顯示影像,我們將使用 load_image() 方法載入影像並設定要顯示影像的目標大小。

步驟

  • 使用 load_img() 方法載入影像。
  • 設定影像的目標大小。
  • 要顯示影像,請使用 show() 方法。

示例

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

img.show()

輸出

更新日期: 02-Jun-2021

2K+ 次瀏覽

開始你的 職業生涯

完成課程來獲得認證

開始
廣告
© . All rights reserved.