Autoencoder with images in Google Drive

Hi,

I’m looking for a basic tutorial for autoencoder using images in Google Drive (not preset datasets like MNIST).
I’m trying to use my photos in Google Drive to develop an Autoencoder in Keras. I loaded images using

data = pathlib.Path('/content/drive/MyDrive/my_imgs')
train_generator = ImageDataGenerator(rescale=1./255, shear_range=0.2, zoom_range=0.2)
train_generator = train_generator.flow_from_directory(data, target_size=(32, 32), batch_size=32) # DirectoryIterator: iterator of batch (array and label)

and the model is simple

W = 32
input_x = Input(shape=(W, W, 3))
x = Conv2D(10, (4, 4), padding='same')(input_x)
x = Flatten()(x)
v = Dense(W * W * 3, activation='relu')(x)
x = Reshape((W, W, 3))(v)

model = Model(input_x, x)
model.compile(optimizer='rmsprop', loss='mse')
model.summary()

Now in the train phase

model.fit(
    train_generator,
    train_generator,
    epochs=10,
    batch_size=10,
    validation_split=0.2,
    shuffle=True
)

got error

ValueError: `validation_split` is only supported for Tensors or NumPy arrays, found following types in the input: [<class 'keras.preprocessing.image.DirectoryIterator'>, <class 'keras.preprocessing.image.DirectoryIterator'>]

I think I’m going the wrong way, but I can’t find the best practice.
Does anyone know a good resource (notebook, blog etc) on it?

Thanks