Recently, I've run this project( https://github.com/milesial/Pytorch-UNet )and when I run predict.py, it came to this error:
Traceback (most recent call last):
File "predict.py", line 131, in <module>
device=device)
File "predict.py", line 43, in predict_img
transforms.Resize(full_img.shape[2]),
AttributeError: 'PngImageFile' object has no attribute 'shape'
Then I check the code and I find that this version is extremely similar to the version before
previous version:
img_height = full_img.size[1]
tf = transforms.Compose(
[
transforms.ToPILImage(),
transforms.Resize(img_height),
transforms.ToTensor()
]
)
present version:
tf = transforms.Compose(
[
transforms.ToPILImage(),
transforms.Resize(full_img.shape[1]),
transforms.ToTensor()
]
)
I don't know what had happened but if any friend know something about this question I will be great gratefull to you! Thanks!
看起来您缺少一个右括号来关闭“撰写”
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.