public static class CloudVision.AnnotateImagesFromBytes extends PTransform<PCollection<T>,PCollection<java.util.List<com.google.cloud.vision.v1.AnnotateImageResponse>>>
ByteString
(encoded image contents) 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 |
name
Constructor and Description |
---|
AnnotateImagesFromBytes(PCollectionView<java.util.Map<ByteString,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(ByteString input,
@Nullable com.google.cloud.vision.v1.ImageContext ctx)
Maps the
ByteString with encoded image data and the optional ImageContext
into an AnnotateImageRequest . |
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 AnnotateImagesFromBytes(PCollectionView<java.util.Map<ByteString,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(ByteString input, @Nullable com.google.cloud.vision.v1.ImageContext ctx)
ByteString
with encoded image data and the optional ImageContext
into an AnnotateImageRequest
.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>>>