小编Ale*_*lor的帖子

在预测期间,数据规范化如何在keras中发挥作用?

我看到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)
Run Code Online (Sandbox Code Playgroud)

我的问题是,如果我在培训期间指定了数据规范化,预测如何工作?我无法看到在框架中我甚至会传递训练集均值/标准偏差的知识以预测允许我自己标准化我的测试数据,但我也没有在训练代码中看到此信息是存储.

归一化所需的图像统计是否存储在模型中,以便在预测期间使用它们?

python machine-learning neural-network keras tensorflow

17
推荐指数
2
解决办法
2万
查看次数