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

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程语言 > python >内容正文

python

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

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

我在Keras中讀過一些關(guān)于數(shù)據(jù)擴(kuò)充的資料,但對我來說還是有點(diǎn)模糊。在數(shù)據(jù)擴(kuò)充步驟中,是否有任何參數(shù)來控制從每個輸入圖像創(chuàng)建的圖像的數(shù)量?在this example中,我看不到任何控制從每個圖像創(chuàng)建的圖像數(shù)量的參數(shù)。在

例如,在下面的代碼中,我可以使用一個參數(shù)(num_imgs)來控制從每個輸入圖像創(chuàng)建并存儲在名為preview的文件夾中的圖像數(shù)量;但是在實(shí)時數(shù)據(jù)擴(kuò)充中,沒有任何參數(shù)用于此目的。在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

總結(jié)

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

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。