
Label Studio ASR Hypotheses 选择模板从多个语音识别候选转录中挑选最优结果【免费下载链接】label-studioLabel Studio is a multi-type data labeling and annotation tool with standardized output format项目地址: https://gitcode.com/GitHub_Trending/la/label-studioASR自动语音识别系统通常会为同一段音频返回多条置信度不同的转录候选hypotheses。本文基于 Label Studio 官方模板 asr_hypotheses.md 与仓库内的配套实现讲解如何用Audio 动态Choices搭建听音频、比对候选、勾选最佳转录的标注界面并深入剖析动态选项的加载原理、样式定制与结果导出格式。读完本文你将能够直接复用该模板构建语音转录质量评测或 ASR 模型对比数据集。模板解决什么问题在语音识别工作流中一个常见的评测场景是同一段音频由 ASR 引擎生成若干条转录假设通常基于 n-best 解码、不同声学/语言模型或不同分词策略标注者的任务是从多条候选转录中选中最准确的一条作为评估 ASR 质量或微调模型的 Ground Truth。这正是 Label Studio 的ASR Hypotheses Selection模板位于 docs/source/templates/asr_hypotheses.md归类于 Ranking and Scoring 类别的核心场景一边播放音频一边对比多条转录文本勾选出与语音内容最吻合的一条。它不需要标注者从零转写而是做选择题因此标注速度快、标注结果一致性高非常适合大规模 ASR 评测。完整标注配置与逐行解析模板的核心是如下一段标签配置与 label_studio/annotation_templates/ranking-and-scoring/asr-hypotheses/config.yml 中config:字段一致View Audio nameaudio value$audio/ Choices nametranscriptions toNameaudio value$transcriptions selectionhighlight/ Style .lsf-choice__item { padding: var(--spacing-tighter) var(--spacing-tight); box-shadow: 0 2px 4px rgba(var(--color-neutral-shadow-raw) / calc(16% * var(--shadow-intensity))) ; background-color: var(--color-neutral-background); border-radius: var(--corner-radius-small); margin: 0 var(--spacing-tighter) var(--spacing-tighter) var(--spacing-tighter); line-height: 1.6rem; transition: all 150ms ease-out; } .lsf-choice__item:hover { background-color: var(--color-primary-emphasis-subtle); } /Style /ViewAudio音频播放与波形可视化Audio nameaudio value$audio/负责播放音频并展示波形value$audio表示从任务数据data.audio字段读取音频文件路径或 URL。根据标签参考文档 docs/source/tags/audio.mdAudio还支持以下常用参数参数类型默认值说明defaultspeedstring1默认播放速度0.5 ~ 2defaultvolumestring1默认音量0 ~ 1hotkeystring—播放/暂停快捷键syncstring—与其它对象标签如Paragraphs、Video同步heightstring96音频播放器总高度spectrogrambooleanfalse是否自动显示频谱图splitchannelsbooleanfalse多声道音频是否分声道展示更耗内存decoderstringwebaudio音频解码方式webaudio/ffmpeg/noneplayerstringhtml5播放方式html5/webaudio在该模板中Audio只作为被标注对象存在标注动作发生在Choices上。Choices动态加载转录候选Choices nametranscriptions toNameaudio value$transcriptions selectionhighlight/是模板的灵魂其中toNameaudio把选项与audio对象标签绑定使选项成为针对该音频的分类结果value$transcriptions动态选项的关键参数——不写死Choice子标签而是从任务数据data.transcriptions字段中读取一个字符串数组为每个字符串自动生成一个Choiceselectionhighlight选项以高亮/强调样式呈现使转录文本在界面上更醒目便于对比阅读。从源码看动态选项由 web/libs/editor/src/mixins/DynamicChildrenMixin.js 实现在标签创建时通过parseValue(self.value, store.task?.dataObj)从任务数据解析出value字段对应的数组再逐个把数组元素作为Choice的子节点动态挂载到Choices上。这也意味着候选列表随任务数据变化而变化同一标注配置可以复用于成千上万条不同候选的音频任务这正是该模板可以规模化的关键。关于Choices的其它可选参数如choicesingle|single-radio|multiple、layoutselect|inline|vertical、required、perRegion、randomize等完整参数表见 docs/source/includes/tags/choices.md 与 Choices.jsx 中的param注释。Style为候选列表定制卡片外观模板内嵌Style通过 CSS 选择器.lsf-choice__item把每个候选转录渲染成带圆角、浅色背景、阴影和 hover 高亮的卡片box-shadow与border-radius使用 Label Studio 的设计令牌CSS 变量如--corner-radius-small、--color-neutral-shadow-raw保证与整体主题一致:hover时背景变为--color-primary-emphasis-subtle给标注者明确的悬停反馈line-height: 1.6rem提高长文本整句转录的可读性。该样式类是编辑器内置的lsf-choice__item前缀lsf来自 Label Studio Frontend 的 CSS 命名空间参见 web/README.md 与 web/libs/editor/src/tags/control/Choices/Choices.prefix.css。示例任务数据与候选差异分析模板提供了可直接导入的示例任务数据同样内嵌于 config.yml 的注释块中{ data: { audio: https://htx-pub.s3.amazonaws.com/datasets/audio/f2btrop6.0.wav, transcriptions: [ { value: potrostith points out that if school based clinics were established parental permission would be required for students to receive each service offered }, { value: potrostith points out that if school-based clinics were established parental permission would be required for students to receive each service offered }, { value: purporting points out that if school based clinics were established parental permission would be required for students to receive each service offered }, { value: pork roasted points out that if school based clinics were establish parental permission would be required for students to receive each service offered }, { value: purpose it points out that if school based clinics war establish parental permission would be required for students to receive each service offered } ] } }数据由两部分组成audio音频文件的 URL示例中使用 AWS S3 公共数据集中的 wav 文件实际项目中可替换为本地存储、MinIO、S3 等 io_storages 中的数据地址transcriptions候选转录数组每条是一个{value: ...}对象。仔细对比可以看出这些候选是刻意构造的相似但不同的错误形态候选 1 与 2 仅在连字符上不同school basedvsschool-based考察分词规范候选 3 把potrostith误听为purporting发音相似的词语混淆候选 4、5 出现pork roasted、purpose it等明显误识别以及establish少-ed、war等语法/用词错误。这种细节差异 明显错误并存的设计正好模拟了真实 ASR n-best 输出的分布——正确答案往往藏在细微差别中需要标注者结合音频仔细甄别。提示动态Choices的数组元素除value外还支持html字段优先级高于value用于富文本展示但导出时仍取value以及children字段配合allowNested实现嵌套选项详见 docs/source/tags/choices.md 的动态选项示例。标注操作与结果导出标注者进入任务后先点击播放按钮试听音频可通过Audio的hotkey设置快捷键在候选转录列表中比对文本勾选最准确的一条choice默认为single即单选提交即可。提交后的标注结果由Choices标签的serializableValue逻辑Choices.jsx 中get serializableValue序列化形如{ result: [ { type: choices, value: { choices: [potrostith points out that if school based clinics were established parental permission would be required for students to receive each service offered] }, from_name: transcriptions, to_name: audio } ] }其中from_name对应Choices的nameto_name对应audio。每条任务最终得到音频 最优转录的配对可直接导出为 CSV/JSON 用于 ASR 错误率如 WER对比分析或作为训练数据回流。在项目中如何使用该模板该模板在仓库中有两处正式定义文档源docs/source/templates/asr_hypotheses.md标注配置 示例数据 截图引用可导入模板label_studio/annotation_templates/ranking-and-scoring/asr-hypotheses/config.yml含title、type: community、group: Ranking Scoring、image与config字段。实际使用方式有两种UI 导入在 Label Studio 项目设置的 Labeling Config 编辑器中从模板库的 Ranking Scoring 分组中找到ASR Hypotheses Selection一键载入配置后保存API / SDK 创建项目将上述 XML 配置作为label_config传入再通过 数据导入 API 上传含audio与transcriptions字段的任务。若候选不是 n-best 列表而是需要两两对比或打分排序可参考同分组的 pairwise-classification 与 pairwise-regression 模板若只需要最基础的听音频 打分/转写可参考 audio_classification 等音频模板。小结ASR Hypotheses Selection 模板用最小的配置量实现了音频回放 动态候选 单选评测的完整标注闭环Audio负责呈现音频value$transcriptions驱动的动态Choices让候选随任务数据变化而免去重复配置内嵌Style则优化了长句候选的阅读体验。对于需要构建 ASR 评测集或转录质量校验流水线的团队这是一个开箱即用、可规模化复用的成熟方案。【免费下载链接】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),仅供参考