public static class CloudVision.AnnotateImagesFromGcsUriWithContext extends PTransform<PCollection<T>,PCollection<java.util.List<com.google.cloud.vision.v1.AnnotateImageResponse>>>
KV
s of String
(GCS URI to the image) and ImageContext
. It's
possible to add ImageContext
to each image to be annotated.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 |
name
Constructor and Description |
---|
AnnotateImagesFromGcsUriWithContext(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(KV<java.lang.String,com.google.cloud.vision.v1.ImageContext> input,
@Nullable com.google.cloud.vision.v1.ImageContext ctx)
|
compose, compose, getAdditionalInputs, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, populateDisplayData, toString, 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 AnnotateImagesFromGcsUriWithContext(java.util.List<com.google.cloud.vision.v1.Feature> featureList, long batchSize, int desiredRequestParallelism)
public com.google.cloud.vision.v1.AnnotateImageRequest mapToRequest(KV<java.lang.String,com.google.cloud.vision.v1.ImageContext> input, @Nullable com.google.cloud.vision.v1.ImageContext ctx)
input
- Input element.ctx
- optional image context, ignored here since the input holds 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>>>