pytorch - AttributeError:“PngImageFile”对象没有属性“apply_tfms”
问题描述
当我使用learn.predict(img)
图像文件格式预测图像类时出现此错误png
AttributeError: PngImageFile object has no attribute apply_tfms
解决方案
谷歌 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 图像。
没有实际代码是不可能确定的,但这似乎是一个可能的原因。
推荐阅读
- sql-server - 使用 goroutine 丢失数据
- c++ - 初始化空的二维向量?
- xamarin - 使用 Infragistics ScatterLineSeries 的 Xamarin 内存泄漏
- python - 如何从html中获取数据并将其作为对象,字典,在python中安全
- python - 迭代字典列表并通过比较两个列表来创建结果集
- powerbi - DAX Power BI 计算两列中不同参数的乘积并显示折线图
- r - ggplot reorder changes when using facet_wrap
- javascript - 多次调用节点google自定义搜索API
- javascript - 嵌套数据切换元素
- python - 当我在 python 的二进制文件中写入一些行时读取 1 行