Skip to content

start_project_version

start_project_version(
    project_version_arn: ProjectVersionArn,
    min_inference_units: InferenceUnits,
    *,
    config_overrides: Optional[RekognitionClientConfig] = None,
    max_inference_units: Optional[InferenceUnits] = None,
) -> StartProjectVersionResponse

This operation applies only to Amazon Rekognition Custom Labels.

Starts the running of the version of a model. Starting a model takes a while to complete. To check the current state of the model, use DescribeProjectVersions.

Once the model is running, you can detect custom labels in new images by calling DetectCustomLabels.

You are charged for the amount of time that the model is running. To stop a running model, call StopProjectVersion.

This operation requires permissions to perform the rekognition:StartProjectVersion action.

Parameters:

  • project_version_arn (ProjectVersionArn) –

    The Amazon Resource Name(ARN) of the model version that you want to start.

  • min_inference_units (InferenceUnits) –

    The minimum number of inference units to use. A single inference unit represents 1 hour of processing.

    Use a higher number to increase the TPS throughput of your model. You are charged for the number of inference units that you use.

  • max_inference_units (Optional[InferenceUnits], default: None ) –

    The maximum number of inference units to use for auto-scaling the model. If you don't specify a value, Amazon Rekognition Custom Labels doesn't auto-scale the model.

Raises:

  • AccessDeniedException –

    You are not authorized to perform the action.

  • InternalServerError –

    Amazon Rekognition experienced a service issue. Try your call again.

  • InvalidParameterException –

    Input parameter violated a constraint. Validate your parameter before calling the API operation again.

  • LimitExceededException –

    An Amazon Rekognition service limit was exceeded. For example, if you start too many jobs concurrently, subsequent calls to start operations (ex: StartLabelDetection) will raise a LimitExceededException exception (HTTP status code: 400) until the number of concurrently running jobs is below the Amazon Rekognition service limit.

  • ProvisionedThroughputExceededException –

    The number of requests exceeded your throughput limit. If you want to increase this limit, contact Amazon Rekognition.

  • ResourceInUseException –

    The specified resource is already being used.

  • ResourceNotFoundException –

    The resource specified in the request cannot be found.

  • ThrottlingException –

    Amazon Rekognition is temporarily unable to process the request. Try your call again.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

To start an Amazon Rekognition Custom Labels model Starts a version of an Amazon Rekognition Custom Labels model.

>>> client.start_project_version(project_version_arn='arn:aws:rekognition:us-east-1:111122223333:project/my-project/version/1/1690556751958', min_inference_units=1, max_inference_units=1)
Source code in docs_src/capo_rekognition/_services/rekognition.py
def start_project_version(
    self,
    project_version_arn: "capo_rekognition.types.project_version_arn.ProjectVersionArn",
    min_inference_units: "capo_rekognition.types.inference_units.InferenceUnits",
    *,
    config_overrides: Optional[RekognitionClientConfig] = None,
    max_inference_units: Optional[
        "capo_rekognition.types.inference_units.InferenceUnits"
    ] = None,
) -> "capo_rekognition.types.start_project_version_response.StartProjectVersionResponse":
    """<note> <p>This operation applies only to Amazon Rekognition Custom Labels.</p> </note> <p>Starts the running of the version of a model. Starting a model takes a while to complete. To check the current state of the model, use <a>DescribeProjectVersions</a>. </p> <p>Once the model is running, you can detect custom labels in new images by calling <a>DetectCustomLabels</a>.</p> <note> <p>You are charged for the amount of time that the model is running. To stop a running model, call <a>StopProjectVersion</a>.</p> </note> <p>This operation requires permissions to perform the <code>rekognition:StartProjectVersion</code> action.</p>

    Args:
        project_version_arn: <p>The Amazon Resource Name(ARN) of the model version that you want to start.</p>
        min_inference_units: <p>The minimum number of inference units to use. A single inference unit represents 1 hour of processing. </p> <p>Use a higher number to increase the TPS throughput of your model. You are charged for the number of inference units that you use. </p>
        max_inference_units: <p>The maximum number of inference units to use for auto-scaling the model. If you don't specify a value, Amazon Rekognition Custom Labels doesn't auto-scale the model.</p>

    Raises:
        capo_rekognition.errors.access_denied_exception.AccessDeniedException: <p>You are not authorized to perform the action.</p>
        capo_rekognition.errors.internal_server_error.InternalServerError: <p>Amazon Rekognition experienced a service issue. Try your call again.</p>
        capo_rekognition.errors.invalid_parameter_exception.InvalidParameterException: <p>Input parameter violated a constraint. Validate your parameter before calling the API operation again.</p>
        capo_rekognition.errors.limit_exceeded_exception.LimitExceededException: <p>An Amazon Rekognition service limit was exceeded. For example, if you start too many jobs concurrently, subsequent calls to start operations (ex: <code>StartLabelDetection</code>) will raise a <code>LimitExceededException</code> exception (HTTP status code: 400) until the number of concurrently running jobs is below the Amazon Rekognition service limit. </p>
        capo_rekognition.errors.provisioned_throughput_exceeded_exception.ProvisionedThroughputExceededException: <p>The number of requests exceeded your throughput limit. If you want to increase this limit, contact Amazon Rekognition.</p>
        capo_rekognition.errors.resource_in_use_exception.ResourceInUseException: <p>The specified resource is already being used.</p>
        capo_rekognition.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource specified in the request cannot be found.</p>
        capo_rekognition.errors.throttling_exception.ThrottlingException: <p>Amazon Rekognition is temporarily unable to process the request. Try your call again.</p>
        capo_rekognition.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To start an Amazon Rekognition Custom Labels model
        Starts a version of an Amazon Rekognition Custom Labels model.

        >>> client.start_project_version(project_version_arn='arn:aws:rekognition:us-east-1:111122223333:project/my-project/version/1/1690556751958', min_inference_units=1, max_inference_units=1)
    """

    def _handler(
        req: "OperationRequest[capo_rekognition.types.start_project_version_request.StartProjectVersionRequest]",
    ) -> OperationResponse[
        "capo_rekognition.types.start_project_version_response.StartProjectVersionResponse"
    ]:
        import capo_rekognition._operations.rekognition_service.start_project_version

        output, http_response = (
            capo_rekognition._operations.rekognition_service.start_project_version.start_project_version(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StartProjectVersion")
    )
    input_: capo_rekognition.types.start_project_version_request.StartProjectVersionRequest = {
        "project_version_arn": project_version_arn,
        "min_inference_units": min_inference_units,
    }
    if max_inference_units is not None:
        input_["max_inference_units"] = max_inference_units

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output