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

猜你喜欢

转载自blog.csdn.net/hhhhhhhhhhwwwwwwwwww/article/details/125556504
今日推荐