I am training convolutional autoencoder and I have this code for loading data (images):
train_ds = tf.keras.preprocessing.image_dataset_from_directory(
'path/to/images',
image_size=image_size
)
normalization_layer = layers.experimental.preprocessing.Rescaling(1./255)
def adjust_inputs(images, labels):
return normalization_layer(images), normalization_layer(images)
normalized_train_ds = train_ds.map(adjust_inputs)
As I don't need class labels but images itself as Y, I am mapping function adjust_inputs to dataset. But now when I try to access attribute filenames, I get error: AttributeError: 'MapDataset' object has no attribute 'filenames'. That is logical, because MapDataset is not Dataset.
How would I attach or get filenames of loaded images that are in my Dataset?
I am really surprised that there is not an easier interface for this, this looks like pretty common thing.
