Label Studio Enterprise Ground Truth 标注完整指南:设置、筛选、导出与评估原理
Label Studio Enterprise Ground Truth 标注完整指南设置、筛选、导出与评估原理【免费下载链接】label-studioLabel Studio is a multi-type data labeling and annotation tool with standardized output format项目地址: https://gitcode.com/GitHub_Trending/la/label-studioGround truth真实标注/标准答案是 Label Studio 中用于衡量标注质量与模型性能的基准标注。本文围绕 ground_truths.md 的完整操作流程结合本项目源码中Annotation.ground_truth字段、ensure_unique_groundtruth约束以及 Data Manager 的筛选/批量动作实现系统讲解如何设置、查看、筛选与移除 Ground Truth 标注并深入其背后的数据模型与任务分配机制帮助你建立一套可度量、可追溯的标注质量基准体系。Ground Truth 是什么标准答案与质量基准Ground truth真实标注是指经过验证的高质量标注它被当作某个具体任务的正确答案使用。它承担着两重核心职责标注质量的基准将标注者annotator产出的标注与该任务的 Ground Truth 对比计算两者的一致性分数从而评估单个标注者的标注准确率模型性能的评估基准将机器学习模型给出的预测prediction与 Ground Truth 对比衡量模型在标注任务上的表现。Label Studio Enterprise 会针对一个任务将标注者的标注与模型预测同 Ground Truth 进行比较最终计算出介于 0 与 1 之间的准确率分数accuracy score为质量度量、人员考核与模型迭代提供量化依据。⚠️Enterprise 限制Ground Truth 标注功能仅在Label Studio Enterprise Edition中提供。如果你正在使用 Community Edition社区版该功能不可用相关功能对比可参见 label_studio_compare.md。数据模型层面的实现在数据模型上Ground Truth 并不是独立的对象而是标注Annotation对象上的一个布尔标志位。在 tasks/models.py 中可以看到ground_truth models.BooleanField( _(ground_truth), defaultFalse, help_textThis annotation is a Ground Truth (ground_truth), )即任何一条标注都可以通过把ground_truth置为True而升级为 Ground Truth。为了支撑高频筛选与统计该字段还建立了多组数据库索引见 tasks/models.py单字段索引(ground_truth)组合索引(project, ground_truth)与(task, ground_truth)这些索引让按任务/项目筛选出 Ground Truth 标注这类查询例如任务分配、导出过滤、项目统计可以在大规模数据下高效执行。一个任务只能有一个 Ground Truth唯一性约束的源码保证Ground Truth 具有任务级唯一性每个任务最多只能有一条标注被标记为 Ground Truth。当你把任务中的某条新标注设为 Ground Truth 时该任务此前被标记为 Ground Truth 的那条标注会被自动取消标记。这一规则在源码中有明确的强制实现。在 tasks/models.py 中Task模型提供了ensure_unique_groundtruth方法def ensure_unique_groundtruth(self, annotation_id): self.annotations.exclude(idannotation_id).update(ground_truthFalse)它的语义是排除当前这条标注之外将该任务下所有其他标注的ground_truth统一置为False。因此无论前端如何操作服务端都会保证唯一性不会出现一个任务同时存在两条 Ground Truth 的情况。该约束在标注更新 API 中实际生效。在 tasks/api.py 的AnnotationAPI.update中task annotation.task if self.request.data.get(ground_truth): task.ensure_unique_groundtruth(annotation_idannotation.id) task.update_is_labeled() task.save() # refresh task metrics当通过 API 更新标注且请求体中携带ground_truth: true时后端会先调用ensure_unique_groundtruth清理同任务的其他 Ground Truth 标记随后刷新任务的is_labeled状态与任务统计指标。这也意味着Ground Truth 的设置与取消不仅可以在界面上完成也可以通过标注 API 以编程方式完成PATCH/PUT /api/tasks/{task_id}/annotations/{annotation_id}携带ground_truth字段。将单条标注标记为 Ground Truth界面操作步骤在项目任务列表中打开某个任务进入标注/审查视图在任务底部工具栏中找到星形图标⭐点击该星形图标即可将当前选中的标注标记为该任务的 Ground Truth。注意如前文所述一个任务只能有一条 Ground Truth。若任务已有 Ground Truth再对另一条标注执行此操作前一条会被自动取消标记由ensure_unique_groundtruth保证见 tasks/models.py。星形图标的工程实现前端视角下Ground Truth 的展示与交互由编辑器底栏组件承载例如 Actions.jsx 与 GroundTruth.jsx。这些组件将用户点击映射为对标注的ground_truth字段更新请求最终进入上文AnnotationAPI.update的处理流程。换言之星形图标本质上是ground_truth布尔字段的前端开关。按标注者批量设置 Ground Truth当团队希望某个标注者产出的标注天然视为标准答案时无需逐条手动设置可以按用户批量操作在 Data Manager 中勾选需要更新的任务可配合筛选器精确圈定任务范围点击工具栏Actions Set Ground Truths在弹出的列表中选择对应的标注者annotator系统将把该标注者在这些任务上产出的标注统一标记为 Ground Truth。批量设置同样受到每任务唯一 Ground Truth约束的制约对于已存在 Ground Truth 的任务新设置的标注会替换旧的 Ground Truth 标记。在 Data Manager 中查看与筛选 Ground Truth 任务Ground Truth 列Data Manager 提供Ground Truth列用于直观标识哪些任务已经设置了 Ground Truth。你可以在列设置中启用该列列表中对应任务会以标记/颜色方式呈现。从 Data Manager 的列定义看该列对应的筛选字段在 prepare_params.py 中注册GROUND_TRUTH ground_truth, Boolean, Ground truth status of the tasks即ground_truth是任务级布尔型筛选字段类型为Boolean含义为任务的 Ground Truth 状态。使用过滤器包含/排除你可以为ground_truth字段添加过滤器实现只看有 Ground Truth 的任务ground_truthtrue存在 Ground Truth 标注排除有 Ground Truth 的任务ground_truthfalse用于挑选仍需打标准答案的任务。在实现层面任务级ground_truth是通过子查询Exists(...)计算的而非直接存储的字段相关逻辑见 managers.py 与 next_task.pydef _annotate_has_ground_truths(tasks: QuerySet[Task]) - QuerySet[Task]: ground_truth Annotation.objects.filter(taskOuterRef(pk), ground_truthTrue) return tasks.annotate(has_ground_truthsExists(ground_truth))由于它永远是Exists(...)的结果而不会为 NULL因此筛选器不支持empty为空运算符。测试用例 test_serializers.py 明确验证了这一点对filter:tasks:ground_truth使用empty运算符会被拒绝而equal等于运算符被保留FIT-2525。在标注一致性IAA弹窗中查看 Ground Truth在 Data Manager 中将鼠标悬停在Agreement一致性列上会弹出标注者间一致性inter-annotator agreement详情弹窗展示多个标注者之间的标注一致程度。被标记为 Ground Truth 的标注会以星形图标 ⭐️ 显著标识方便你快速定位标准答案与普通标注在一致性矩阵中的位置该弹窗是质量审查Review场景的重要入口结合一致性分数与 Ground Truth 标识可以快速判断分歧源于标注者误差还是标注指南模糊。移除 Ground Truth 标注移除单条 Ground Truth打开任务找到当前被标记为 Ground Truth 的标注再次点击星形图标即可取消标记。底层对应将标注的ground_truth字段由True更新为False任务随即不再拥有 Ground Truth。批量移除 Ground Truth在 Data Manager 中勾选需要处理的任务选择Actions Delete Ground Truths系统将所选任务上的 Ground Truth 标记统一清除。批量删除动作在 Data Manager 的 Actions API 中有对应的动作标识delete_ground_truths见 api.py可通过POST /api/dm/actions并指定iddelete_ground_truths以编程方式触发POST /api/dm/actions?iddelete_ground_truthsprojectproject_id进阶Ground Truth 在评估、任务分配与导出中的联动Ground Truth 的价值不止于标记本身它还深度参与了 Label Studio Enterprise 的质量度量与任务流转标注者评估模式与 Ground Truth 优先队列项目开启**标注者评估annotator evaluation**后Ground Truth 会参与任务分配策略。相关开关定义在 projects/models.py# Deprecated in favor of annotator_evaluation_enabled show_ground_truth_first models.BooleanField( _(show ground truth first), defaultFalse, help_textOnboarding mode (true): show ground truth tasks first in the labeling stream, ) annotator_evaluation_enabled models.BooleanField( _(annotator evaluation enabled), defaultFalse, db_defaultFalse, help_textEnable annotator evaluation for the project, )其中show_ground_truth_first已废弃由annotator_evaluation_enabled取代。在评估模式下任务分配逻辑会优先尝试Ground Truth 入门队列Onboarding ground truth queue先为标注者派发那些已有 Ground Truth 但尚未被其正确标注的任务用于检验其标注能力。该策略在 next_task.py 中实现def _try_onboarding_ground_truth(tasks, project, user): if not should_attempt_ground_truth_first(user, project): return None not_solved_tasks_with_ground_truths _annotate_has_ground_truths(tasks).filter(has_ground_truthsTrue) ...详细决策流程可参考 next_task.md。此外常规的任务轮转、重叠overlap与加锁逻辑也会将 Ground Truth 标注排除在普通标注计数之外避免标准答案被当作普通标注参与去重与锁定见 tasks/models.py 的exclude_q q | Q(ground_truthTrue)。导出时按标注类型过滤在数据导出环节Ground Truth 标注可以独立于普通标注导出。导出序列化器 serializers.py 定义了标注过滤选项class AnnotationFilterOptionsSerializer(serializers.Serializer): usual serializers.BooleanField( allow_nullTrue, requiredFalse, defaultTrue, help_textInclude not skipped and not ground truth annotations ) ground_truth serializers.BooleanField( allow_nullTrue, requiredFalse, help_textInclude ground truth annotations ) skipped serializers.BooleanField(allow_nullTrue, requiredFalse, help_textInclude skipped annotations)usualtrue默认包含未跳过且非 Ground Truth的普通标注ground_truthtrue额外包含 Ground Truth 标注skippedtrue包含被跳过的标注。对应的查询拼接逻辑见 mixins.py导出时通过Q(ground_truthTrue)/Q(was_cancelledFalse, ground_truthFalse)等条件组合完成过滤。用 Ground Truth 训练 ML 模型Ground Truth 还可作为高质量训练数据用于机器学习后端。在 api_connector.py 中ML 后端连接的训练入口支持显式选择是否使用 Ground Truthdef train(self, project, use_ground_truthFalse):当use_ground_truthTrue时模型训练将以 Ground Truth 标注为监督信号从而避免低质量标注对模型收敛的干扰。小结Ground Truth 是 Label Studio Enterprise 质量闭环中的关键一环它在数据模型上是Annotation上的布尔字段tasks/models.py通过ensure_unique_groundtruth保证任务级唯一性在界面上可通过星形图标单条设置、通过Actions Set Ground Truths按标注者批量设置、通过 Data Manager 的Ground Truth列与过滤器进行查看与筛选注意empty运算符不可用、通过Actions Delete Ground Truths批量移除在系统内部它同时驱动着标注者评估、任务分配队列、导出过滤与 ML 训练。将这套机制组合使用你可以在项目中建立可量化的标准答案体系让每一次标注质量评估都有据可依。【免费下载链接】label-studioLabel Studio is a multi-type data labeling and annotation tool with standardized output format项目地址: https://gitcode.com/GitHub_Trending/la/label-studio创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考
上一篇/下一篇内容由系统自动关联
返回资讯列表 →