33
33
class LabelVideo {
34
34
35
35
// Start a Video Labeling Task
36
- static void labelVideo (String formattedInstructionName , String formattedAnnotationSpecSetName ,
37
- String formattedDatasetName ) throws IOException {
36
+ static void labelVideo (
37
+ String formattedInstructionName ,
38
+ String formattedAnnotationSpecSetName ,
39
+ String formattedDatasetName )
40
+ throws IOException {
38
41
// String formattedInstructionName = DataLabelingServiceClient.formatInstructionName(
39
42
// "YOUR_PROJECT_ID", "YOUR_INSTRUCTION_UUID");
40
43
// String formattedAnnotationSpecSetName =
@@ -50,36 +53,40 @@ static void labelVideo(String formattedInstructionName, String formattedAnnotati
50
53
}
51
54
// [START datalabeling_label_video_beta]
52
55
53
- DataLabelingServiceSettings settings = DataLabelingServiceSettings
54
- .newBuilder ()
55
- // [END datalabeling_label_video_beta]
56
- .setEndpoint (endpoint )
57
- // [START datalabeling_label_video_beta]
58
- .build ();
56
+ DataLabelingServiceSettings settings =
57
+ DataLabelingServiceSettings .newBuilder ()
58
+ // [END datalabeling_label_video_beta]
59
+ .setEndpoint (endpoint )
60
+ // [START datalabeling_label_video_beta]
61
+ .build ();
59
62
try (DataLabelingServiceClient dataLabelingServiceClient =
60
- DataLabelingServiceClient .create (settings )) {
61
- HumanAnnotationConfig humanAnnotationConfig = HumanAnnotationConfig .newBuilder ()
62
- .setAnnotatedDatasetDisplayName ("annotated_displayname" )
63
- .setAnnotatedDatasetDescription ("annotated_description" )
64
- .setInstruction (formattedInstructionName )
65
- .build ();
63
+ DataLabelingServiceClient .create (settings )) {
64
+ HumanAnnotationConfig humanAnnotationConfig =
65
+ HumanAnnotationConfig .newBuilder ()
66
+ .setAnnotatedDatasetDisplayName ("annotated_displayname" )
67
+ .setAnnotatedDatasetDescription ("annotated_description" )
68
+ .setInstruction (formattedInstructionName )
69
+ .build ();
66
70
67
- AnnotationSpecSetConfig annotationSpecSetConfig = AnnotationSpecSetConfig .newBuilder ()
68
- .setAnnotationSpecSet (formattedAnnotationSpecSetName )
69
- .setAllowMultiLabel (true )
70
- .build ();
71
+ AnnotationSpecSetConfig annotationSpecSetConfig =
72
+ AnnotationSpecSetConfig .newBuilder ()
73
+ .setAnnotationSpecSet (formattedAnnotationSpecSetName )
74
+ .setAllowMultiLabel (true )
75
+ .build ();
71
76
72
- VideoClassificationConfig videoClassificationConfig = VideoClassificationConfig .newBuilder ()
73
- .setApplyShotDetection (true )
74
- .addAnnotationSpecSetConfigs (annotationSpecSetConfig )
75
- .build ();
77
+ VideoClassificationConfig videoClassificationConfig =
78
+ VideoClassificationConfig .newBuilder ()
79
+ .setApplyShotDetection (true )
80
+ .addAnnotationSpecSetConfigs (annotationSpecSetConfig )
81
+ .build ();
76
82
77
- LabelVideoRequest labelVideoRequest = LabelVideoRequest .newBuilder ()
78
- .setParent (formattedDatasetName )
79
- .setBasicConfig (humanAnnotationConfig )
80
- .setVideoClassificationConfig (videoClassificationConfig )
81
- .setFeature (Feature .CLASSIFICATION )
82
- .build ();
83
+ LabelVideoRequest labelVideoRequest =
84
+ LabelVideoRequest .newBuilder ()
85
+ .setParent (formattedDatasetName )
86
+ .setBasicConfig (humanAnnotationConfig )
87
+ .setVideoClassificationConfig (videoClassificationConfig )
88
+ .setFeature (Feature .CLASSIFICATION )
89
+ .build ();
83
90
84
91
OperationFuture <AnnotatedDataset , LabelOperationMetadata > operation =
85
92
dataLabelingServiceClient .labelVideoAsync (labelVideoRequest );
0 commit comments