Search in sources :

Example 1 with AutoMlVideoActionRecognitionInputs

use of com.google.cloud.aiplatform.v1.schema.trainingjob.definition.AutoMlVideoActionRecognitionInputs in project java-aiplatform by googleapis.

the class CreateTrainingPipelineVideoActionRecognitionSample method createTrainingPipelineVideoActionRecognitionSample.

static void createTrainingPipelineVideoActionRecognitionSample(String project, String displayName, String datasetId, String modelDisplayName) throws IOException {
    PipelineServiceSettings settings = PipelineServiceSettings.newBuilder().setEndpoint("us-central1-aiplatform.googleapis.com:443").build();
    String location = "us-central1";
    // the "close" method on the client to safely clean up any remaining background resources.
    try (PipelineServiceClient client = PipelineServiceClient.create(settings)) {
        AutoMlVideoActionRecognitionInputs trainingTaskInputs = AutoMlVideoActionRecognitionInputs.newBuilder().setModelType(ModelType.CLOUD).build();
        InputDataConfig inputDataConfig = InputDataConfig.newBuilder().setDatasetId(datasetId).build();
        Model modelToUpload = Model.newBuilder().setDisplayName(modelDisplayName).build();
        TrainingPipeline trainingPipeline = TrainingPipeline.newBuilder().setDisplayName(displayName).setTrainingTaskDefinition("gs://google-cloud-aiplatform/schema/trainingjob/definition/" + "automl_video_action_recognition_1.0.0.yaml").setTrainingTaskInputs(ValueConverter.toValue(trainingTaskInputs)).setInputDataConfig(inputDataConfig).setModelToUpload(modelToUpload).build();
        LocationName parent = LocationName.of(project, location);
        TrainingPipeline response = client.createTrainingPipeline(parent, trainingPipeline);
        System.out.format("response: %s\n", response);
        System.out.format("Name: %s\n", response.getName());
    }
}
Also used : TrainingPipeline(com.google.cloud.aiplatform.v1.TrainingPipeline) Model(com.google.cloud.aiplatform.v1.Model) PipelineServiceSettings(com.google.cloud.aiplatform.v1.PipelineServiceSettings) PipelineServiceClient(com.google.cloud.aiplatform.v1.PipelineServiceClient) AutoMlVideoActionRecognitionInputs(com.google.cloud.aiplatform.v1.schema.trainingjob.definition.AutoMlVideoActionRecognitionInputs) InputDataConfig(com.google.cloud.aiplatform.v1.InputDataConfig) LocationName(com.google.cloud.aiplatform.v1.LocationName)

Aggregations

InputDataConfig (com.google.cloud.aiplatform.v1.InputDataConfig)1 LocationName (com.google.cloud.aiplatform.v1.LocationName)1 Model (com.google.cloud.aiplatform.v1.Model)1 PipelineServiceClient (com.google.cloud.aiplatform.v1.PipelineServiceClient)1 PipelineServiceSettings (com.google.cloud.aiplatform.v1.PipelineServiceSettings)1 TrainingPipeline (com.google.cloud.aiplatform.v1.TrainingPipeline)1 AutoMlVideoActionRecognitionInputs (com.google.cloud.aiplatform.v1.schema.trainingjob.definition.AutoMlVideoActionRecognitionInputs)1