第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

是否可以使用 google vision api 一次掃描 10 張圖像?到目前為止只做 1

是否可以使用 google vision api 一次掃描 10 張圖像?到目前為止只做 1

猛跑小豬 2023-05-16 15:55:25
我們目前正在使用 google vision API 做一個 ocr 項目,其中圖像返回一個文本值......但到目前為止我們只能做 1 張圖像,是否可以做 10 張圖像?我使用 python 并且此代碼僅運行一個圖像..謝謝import os, iofrom google.cloud import visionfrom google.cloud.vision import typesimport pandas as pdos.environ['GOOGLE_APPLICATION_CREDENTIALS'] = r'anjir.json'client = vision.ImageAnnotatorClient()FILE_NAME = 'receipttest2.jpg'FOLDER_PATH = r'C:\Users\Fadhlan\Desktop\Python venv\image\text'with io.open(os.path.join(FOLDER_PATH, FILE_NAME), 'rb') as image_file:    content = image_file.read()image = vision.types.Image(content=content)response = client.text_detection(image=image)texts = response.text_annotationsdf = pd.DataFrame(columns=['locale', 'description'])for text in texts:    df = df.append(        dict(            locale=text.locale,            description=text.description        ),        ignore_index=True    )print(df['description'][0])
查看完整描述

1 回答

?
躍然一笑

TA貢獻1826條經(jīng)驗 獲得超6個贊

由于異步模式支持“TEXT_DETECTION”功能,因此可以離線使用批量圖像注釋。您可以在此處找到 Python 的示例代碼,如您所見,需要為每個圖像創(chuàng)建一個請求元素并將其添加到請求數(shù)組中:

client = vision_v1.ImageAnnotatorClient()


//image one

source1 = {"image_uri": image_uri_1}

image1 = {"source": source1}

features1 = [

? ? {"type": enums.Feature.Type.LABEL_DETECTION},

? ? {"type": enums.Feature.Type.IMAGE_PROPERTIES}

]


//image two

source2 = {"image_uri": image_uri_2}

image2 = {"source": source2}

features2 = [

? ? {"type": enums.Feature.Type.LABEL_DETECTION}

]


# Each requests element corresponds to a single image

requests = [{"image": image1, "features": features1}, {"image": image2, "features": features2}]

gcs_destination = {"uri": output_uri}


# The max number of responses to output in each JSON file

batch_size = 2


output_config = {"gcs_destination": gcs_destination,

? ? ? ? ? ? ? ? ?"batch_size": batch_size}

operation = client.async_batch_annotate_images(requests, output_config)


查看完整回答
反對 回復(fù) 2023-05-16
  • 1 回答
  • 0 關(guān)注
  • 152 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號