我希望预览keras图像数据生成器的输出。我如何从一个生成器中生成5张图像?
train_datagen = ImageDataGenerator(
rescale=1./255,
shear_range=0.2,
zoom_range=0.2,
horizontal_flip=True)
test_datagen = ImageDataGenerator(rescale=1./255)
train_generator = train_datagen.flow_from_directory(
'data/train',
target_size=(150, 150),
batch_size=32,
class_mode='binary')
尝试通过迭代器的常规方法似乎无效
for image in train_generator:
print(image)
AttributeError: 'DirectoryIterator' object has no attribute 'next'
答案 0 :(得分:0)
这会从数据集中产生前三张图像:
public static boolean removeEmployee(Employee employee)
{
employee.setEmployees(employee.getEmployees().stream().filter(Employee::removeEmployee).collect(Collectors.toList()));
return !(employee.getSalary()==0 && employee.getEmployees().size()==0);
}