EmbodiFlow文档
开始使用数据工作流与算法训练与部署开发者参考
  • 工作流与算法

工作流

  • 认识工作流
  • 搭建自己的工作流
  • 运行与日志

算法

  • 算法目录
  • 编写自定义算法

算法开发指南

  • 第一个算法
    • 标准化
    • 质检
    • 变换
    • 增强
    • 切分
    • 整理
    • 导出
  • 镜像算法
  • 在工作流中使用算法
  • 接口参考
  • SDK 参考
  • 命令行
  • MCP 工具
  • 问题排查

© 2026 EmbodiFlow

llms.txtOpenAPI JSON
  1. 工作流与算法
  2. 算法开发指南
  3. 按类别
  4. 切分

切分

把一条长录制切成任务片段:带任务文字的时间段,再由人来审核。

一条长的人类录制里通常有很多个任务,而训练需要把它们一个个分开。切分算法给出每个任务片段的起止位置,可以按固定窗口、按动作停顿,或者用模型来判断。这些结果只是建议:它们会等待审核,永远不会覆盖人工创建的任务片段。

测试阶段。自定义算法和工作流已经在产品里,可以直接试用,但还没有在真实数据上完成完整验收。可能会遇到不完善的地方,依赖结果之前请先核对。

切分算法每条录制运行一次。它读取 recording,并通过 out(一个 EpisodeWriter)写出 episodes。它只有一个方法:out.episode(start_s, end_s, task, labels=None, confidence=None),每调用一次添加一条建议。时间是从录制开头算起的秒数。如果任务片段带标签,要在装饰器里用 labels={键: 语义类型} 声明这些键。

示例:固定窗口

文件是 packages/sdk-python/examples/v1/segment-fixed-windows/main.py。

"""Segment: cut the recording into windows of a fixed length.

In:  the canonical recording.
Out: episodes: consecutive windows with a task text and a "window" label; the last one may be shorter.
Why: a long recording of continuous work (a human doing chores, one long teleoperation session) must become
     episodes before it can be curated or trained on. Replace the loop with your own idea of a boundary.
"""

from dataclasses import dataclass

from embodiflow import EpisodeWriter, Recording, algorithm, param


@dataclass
class Params:
    window_s: float = param(10.0, minimum=0.5, title="Window length (s)")
    task: str = param("do the task", title="Task text of every window")


@algorithm.segment(name="fixed-windows", title="Fixed windows", labels={"window": "scalar"}, params=Params)
def run(recording: Recording, out: EpisodeWriter, ctx) -> None:
    start, index = 0.0, 0
    while start < recording.duration_s - 1e-6:
        end = min(start + ctx.params.window_s, recording.duration_s)
        out.episode(start, end, ctx.params.task, labels={"window": index}, confidence=1.0)
        start, index = end, index + 1

它的测试是 packages/sdk-python/examples/v1/segment-fixed-windows/test_main.py:用一份很小的测试数据,通过真实的运行器运行这段代码,并检查写出的值。想从它开始,运行 embodiflow algorithm init my-algorithm --category segment,它会写出 main.py 和 test_main.py;再运行 embodiflow algorithm test my-algorithm(需要装有 pytest 和 SDK 的 Python)。

值得知道

时间段不能为空,必须在录制范围之内,而且互不重叠,否则结果会被 EPISODES_INVALID 拒绝。没有声明过的标签键同样会被拒绝。

任务片段在列表中的位置就是它的序号,任务片段级步骤用这个序号来指代它。

这些建议会以 AI 提出的身份保存,在有人审核之前一直带着「AI 提出,未审阅」标记。

在内置工作流里,只有人类录制会被切分,机器人录制每条就是一个任务片段。切分步骤最适合一条录制包含许多任务的场景。

下一步

  • 整理算法
  • 在工作流中使用算法
上一页

增强

下一页

整理