Class CloudVision
- java.lang.Object
-
- org.apache.beam.sdk.extensions.ml.CloudVision
-
public class CloudVision extends java.lang.ObjectFactory class for implementations ofAnnotateImages.Example usage:
pipeline .apply(Create.of(IMAGE_URI)) .apply(CloudVision.annotateImagesFromGcsUri(sideInputWithContext, features, 1, 1));
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCloudVision.AnnotateImagesFromBytesAcceptsByteString(encoded image contents) with optionalDoFn.SideInputwith aMapofImageContextto the image.static classCloudVision.AnnotateImagesFromBytesWithContextAcceptsKVs ofByteString(encoded image contents) andImageContext.static classCloudVision.AnnotateImagesFromGcsUriAcceptsString(image URI on GCS) with optionalDoFn.SideInputwith aMapofImageContextto the image.static classCloudVision.AnnotateImagesFromGcsUriWithContextAcceptsKVs ofString(GCS URI to the image) andImageContext.
-
Constructor Summary
Constructors Constructor Description CloudVision()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static CloudVision.AnnotateImagesFromBytesannotateImagesFromBytes(org.apache.beam.sdk.values.PCollectionView<java.util.Map<com.google.protobuf.ByteString,com.google.cloud.vision.v1.ImageContext>> contextSideInput, java.util.List<com.google.cloud.vision.v1.Feature> features, long batchSize)Creates aPTransformthat annotates images from their contents encoded inByteStrings.static CloudVision.AnnotateImagesFromBytesannotateImagesFromBytes(org.apache.beam.sdk.values.PCollectionView<java.util.Map<com.google.protobuf.ByteString,com.google.cloud.vision.v1.ImageContext>> contextSideInput, java.util.List<com.google.cloud.vision.v1.Feature> features, long batchSize, int desiredRequestParallelism)Creates aPTransformthat annotates images from their contents encoded inByteStrings.static CloudVision.AnnotateImagesFromBytesWithContextannotateImagesFromBytesWithContext(java.util.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.static CloudVision.AnnotateImagesFromBytesWithContextannotateImagesFromBytesWithContext(java.util.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.static CloudVision.AnnotateImagesFromGcsUriannotateImagesFromGcsUri(org.apache.beam.sdk.values.PCollectionView<java.util.Map<java.lang.String,com.google.cloud.vision.v1.ImageContext>> contextSideInput, java.util.List<com.google.cloud.vision.v1.Feature> features, long batchSize)Creates aPTransformthat annotates images from their GCS addresses.static CloudVision.AnnotateImagesFromGcsUriannotateImagesFromGcsUri(org.apache.beam.sdk.values.PCollectionView<java.util.Map<java.lang.String,com.google.cloud.vision.v1.ImageContext>> contextSideInput, java.util.List<com.google.cloud.vision.v1.Feature> features, long batchSize, int desiredRequestParallelism)Creates aPTransformthat annotates images from their GCS addresses.static CloudVision.AnnotateImagesFromGcsUriWithContextannotateImagesFromGcsUriWithContext(java.util.List<com.google.cloud.vision.v1.Feature> features, long batchSize)Creates aPTransformthat annotates images from KVs of their String-encoded contents andImageContextfor each image.static CloudVision.AnnotateImagesFromGcsUriWithContextannotateImagesFromGcsUriWithContext(java.util.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.
-
-
-
Method Detail
-
annotateImagesFromGcsUri
public static CloudVision.AnnotateImagesFromGcsUri annotateImagesFromGcsUri(org.apache.beam.sdk.values.PCollectionView<java.util.Map<java.lang.String,com.google.cloud.vision.v1.ImageContext>> contextSideInput, java.util.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(org.apache.beam.sdk.values.PCollectionView<java.util.Map<java.lang.String,com.google.cloud.vision.v1.ImageContext>> contextSideInput, java.util.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(org.apache.beam.sdk.values.PCollectionView<java.util.Map<com.google.protobuf.ByteString,com.google.cloud.vision.v1.ImageContext>> contextSideInput, java.util.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(org.apache.beam.sdk.values.PCollectionView<java.util.Map<com.google.protobuf.ByteString,com.google.cloud.vision.v1.ImageContext>> contextSideInput, java.util.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(java.util.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(java.util.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(java.util.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(java.util.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.
-
-