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 classAcceptsByteString(encoded image contents) with optionalDoFn.SideInputwith aMapofImageContextto the image.static classstatic classAcceptsString(image URI on GCS) with optionalDoFn.SideInputwith aMapofImageContextto 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 aPTransformthat annotates images from their contents encoded inByteStrings.annotateImagesFromBytes(PCollectionView<Map<ByteString, com.google.cloud.vision.v1.ImageContext>> contextSideInput, List<com.google.cloud.vision.v1.Feature> features, long batchSize, int desiredRequestParallelism) Creates aPTransformthat annotates images from their contents encoded inByteStrings.annotateImagesFromBytesWithContext(List<com.google.cloud.vision.v1.Feature> features, long batchSize) Creates aPTransformthat annotates images from KVs of their GCS addresses in Strings andImageContextfor each image.annotateImagesFromBytesWithContext(List<com.google.cloud.vision.v1.Feature> features, long batchSize, int desiredRequestParallelism) Creates aPTransformthat annotates images from KVs of their GCS addresses in Strings andImageContextfor each image.annotateImagesFromGcsUri(PCollectionView<Map<String, com.google.cloud.vision.v1.ImageContext>> contextSideInput, List<com.google.cloud.vision.v1.Feature> features, long batchSize) Creates aPTransformthat 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 aPTransformthat annotates images from their GCS addresses.annotateImagesFromGcsUriWithContext(List<com.google.cloud.vision.v1.Feature> features, long batchSize) Creates aPTransformthat annotates images from KVs of their String-encoded contents andImageContextfor each image.annotateImagesFromGcsUriWithContext(List<com.google.cloud.vision.v1.Feature> features, long batchSize, int desiredRequestParallelism) Creates aPTransformthat annotates images from KVs of their String-encoded contents andImageContextfor 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 aPTransformthat annotates images from their GCS addresses.- Parameters:
contextSideInput- optional side input with contexts for select images. TheImageContextobjects 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 aPTransformthat annotates images from their GCS addresses. Uses a default value 5 for desiredRequestParallelism.- Parameters:
contextSideInput- optional side input with contexts for select images. TheImageContextobjects 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 aPTransformthat annotates images from their contents encoded inByteStrings.- Parameters:
contextSideInput- optional side input with contexts for select images. TheImageContextobjects 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 aPTransformthat annotates images from their contents encoded inByteStrings. Uses a default value 5 for desiredRequestParallelism.- Parameters:
contextSideInput- optional side input with contexts for select images. TheImageContextobjects 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 aPTransformthat annotates images from KVs of their GCS addresses in Strings andImageContextfor 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 aPTransformthat annotates images from KVs of their GCS addresses in Strings andImageContextfor 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 aPTransformthat annotates images from KVs of their String-encoded contents andImageContextfor 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 aPTransformthat annotates images from KVs of their String-encoded contents andImageContextfor 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.
-