Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/343.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Keras ImageDataGenerator不同的图像_Python_Keras - Fatal编程技术网

Python Keras ImageDataGenerator不同的图像

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

我对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, 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):
...