我有一个神经网络测试文件夹,我想将它分成三个网络样本,以检查神经网络在每个类上失败的频率。我如何将数据加载到训练模型中:
from tensorflow.python.keras.preprocessing.image import ImageDataGenerator
datagen = ImageDataGenerator(rescale=1./255, rotation_range=15, width_shift_range=0.1, height_shift_range=0.1, zoom_range=0.1, horizontal_flip=True, fill_mode='nearest', validation_split=0.1)
train_generator = datagen.flow_from_directory(train_path, target_size=(img_height, img_width), batch_size=batch_size, class_mode='categorical', shuffle=True, subset='training')
validation_generator = datagen.flow_from_directory(train_path, target_size=(img_height, img_width), batch_size=batch_size, class_mode='categorical', shuffle=True, subset='validation')
我如何测试模型:
path = '/content/drive/MyDrive/БД/распознавание 3 марок машин/данные/Автомобили/val/'
validation = datagen.flow_from_directory(train_path, target_size=(img_height, img_width), batch_size=batch_size, class_mode='categorical', shuffle=True, subset='validation')
answers = model.evaluate(validation, batch_size=batch_size)
但是如何分别检查每个班级的模型?
如果我理解正确,并且“类”是出路,即 你的神经模型的工作结果,然后你只需检查构建模型的工作,不仅要考虑它是否“猜测”,还要为每个“类”单独做,将接收到的标签与现有的标签进行比较. 顺便说一句,我希望你知道,不可能只用一类数据训练模型。
但是为什么你把数据分成三个数据集还不清楚。通常他们使用两个训练样本和测试样本。第三个可能仅在您进行交叉验证时出现。