增強版 AI Crowd HTML 元素 - Amazon SageMaker

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

增強版 AI Crowd HTML 元素

以下 Crowd HTML 元素僅適用於 Amazon 增強版 AI 人力工作流程任務。

可對 Amazon Textract 文件分析結果啟用人工審核的 Widget。

Attributes

此元素支援下列屬性。

header

這是顯示為標題的文字。

src

這是要由工作者分析之影像的連結。

initialValue

這針對工作者使用者介面中找到的屬性設定初始值。

以下為 initialValue 輸入的範例:

[ { "blockType": "KEY_VALUE_SET", "confidence": 38.43309020996094, "geometry": { "boundingBox": { "width": 0.32613086700439453, "weight": 0.0942094624042511, "left": 0.4833833575248718, "top": 0.5227988958358765 }, "polygon": [ {"x": 0.123, "y": 0.345}, ... ] } "id": "8c97b240-0969-4678-834a-646c95da9cf4", "relationships": [ { "type": "CHILD", "ids": [ "7ee7b7da-ee1b-428d-a567-55a3e3affa56", "4d6da730-ba43-467c-a9a5-c6137ba0c472" ] }, { "type": "VALUE", "ids": [ "6ee7b7da-ee1b-428d-a567-55a3e3affa54" ] } ], "entityTypes": [ "KEY" ], "text": "Foo bar" }, ]

blockTypes

這決定工作者可以執行的分析類型。目前僅支援 KEY_VALUE_SET

keys

這指定工作者可新增的新索引鍵和相關文字值。keys 的輸入值可以包括下列元素:

  • importantFormKey 接受字串,並用於指定單一索引鍵。

  • importantFormKeyAliases 可用來指定除了提供的索引鍵之外還可接受的替代別名。使用此元素來識別索引鍵的替代拼寫或表示法。此參數接受一或多個字串的清單。

以下為 keys 輸入的範例。

[ { importantFormKey: 'Address', importantFormKeyAliases: [ 'address', 'Addr.', 'Add.', ] }, { importantFormKey: 'Last name', importantFormKeyAliases: ['Surname'] } ]

no-key-edit

這防止工作者編輯經由 initialValue 傳遞的註釋的索引鍵。這防止工作者編輯文件上偵測到的索引鍵。這是必要的。

no-geometry-edit

這防止工作者編輯經由 initialValue 傳遞的註釋的多邊形。例如,這樣可防止工作者編輯某個索引鍵的邊界框。這是必要的。

元素階層

此元素具有下列父元素及子元素。

區域

此元素支援下列區域。您可以在這些區域內使用自訂 HTML 和 CSS 程式碼,以格式化要呈現給工作者的指示。例如,使用 short-instructions 區段提供如何完成任務的良好與不良範例。

full-instructions

如何使用小工具的一般說明。

short-instructions

在明顯位置顯示的重要任務特定指示。

使用 crowd 元素的工作者範本範例

使用此 crowd 元素的工作者範本範例下所示。

<script src="https://assets.crowd.aws/crowd-html-elements.js"></script> {% capture s3_uri %}http://s3.amazonaws.com/{{ task.input.aiServiceRequest.document.s3Object.bucket }}/{{ task.input.aiServiceRequest.document.s3Object.name }}{% endcapture %} <crowd-form> <crowd-textract-analyze-document src="{{ s3_uri | grant_read_access }}" initial-value="{{ task.input.selectedAiServiceResponse.blocks }}" header="Review the key-value pairs listed on the right and correct them if they don't match the following document." no-key-edit no-geometry-edit keys="{{ task.input.humanLoopContext.importantFormKeys }}" block-types="['KEY_VALUE_SET']" > <short-instructions header="Instructions"> <style> .instructions { white-space: pre-wrap; } .instructionsImage { display: inline-block; max-width: 100%; } </style> <p class='instructions'>Click on a key-value block to highlight the corresponding key-value pair in the document. If it is a valid key-value pair, review the content for the value. If the content is incorrect, correct it. The text of the value is incorrect, correct it. <img class='instructionsImage' src="https://assets.crowd.aws/images/a2i-console/correct-value-text.png" /> A wrong value is identified, correct it. <img class='instructionsImage' src="https://assets.crowd.aws/images/a2i-console/correct-value.png" /> If it is not a valid key-value relationship, choose No. <img class='instructionsImage' src="https://assets.crowd.aws/images/a2i-console/not-a-key-value-pair.png" /> If you can’t find the key in the document, choose Key not found. <img class='instructionsImage' src="https://assets.crowd.aws/images/a2i-console/key-is-not-found.png" /> If the content of a field is empty, choose Value is blank. <img class='instructionsImage' src="https://assets.crowd.aws/images/a2i-console/value-is-blank.png" /> <b>Examples</b> Key and value are often displayed next or below to each other. Key and value displayed in one line. <img class='instructionsImage' src="https://assets.crowd.aws/images/a2i-console/sample-key-value-pair-1.png" /> Key and value displayed in two lines. <img class='instructionsImage' src="https://assets.crowd.aws/images/a2i-console/sample-key-value-pair-2.png" /> If the content of the value has multiple lines, enter all the text without line break. Include all value text even if it extends beyond the highlight box. <img class='instructionsImage' src="https://assets.crowd.aws/images/a2i-console/multiple-lines.png" /></p> </short-instructions> <full-instructions header="Instructions"></full-instructions> </crowd-textract-analyze-document> </crowd-form>

輸出

下列是此元素中輸出的範本。您可以在 Amazon Textract AnalyzeDocumentAPI 文件中找到此輸出的詳細說明。

{ "AWS/Textract/AnalyzeDocument/Forms/V1": { blocks: [ { "blockType": "KEY_VALUE_SET", "id": "8c97b240-0969-4678-834a-646c95da9cf4", "relationships": [ { "type": "CHILD", "ids": ["7ee7b7da-ee1b-428d-a567-55a3e3affa56", "4d6da730-ba43-467c-a9a5-c6137ba0c472"] }, { "type": "VALUE", "ids": ["6ee7b7da-ee1b-428d-a567-55a3e3affa54"] } ], "entityTypes": ["KEY"], "text": "Foo bar baz" } ] } }

支援對 Amazon Rekognition Image 仲裁結果進行人工審核的 Widget。

Attributes

此元素支援下列屬性。

header

這是顯示為標題的文字。

src

這是要由工作者分析之影像的連結。

categories

這支援 categories 作為字串陣列物件陣列,其中每個物件都有一個 name 欄位。

如果以物件形式傳入類別,則情況如下:

  • 顯示的類別是 name 欄位的值。

  • 傳回的答案包含所選任何類別的完整物件。

如果以字串形式傳入類別,則情況如下:

  • 傳回的答案是所選全部字串的陣列。

exclusion-category

您可以設定這個屬性,在使用者介面中的類別下建立按鈕。

  • 當使用者選擇此按鈕,所有類別將取消選取並停用。

  • 再次選擇此按鈕會重新啟用類別,讓使用者可以選擇類別。

  • 如果您在選擇此按鈕後提交,則會傳回空陣列。

元素階層

此元素具有下列父元素及子元素。

AWS 地區

此元素支援下列「 AWS 區域」。您可以在這些區域內使用自訂 HTML 和 CSS 程式碼,以格式化要呈現給工作者的指示。例如,使用 short-instructions 區段提供如何完成任務的良好與不良範例。

full-instructions

如何使用小工具的一般說明。

short-instructions

在明顯位置顯示的重要任務特定指示。

使用 crowd 元素的工作者範本範例

使用 crowd 元素的工作者範本範例下所示。

<script src="https://assets.crowd.aws/crowd-html-elements.js"></script> {% capture s3_uri %}http://s3.amazonaws.com/{{ task.input.aiServiceRequest.image.s3Object.bucket }}/{{ task.input.aiServiceRequest.image.s3Object.name }}{% endcapture %} <crowd-form> <crowd-rekognition-detect-moderation-labels categories='[ {% for label in task.input.selectedAiServiceResponse.moderationLabels %} { name: "{{ label.name }}", parentName: "{{ label.parentName }}", }, {% endfor %} ]' src="{{ s3_uri | grant_read_access }}" header="Review the image and choose all applicable categories." > <short-instructions header="Instructions"> <style> .instructions { white-space: pre-wrap; } </style> <p class='instructions'>Review the image and choose all applicable categories. If no categories apply, choose None. <b>Nudity</b> Visuals depicting nude male or female person or persons <b>Graphic Male Nudity</b> Visuals depicting full frontal male nudity, often close ups <b>Graphic Female Nudity</b> Visuals depicting full frontal female nudity, often close ups <b>Sexual Activity</b> Visuals depicting various types of explicit sexual activities and pornography <b>Illustrated Nudity or Sexual Activity</b> Visuals depicting animated or drawn sexual activity, nudity or pornography <b>Adult Toys</b> Visuals depicting adult toys, often in a marketing context <b>Female Swimwear or Underwear</b> Visuals depicting female person wearing only swimwear or underwear <b>Male Swimwear Or Underwear</b> Visuals depicting male person wearing only swimwear or underwear <b>Partial Nudity</b> Visuals depicting covered up nudity, for example using hands or pose <b>Revealing Clothes</b> Visuals depicting revealing clothes and poses, such as deep cut dresses <b>Graphic Violence or Gore</b> Visuals depicting prominent blood or bloody injuries <b>Physical Violence</b> Visuals depicting violent physical assault, such as kicking or punching <b>Weapon Violence</b> Visuals depicting violence using weapons like firearms or blades, such as shooting <b>Weapons</b> Visuals depicting weapons like firearms and blades <b>Self Injury</b> Visuals depicting self-inflicted cutting on the body, typically in distinctive patterns using sharp objects <b>Emaciated Bodies</b> Visuals depicting extremely malnourished human bodies <b>Corpses</b> Visuals depicting human dead bodies <b>Hanging</b> Visuals depicting death by hanging</p> </short-instructions> <full-instructions header="Instructions"></full-instructions> </crowd-rekognition-detect-moderation-labels> </crowd-form>

輸出

下列是此元素中輸出的範本。如需有關此輸出的詳細資訊,請參閱 Amazon Rekognition DetectModeration標籤 API 文件。

{ "AWS/Rekognition/DetectModerationLabels/Image/V3": { "ModerationLabels": [ { name: 'Gore', parentName: 'Violence' }, { name: 'Corpses', parentName: 'Violence' }, ] } }