我正在研究斯坦福大学的MURA dataset。我尝试使用Keras的ImageDataGenerator加载数据集。数据在以下层次结构中:
study1_positive
文件夹包含这些图像。在
ImageDataGenerator.flow_from_directory
不能与此文件夹结构一起使用,因此我尝试使用flow_from_dataframe
方法。在
但是,当运行时,代码会继续执行并且不会停止。在
下面是我传递给flow_from_directory
方法的Pandas数据帧的格式:
我还尝试将标签分别改为“异常”和“正常”来代替1和0。在
编辑:
我粘贴了下面的代码:
train_imggen = ImageDataGenerator(rescale=1./255, rotation_range=30,
horizontal_flip=True)
train_loader = train_imggen.flow_from_dataframe(traindf, '.', shuffle=True,
x_col='path', y_col='label',
color_mode='grayscale',
target_size=(320,320),
class_mode='binary',
batch_size=8)
找到了解决方案here。显然,当前的
flow_from_dataframe
不处理相对路径。在相关问题 更多 >
编程相关推荐