hylo.codeagents.replay_tools¶
Package: hylo-code-agents · Core contracts
replay_tools ¶
The perception and rendering tools the replay workflow calls, behind one small interface.
RealTools runs the hylo-tools workers (each in its own uv environment, on the CPU): segment (SAM 3), depth
(MoGe-2, a persistent worker for whole videos), gravity (GeoCalib), mesh (SAM 3D Objects when access is
granted, else depth carving), convex (CoACD + MJCF), hands (WiLoR, else MediaPipe) and render (Blender Cycles
or MuJoCo offscreen). StubTools gives the same interface without workers (tests, and runs that must not start
models): masks from a callback or the recording's segmentation, the recording's own depth, convex hulls for meshes.
RealTools ¶
RealTools(threads: int | None = None, log: Callable[[str], None] | None = None, render_backend: str = 'mujoco')
segment ¶
segment(rgb: ndarray, labels: Sequence[str], threshold: float = 0.5) -> list[tuple[str, np.ndarray, float]]
depth ¶
Metric depth for every frame (one persistent MoGe-2 worker; the field of view of frame 0 is reused).
mesh ¶
mesh(rgb: ndarray, mask: ndarray, depth: ndarray, K: ndarray, T_world_cam: ndarray, name: str, out_dir: Path) -> dict[str, Any]
render ¶
render(scene: str | Path, qpos: ndarray, times: ndarray, *, camera: str, width: int, height: int, fps: float) -> dict[str, Any]
StubTools ¶
StubTools(segmenter: Callable[[ndarray, Sequence[str]], list[tuple[str, ndarray, float]]] | None = None, depth_fn: Callable[[ndarray], dict[str, Any]] | None = None, render_fn: Callable[..., dict[str, Any]] | None = None, table_z: float = 0.0)
No workers: deterministic stand-ins with the same interface (tests; dry runs).
gt_segmenter ¶
gt_segmenter(seg0: ndarray, segments: dict[str, str]) -> Callable[[np.ndarray, Sequence[str]], list]
A segmenter from a ground-truth instance image: each label gets the instance whose name contains its words.