【发布时间】:2017-06-10 20:45:19
【问题描述】:
我看到 imageDataGenerator 允许我指定不同样式的数据规范化,例如featurewise_center、samplewise_center 等
我从示例中看到,如果我指定了这些选项之一,那么我需要在生成器上调用 fit 方法,以便让生成器计算像生成器上的平均图像这样的统计数据。
(X_train, y_train), (X_test, y_test) = cifar10.load_data()
Y_train = np_utils.to_categorical(y_train, nb_classes)
Y_test = np_utils.to_categorical(y_test, nb_classes)
datagen = ImageDataGenerator(
featurewise_center=True,
featurewise_std_normalization=True,
rotation_range=20,
width_shift_range=0.2,
height_shift_range=0.2,
horizontal_flip=True)
# compute quantities required for featurewise normalization
# (std, mean, and principal components if ZCA whitening is applied)
datagen.fit(X_train)
# fits the model on batches with real-time data augmentation:
model.fit_generator(datagen.flow(X_train, Y_train, batch_size=32),
samples_per_epoch=len(X_train), nb_epoch=nb_epoch)
我的问题是,如果我在训练期间指定了数据归一化,预测如何工作?我看不到在框架中我什至会如何传递训练集均值/标准偏差的知识来预测以允许我自己规范化我的测试数据,但我也没有在训练代码中看到这些信息在哪里存储。
标准化所需的图像统计信息是否存储在模型中,以便在预测期间使用?
【问题讨论】:
标签: python machine-learning tensorflow neural-network keras