클래스 ImageAnnotatorClient (3.4.4)

ImageAnnotatorClient(*, credentials: typing.Optional[google.auth.credentials.Credentials] = None, transport: typing.Optional[typing.Union[str, google.cloud.vision_v1.services.image_annotator.transports.base.ImageAnnotatorTransport]] = None, client_options: typing.Optional[typing.Union[google.api_core.client_options.ClientOptions, dict]] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)

얼굴, 랜드마크, 로고, 라벨, 텍스트 인식 등 클라이언트 이미지에 대한 Google Cloud Vision API 감지 작업을 수행하는 서비스입니다. ImageAnnotator 서비스는 이미지에서 감지된 항목을 반환합니다.

속성

전송

클라이언트 인스턴스에서 사용한 전송을 반환합니다.

반환
유형설명
ImageAnnotatorTransport클라이언트 인스턴스에서 사용되는 전송입니다.

메서드

ImageAnnotatorClient

ImageAnnotatorClient(*, credentials: typing.Optional[google.auth.credentials.Credentials] = None, transport: typing.Optional[typing.Union[str, google.cloud.vision_v1.services.image_annotator.transports.base.ImageAnnotatorTransport]] = None, client_options: typing.Optional[typing.Union[google.api_core.client_options.ClientOptions, dict]] = None, client_info: google.api_core.gapic_v1.client_info.ClientInfo = <google.api_core.gapic_v1.client_info.ClientInfo object>)

이미지 주석 작성자 클라이언트를 인스턴스화합니다.

매개변수
이름설명
credentials Optional[google.auth.credentials.Credentials]

요청에 연결할 승인 사용자 인증 정보입니다. 이 사용자 인증 정보는 서비스에 애플리케이션을 식별합니다. 지정된 사용자 인증 정보가 없으면 클라이언트가 환경에서 사용자 인증 정보를 확인하려고 시도합니다.

transport Union[str, ImageAnnotatorTransport]

사용할 전송입니다. None으로 설정하면 전송이 자동으로 선택됩니다.

client_options Optional[Union[google.api_core.client_options.ClientOptions, dict]]

클라이언트의 맞춤 옵션입니다. transport 인스턴스가 제공되면 적용되지 않습니다. (1) api_endpoint 속성을 사용하여 클라이언트에서 제공하는 기본 엔드포인트를 재정의할 수 있습니다. GOOGLE_API_USE_MTLS_ENDPOINT 환경 변수를 사용하여 엔드포인트를 재정의할 수도 있습니다('always'(항상 기본 mTLS 엔드포인트 사용), 'never'(항상 기본 일반 엔드포인트 사용), 'auto'(클라이언트 인증서가 있는 경우 기본 mTLS 엔드포인트로 자동 전환, 기본값)). 하지만 api_endpoint 속성이 제공되면 우선합니다. (2) GOOGLE_API_USE_CLIENT_CERTIFICATE 환경 변수가 'true'인 경우 client_cert_source 속성을 사용하여 상호 TLS 전송을 위한 클라이언트 인증서를 제공할 수 있습니다. 제공되지 않으면 기본 SSL 클라이언트 인증서가 있는 경우 사용됩니다. GOOGLE_API_USE_CLIENT_CERTIFICATE가 'false'이거나 설정되지 않은 경우 클라이언트 인증서가 사용되지 않습니다.

client_info google.api_core.gapic_v1.client_info.ClientInfo

API 요청과 함께 사용자 에이전트 문자열을 전송하는 데 사용되는 클라이언트 정보입니다. None인 경우 기본 정보가 사용됩니다. 일반적으로 자체 클라이언트 라이브러리를 개발하는 경우에만 이 값을 설정하면 됩니다.

예외
유형설명
google.auth.exceptions.MutualTLSChannelError어떤 이유로든 상호 TLS 전송 생성이 실패한 경우

__exit__

__exit__(type, value, traceback)

기본 전송 리소스를 해제합니다.

async_batch_annotate_files

async_batch_annotate_files(
    request: typing.Optional[
        typing.Union[
            google.cloud.vision_v1.types.image_annotator.AsyncBatchAnnotateFilesRequest,
            dict,
        ]
    ] = None,
    *,
    requests: typing.Optional[
        typing.MutableSequence[
            google.cloud.vision_v1.types.image_annotator.AsyncAnnotateFileRequest
        ]
    ] = None,
    retry: typing.Union[
        google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.api_core.operation.Operation

여러 페이지를 포함할 수 있고 페이지당 여러 이미지를 포함할 수 있는 PDF 파일과 같은 일반 파일 목록에 대해 비동기 이미지 감지 및 주석을 실행합니다. google.longrunning.Operations 인터페이스를 통해 진행 상태 및 결과를 가져올 수 있습니다. Operation.metadata에는 OperationMetadata(메타데이터)이 포함됩니다. Operation.response에는 AsyncBatchAnnotateFilesResponse (결과)가 포함됩니다.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import vision_v1

def sample_async_batch_annotate_files():
    # Create a client
    client = vision_v1.ImageAnnotatorClient()

    # Initialize request argument(s)
    request = vision_v1.AsyncBatchAnnotateFilesRequest(
    )

    # Make the request
    operation = client.async_batch_annotate_files(request=request)

    print("Waiting for operation to complete...")

    response = operation.result()

    # Handle the response
    print(response)
매개변수
이름설명
request Union[google.cloud.vision_v1.types.AsyncBatchAnnotateFilesRequest, dict]

요청 객체입니다. 여러 비동기 파일 주석 요청이 단일 서비스 호출로 일괄 처리됩니다.

requests MutableSequence[google.cloud.vision_v1.types.AsyncAnnotateFileRequest]

필수 항목입니다. 이 배치에 대한 개별 비동기 파일 주석 요청입니다. 이는 request 인스턴스의 requests 필드에 해당합니다. request이 제공된 경우 이를 설정하면 안 됩니다.

retry google.api_core.retry.Retry

재시도해야 하는 오류(있는 경우)의 지정입니다.

timeout float

이 요청의 제한 시간입니다.

metadata Sequence[Tuple[str, str]]

요청과 함께 메타데이터로 전송되어야 하는 문자열입니다.

반환
유형설명
google.api_core.operation.Operation장기 실행 작업을 나타내는 객체입니다. 작업의 결과 유형은 비동기 배치 파일 주석 요청에 대한 응답인 AsyncBatchAnnotateFilesResponse입니다.

batch_annotate_files

batch_annotate_files(
    request: typing.Optional[
        typing.Union[
            google.cloud.vision_v1.types.image_annotator.BatchAnnotateFilesRequest, dict
        ]
    ] = None,
    *,
    requests: typing.Optional[
        typing.MutableSequence[
            google.cloud.vision_v1.types.image_annotator.AnnotateFileRequest
        ]
    ] = None,
    retry: typing.Union[
        google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.vision_v1.types.image_annotator.BatchAnnotateFilesResponse

파일 배치에 대한 이미지 감지 및 주석을 수행하는 서비스입니다. 이제 'application/pdf', 'image/tiff', 'image/gif'만 지원됩니다. 이 서비스는 제공된 각 파일에서 최대 5개 (AnnotateFileRequest.pages에 지정 가능)의 프레임(gif) 또는 페이지 (pdf 또는 tiff)를 추출하고 추출된 각 이미지에 대한 감지 및 주석을 수행합니다.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import vision_v1

def sample_batch_annotate_files():
    # Create a client
    client = vision_v1.ImageAnnotatorClient()

    # Initialize request argument(s)
    request = vision_v1.BatchAnnotateFilesRequest(
    )

    # Make the request
    response = client.batch_annotate_files(request=request)

    # Handle the response
    print(response)
매개변수
이름설명
request Union[google.cloud.vision_v1.types.BatchAnnotateFilesRequest, dict]

요청 객체입니다. BatchAnnotateFiles API를 사용하여 파일에 주석을 다는 요청의 목록입니다.

requests MutableSequence[google.cloud.vision_v1.types.AnnotateFileRequest]

필수 항목입니다. 파일 주석 요청 목록입니다. 현재는 BatchAnnotateFilesRequest에서 AnnotateFileRequest가 한 개만 지원됩니다. 이는 request 인스턴스의 requests 필드에 해당합니다. request이 제공된 경우 이를 설정하면 안 됩니다.

retry google.api_core.retry.Retry

재시도해야 하는 오류(있는 경우)의 지정입니다.

timeout float

이 요청의 제한 시간입니다.

metadata Sequence[Tuple[str, str]]

요청과 함께 메타데이터로 전송되어야 하는 문자열입니다.

반환
유형설명
google.cloud.vision_v1.types.BatchAnnotateFilesResponse파일 주석 응답의 목록입니다.

batch_annotate_images

batch_annotate_images(
    request: typing.Optional[
        typing.Union[
            google.cloud.vision_v1.types.image_annotator.BatchAnnotateImagesRequest,
            dict,
        ]
    ] = None,
    *,
    requests: typing.Optional[
        typing.MutableSequence[
            google.cloud.vision_v1.types.image_annotator.AnnotateImageRequest
        ]
    ] = None,
    retry: typing.Union[
        google.api_core.retry.Retry, google.api_core.gapic_v1.method._MethodDefault
    ] = _MethodDefault._DEFAULT_VALUE,
    timeout: typing.Union[float, object] = _MethodDefault._DEFAULT_VALUE,
    metadata: typing.Sequence[typing.Tuple[str, str]] = ()
) -> google.cloud.vision_v1.types.image_annotator.BatchAnnotateImagesResponse

이미지 배치에 대한 이미지 감지 및 주석을 실행합니다.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import vision_v1

def sample_batch_annotate_images():
    # Create a client
    client = vision_v1.ImageAnnotatorClient()

    # Initialize request argument(s)
    request = vision_v1.BatchAnnotateImagesRequest(
    )

    # Make the request
    response = client.batch_annotate_images(request=request)

    # Handle the response
    print(response)
매개변수
이름설명
request Union[google.cloud.vision_v1.types.BatchAnnotateImagesRequest, dict]

요청 객체입니다. 여러 이미지 주석 요청이 단일 서비스 호출로 일괄 처리됩니다.

requests MutableSequence[google.cloud.vision_v1.types.AnnotateImageRequest]

필수 항목입니다. 이 배치에 대한 개별 이미지 주석 요청입니다. 이는 request 인스턴스의 requests 필드에 해당합니다. request이 제공된 경우 이를 설정하면 안 됩니다.

retry google.api_core.retry.Retry

재시도해야 하는 오류(있는 경우)의 지정입니다.

timeout float

이 요청의 제한 시간입니다.

metadata Sequence[Tuple[str, str]]

요청과 함께 메타데이터로 전송되어야 하는 문자열입니다.

반환
유형설명
google.cloud.vision_v1.types.BatchAnnotateImagesResponse배치 이미지 주석 요청에 대한 응답입니다.

common_billing_account_path

common_billing_account_path(billing_account: str) -> str

정규화된 billing_account 문자열을 반환합니다.

common_folder_path

common_folder_path(folder: str) -> str

정규화된 폴더 문자열을 반환합니다.

common_location_path

common_location_path(project: str, location: str) -> str

정규화된 위치 문자열을 반환합니다.

common_organization_path

common_organization_path(organization: str) -> str

정규화된 조직 문자열을 반환합니다.

common_project_path

common_project_path(project: str) -> str

정규화된 프로젝트 문자열을 반환합니다.

from_service_account_file

from_service_account_file(filename: str, *args, **kwargs)

제공된 사용자 인증 정보 파일을 사용하여 이 클라이언트의 인스턴스를 만듭니다.

매개변수
이름설명
filename str

서비스 계정 비공개 키 json 파일의 경로입니다.

반환
유형설명
ImageAnnotatorClient구성된 클라이언트입니다.

from_service_account_info

from_service_account_info(info: dict, *args, **kwargs)

제공된 사용자 인증 정보 정보를 사용하여 이 클라이언트의 인스턴스를 만듭니다.

매개변수
이름설명
info dict

서비스 계정 비공개 키 정보입니다.

반환
유형설명
ImageAnnotatorClient구성된 클라이언트입니다.

from_service_account_json

from_service_account_json(filename: str, *args, **kwargs)

제공된 사용자 인증 정보 파일을 사용하여 이 클라이언트의 인스턴스를 만듭니다.

매개변수
이름설명
filename str

서비스 계정 비공개 키 json 파일의 경로입니다.

반환
유형설명
ImageAnnotatorClient구성된 클라이언트입니다.

get_mtls_endpoint_and_cert_source

get_mtls_endpoint_and_cert_source(
    client_options: typing.Optional[
        google.api_core.client_options.ClientOptions
    ] = None,
)

상호 TLS의 API 엔드포인트와 클라이언트 인증서 소스를 반환합니다.

클라이언트 인증서 소스는 다음 순서로 결정됩니다. (1) GOOGLE_API_USE_CLIENT_CERTIFICATE 환경 변수가 'true'가 아닌 경우 클라이언트 인증서 소스는 None입니다. (2) client_options.client_cert_source가 제공되면 제공된 것을 사용하고, 기본 클라이언트 인증서 소스가 있으면 기본값을 사용하고, 그렇지 않으면 클라이언트 인증서 소스는 None입니다.

API 엔드포인트는 다음 순서로 결정됩니다. (1) client_options.api_endpoint가 제공된 경우 제공된 것을 사용합니다. (2) GOOGLE_API_USE_CLIENT_CERTIFICATE 환경 변수가 'always'인 경우 기본 mTLS 엔드포인트를 사용합니다. 환경 변수가 'never'인 경우 기본 API 엔드포인트를 사용합니다. 그렇지 않고 클라이언트 인증서 소스가 있는 경우 기본 mTLS 엔드포인트를 사용하고, 그렇지 않은 경우 기본 API 엔드포인트를 사용합니다.

자세한 내용은 https://google.aip.dev/auth/4114를 참고하세요.

매개변수
이름설명
client_options google.api_core.client_options.ClientOptions

클라이언트의 맞춤 옵션입니다. 이 메서드에서는 api_endpointclient_cert_source 속성만 사용할 수 있습니다.

예외
유형설명
google.auth.exceptions.MutualTLSChannelError오류가 발생한 경우
반환
유형설명
Tuple[str, Callable[[], Tuple[bytes, bytes]]]사용할 API 엔드포인트와 클라이언트 인증서 소스를 반환합니다.

parse_common_billing_account_path

parse_common_billing_account_path(path: str) -> typing.Dict[str, str]

billing_account 경로를 구성요소 세그먼트로 파싱합니다.

parse_common_folder_path

parse_common_folder_path(path: str) -> typing.Dict[str, str]

폴더 경로를 구성요소 세그먼트로 파싱합니다.

parse_common_location_path

parse_common_location_path(path: str) -> typing.Dict[str, str]

위치 경로를 구성요소 세그먼트로 파싱합니다.

parse_common_organization_path

parse_common_organization_path(path: str) -> typing.Dict[str, str]

조직 경로를 구성요소 세그먼트로 파싱합니다.

parse_common_project_path

parse_common_project_path(path: str) -> typing.Dict[str, str]

프로젝트 경로를 구성요소 세그먼트로 파싱합니다.

parse_product_path

parse_product_path(path: str) -> typing.Dict[str, str]

제품 경로를 구성요소 세그먼트로 파싱합니다.

parse_product_set_path

parse_product_set_path(path: str) -> typing.Dict[str, str]

product_set 경로를 구성요소 세그먼트로 파싱합니다.

product_path

product_path(project: str, location: str, product: str) -> str

정규화된 제품 문자열을 반환합니다.

product_set_path

product_set_path(project: str, location: str, product_set: str) -> str

정규화된 product_set 문자열을 반환합니다.