Python image_dataset_loader 模块实例不一致

Python image_dataset_loader Module Instances are inconsistent

我想将一个图像数据集导入到带有图像和标签的 Numpy 数组中。我正在尝试使用 image_dataset_loader 来做到这一点并且到目前为止已经写了这个:

import image_dataset_loader

(x_train, y_train), (x_test, y_test) = image_dataset_loader.load('./data', ['train', 'test'])

我的数据目录结构如下:

data
    -train
        -male
            -male_1.jpg
            -male_2.jpg
            -male_3.jpg
            -male_4.jpg
            -......
        -female
            -female_1.jpg
            -female_2.jpg
            -female_3.jpg
            -female_4.jpg
            -......
    -test
        -male
            -male_1.jpg
            -male_2.jpg
            -male_3.jpg
            -male_4.jpg
            -......
        -female
            -female_1.jpg
            -female_2.jpg
            -female_3.jpg
            -female_4.jpg
            -......

我已将所有图片的格式设置为 120x120,并严格按照上面所示命名。我每个类别大约有 56000 个文件。当我 运行 上面的脚本时,它抛出以下错误:

Traceback (most recent call last):
  File "main.py", line 33, in <module>
    (x_train, y_train), (x_test, y_test) = image_dataset_loader.load('./data', ['train', 'test'])
  File "/home/user/anaconda3/envs/AIOS/lib/python3.8/site-packages/image_dataset_loader.py", line 44, in load
    raise RuntimeError('Instance shapes are not consistent.')
RuntimeError: Instance shapes are not consistent.

有人可以帮我将这些图像分类到 Numpy 数组中吗?

检查图像的颜色。您的某些图像可能是灰度图像。