我正在尝试遵循此code,但此后许多事情(功能)已经改变。因此,我尝试重新编写它,但是当我要覆盖它们时,出现此错误:
TypeError: unsupported operand type(s) for *: 'JpegImageFile' and 'JpegImageFile'
这是我的代码:
import os
import matplotlib.pyplot as plt
from fastai.basic_train import *
from pathlib import Path
from PIL import Image
%matplotlib inline
%reload_ext autoreload
%autoreload 2
PATH = Path('.../data')
idx = 16
input_img = Image.open(PATH/f'{idx}_naive.jpg')
#input_img.show()
style_img = Image.open(PATH/f'{idx}_target.jpg')
#style_img.show()
mask = Image.open(PATH/f'{idx}_c_mask.jpg')
#mask.show()
loose_mask = Image.open(PATH/f'{idx}_c_mask_dilated.jpg')
#loose_mask.show()
fig, axs = plt.subplots(1,3,figsize = (12,6))
#axs[0].imshow(input_img * mask) #doesn't work
#axs[0].axis('off')
axs[1].imshow(input_img)
axs[1].axis('off')
axs[2].imshow(style_img)
axs[2].axis('off')