startProjectVersion method

Future<StartProjectVersionResponse> startProjectVersion({
  1. required int minInferenceUnits,
  2. required String projectVersionArn,
  3. int? maxInferenceUnits,
})
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. This operation requires permissions to perform the rekognition:StartProjectVersion action.

May throw AccessDeniedException. May throw InternalServerError. May throw InvalidParameterException. May throw LimitExceededException. May throw ProvisionedThroughputExceededException. May throw ResourceInUseException. May throw ResourceNotFoundException. May throw ThrottlingException.

Parameter minInferenceUnits : 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.

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

Parameter maxInferenceUnits : 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.

Implementation

Future<StartProjectVersionResponse> startProjectVersion({
  required int minInferenceUnits,
  required String projectVersionArn,
  int? maxInferenceUnits,
}) async {
  _s.validateNumRange(
    'minInferenceUnits',
    minInferenceUnits,
    1,
    1152921504606846976,
    isRequired: true,
  );
  _s.validateNumRange(
    'maxInferenceUnits',
    maxInferenceUnits,
    1,
    1152921504606846976,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'RekognitionService.StartProjectVersion'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'MinInferenceUnits': minInferenceUnits,
      'ProjectVersionArn': projectVersionArn,
      if (maxInferenceUnits != null) 'MaxInferenceUnits': maxInferenceUnits,
    },
  );

  return StartProjectVersionResponse.fromJson(jsonResponse.body);
}