Closed yuchen202 closed 2 years ago
已知pillow<=7.2.0,不知道其他的怎么样 另外,AttributeError: 'tuple' object has no attribute 'cpu'怎么办呢
把那边注释掉,直接用上面输出的output
已知pillow<=7.2.0,不知道其他的怎么样 另外,AttributeError: 'tuple' object has no attribute 'cpu'怎么办呢
把那边注释掉,直接用上面输出的output
我也是遇到了同样的问题,刚刚才学习python,请问能说一下具体怎么修改吗?
for content_path in content_paths: for style_path in style_paths: print(content_path) content_tf1 = content_transform() content = content_tf(Image.open(content_path).convert("RGB"))
h, w, c = np.shape(content)
style_tf1 = style_transform(h, w)
style = style_tf(Image.open(style_path).convert("RGB"))
style = style.to(device).unsqueeze(0)
content = content.to(device).unsqueeze(0)
with torch.no_grad():
output = network(content, style)
# output = output.cuda()
output = output
output_name = '{:s}/{:s}_stylized_{:s}{:s}'.format(
output_path, splitext(basename(content_path))[0],
splitext(basename(style_path))[0], save_ext
)
save_image(output[0], output_name)
You can copy this code to replace corresponding code on test.py
I replace the code with yours, but I got the output as this
收到了,谢谢
已知pillow<=7.2.0,不知道其他的怎么样 另外,AttributeError: 'tuple' object has no attribute 'cpu'怎么办呢