public static class CloudVision.AnnotateImagesFromGcsUri extends PTransform<PCollection<T>,PCollection<java.util.List<com.google.cloud.vision.v1.AnnotateImageResponse>>>
String
(image URI on GCS) with optional DoFn.SideInput
with a Map
of ImageContext
to
the image.Modifier and Type | Class and Description |
---|---|
static class |
org.apache.beam.sdk.extensions.ml.AnnotateImages.PerformImageAnnotation
The
DoFn performing the calls to Cloud Vision API. |
Modifier and Type | Field and Description |
---|---|
protected PCollectionView<java.util.Map<T,com.google.cloud.vision.v1.ImageContext>> |
contextSideInput |
protected int |
desiredRequestParallelism |
protected java.util.List<com.google.cloud.vision.v1.Feature> |
featureList |
annotations, displayData, name, resourceHints
Constructor and Description |
---|
AnnotateImagesFromGcsUri(PCollectionView<java.util.Map<java.lang.String,com.google.cloud.vision.v1.ImageContext>> contextSideInput,
java.util.List<com.google.cloud.vision.v1.Feature> featureList,
long batchSize,
int desiredRequestParallelism) |
Modifier and Type | Method and Description |
---|---|
PCollection<java.util.List<com.google.cloud.vision.v1.AnnotateImageResponse>> |
expand(PCollection<T> input)
Applies all necessary transforms to call the Vision API.
|
com.google.cloud.vision.v1.AnnotateImageRequest |
mapToRequest(java.lang.String uri,
@Nullable com.google.cloud.vision.v1.ImageContext ctx)
Maps the
String with encoded image data and the optional ImageContext into an
AnnotateImageRequest . |
addAnnotation, compose, compose, getAdditionalInputs, getAnnotations, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, getResourceHints, populateDisplayData, setDisplayData, setResourceHints, toString, validate, validate
protected final PCollectionView<java.util.Map<T,com.google.cloud.vision.v1.ImageContext>> contextSideInput
protected final java.util.List<com.google.cloud.vision.v1.Feature> featureList
protected final int desiredRequestParallelism
public AnnotateImagesFromGcsUri(PCollectionView<java.util.Map<java.lang.String,com.google.cloud.vision.v1.ImageContext>> contextSideInput, java.util.List<com.google.cloud.vision.v1.Feature> featureList, long batchSize, int desiredRequestParallelism)
public com.google.cloud.vision.v1.AnnotateImageRequest mapToRequest(java.lang.String uri, @Nullable com.google.cloud.vision.v1.ImageContext ctx)
String
with encoded image data and the optional ImageContext
into an
AnnotateImageRequest
.uri
- Input element.ctx
- optional image context.public PCollection<java.util.List<com.google.cloud.vision.v1.AnnotateImageResponse>> expand(PCollection<T> input)
GroupIntoBatches
works only on KV
s.expand
in class PTransform<PCollection<T>,PCollection<java.util.List<com.google.cloud.vision.v1.AnnotateImageResponse>>>