Skip to content

Commit

Permalink
datasets.py: Convert image to RGB channel
Browse files Browse the repository at this point in the history
Converts images with less than 3 channels to RGB. 
Closes #155
  • Loading branch information
EverWinter23 committed May 3, 2019
1 parent 6442556 commit 38c2465
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion utils/datasets.py
Expand Up @@ -83,7 +83,7 @@ def __getitem__(self, index):
img_path = self.img_files[index % len(self.img_files)].rstrip()

# Extract image as PyTorch tensor
img = transforms.ToTensor()(Image.open(img_path))
img = transforms.ToTensor()(Image.open(img_path).convert('RGB'))

# Handle images with less than three channels
if len(img.shape) != 3:
Expand Down

0 comments on commit 38c2465

Please sign in to comment.