代码:
from google.cloud import vision
import google.cloud.proto.vision.v1.image_annotator_pb2 as pvv
import io
client = vision.ImageAnnotatorClient()
def mkrl(imageStr):
im_obj = pvv.Image(content = imageStr)
return pvv.AnnotateImageRequest(image = im_obj, features = [{"type": "TEXT_DETECTION"}])
def getR(imageList):
req = map(mkrl,imageList)
response = client.batch_annotate_images(req)
return response
我尝试使用google vision api从图像中提取文本。我需要发送一批图片 - 工作正常,但现在出现了这个错误:
ImportError:没有名为' google.cloud.proto.vision'
的模块
答案 0 :(得分:0)
这已经解决了.....
导入它的正确方法是:
将google.cloud.vision_v1.proto.image_annotator_pb2导入为pvv
或
从google.cloud.vision_v1.proto导入image_annotator_pb2作为pvv