日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

pythonkeras数据增强_Keras数据增强参数

發布時間:2023/12/19 python 27 豆豆
生活随笔 收集整理的這篇文章主要介紹了 pythonkeras数据增强_Keras数据增强参数 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

我在Keras中讀過一些關于數據擴充的資料,但對我來說還是有點模糊。在數據擴充步驟中,是否有任何參數來控制從每個輸入圖像創建的圖像的數量?在this example中,我看不到任何控制從每個圖像創建的圖像數量的參數。在

例如,在下面的代碼中,我可以使用一個參數(num_imgs)來控制從每個輸入圖像創建并存儲在名為preview的文件夾中的圖像數量;但是在實時數據擴充中,沒有任何參數用于此目的。在from keras.preprocessing.image import ImageDataGenerator, array_to_img, img_to_array, load_img

num_imgs = 20

datagen = ImageDataGenerator(

rotation_range=40,

width_shift_range=0.2,

height_shift_range=0.2,

shear_range=0.2,

zoom_range=0.2,

horizontal_flip=True,

fill_mode='nearest')

img = load_img('data/train/cats/cat.0.jpg') # this is a PIL image

x = img_to_array(img) # this is a Numpy array with shape (3, 150, 150)

x = x.reshape((1,) + x.shape) # this is a Numpy array with shape (1, 3, 150, 150)

# the .flow() command below generates batches of randomly transformed images

# and saves the results to the `preview/` directory

i = 0

for batch in datagen.flow(x, batch_size=1,

save_to_dir='preview', save_prefix='cat', save_format='jpeg'):

i += 1

if i > num_imgs:

break # otherwise the generator would loop indefinitely

總結

以上是生活随笔為你收集整理的pythonkeras数据增强_Keras数据增强参数的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。