1

My autoencoder shows a "Valueerror: Data cardinality is ambiguous: x sizes: 14 y sizes: 31 Make sure all arrays contain the same number of samples."

split_size_i = int(images.shape[0]*0.7)
split_size = int(images_gray.shape[0]*0.7)

autoencoder.fit(images[split_size_i:], images[:split_size_i], 
                epochs=10, 
                shuffle=True, 
                validation_data=(images_gray[split_size:],images_gray[:split_size]))

My dataset for images and images_gray has 45 images each. Need help with this.

1 Answers1

0

As the error states x has 14 images and y has 31 images, both x and y must be equal.

Doing the following changes will help in solving the error

autoencoder.fit(images_gray[:split_size], images[:split_size_i], 
                epochs=10, 
                shuffle=True, 
                validation_data=(images_gray[split_size:],images[split_size_i:]))

Let us know if the issue still persists. Thanks!