createProjectVersion method

Future<CreateProjectVersionResponse> createProjectVersion({
  1. required OutputConfig outputConfig,
  2. required String projectArn,
  3. required TestingData testingData,
  4. required TrainingData trainingData,
  5. required String versionName,
})

Creates a new version of a model and begins training. Models are managed as part of an Amazon Rekognition Custom Labels project. You can specify one training dataset and one testing dataset. The response from CreateProjectVersion is an Amazon Resource Name (ARN) for the version of the model.

Training takes a while to complete. You can get the current status by calling DescribeProjectVersions.

Once training has successfully completed, call DescribeProjectVersions to get the training results and evaluate the model.

After evaluating the model, you start the model by calling StartProjectVersion.

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

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

Parameter outputConfig : The Amazon S3 location to store the results of training.

Parameter projectArn : The ARN of the Amazon Rekognition Custom Labels project that manages the model that you want to train.

Parameter testingData : The dataset to use for testing.

Parameter trainingData : The dataset to use for training.

Parameter versionName : A name for the version of the model. This value must be unique.

Implementation

Future<CreateProjectVersionResponse> createProjectVersion({
  required OutputConfig outputConfig,
  required String projectArn,
  required TestingData testingData,
  required TrainingData trainingData,
  required String versionName,
}) async {
  ArgumentError.checkNotNull(outputConfig, 'outputConfig');
  ArgumentError.checkNotNull(projectArn, 'projectArn');
  _s.validateStringLength(
    'projectArn',
    projectArn,
    20,
    2048,
    isRequired: true,
  );
  ArgumentError.checkNotNull(testingData, 'testingData');
  ArgumentError.checkNotNull(trainingData, 'trainingData');
  ArgumentError.checkNotNull(versionName, 'versionName');
  _s.validateStringLength(
    'versionName',
    versionName,
    1,
    255,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'RekognitionService.CreateProjectVersion'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'OutputConfig': outputConfig,
      'ProjectArn': projectArn,
      'TestingData': testingData,
      'TrainingData': trainingData,
      'VersionName': versionName,
    },
  );

  return CreateProjectVersionResponse.fromJson(jsonResponse.body);
}