Merge pull request #159 from Michael-Hsu/patch-1

Let sample.py can generate caption for gray image.
This commit is contained in:
Yunjey Choi
2020-01-28 00:04:54 +09:00
committed by GitHub

View File

@ -14,7 +14,7 @@ from PIL import Image
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
def load_image(image_path, transform=None):
image = Image.open(image_path)
image = Image.open(image_path).convert('RGB')
image = image.resize([224, 224], Image.LANCZOS)
if transform is not None: