我正在尝试提供一个目录作为 ImageDataGenerator.flow_from_directory 的输入,但我无法做到。
train_data_dir = "/train"
validation_data_dir = "/test"
train_generator = ImageDataGenerator.flow_from_directory(directory=train_data_dir,
target_size = (img_height, img_width),
batch_size = batch_size,
class_mode = "categorical")
validation_generator = ImageDataGenerator.flow_from_directory(directory=validation_data_dir,
target_size = (img_height, img_width),
class_mode = "categorical")
上面的代码返回以下错误
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-126-39ed634afa51> in <module>
2 target_size = (img_height, img_width),
3 batch_size = batch_size,
----> 4 class_mode = "categorical")
5
6 validation_generator = ImageDataGenerator.flow_from_directory(validation_data_dir,
TypeError: flow_from_directory() missing 1 required positional argument: 'self'
我该如何解决这个问题?