创建包含标签类别和帧属性的标注类别配置文件 - Amazon SageMaker
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

创建包含标签类别和帧属性的标注类别配置文件

使用 Amazon SageMaker API 操作 CreateLabelingJob 创建 3D 点云或视频帧标注作业时,您需要使用标签类别配置文件来指定标签和工作人员说明。您也可以选择在标签类别属性文件中提供以下内容:

  • 您可以为视频帧和 3D 点云对象跟踪和对象检测任务类型提供标签类别属性。工作人员可以使用一个或多个属性来提供有关对象的更多信息。例如,您可能希望使用 occluded 属性,以使工作人员确定对象何时被部分遮挡。您可以使用 categoryAttributes 参数为单个标签指定标签类别属性,或者使用 categoryGlobalAttributes 参数为所有标签指定标签类别属性。

  • 您可以使用 frameAttributes 为视频帧和 3D 点云对象跟踪和对象检测任务类型提供帧属性。创建帧属性时,该属性会出现在工作人员任务中的每个帧或点云上。在视频帧标注作业中,这些属性是工作人员分配给整个视频帧的属性。对于 3D 点云标注作业,这些属性应用于单个点云。使用帧属性可让工作人员提供特定帧或点云中场景的更多信息。

  • 对于视频帧标注作业,可以使用标签类别配置文件指定发送给工作人员的任务类型(边界框、折线、多边形或关键点)。

工作人员可以选择性地为标签类别属性和帧属性指定值。

重要

只有在运行审核作业以验证或调整标签时,您才应在 auditLabelAttributeName 中提供标签属性名称。使用该参数可输入标注作业中使用的 LabelAttributeName,该标注作业生成了您希望工作人员调整的注释。在控制台中创建标注作业时,如果您未指定标签属性名称,则会将作业的名称作为 LabelAttributeName。

标签类别配置文件架构

下表列出了您可以或必须在标签类别配置文件中包含的元素。

注意

仅视频帧标注作业支持 annotationType 参数。

参数

必需

接受的值

描述

frameAttributes

JSON 对象列表。

每个 JSON 对象中的必需参数:

name, type, description

如果 type"number",则 minimummaximum 是必需的

每个 JSON 对象中的可选参数:

enum, editsAllowed, isRequired

使用此参数可创建一个帧属性,该属性应用于标注作业中的所有帧或 3D 点云。

有关更多信息,请参阅本节中的第三个表。
categoryGlobalAttributes

JSON 对象列表。

每个 JSON 对象中的必需参数:

name, type

如果 type"number",则 minimummaximum 是必需的

每个 JSON 对象中的可选参数:

description, enum, editsAllowed, isRequired

使用此参数可以创建应用于在 labels 中指定的所有标签的标签类别属性。

有关更多信息,请参阅本节中的第三个表。
labels

最多包含 30 个 JSON 对象的列表

每个 JSON 对象中的必需参数:

label

每个 JSON 对象中的可选参数:

categoryAttributes, editsAllowed

使用此参数可以指定标签或类。为每个类添加一个 label

要将标签类别属性添加到一个标签中,请将 categoryAttributes 添加到该标签中。

使用 editsAllowed 可指定是否可以在调整标注作业中编辑标签。对于验证标注作业,将 editsAllowed 设置为 "none"

有关更多信息,请参阅下表。

annotationType(仅视频帧标注作业支持)

字符串

接受的参数

BoundingBox, Polyline, Polygon, Keypoint

默认值

BoundingBox

使用此项可以指定视频帧标注作业的任务类型。例如,对于多边形视频帧对象检测任务,请选择 Polygon

如果在创建视频帧标注作业时未指定 annotationType,Ground Truth 将默认使用 BoundingBox

instructions

JSON 对象

每个 JSON 对象中的必需参数:

"shortInstruction", "fullInstruction"

使用此参数可以添加有助于工作人员完成任务的工作人员说明。有关工作人员说明的更多信息,请参阅工作人员说明

短说明必须少于 255 个字符,长说明必须少于 2048 个字符。

有关更多信息,请参阅 创建工作人员说明

auditLabelAttributeName

调整和验证任务类型所必需的

字符串

输入要调整注释的标注作业中使用的 LabelAttributeName

仅当您正在为视频帧和 3D 点云对象检测、对象跟踪或 3D 点云语义分割创建调整作业时,才使用此参数。

下表描述了创建 Labels 列表时可以使用和必须使用的参数。每个参数都应包含在 JSON 对象中。

参数 必需 接受的值 描述
label

字符串

向工作人员显示的标签类别的名称。每个标签类别名称必须唯一。

categoryAttributes

JSON 对象列表。

每个 JSON 对象中的必需参数:

name, type

如果 type"number",则 minimummaximum 是必需的

每个 JSON 对象中的可选参数:

description, enum, editsAllowed, isRequired

使用此参数可以将标签类别属性添加到在 labels 中指定的特定标签。

要向标签添加一个或多个标签类别属性,请将 categoryAttributes JSON 对象包含在与 label 相同的 labels JSON 对象中。

有关更多信息,请参阅下表。
editsAllowed

字符串

支持的值

"none":不允许进行任何修改。

"any"(默认):允许所有修改。

指定工作人员是否可以编辑标签。

对于视频帧或 3D 点云调整标注作业,请将此参数添加到 labels 列表中的一个或多个 JSON 对象,以指定工作人员是否可以编辑标签。

对于 3D 点云和视频帧验证标注作业,请将此参数与值 "none" 一起添加到 labels 列表中的每个 JSON 对象。这将使所有标签都不可编辑。

下表描述了使用 frameAttributes 创建帧属性时以及使用 categoryGlobalAttributescategoryAttributes 参数创建标签类别属性时可以使用和必须使用的参数。

参数

必需

接受的值

描述

name

字符串

使用此参数可以为标签类别或帧属性分配名称。这是工作人员看到的属性名称。

标签类别配置文件中的每个标签类别属性名称必须是唯一的。全局标签类别属性和特定于标签的标签类别属性不能具有相同的名称。

type

字符串

必需的值

"string""number"

使用此参数可以定义标签类别或帧属性类型。

如果为 type 指定 "string" 并为此属性提供 enum 值,则工作人员将能够从您提供的选项中进行选择。

如果为 type 指定 "string" 但不提供 enum 值,则工作人员可以输入自由格式文本。

如果为 type 指定 number,则工作人员可以输入介于您指定的 minimummaximum 之间的数字。

enum

字符串列表

使用此参数可以定义工作人员可为此标签类别或帧属性选择的选项。工作人员可以选择在 enum 中指定的一个值。例如,如果为 enum 指定 ["foo", "buzz", "bar"],则工作人员可以选择 foobuzzbar 中的一个。

必须为 type 指定 "string" 才能使用 enum 列表。

description

frameAttributes:是

categoryAttributescategoryGlobalAttributes:否

字符串

使用此参数可以添加标签类别或帧属性的描述。您可以使用此字段向工作人员提供有关属性的更多信息。

只有帧属性才需要此字段。

minimummaximum 如果属性 type"number",则是必需的 整数

使用这些参数可以指定工作人员可为数值标签类别或帧属性输入的最小值和最大值(包括)。

必须为 type 指定 "number" 才能使用 minimummaximum

editsAllowed

字符串

必需的值

"none":不允许进行任何修改。

"any"(默认):允许所有修改。

指定工作人员是否可以编辑标签类别或帧属性。

对于视频帧或 3D 点云调整验证标注作业,请将此参数添加到标签类别和帧属性 JSON 对象中,以指定工作人员是否可以编辑属性。

isRequired

布尔值

指定是否需要工作人员对属性进行注释。在对所有必需的属性进行注释之前,工作人员无法提交作业。

标签和标签类别属性限额

您最多可以为每个类指定 10 个标签类别属性。这 10 个属性限额包括全局标签类别属性。例如,如果您创建 4 个全局标签类别属性,然后将三个标签类别属性分配给标签 X,则该标签总共具有 4+3=7 个标签类别属性。有关所有标签类别和标签类别属性限制,请参阅下表。

类型

最小值

最大值

标签 (Labels)

1

30

标签名称字符限额

1

16

每个标签的标签类别属性(categoryAttributescategoryGlobalAttributes 总和)

0

10

每个标签的自由格式文本条目标签类别属性(categoryAttributescategoryGlobalAttributes 总和)。

0 5

帧属性

0

10

frameAttributes 中的自由格式文本条目属性。

0 5

属性名称字符限额 (name)

1

16

属性描述字符限额 (description)

0

128

属性类型字符限额 (type)

1

16

string 属性的 enum 列表中允许的值

1 10

enum 列表中某个值的字符限额

1 16
自由格式文本 frameAttributes 的自由格式文本响应中的最大字符数 0 1000
自由格式文本 categoryAttributescategoryGlobalAttributes 的自由格式文本响应中的最大字符数 0 80

示例:3D 点云标注作业的标签类别配置文件

在下表中选择一个选项卡,以查看用于对象检测、对象跟踪、语义分割、调整和验证标注作业的 3D 点云标签类别配置文件的示例。

3D Point Cloud Object Tracking and Object Detection

下面是一个标签类别配置文件示例,其中包含 3D 点云对象检测或对象跟踪标注作业的标签类别属性。此示例包括两个帧属性,这些属性将添加到提交给标注作业的所有点云中。Car 标签将包括四个标签类别属性 – XYZ 和全局属性 W

{ "documentVersion": "2020-03-01", "frameAttributes": [ { "name":"count players", "description":"How many players to you see in the scene?", "type":"number" }, { "name":"select one", "description":"describe the scene", "type":"string", "enum":["clear","blurry"], "isRequired":true }, ], "categoryGlobalAttributes": [ { "name":"W", "description":"label-attributes-for-all-labels", "type":"string", "enum": ["foo", "buzz", "biz"] } ], "labels": [ { "label": "Car", "categoryAttributes": [ { "name":"X", "description":"enter a number", "type":"number", }, { "name":"Y", "description":"select an option", "type":"string", "enum":["y1", "y2"] }, { "name":"Z", "description":"submit a free-form response", "type":"string", } ] }, { "label": "Pedestrian", "categoryAttributes": [...] } ], "instructions": {"shortInstruction":"Draw a tight Cuboid", "fullInstruction":"<html markup>"} }
3D Point Cloud Semantic Segmentation

下面是 3D 点云语义分割标注作业的标签类别配置文件示例。

3D 点云语义分割任务类型不支持标签类别属性。支持帧属性。如果您为语义分割标注作业提供标签类别属性,将忽略这些属性。

{ "documentVersion": "2020-03-01", "frameAttributes": [ { "name":"count players", "description":"How many players to you see in the scene?", "type":"number" }, { "name":"select one", "description":"describe the scene", "type":"string", "enum":["clear","blurry"] }, ], "labels": [ { "label": "Car", }, { "label": "Pedestrian", }, { "label": "Cyclist", } ], "instructions": {"shortInstruction":"Select the appropriate label and paint all objects in the point cloud that it applies to the same color", "fullInstruction":"<html markup>"} }

在下表中选择一个选项卡,以查看用于 3D 点云验证或调整标注作业的标签类别配置文件示例。

3D Point Cloud Adjustment

以下是用于 3D 点云对象检测或对象跟踪调整标注作业的标签类别配置文件示例。对于 3D 点云语义分割调整标注作业,不支持 categoryGlobalAttributescategoryAttributes

必须包括 auditLabelAttributeName 以指定用于创建调整标注作业的前一个标注作业的标签属性名称。也可以选择使用 editsAllowed 参数来指定是否可以编辑标签或帧属性。

{ "documentVersion": "2020-03-01", "frameAttributes": [ { "name":"count players", "description":"How many players to you see in the scene?", "type":"number" }, { "name":"select one", "editsAllowed":"none", "description":"describe the scene", "type":"string", "enum":["clear","blurry"] }, ], "categoryGlobalAttributes": [ { "name":"W", "editsAllowed":"any", "description":"label-attributes-for-all-labels", "type":"string", "enum": ["foo", "buzz", "biz"] } ], "labels": [ { "label": "Car", "editsAllowed":"any", "categoryAttributes": [ { "name":"X", "description":"enter a number", "type":"number" }, { "name":"Y", "description":"select an option", "type":"string", "enum":["y1", "y2"], "editsAllowed":"any" }, { "name":"Z", "description":"submit a free-form response", "type":"string", "editsAllowed":"none" } ] }, { "label": "Pedestrian", "categoryAttributes": [...] } ], "instructions": {"shortInstruction":"Draw a tight Cuboid", "fullInstruction":"<html markup>"}, // include auditLabelAttributeName for label adjustment jobs "auditLabelAttributeName": "myPrevJobLabelAttributeName" }
3D Point Cloud Verification

以下是可用于 3D 点云对象检测或对象跟踪验证标注作业的标签类别配置文件示例。对于 3D 点云语义分割验证标注作业,不支持 categoryGlobalAttributescategoryAttributes

必须包括 auditLabelAttributeName 以指定用于创建验证标注作业的前一个标注作业的标签属性名称。此外,必须使用 editsAllowed 参数以指定不能编辑任何标签。

{ "documentVersion": "2020-03-01", "frameAttributes": [ { "name":"count players", "editsAllowed":"any", "description":"How many players to you see in the scene?", "type":"number" }, { "name":"select one", "editsAllowed":"any", "description":"describe the scene", "type":"string", "enum":["clear","blurry"] }, ], "categoryGlobalAttributes": [ { "name":"W", "editsAllowed":"none", "description":"label-attributes-for-all-labels", "type":"string", "enum": ["foo", "buzz", "biz"] } ], "labels": [ { "label": "Car", "editsAllowed":"none", "categoryAttributes": [ { "name":"X", "description":"enter a number", "type":"number", "editsAllowed":"none" }, { "name":"Y", "description":"select an option", "type":"string", "enum":["y1", "y2"], "editsAllowed":"any" }, { "name":"Z", "description":"submit a free-form response", "type":"string", "editsAllowed":"none" } ] }, { "label": "Pedestrian", "editsAllowed":"none", "categoryAttributes": [...] } ], "instructions": {"shortInstruction":"Draw a tight Cuboid", "fullInstruction":"<html markup>"}, // include auditLabelAttributeName for label verification jobs "auditLabelAttributeName": "myPrevJobLabelAttributeName" }

示例:视频帧标注作业的标签类别配置文件

工作人员可用的注释工具和使用的任务类型取决于您为 annotationType 指定的值。例如,如果希望工作人员使用关键点来跟踪多个帧中特定对象姿势的变化,则应该为 annotationType 指定 Keypoint。如果未指定注释类型,则默认情况下将使用 BoundingBox

下面是一个带有标签类别属性的视频帧关键点标签类别配置文件示例。此示例包括两个帧属性,这两个属性将添加到提交给标注作业的所有帧中。Car 标签将包括四个标签类别属性 – XYZ 和全局属性 W

{ "documentVersion": "2020-03-01", "frameAttributes": [ { "name":"count players", "description":"How many players to you see in the scene?", "type":"number" }, { "name":"select one", "description":"describe the scene", "type":"string", "enum":["clear","blurry"] }, ], "categoryGlobalAttributes": [ { "name":"W", "description":"label-attributes-for-all-labels", "type":"string", "enum": ["foo", "buz", "buz2"] } ], "labels": [ { "label": "Car", "categoryAttributes": [ { "name":"X", "description":"enter a number", "type":"number", }, { "name":"Y", "description":"select an option", "type":"string", "enum": ["y1", "y2"] }, { "name":"Z", "description":"submit a free-form response", "type":"string", } ] }, { "label": "Pedestrian", "categoryAttributes": [...] } ], "annotationType":"Keypoint", "instructions": {"shortInstruction":"add example short instructions here", "fullInstruction":"<html markup>"} }

从下表中选择一个选项卡,查看视频帧调整和验证标注作业的标签类别配置文件示例。

Video Frame Adjustment

以下是可用于视频帧调整标注作业的标签类别配置文件示例。

必须包括 auditLabelAttributeName 以指定用于创建验证标注作业的前一个标注作业的标签属性名称。也可以选择使用 editsAllowed 参数来指定是否可以编辑标签、标签类别属性或帧属性。

{ "documentVersion": "2020-03-01", "frameAttributes": [ { "name":"count players", "editsAllowed":"none", "description":"How many players to you see in the scene?", "type":"number" }, { "name":"select one", "description":"describe the scene", "type":"string", "enum":["clear","blurry"] }, ], "categoryGlobalAttributes": [ { "name":"W", "editsAllowed":"any", "description":"label-attributes-for-all-labels", "type":"string", "enum": ["foo", "buz", "buz2"] } ], "labels": [ { "label": "Car", "editsAllowed":"any", "categoryAttributes": [ { "name":"X", "description":"enter a number", "type":"number", "editsAllowed":"any" }, { "name":"Y", "description":"select an option", "type":"string", "enum": ["y1", "y2"], "editsAllowed":"any" }, { "name":"Z", "description":"submit a free-form response", "type":"string", "editsAllowed":"none" } ] }, { "label": "Pedestrian", "editsAllowed":"none", "categoryAttributes": [...] } ], "annotationType":"Keypoint", "instructions": {"shortInstruction":"add example short instructions here", "fullInstruction":"<html markup>"}, // include auditLabelAttributeName for label adjustment jobs "auditLabelAttributeName": "myPrevJobLabelAttributeName" }
Video Frame Verification

以下是视频帧标注作业的标签类别配置文件示例。

必须包括 auditLabelAttributeName 以指定用于创建验证标注作业的前一个标注作业的标签属性名称。此外,必须使用 editsAllowed 参数以指定不能编辑任何标签。

{ "documentVersion": "2020-03-01", "frameAttributes": [ { "name":"count players", "editsAllowed":"none", "description":"How many players to you see in the scene?", "type":"number" }, { "name":"select one", "editsAllowed":"any", "description":"describe the scene", "type":"string", "enum":["clear","blurry"] }, ], "categoryGlobalAttributes": [ { "name":"W", "editsAllowed":"none", "description":"label-attributes-for-all-labels", "type":"string", "enum": ["foo", "buz", "buz2"] } ], "labels": [ { "label": "Car", "editsAllowed":"none", "categoryAttributes": [ { "name":"X", "description":"enter a number", "type":"number", "editsAllowed":"any" }, { "name":"Y", "description":"select an option", "type":"string", "enum": ["y1", "y2"], "editsAllowed":"any" }, { "name":"Z", "description":"submit a free-form response", "type":"string", "editsAllowed":"none" } ] }, { "label": "Pedestrian", "editsAllowed":"none", "categoryAttributes": [...] } ], "annotationType":"Keypoint", "instructions": {"shortInstruction":"add example short instructions here", "fullInstruction":"<html markup>"}, // include auditLabelAttributeName for label adjustment jobs "auditLabelAttributeName": "myPrevJobLabelAttributeName" }

创建工作人员说明

创建有关标注作业的自定义说明,以提高工作人员完成其任务的准确性。当工作人员在工作人员 UI 中选择说明菜单选项时,便可以访问您的说明。短说明必须少于 255 个字符,长说明必须少于 2048 个字符。

说明分为两种:

  • 简短说明 – 当工作人员在工作人员 UI 菜单中选择说明时,将向他们显示这些说明。这些说明应提供简单的参考内容,以向工作人员显示标注对象的正确方法。

  • 完整说明 – 当工作人员在说明弹出窗口中选择更多说明时,将显示这些说明。如果要完成的任务使用多个示例来显示边缘情况和其他难以标注对象的情况,我们建议您提供详细说明。

对于 3D 点云和视频帧标注作业,可以将工作人员说明添加到标签类别配置文件中。您可以使用单个字符串以创建说明,也可以添加 HTML 标记以自定义说明外观和添加图像。确保您在说明中包含的任何图像是公开可用的,如果说明位于 Amazon S3 中,请确保工作人员具有读取访问权限,以便他们可以查看这些说明。