You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I also encountered this problem. It may be that some images in the data set are grayscale images instead of rgb images. I deleted these grayscale images to solve this problem.
Here is my code.
`def remove_single_channel_images(images_files):
for path in sorted(os.listdir(images_files)):
image_path = os.path.join(images_files, path)
image = Image.open(image_path)
image = np.array(image)
if image.shape != (256, 256, 3):
print(image_path)
os.remove(image_path)
The main reason for this problem is that there are single channel images in the data set. Solution: just add. convert ('rgb ') in datasets.py file
iterm_B = self.transform(Image.open(self.files_B[random.randint(0, len(self.files_B)-1)]).convert('RGB'))
When I use my own data set, the program runs normally, but with the dataset :horse2zebra, the program starts to report errors:
The text was updated successfully, but these errors were encountered: