loader = transforms.Compose([ transforms.Resize(imsize), # scale imported image on shortest length transforms.ToTensor() ]) # transform it into a torch tensor # Verify image path style_path = input("Path to Style: ") while not os.path.isfile(style_path): style_path = input('E: Image not found. Path to Style: ') # Verify content path content_path = input("Path to Content: ") while not os.path.isfile(content_path): content_path = input('E: Image not found. Path to Content: ') style_img = img_handler.image_loader(device, loader, style_path) content_img = img_handler.image_loader(device, loader, content_path) # TODO remove once image size class is implemented assert style_img.size() == content_img.size(), \ "we need to import style and content imsages of the same size" unloader = transforms.ToPILImage() # reconvert into PIL image if plt_prvs: plt.ion() plt.figure() img_handler.imshow(style_img, unloader, title='Style Image') plt.figure() img_handler.imshow(content_img, unloader, title='Content Image')