1

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'

これを解決するにはどうすればよいですか?

4

1 に答える 1