本文整理汇总了Python中keras.preprocessing.image.ImageDataGenerator.next方法的典型用法代码示例。如果您正苦于以下问题:Python ImageDataGenerator.next方法的具体用法?Python ImageDataGenerator.next怎么用?Python ImageDataGenerator.next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类keras.preprocessing.image.ImageDataGenerator
的用法示例。
在下文中一共展示了ImageDataGenerator.next方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ImageDataGenerator
# 需要导入模块: from keras.preprocessing.image import ImageDataGenerator [as 别名]
# 或者: from keras.preprocessing.image.ImageDataGenerator import next [as 别名]
(X_train, y_train), (X_test, y_test) = mnist.load_data()
# reshape to be [samples][pixels][width][height]
X_train = X_train.reshape(X_train.shape[0], 1, 28, 28)
X_test = X_test.reshape(X_test.shape[0], 1, 28, 28)
# convert from int to float
X_train = X_train.astype('float32')
X_test = X_test.astype('float32')
# define data preparation
datagen = ImageDataGenerator(featurewise_center=False, samplewise_center=True,
featurewise_std_normalization=False, samplewise_std_normalization=True)
# fit parameters from data
datagen.fit(X_train)
# configure batch size
datagen.flow(X_train, y_train, batch_size=9)
# retrieve one batch of images
X_batch, y_batch = datagen.next()
# create a grid of 3x3 images
for i in range(0, 9):
pyplot.subplot(330 + 1 + i)
pyplot.imshow(X_batch[i].reshape(28, 28), cmap=pyplot.get_cmap('gray'))
# show the plot
pyplot.show()
示例2: range
# 需要导入模块: from keras.preprocessing.image import ImageDataGenerator [as 别名]
# 或者: from keras.preprocessing.image.ImageDataGenerator import next [as 别名]
for i in range(1, N_TRAIN+1):
#print '\rLoading:',i,'/',N_TRAIN,'.',
train_images_full_info.append(load_imgs('train/' + str(i) + '.png'))
print '\n'
Train_Input = np.array(train_images_full_info)
#Configurating labels
Train_Labels = np.array(labels[1:N_TRAIN+1])
#Preprosesing the Tran images
log.info('Preprosseing Train images.')
datagen.fit(Train_Input,False,3)
#Pre-Process and save
datagen.flow(Train_Input, Train_Labels, N_TRAIN,False,0, "./lol/","tt","png")
#Execute
(H,Y) = datagen.next()
#Reductic 1 Layer -- Error in Layer -- Verify!
Train_Input = np.zeros((len(H),1,32,32))
for i in range(len(H)):
Train_Input[i] = H[i]
for i in range(0):
datagen.flow(Train_Input, Train_Labels, N_TRAIN,False,0)
(H,Y) = datagen.next()
Train_Labels = np.concatenate((Train_Labels, Y), axis=0)
Train_Input = np.concatenate((Train_Input, H), axis=0)
#Reading Testing Images