- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试对 Keras 模型进行 K 折交叉验证(使用 ImageDataGenerator 和 flow_from_directory 用于训练和验证数据),我想知道“ImageDataGenerator”中的参数“validation_split”是否有效
test_datagen = ImageDataGenerator(
rescale=1. / 255,
rotation_range = 180,
width_shift_range = 0.2,
height_shift_range = 0.2,
brightness_range = (0.8, 1.2),
shear_range = 0.2,
zoom_range = 0.2,
horizontal_flip = True,
vertical_flip = True,
validation_split = 0.1
)
train_datagen = ImageDataGenerator(
rotation_range = 180,
width_shift_range = 0.2,
height_shift_range = 0.2,
brightness_range = (0.8, 1.2),
rescale = 1. / 255,
shear_range = 0.2,
zoom_range = 0.2,
horizontal_flip = True,
vertical_flip = True,
validation_split = 0.1
)
train_generator = train_datagen.flow_from_directory(
train_data_dir,
target_size = (img_width, img_height),
batch_size = batch_size,
class_mode ='binary',
seed = 42
)
validation_generator = test_datagen.flow_from_directory(
validation_data_dir,
target_size = (img_width, img_height),
batch_size = batch_size,
class_mode = 'binary',
seed = 42
)
history = model.fit_generator(
train_generator,
steps_per_epoch = nb_train_samples // batch_size,
epochs = epochs,
validation_data = validation_generator,
validation_steps = nb_validation_samples // batch_size)
“validation_split = 0.1”是否意味着我已经对数据集进行了 10 倍交叉验证?
最佳答案
没有。它只进行一次验证。来自 official document :
validation_split: Float between 0 and 1. Fraction of the training data to be used as validation data. The model will set apart this fraction of the training data, will not train on it, and will evaluate the loss and any model metrics on this data at the end of each epoch. The validation data is selected from the last samples in the x and y data provided, before shuffling.
因此将其设置为 validation_split=0.1
只是保留最后 10% 的训练数据,并将其用作验证集。
如果您想进行 k 交叉验证,则必须手动进行。这是一个很好的起点:Evaluate the Performance of Deep Learning Models in Keras
关于python - 在 Keras "ImageDataGenerator"中, "validation_split"参数是一种 K 折交叉验证吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55963087/
我正在尝试使用 Keras 进行语义分割,当尝试加载图像时,我使用 flow_from_directory 方法收到此错误。 Found 0 images belonging to 0 classes
我试图实现的架构在这里: Patient-data adapted model architecture: ResNet-50 。我的图像按标签分为文件夹,如下所示: root/ ├── tr
我的keras文档中的代码有问题。在下面的代码中,它只加载了 1 张图像。如果我的文件夹中有 10 个图像,我将如何使用此代码,因为 load_img 函数仅加载 1 个图像,而我想加载包含 10 个
我正在尝试使用 Inception V3 模型进行图像分类。 Keras 的 ImageDataGenerator 是否会创建添加到我的数据集的新图像?如果我有 1000 张图片,使用此功能是否会将其
例如,考虑在 Keras 中微调 Resnet50 模型。 For example here : from keras.applications.resnet50 import ResNet50 fr
我正在尝试使用 ImageDataGenerator 对象的流方法获取输入图像并保存该图像的 10 个增强版本。问题是它无意中改变了图像的颜色,即使我没有向 ImageDataGenerator 类传
我一直在尝试实现 Keras 自定义图像数据生成器,以便我可以进行头发和显微镜图像增强。 这是数据生成器类: class DataGenerator( Sequence ): def __in
我知道的方法是这样的 from tensorflow.keras.preprocessing.image import ImageDataGenerator train_datagen = Image
我正在训练一个神经网络来预测鼠标大脑图像上的二进制掩码。为此,我使用来自 keras 的 ImageDataGenerator 来扩充我的数据。 但我已经意识到数据生成器在应用空间变换时正在插入数据。
我目前正在创建一个CNN模型来分类字体是否为Arial , Verdana , Times New Roman和 Georgia .总共有16类,因为我还考虑检测字体是否为 regular , bol
我有一个关于在使用 ImageDataGenerator 的 Keras 数据增强上下文中使用 sample_weight 参数的问题。假设我有一系列简单的图像,只有一类对象。因此,对于每个图像,我将
嗨,我想问你一个关于 Keras ImageDataGenerator 的问题。我可以确定将创建多少增强图像吗?或者如何在增强后找到训练图像集的大小。在 Keras 文档中,流程函数描述是:“采用 n
我正在制作一个用于图像分类的 CNN 模型(我有两个类)。我使用 ImageDataGenerator 进行数据准备,使用 model.fit_generator 进行训练。为了进行测试,我使用mod
我有一个模型,它将两个图像作为输入并生成一个图像作为目标输出。 我所有的训练图像数据都在以下子文件夹中: 输入1 输入2 目标 我可以使用 keras 中的 ImageDataGenerator 类和
我是卷积神经网络的新手,我即将构建我的第一个 ConvNet,它是一个多类图像分类 ConvNet。 型号说明 假设我有两个图像文件夹,一个包含数千张特定类型叶子的图像(叶子 A)(图像集 X),另一
我正在使用 keras ImageDataGenerator 来预处理训练图像,并且需要某种颜色更改功能(随机颜色、色调更改)。 我的生成器代码如下所示: image_generator = tf.k
以下是我的 csv 文件 file,pt1,pt2,pt3,,pt4,pt5,pt6 object/obj0.png,66.0335639098,39.0022736842,30.2270075188
假设我想应用两个不同的 preprocessing_functions分成两份ImageDataGenerator s 到一张图像,然后将这些输出连接到一个张量来训练模型。 即,如果我有 RGB 图像
我正在尝试使用tensorflow.keras构建语义分割模型。我使用的数据集将图像和蒙版存储在单独的目录中,每个文件名都有一个 ID,用于将图像文件与其各自的蒙版进行映射。 以下是我的数据集目录的结
我有 70'000 个 2D numpy 数组,我想在其上使用 Keras 训练 CNN 网络。将它们保存在内存中是一种选择,但会消耗大量内存。因此,我想将矩阵保存在磁盘上并在运行时加载它们。一种选择
我是一名优秀的程序员,十分优秀!