python交叉验证cnn,如何为此CNN使用K折交叉验证?

本文档展示了如何在二分类图像分类任务中实施K折交叉验证。作者试图将Keras与ImageDataGenerator结合使用,但遇到了困难。代码包括CNN模型构建、数据预处理和训练过程。解决方案部分提到了通过自定义加载函数实现数据集的K折切分,避免使用Keras生成器,并展示了如何在每个折中训练和评估模型。
摘要由CSDN通过智能技术生成

I have tried to implement K Fold Cross Validation for my binary image classifier, but I have been struggling for a while as I have been stuck with the whole data processing side of things. I have included my code below (it is quite long and messy - apologies) before my attempts at the K Fold as it went horribly wrong. Any suggestions or support would be greatly appreciated. I believe that using a K Fold is the right approach here, but if not, please let me know. Thank you so much!

I was wondering how I can reformat my data to create the separate folds as pretty much every tutorial out there uses a .csv file; however, I simply have two different folders containing images, either ordered into two separate categories (for the training data) or just one singular category (for the test data).

from keras.models import Sequential

from keras.layers import Conv2D

from keras.layer

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值