machine-learning - Kaggle - 猫与狗(用户警告 : Found 20000 invalid image filename(s) in x_col ="filename". 这些文件名将被忽略。)

标签 machine-learning keras

当我生成测试生成器时,出现以下错误

UserWarning: Found 20000 invalid image filename(s) in x_col="filename". These filename(s) will be ignored.

代码如下:

test_datagen = ImageDataGenerator(rotation_range=15,
                            rescale=1./255,
                            shear_range=0.1,
                            zoom_range=0.2,
                            horizontal_flip=True,
                            width_shift_range=0.1,
                            height_shift_range=0.1)

test_generator = train_datagen.flow_from_dataframe(train_df,
                                             "./test/",x_col='filename',y_col='category',
                                             target_size=Image_Size,
                                             class_mode='categorical',
                                             batch_size=batch_size)

测试文件夹就在文件之前。我已经搜索了很多来解决这个问题。如果代码中有任何错误,请指出或给我其他建议。

最佳答案

所有 jpeg/png 名称必须按数字顺序排列,根据 ImageDataGenerator 中的 flow_from_dataframe,不允许使用字母数字标签。该图像将被忽略,并且将发出该文件的警告。 您场景中的每个图像都有字母数字标签(csv 格式的名称)。

关于machine-learning - Kaggle - 猫与狗(用户警告 : Found 20000 invalid image filename(s) in x_col ="filename". 这些文件名将被忽略。),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66402140/

相关文章:

python - ValueError : The name "dense_1" is used 2 times in the model. 所有图层名称应该是唯一的

python - 如果我的输出变量是二进制,我是否需要使用 one_hot 编码?

tensorflow - keras.layers.InputLayer 和 keras.Input 之间的区别

tensorflow - 初始化 LSTM 隐藏状态 Tensorflow/Keras

tensorflow - TF/喀拉斯 : ModelCheckpoint "period" and "save_best_only"

machine-learning - 为什么马尔可夫随机场中的推理很难?

hashmap - 使用局部敏感哈希时的余弦相似度可以为-1吗?

python - 使用 Python 的 scikit-learn 中随机森林算法的置信度与概率

neural-network - Keras中如何将一些节点直接连接到输出层

python - Keras - 没有停止和恢复训练的好方法?