Class CloudVision


  • public class CloudVision
    extends java.lang.Object
    Factory class for implementations of AnnotateImages.

    Example usage:

     pipeline
      .apply(Create.of(IMAGE_URI))
      .apply(CloudVision.annotateImagesFromGcsUri(sideInputWithContext,
             features, 1, 1));
     
    • Constructor Detail

      • CloudVision

        public CloudVision()
    • 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 a PTransform that annotates images from their GCS addresses.
        Parameters:
        contextSideInput - optional side input with contexts for select images. The ImageContext objects provide additional metadata for the annotation API. This way users can
        features - annotation features that should be passed to the API
        batchSize - 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 a PTransform that annotates images from their GCS addresses. Uses a default value 5 for desiredRequestParallelism.
        Parameters:
        contextSideInput - optional side input with contexts for select images. The ImageContext 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 API
        batchSize - 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 a PTransform that annotates images from their contents encoded in ByteStrings.
        Parameters:
        contextSideInput - optional side input with contexts for select images. The ImageContext 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 API
        batchSize - 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 a PTransform that annotates images from their contents encoded in ByteStrings. Uses a default value 5 for desiredRequestParallelism.
        Parameters:
        contextSideInput - optional side input with contexts for select images. The ImageContext 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 API
        batchSize - 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 a PTransform that annotates images from KVs of their GCS addresses in Strings and ImageContext for each image.
        Parameters:
        features - annotation features that should be passed to the API
        batchSize - 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 a PTransform that annotates images from KVs of their GCS addresses in Strings and ImageContext for each image. Uses a default value 5 for desiredRequestParallelism.
        Parameters:
        features - annotation features that should be passed to the API
        batchSize - 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 a PTransform that annotates images from KVs of their String-encoded contents and ImageContext for each image.
        Parameters:
        features - annotation features that should be passed to the API
        batchSize - 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 a PTransform that annotates images from KVs of their String-encoded contents and ImageContext for each image. Uses a default value 5 for desiredRequestParallelism.
        Parameters:
        features - annotation features that should be passed to the API
        batchSize - request batch size to be sent to API. Max 16, at least 1.
        Returns:
        the PTransform.