public static class CloudVision.AnnotateImagesFromBytesWithContext extends PTransform<PCollection<T>,PCollection<java.util.List<com.google.cloud.vision.v1.AnnotateImageResponse>>>
KV
s of ByteString
(encoded image contents) 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, resourceHints
Constructor and Description |
---|
AnnotateImagesFromBytesWithContext(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<ByteString,com.google.cloud.vision.v1.ImageContext> input,
@Nullable com.google.cloud.vision.v1.ImageContext ctx)
|
compose, compose, getAdditionalInputs, getDefaultOutputCoder, getDefaultOutputCoder, getDefaultOutputCoder, getKindString, getName, getResourceHints, populateDisplayData, 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 AnnotateImagesFromBytesWithContext(java.util.List<com.google.cloud.vision.v1.Feature> featureList, long batchSize, int desiredRequestParallelism)
public com.google.cloud.vision.v1.AnnotateImageRequest mapToRequest(KV<ByteString,com.google.cloud.vision.v1.ImageContext> input, @Nullable com.google.cloud.vision.v1.ImageContext ctx)
input
- 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>>>