Python Keras ImageDataGenerator不同的图像
我对Keras用于图像增强的Python Keras ImageDataGenerator不同的图像,python,keras,Python,Keras,我对Keras用于图像增强的ImageDataGenerator有问题。现在,我正在尝试垂直翻转训练数据集中的图像X_batch是我的翻转图像数据集,X_train是我的原始训练数据集 有人能解释一下为什么X\u批次中的图像与X\u序列中的图像顺序不同吗X\u batch[0]应该是X\u train[0]的翻页版本,但是X\u batch[0]是我的数据集中不同图像的翻页版本 X_train, X_test, y_train, y_test = train_test_split(X, y, t
ImageDataGenerator
有问题。现在,我正在尝试垂直翻转训练数据集中的图像X_batch
是我的翻转图像数据集,X_train
是我的原始训练数据集
有人能解释一下为什么X\u批次
中的图像与X\u序列
中的图像顺序不同吗X\u batch[0]
应该是X\u train[0]
的翻页版本,但是X\u batch[0]
是我的数据集中不同图像的翻页版本
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
datagen = ImageDataGenerator(vertical_flip=True)
datagen.fit(X_train)
for X_batch, y_batch in datagen.flow(X_train, y_train):
X_batch = X_batch.astype('uint8')
plt.subplot(2, 1, 1)
plt.imshow(X_batch[0]) // flipped image
plt.subplot(2, 1, 2)
plt.imshow(X_train[0]) // original image
plt.show()
break
根据flow
方法,获取一个名为shuffle
的参数,如果将该参数设置为True
(默认情况下),则会对数据进行无序处理,然后应用图像变换。如果您不喜欢此行为,可以将其设置为False
:
对于datagen.flow中的X_批,y_批(X_列,y_列,shuffle=False):
...