【问题标题】:Does Keras preprocessing layers apply to the validation set?Keras 预处理层是否适用于验证集?
【发布时间】:2021-06-03 13:09:04
【问题描述】:

我正在阅读data augmentation article on Keras,它们允许将预处理层作为模型的一部分:

model = tf.keras.Sequential([
    resize_and_rescale,
    data_augmentation,
    layers.Conv2D(16, 3, padding="same", activation="relu"),
    layers.MaxPooling2D(),
    # Rest of your model
])

我想知道 resize_and_rescale 和 data_augmentation 层中的一个或两个是否也适用于训练期间的验证集?

【问题讨论】:

  • 您无需怀疑。编写一个程序来检验你的假设,看看会发生什么。

标签: tensorflow image-processing keras deep-learning data-augmentation


【解决方案1】:

这取决于您使用的增强类型。例如,如果您使用调整大小层或重新调整层,即使在推理模式下也会应用它们,也就是说,它们将应用于 model.fit 中的验证数据。对于其他增强层,如 RandomFlip 层,文档指出:

During inference time, the output will be identical to input.

因此,您必须查找有关您正在使用的图层类型的信息。文档是here.据我所知,我认为只有调整大小和重新调整层在推理模式下保持活动状态。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-02
    • 1970-01-01
    • 1970-01-01
    • 2011-07-08
    相关资源
    最近更新 更多