AttributeError: type object ‘Image‘ has no attribute ‘fromarray‘
Posted AI浩
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了AttributeError: type object ‘Image‘ has no attribute ‘fromarray‘相关的知识,希望对你有一定的参考价值。
错误描述:
Traceback (most recent call last):
File "D:\\OCR\\DBNet.pytorch-master\\tools\\predict.py", line 195, in <module>
img = rec_image(img, boxes_max,model_cls)
File "D:\\OCR\\DBNet.pytorch-master\\tools\\predict.py", line 160, in rec_image
img = transform_test(Image.fromarray(dst_img))
AttributeError: type object 'Image' has no attribute 'fromarray'
错误的原因:
导入Image的方法错误!
错误导入: from PIL.Image import Image
正确导入: from PIL import Image
以上是关于AttributeError: type object ‘Image‘ has no attribute ‘fromarray‘的主要内容,如果未能解决你的问题,请参考以下文章
AttributeError: 'DatabaseOperations' 对象没有属性 'geo_db_type' QGIS Docker 容器到 Heroku
“AttributeError: type object ‘RocCurveDisplay‘ has no attribute ‘from_predictions‘ “.
“AttributeError: type object ‘RocCurveDisplay‘ has no attribute ‘from_estimator‘ “.
Python 3 urllib json AttributeError:“HTTPResponse”对象没有属性“type”