Class CloudVision
java.lang.Object
org.apache.beam.sdk.extensions.ml.CloudVision
Factory class for implementations of
AnnotateImages
.
Example usage:
pipeline .apply(Create.of(IMAGE_URI)) .apply(CloudVision.annotateImagesFromGcsUri(sideInputWithContext, features, 1, 1));
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
AcceptsByteString
(encoded image contents) with optionalDoFn.SideInput
with aMap
ofImageContext
to the image.static class
static class
AcceptsString
(image URI on GCS) with optionalDoFn.SideInput
with aMap
ofImageContext
to the image.static class
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionannotateImagesFromBytes
(PCollectionView<Map<ByteString, com.google.cloud.vision.v1.ImageContext>> contextSideInput, List<com.google.cloud.vision.v1.Feature> features, long batchSize) Creates aPTransform
that annotates images from their contents encoded inByteString
s.annotateImagesFromBytes
(PCollectionView<Map<ByteString, com.google.cloud.vision.v1.ImageContext>> contextSideInput, List<com.google.cloud.vision.v1.Feature> features, long batchSize, int desiredRequestParallelism) Creates aPTransform
that annotates images from their contents encoded inByteString
s.annotateImagesFromBytesWithContext
(List<com.google.cloud.vision.v1.Feature> features, long batchSize) Creates aPTransform
that annotates images from KVs of their GCS addresses in Strings andImageContext
for each image.annotateImagesFromBytesWithContext
(List<com.google.cloud.vision.v1.Feature> features, long batchSize, int desiredRequestParallelism) Creates aPTransform
that annotates images from KVs of their GCS addresses in Strings andImageContext
for each image.annotateImagesFromGcsUri
(PCollectionView<Map<String, com.google.cloud.vision.v1.ImageContext>> contextSideInput, List<com.google.cloud.vision.v1.Feature> features, long batchSize) Creates aPTransform
that annotates images from their GCS addresses.annotateImagesFromGcsUri
(PCollectionView<Map<String, com.google.cloud.vision.v1.ImageContext>> contextSideInput, List<com.google.cloud.vision.v1.Feature> features, long batchSize, int desiredRequestParallelism) Creates aPTransform
that annotates images from their GCS addresses.annotateImagesFromGcsUriWithContext
(List<com.google.cloud.vision.v1.Feature> features, long batchSize) Creates aPTransform
that annotates images from KVs of their String-encoded contents andImageContext
for each image.annotateImagesFromGcsUriWithContext
(List<com.google.cloud.vision.v1.Feature> features, long batchSize, int desiredRequestParallelism) Creates aPTransform
that annotates images from KVs of their String-encoded contents andImageContext
for each image.
-
Constructor Details
-
CloudVision
public CloudVision()
-
-
Method Details
-
annotateImagesFromGcsUri
public static CloudVision.AnnotateImagesFromGcsUri annotateImagesFromGcsUri(PCollectionView<Map<String, com.google.cloud.vision.v1.ImageContext>> contextSideInput, List<com.google.cloud.vision.v1.Feature> features, long batchSize, int desiredRequestParallelism) Creates aPTransform
that annotates images from their GCS addresses.- Parameters:
contextSideInput
- optional side input with contexts for select images. TheImageContext
objects provide additional metadata for the annotation API. This way users canfeatures
- annotation features that should be passed to the APIbatchSize
- request batch size to be sent to API. Max 16, at least 1.desiredRequestParallelism
- desired number of concurrent batched requests.- Returns:
- the PTransform.
-
annotateImagesFromGcsUri
public static CloudVision.AnnotateImagesFromGcsUri annotateImagesFromGcsUri(PCollectionView<Map<String, com.google.cloud.vision.v1.ImageContext>> contextSideInput, List<com.google.cloud.vision.v1.Feature> features, long batchSize) Creates aPTransform
that annotates images from their GCS addresses. Uses a default value 5 for desiredRequestParallelism.- Parameters:
contextSideInput
- optional side input with contexts for select images. TheImageContext
objects provide additional metadata for the annotation API. This way users can fine-tune analysis of selected images.features
- annotation features that should be passed to the APIbatchSize
- request batch size to be sent to API. Max 16, at least 1.- Returns:
- the PTransform.
-
annotateImagesFromBytes
public static CloudVision.AnnotateImagesFromBytes annotateImagesFromBytes(PCollectionView<Map<ByteString, com.google.cloud.vision.v1.ImageContext>> contextSideInput, List<com.google.cloud.vision.v1.Feature> features, long batchSize, int desiredRequestParallelism) Creates aPTransform
that annotates images from their contents encoded inByteString
s.- Parameters:
contextSideInput
- optional side input with contexts for select images. TheImageContext
objects provide additional metadata for the annotation API. This way users can fine-tune analysis of selected images.features
- annotation features that should be passed to the APIbatchSize
- request batch size to be sent to API. Max 16, at least 1.desiredRequestParallelism
- desired number of concurrent batched requests.- Returns:
- the PTransform.
-
annotateImagesFromBytes
public static CloudVision.AnnotateImagesFromBytes annotateImagesFromBytes(PCollectionView<Map<ByteString, com.google.cloud.vision.v1.ImageContext>> contextSideInput, List<com.google.cloud.vision.v1.Feature> features, long batchSize) Creates aPTransform
that annotates images from their contents encoded inByteString
s. Uses a default value 5 for desiredRequestParallelism.- Parameters:
contextSideInput
- optional side input with contexts for select images. TheImageContext
objects provide additional metadata for the annotation API. This way users can fine-tune analysis of selected images.features
- annotation features that should be passed to the APIbatchSize
- request batch size to be sent to API. Max 16, at least 1.- Returns:
- the PTransform.
-
annotateImagesFromBytesWithContext
public static CloudVision.AnnotateImagesFromBytesWithContext annotateImagesFromBytesWithContext(List<com.google.cloud.vision.v1.Feature> features, long batchSize, int desiredRequestParallelism) Creates aPTransform
that annotates images from KVs of their GCS addresses in Strings andImageContext
for each image.- Parameters:
features
- annotation features that should be passed to the APIbatchSize
- request batch size to be sent to API. Max 16, at least 1.desiredRequestParallelism
- desired number of concurrent batched requests.- Returns:
- the PTransform.
-
annotateImagesFromBytesWithContext
public static CloudVision.AnnotateImagesFromBytesWithContext annotateImagesFromBytesWithContext(List<com.google.cloud.vision.v1.Feature> features, long batchSize) Creates aPTransform
that annotates images from KVs of their GCS addresses in Strings andImageContext
for each image. Uses a default value 5 for desiredRequestParallelism.- Parameters:
features
- annotation features that should be passed to the APIbatchSize
- request batch size to be sent to API. Max 16, at least 1.- Returns:
- the PTransform.
-
annotateImagesFromGcsUriWithContext
public static CloudVision.AnnotateImagesFromGcsUriWithContext annotateImagesFromGcsUriWithContext(List<com.google.cloud.vision.v1.Feature> features, long batchSize, int desiredRequestParallelism) Creates aPTransform
that annotates images from KVs of their String-encoded contents andImageContext
for each image.- Parameters:
features
- annotation features that should be passed to the APIbatchSize
- request batch size to be sent to API. Max 16, at least 1.desiredRequestParallelism
- desired number of concurrent batched requests.- Returns:
- the PTransform.
-
annotateImagesFromGcsUriWithContext
public static CloudVision.AnnotateImagesFromGcsUriWithContext annotateImagesFromGcsUriWithContext(List<com.google.cloud.vision.v1.Feature> features, long batchSize) Creates aPTransform
that annotates images from KVs of their String-encoded contents andImageContext
for each image. Uses a default value 5 for desiredRequestParallelism.- Parameters:
features
- annotation features that should be passed to the APIbatchSize
- request batch size to be sent to API. Max 16, at least 1.- Returns:
- the PTransform.
-