首页 > 解决方案 > AttributeError:“PngImageFile”对象没有属性“apply_tfms”

问题描述

当我使用learn.predict(img) 图像文件格式预测图像类时出现此错误png

AttributeError: PngImageFile object has no attribute apply_tfms

标签: pytorch

解决方案


谷歌 PngImageFile => http://code.nabla.net/doc/PIL/api/PIL/PngImagePlugin/PIL.PngImagePlugin.PngImageFile.html

谷歌 apply_tfms => https://docs.fast.ai/vision.image.html#Image.apply_tfms

该调用需要一个 fastai图像,但您似乎正在传递一个 PIL 图像。

没有实际代码是不可能确定的,但这似乎是一个可能的原因。


推荐阅读