问题是当我尝试在fit_generator函数中传递生成器对象时...
train_gen = DataGen(train_ids, train_path, image_size=image_size, batch_size=batch_size)
valid_gen = DataGen(valid_ids, train_path, image_size=image_size, batch_size=batch_size)
print(bool(train_gen))
train_steps = len(train_ids)//batch_size
valid_steps = len(valid_ids)//batch_size
model.fit_generator(train_gen, steps_per_epoch=train_steps, epochs=1)