crowd-image-classifier - Amazon SageMaker
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

crowd-image-classifier

A widget for classifying an image. Use one of the following supported image formats: APNG, BMP, GIF, ICO, JPEG, PNG, SVG. Images do not have a size limit.

See an interactive example of an HTML template that uses this Crowd HTML Element in CodePen.

The following is an example of an image classification template that uses the <crowd-image-classifier> element. Copy the following code and save it in a file with the extension .html. Open the file in any browser to preview and interact with this template.

Attributes

The following attributes are required by this element.

categories

A JSON formatted array of strings, each of which is a category that a worker can assign to the image. You should include "other" as a category, so that the worker can provide an answer. You can specify up to 10 categories.

header

The text to display above the image. This is typically a question or simple instruction for the worker.

name

The name of this widget. It is used as a key for the widget's input in the form output.

overlay

Information to be overlaid on the source image. This is for verification workflows of bounding-box, semantic-segmentation, and instance-segmentation tasks.

It is a JSON object containing an object with the name of the task-type in camelCase as the key. That key's value is an object that contains the labels and other necessary information from the previous task.

An example of a crowd-image-classifier element with attributes for verifying a bounding-box task follows:

<crowd-image-classifier name="boundingBoxClassification" header="Rate the quality of the annotations based on the background section in the instructions on the left hand side." src="https://i.imgur.com/CIPKVJo.jpg" categories="['good', 'bad', 'okay']" overlay='{ "boundingBox": { labels: ["bird", "cat"], value: [ { height: 284, label: "bird", left: 230, top: 974, width: 223 }, { height: 69, label: "bird", left: 79, top: 889, width: 247 } ] }, }' > ... </crowd-image-classifier>

A semantic segmentation verification task would use the overlay value as follows:

<crowd-image-classifier name='crowd-image-classifier' categories='["good", "bad"]' src='URL of image to be classified' header='Please classify' overlay='{ "semanticSegmentation": { "labels": ["Cat", "Dog", "Bird", "Cow"], "labelMappings": { "Bird": { "color": "#ff7f0e" }, "Cat": { "color": "#2ca02c" }, "Cow": { "color": "#d62728" }, "Dog": { "color": "#2acf59" } }, "src": "URL of overlay image", } }' > ... </crowd-image-classifier>

An instance-segmentation task would use the overlay value as follows:

<crowd-image-classifier name='crowd-image-classifier' categories='["good", "bad"]' src='URL of image to be classified' header='Please classify instances of each category' overlay='{ "instanceSegmentation": { "labels": ["Cat", "Dog", "Bird", "Cow"], "instances": [ { "color": "#2ca02c", "label": "Cat" }, { "color": "#1f77b4", "label": "Cat" }, { "color": "#d62728", "label": "Dog" } ], "src": "URL of overlay image", } }' > ... </crowd-image-classifier>

src

The URL of the image to be classified.

Element Hierarchy

This element has the following parent and child elements.

Regions

The following regions are used by this element.

full-instructions

General instructions for the worker on how to classify an image.

short-instructions

Important task-specific instructions that are displayed in a prominent place.

worker-comment

Use this in verification workflows when you need workers to explain why they made the choice they did. Use the text between the opening and closing tags to provide instructions for workers on what information should be included in the comment.

It uses the following attributes:

header

A phrase with a call to action for leaving a comment. Used as the title text for a modal window where the comment is added.

Optional. Defaults to "Add a comment."

This text appears below the categories in the widget. When clicked, it opens a modal window where the worker may add a comment.

Optional. Defaults to "Add a comment."

placeholder

An example text in the comment text area that is overwritten when worker begins to type. This does not appear in output if the worker leaves the field blank.

Optional. Defaults to blank.

Output

The output of this element is a string that specifies one of the values defined in the categories attribute of the <crowd-image-classifier> element.

Example : Sample Element Outputs

The following is a sample of output from this element.

[ { "<name>": { "label": "<value>" "workerComment": "Comment - if no comment is provided, this field will not be present" } } ]

See Also

For more information, see the following.