Label Studio 任务格式
Label Studio 标注任务的JSON格式
当你标注数据时,Label Studio会将输出以JSON格式存储。每个已完成任务的原始JSON结构示例如下:
{
"id": 1,
"created_at":"2021-03-09T21:52:49.513742Z",
"updated_at":"2021-03-09T22:16:08.746926Z",
"project":83,
"data": {
"image": "https://example.com/opensource/label-studio/1.jpg"
},
"annotations": [
{
"id": "1001",
"result": [
{
"from_name": "tag",
"id": "Dx_aB91ISN",
"source": "$image",
"to_name": "img",
"type": "rectanglelabels",
"value": {
"height": 10.458911419423693,
"rectanglelabels": [
"Moonwalker"
],
"rotation": 0,
"width": 12.4,
"x": 50.8,
"y": 5.869797225186766
}
}
],
"was_cancelled":false,
"ground_truth":false,
"created_at":"2021-03-09T22:16:08.728353Z",
"updated_at":"2021-03-09T22:16:08.728378Z",
"lead_time":4.288,
"result_count":0,
"task":1,
"completed_by":10
}
],
"predictions": [
{
"created_ago": "3 hours",
"model_version": "model 1",
"result": [
{
"from_name": "tag",
"id": "t5sp3TyXPo",
"source": "$image",
"to_name": "img",
"type": "rectanglelabels",
"value": {
"height": 11.612284069097889,
"rectanglelabels": [
"Moonwalker"
],
"rotation": 0,
"width": 39.6,
"x": 13.2,
"y": 34.702495201535505
}
}
]
},
{
"created_ago": "4 hours",
"model_version": "model 2",
"result": [
{
"from_name": "tag",
"id": "t5sp3TyXPo",
"source": "$image",
"to_name": "img",
"type": "rectanglelabels",
"value": {
"height": 33.61228406909789,
"rectanglelabels": [
"Moonwalker"
],
"rotation": 0,
"width": 39.6,
"x": 13.2,
"y": 54.702495201535505
}
}
]
}
]
}
相关JSON属性描述
查看完整的JSON属性列表,请参阅API文档。
JSON属性名称 | 描述 |
---|---|
id | 数据集中标注任务的唯一标识符。 |
data | 从输入数据任务格式中复制的数据。详情请参阅任务格式文档。 |
project | Label Studio中特定项目的标识符。 |
annotations | 包含任务标注结果的数组。 |
annotations.id | 已完成任务的标识符。 |
annotations.lead_time | 标注任务所花费的时间(秒)。 |
annotations.result | 包含标注或注释任务结果的数组。 |
annotations.updated_at | 标注创建或修改的时间戳。 |
annotations.completed_at | 标注创建或提交的时间戳。 |
annotations.completed_by | 创建标注的用户ID。与Label Studio界面中"人员"页面的用户列表顺序匹配。关于导入格式选项,请参阅Specifying annotators during import。 |
annotations.was_cancelled | 布尔值。关于标注是否被跳过或取消的详细信息。 |
result.id | Identifier for the specific annotation result for this task. Use it to combine together regions from different control tags, e.g. <Labels> and <Rectangle> |
result.parentID | (可选) 引用父级区域result.id。它会在区域面板中将区域组织成层次树结构 |
result.from_name | 用于标注区域的标签名称。参见control tags。 |
result.to_name | 提供待标注区域的对象标签名称。参见object tags。 |
result.type | 用于标注任务的标签类型。 |
result.value | 标签特定的值,包含任务标注结果的详细信息。该值的结构取决于标签的类型。更多信息,请参阅Explore each tag。 |
drafts | 草稿注释数组。格式与annotations数组类似。仅当任务作为快照导出时包含,来自UI界面或通过API导出时包含。 |
predictions | 机器学习预测结果数组。遵循与annotations数组相同的格式,但包含一个额外参数。 |
predictions.score | 基于概率输出、置信度或其他因素得出的结果总体评分。 |
task.updated_at | 任务或其任何标注或评审被创建、更新或删除时的时间戳。 |
导入时指定标注人员
Label Studio 如何将结果保存在标注中
每个标注结果由列表或项组成,也称为区域,存储在annotation.result
字段下:
{"result": [{"id": "123", ...}, {"id": "456", ...}], ...}
区域可以表示任何标注操作 - 绘制的边界框、创建的关系、分配的类别等。每个"id"
字段由A-Za-z0-9_-
字符组成的字符串构成,并根据标注结构进行分配:每个独立的标注实体都会获得自己的ID,相同的ID用于将不同实体链接在一起 - 例如通过
建立关联,或使用"perRegion"
属性进行条件标注。
格式根据以下原则推断:
- 必须至少包含1个对象标签
- object tags define data types used (image, html, video, etc.)
- 至少需要附加1个控制标签到对象标签上,才能在该对象上创建区域
- 每个控制标签为区域生成1个结果
- 同一区域的结果共享相同的id
- 分类技术会创建一个特殊的空分类区域
当使用预测结果创建标注时,标注字段中的结果ID保持不变。这使您能够追踪机器学习模型生成的区域,并将其与人工创建和审核的标注直接进行比较。
"value"
表示标注过程的结果,其结构根据标注配置而变化。要了解特定标签的结构,请参阅Control tags文档并查看相关标签。
示例
按区域划分
当强制使用条件式 "perRegion"
结构时的结果格式示例:
<Image name="image" value="$image"/>
<RectangleLabels name="product" toName="image">
<Label value="Some label" />
...
</RectangleLabels>
<TextArea name="name" toName="image" perRegion="true" />
1-2个区域的结果:必需的标注和可选的每个区域文本结果
[{
"id": "X_12fGk",
"from_name": "product",
"to_name": "image",
"type": "rectanglelabels",
// ...
"value": {
"labels": ["Some label"],
// ...
}
}, {
"id": "X_12fGk",
"from_name": "name",
"to_name": "image",
"type": "textarea",
// ...
"value": {
"text": ["Roasted beans"],
// ...
}
}]
可选标签
<Image name="image" value="$image"/>
<Rectangle name="product" toName="image" />
<Labels name="kind" toName="image">
<Label value="Tea" />
<Label value="Coffee" />
</Labels>
1-2个区域的结果:必需的绘图工具及可选的附加标注
[{
"id": "X_12fGk",
"from_name": "product",
"to_name": "image",
"type": "rectangle",
// ...
"value": {
"x": 100,
"y": 200,
// ...
}
}, {
"id": "X_12fGk",
"from_name": "kind",
"to_name": "image",
"type": "labels",
// ...
"value": {
"labels": ["Tea"],
// ...
}
}]
多标签
<Image name="image" value="$image"/>
<Rectangle name="product" toName="image" />
<Labels name="kind" toName="image">
<Label value="Tea" />
<Label value="Coffee" />
</Labels>
<Labels name="country" toName="image">
<Label value="Sri-Lanka" />
<Label value="Brazil" />
</Labels>
<Number name="price" toName="image" perRegion="true" required="true" />
1-4 个区域结果:可选标签和必填价格 + 矩形本身
[{
"id": "X_12fGk",
"from_name": "product",
"to_name": "image",
"type": "rectangle",
// ...
"value": {
// rectangle sizes
}
}, {
"id": "X_12fGk",
"from_name": "kind",
"to_name": "image",
"type": "labels",
// ...
"value": {
"labels": ["Coffee"],
// rectangle sizes
}
}, {
"id": "X_12fGk",
"from_name": "country",
"to_name": "image",
"type": "labels",
// ...
"value": {
"labels": ["Brazil"],
// rectangle sizes
}
}, {
"id": "X_12fGk",
"from_name": "price",
"to_name": "image",
"type": "labels",
// ...
"value": {
"number": 12.5,
// rectangle sizes
}
}]
关系
您可以在两个对象之间绘制关系箭头。例如,对象检测配置
<Image name="image" value="$image"/>
<RectangleLabels name="kind" toName="image">
<Label value="Car" />
<Label value="Airplaine" />
</RectangleLabels>
```json
[{
"id": "oid67",
"type": "rectanglelabels",
// ...
},
{
"id": "RQbW3Sj_Zr",
"type": "rectanglelabels",
// ...
},
{
"type": "relation",
"to_id": "RQbW3Sj_Zr",
"from_id": "oid66",
"direction": "right"
}]