我正在尝试使用Fine-Grained Visual Classification of Aircraft基准数据集训练Vigg19网络。我选择了3架飞机。使用数据集中给定的文本文件,我设法构造一个数据框,以便使用flow_from_dataframe生成器。
df = pd.read_csv("./train_family.csv")
df_test = pd.read_csv("./test_family.csv")
datagen=ImageDataGenerator(rescale=1./255.,validation_split=0.25,rotation_range=10, horizontal_flip=True, vertical_flip=True)
train_generator=datagen.flow_from_dataframe(dataframe=df,
directory="./data/images",
x_col="train", y_col="labels",
class_mode="categorical", target_size=(224,224), batch_size=8, seed = 19, shuffle = True, color_mode = "rgb",
subset = "training")
valid_generator=datagen.flow_from_dataframe(dataframe=df,
directory="./data/images",
x_col="train", y_col="labels",
class_mode="categorical", target_size=(224,224), batch_size=8, seed = 19, shuffle = True, color_mode = "rgb",
subset = "validation")
test_generator=datagen.flow_from_dataframe(dataframe=df_test,
directory="./data/images",
x_col="test", y_col="labels",
class_mode="categorical", target_size=(224,224), batch_size=8, seed = 19, shuffle = False, color_mode = "rgb")
在拟合模型时,算法始终提供相同的验证精度,即“ 1”
损耗:5.5803-acc:0.6538-val_loss:1.1921e-07- val_acc:1.0000
我做了一些挖掘工作,可能是由于火车/验证/测试集中的数据量引起的问题。在下面,您可以分别看到用于训练,验证和测试集的生成器的输出。
Found 550 images belonging to 3 classes.
Found 183 images belonging to 3 classes.
Found 367 images belonging to 3 classes.
我应该通过减少测试集来增加训练集吗?
谢谢