Cloud Vision Plugins

Introduction

Cloud Vision plugins will allow users to use pre-trained Vision API models to detect emotion, understand text, and more. They will be useful in enriching data with additional attributes such as labels, faces, etc.

NOTE: These plugins will incur additional cost of the Cloud Vision APIs

Use case(s)

  • As a user, I want to various features in my images and documents using the Cloud Vision API, so that I can add ML-driven enrichments to my Data Fusion pipelines that process unstructured data
  • As a user, I want easy, UI-driven ways of manipulating and understanding the output of the Cloud Vision API, so that I do not need to write any code for parsing it.

User Storie(s)

Plugin Type

  • Batch Source
  • Batch Sink 
  • Real-time Source
  • Real-time Sink
  • Transform
  • Action
  • Post-Run Action
  • Aggregate
  • Join
  • Spark Model
  • Spark Compute

Configurables 

File Path Batch Source

This source will read a directory, and instead of emitting records from files in the directory, it will emit all the file names as records. It should work for object stores as well.

SectionUser Facing NameTypeDescriptionOptionalDefault
Basic

Service Account File pathtextPath to service account file onYesNone
Project IDtextGCP Project IDYesauto-detect
PathtextboxThe path to the directory where the files whose paths are to be emitted are locatedNo
RecursivetoggleWhether the plugin should recursively traverse the directory for subdirectoriesYesFalse
Last Modified Afterdate-time pickerA way to filter files to be returned based on their last modified timestampYes1/1/1970 (epoch)
AdvancedSplit byradio buttonDetermines splitting mechanisms. Choose amongst default (uses the default splitting mechanism of file input format), batch size (by number of files in a batch), directory (by each sub directory)Yesdefault
Batch sizenumberSpecifies the number of files to process in a single batch. Only required when Split By is set to batch size.

Image Extractor transform

The image extractor transform can be used in conjunction with the file path batch source to extract enrichments from each image based on selected features.

It should send all errors to the error port.

SectionUser Facing NameTypeDescriptionOptionalDefault
Basic

Access TokenPasswordAuthentication token for Cloud Vision API.No
Path FieldInput Field SelectorField in the input schema containing the path to the image. Defaults to 'path'Yespath
Featuresfunction-dropdown-with-aliasThe features to extract from documents, specified as a combination of feature type, max results, and model. Select from Face, Text, Handwriting, Crop Hints, Faces, Image properties, Labels, Landmarks, Logos, Multiple Objects, Explicit Content, Web Detection, Product Search, Object LocalizationNo
Advanced





Language Hintsmulti-selectOptional hints to provide to Cloud Vision API in case it has trouble detecting the language of the text in the images. Only shown when the Text feature is selected. Select from supported languagesYesNone/Empty
Aspect Ratiosmulti-selectAspect ratios as a decimal number, representing the ratio of the width to the height of the image. For example, if the desired aspect ratio is 4/3, the corresponding float value should be 1.33333. Only shown when Crop Hints is selected as a feature. If not specified, the best possible crop is returned. The number of provided aspect ratios is limited to a maximum of 16; any aspect ratios provided after the 16th are ignored.YesNone
Include Geo ResultstoggleWhether to include results derived from the geo information in the image. Only shown when Web Detection is selected as a featureYesfalse
Bounding PolynomialJSONThe bounding polynomial for the image detection. Only shown when Product Search is selected as a feature. Should be a JSON in this formatYesNone
Product Settext

The resource name of a ProductSet to be searched for similar images. Only shown when Product Search is selected as a feature.

Format is: projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID.

YesNone
Product Categoriesselect

The list of product categories to search in. Select one of either "homegoods", "apparel", or "toys". Only shown when Product Search is selected as a feature.

YesNone
Filtertext

The filtering expression. This can be used to restrict search results based on Product labels. We currently support an AND of OR of key-value expressions, where each expression within an OR must have the same key. An '=' should be used to connect the key and value. Only shown when Product Search is selected as a feature.

For example, "(color = red OR color = blue) AND brand = Google" is acceptable, but "(color = red OR brand = Google)" is not acceptable. "color: red" is not acceptable because it uses a ':' instead of an '='.

YesNone

Online Document Text Extractor transform

This transform plugin can detect and transcribe text from small  (upto 5 pages) PDF and TIFF files stored in Cloud Storage in an online manner.


SectionUser Facing NameTypeDescriptionOptionalDefault
Basic

Access TokenPasswordAuthentication token for Cloud Vision API.No
Path FieldInput field selectorField in the input schema containing the path to the image. Defaults to 'path'Yespath
Content FieldInput field selectorField in the input schema containing the file content, represented as a stream of bytes. Defaults to 'content'.Yescontent
Mime TypeselectChoose one of "application/pdf", "image/tiff" and "image/gif"Yesapplication/pdf
Featuresfunction-dropdown-with-aliasThe features to extract from documents, specified as a combination of feature type, max results, and model. Select from Face, Text, Handwriting, Crop Hints, Faces, Image properties, Labels, Landmarks, Logos, Multiple Objects, Explicit Content, Web Detection, Product Search, Object LocalizationNo
Pagesmulti-selectThe pages in the file to perform image annotation. Select from 1-5.Yes1,2,3,4,5
Advanced





Language Hintsmulti-selectOptional hints to provide to Cloud Vision API in case it has trouble detecting the language of the text in the images. Only shown when the Text feature is selected. Select from supported languagesYesNone/Empty
Aspect Ratiosmulti-selectAspect ratios as a decimal number, representing the ratio of the width to the height of the image. For example, if the desired aspect ratio is 4/3, the corresponding float value should be 1.33333. Only shown when Crop Hints is selected as a feature. If not specified, the best possible crop is returned. The number of provided aspect ratios is limited to a maximum of 16; any aspect ratios provided after the 16th are ignored.YesNone
Include Geo ResultstoggleWhether to include results derived from the geo information in the image. Only shown when Web Detection is selected as a featureYesfalse
Bounding PolynomialJSONThe bounding polynomial for the image detection. Only shown when Product Search is selected as a feature. Should be a JSON in this formatYesNone
Product Settext

The resource name of a ProductSet to be searched for similar images. Only shown when Product Search is selected as a feature.

Format is: projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID.

YesNone
Product Categoriesselect

The list of product categories to search in. Select one of either "homegoods", "apparel", or "toys". Only shown when Product Search is selected as a feature.

YesNone
Filtertext

The filtering expression. This can be used to restrict search results based on Product labels. We currently support an AND of OR of key-value expressions, where each expression within an OR must have the same key. An '=' should be used to connect the key and value. Only shown when Product Search is selected as a feature.

For example, "(color = red OR color = blue) AND brand = Google" is acceptable, but "(color = red OR brand = Google)" is not acceptable. "color: red" is not acceptable because it uses a ':' instead of an '='.

YesNone

Offline Document Text Extractor action

This action plugin can detect and transcribe text from large (upto 2000 pages) PDF and TIFF files stored in Cloud Storage in an async manner.


SectionUser Facing NameTypeDescriptionOptionalDefault
Basic

Access TokenPasswordAuthentication token for Cloud Vision API.No
Source PathTextPath to the location of the directory on GCS where the input files are storedYespath
Destination PathTextPath to the location of the directory on GCS where output files should be storedYescontent
Mime TypeselectChoose one of "application/pdf", "image/tiff" and "image/gif"Yesapplication/pdf
Featuresfunction-dropdown-with-aliasThe features to extract from documents, specified as a combination of feature type, max results, and model. Select from Face, Text, Handwriting, Crop Hints, Faces, Image properties, Labels, Landmarks, Logos, Multiple Objects, Explicit Content, Web Detection, Product Search, Object LocalizationNo
Pagesmulti-selectThe pages in the file to perform image annotation. Select from 1-5.Yes1,2,3,4,5
Batch sizenumber

The max number of responses to put into each output JSON file on Google Cloud Storage. The valid range is [1, 100]. If not specified, the default value is 20.

Yes20
Advanced





Language Hintsmulti-selectOptional hints to provide to Cloud Vision API in case it has trouble detecting the language of the text in the images. Only shown when the Text feature is selected. Select from supported languagesYesNone/Empty
Aspect Ratiosmulti-selectAspect ratios as a decimal number, representing the ratio of the width to the height of the image. For example, if the desired aspect ratio is 4/3, the corresponding float value should be 1.33333. Only shown when Crop Hints is selected as a feature. If not specified, the best possible crop is returned. The number of provided aspect ratios is limited to a maximum of 16; any aspect ratios provided after the 16th are ignored.YesNone
Include Geo ResultstoggleWhether to include results derived from the geo information in the image. Only shown when Web Detection is selected as a featureYesfalse
Bounding PolynomialJSONThe bounding polynomial for the image detection. Only shown when Product Search is selected as a feature. Should be a JSON in this formatYesNone
Product Settext

The resource name of a ProductSet to be searched for similar images. Only shown when Product Search is selected as a feature.

Format is: projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID.

YesNone
Product Categoriesselect

The list of product categories to search in. Select one of either "homegoods", "apparel", or "toys". Only shown when Product Search is selected as a feature.

YesNone
Filtertext

The filtering expression. This can be used to restrict search results based on Product labels. We currently support an AND of OR of key-value expressions, where each expression within an OR must have the same key. An '=' should be used to connect the key and value. Only shown when Product Search is selected as a feature.

For example, "(color = red OR color = blue) AND brand = Google" is acceptable, but "(color = red OR brand = Google)" is not acceptable. "color: red" is not acceptable because it uses a ':' instead of an '='.

Offline Image Extractor action

This action plugin can asynchronously extract features from images stored on GCS, and store the extracted output on GCS.


SectionUser Facing NameTypeDescriptionOptionalDefault
Basic

Access TokenPasswordAuthentication token for Cloud Vision API.No
Source PathTextPath to the location of the directory on GCS where the input files are storedYespath
Destination PathTextPath to the location of the directory on GCS where output files should be storedYescontent
Featuresfunction-dropdown-with-aliasThe features to extract from documents, specified as a combination of feature type, max results, and model. Select from Face, Text, Handwriting, Crop Hints, Faces, Image properties, Labels, Landmarks, Logos, Multiple Objects, Explicit Content, Web Detection, Product Search, Object LocalizationNo
Advanced





Language Hintsmulti-selectOptional hints to provide to Cloud Vision API in case it has trouble detecting the language of the text in the images. Only shown when the Text feature is selected. Select from supported languagesYesNone/Empty
Aspect Ratiosmulti-selectAspect ratios as a decimal number, representing the ratio of the width to the height of the image. For example, if the desired aspect ratio is 4/3, the corresponding float value should be 1.33333. Only shown when Crop Hints is selected as a feature. If not specified, the best possible crop is returned. The number of provided aspect ratios is limited to a maximum of 16; any aspect ratios provided after the 16th are ignored.YesNone
Include Geo ResultstoggleWhether to include results derived from the geo information in the image. Only shown when Web Detection is selected as a featureYesfalse
Bounding PolynomialJSONThe bounding polynomial for the image detection. Only shown when Product Search is selected as a feature. Should be a JSON in this formatYesNone
Product Settext

The resource name of a ProductSet to be searched for similar images. Only shown when Product Search is selected as a feature.

Format is: projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID.

YesNone
Product Categoriesselect

The list of product categories to search in. Select one of either "homegoods", "apparel", or "toys". Only shown when Product Search is selected as a feature.

YesNone
Filtertext

The filtering expression. This can be used to restrict search results based on Product labels. We currently support an AND of OR of key-value expressions, where each expression within an OR must have the same key. An '=' should be used to connect the key and value. Only shown when Product Search is selected as a feature.

For example, "(color = red OR color = blue) AND brand = Google" is acceptable, but "(color = red OR brand = Google)" is not acceptable. "color: red" is not acceptable because it uses a ':' instead of an '='.


Design / Implementation Tips

  • Tip #1
  • Tip #2

Design

Approach(s)

Properties

Security

Limitation(s)

Future Work

  • Some future work – HYDRATOR-99999
  • Another future work – HYDRATOR-99999

Test Case(s)

  • Test case #1
  • Test case #2

Sample Pipeline

Please attach one or more sample pipeline(s) and associated data. 

Pipeline #1

Pipeline #2



Table of Contents

Checklist

  • User stories documented 
  • User stories reviewed 
  • Design documented 
  • Design reviewed 
  • Feature merged 
  • Examples and guides 
  • Integration tests 
  • Documentation for feature 
  • Short video demonstrating the feature