具身视频结构化打标
更新时间:2026-11-23
简介
具身视频理解与结构化打标算子,继承 QwenVLVideoUnderstandingVLLM,一次模型调用同时产出中文描述和结构化标签(动作类目、被操作物、来源等),可直接替代流水线里的 caption 步骤。默认模型 Qwen3-VL-32B-Instruct。
功能描述
- 内置约束 prompt,不需要自己写 prompt
- 可选受控词表:
taxonomy(工序类目)、glossary(物料名),留空为开放词表 - 可选
secondary_verify对被操作物和来源再核验一次(每条多一次推理) - 每条视频输出一个 JSON 字符串,解析失败时也保留原文
算子参数
输入
| 输入 | 含义 |
|---|---|
| video | 视频,形式由 video_src_type 决定:路径 / base64 / 字节 |
| user_prompts(可选) | 自定义 prompt,一般不传 |
输出
| 输出 | 含义 |
|---|---|
| (返回列) | large_string JSON 串,字段:carried_items / instruction / description_zh / task_id / manipulated_object / source / target_object_or_location / execution_status / confidence,外加 _parse_ok、_raw |
参数
| 参数名称 | 类型 | 默认值 | 描述 |
|---|---|---|---|
| taxonomy | list[str] 或 None | None | 工序类目词表 |
| glossary | list[str] 或 None | None | 物料名词表 |
| no_anticipation | bool | True | 只标注正在进行的动作 |
| task_field | str | "task_id" | 动作类目的字段名 |
| secondary_verify | bool | False | 是否二次核验被操作物和来源 |
| video_src_type | str | "video_url" | video_url / video_base64 / video_binary |
| model_path | str | "/opt/aihc/model" | 权重根目录 |
| model_name | str | "Qwen3-VL-32B-Instruct" | 权重子目录 |
| tensor_parallel_size | int | 1 | 张量并行卡数,32B 建议 2 |
| dtype | str | "auto" | 精度 |
| quantization | str 或 None | None | 量化方式,AWQ 权重设 awq |
| max_model_len | int | 128000 | 最大上下文长度 |
| gpu_memory_utilization | float | 0.9 | 单卡显存利用率上限 |
| max_pixels | int 或 None | None | 每帧最大像素,上限 602112 |
| fps | float 或 None | None | 抽帧率 |
| batch_size | int | 4 | 单次推理样本数 |
| backend | str | "auto" | auto / vllm / transformers |
| fail_on_error | bool | False | 出错是否抛异常 |
调用示例
Python
1from __future__ import annotations
2import os
3import daft
4from daft import col
5from daft.aihc.common.udf import aihc_udf
6from daft.aihc.functions.multimodal.embodied_structured_caption import EmbodiedStructuredCaption
7
8if __name__ == "__main__":
9 if os.getenv("DAFT_RUNNER", "native") == "ray":
10 import ray
11 ray.init(ignore_reinit_error=True)
12 daft.set_runner_ray()
13 daft.set_execution_config(actor_udf_ready_timeout=6000, min_cpu_per_task=0)
14
15ds = daft.from_pydict({"video": ["/path/to/clip.mp4"]}) # 或 bos://... ;字节则配 video_binary
16 ds = ds.with_column(
17 "caption_json",
18 aihc_udf(
19 EmbodiedStructuredCaption,
20 construct_args={
21 "video_src_type": "video_url",
22 "model_path": "/opt/aihc/model",
23 "model_name": "Qwen3-VL-32B-Instruct",
24 "tensor_parallel_size": 2, # 32B 建议 2 卡
25 "fail_on_error": True,
26 # 可选:受控词表 / 二次核验
27 # "taxonomy": ["搬运", "分拣", "整理", ...],
28 # "glossary": ["生菜苗", "塑料框", ...],
29 # "secondary_verify": True,
30 },
31 num_cpus=2, num_gpus=2, concurrency=1, batch_size=2,
32 )(col("video")),
33 )
34 ds.show()
评价此篇文章
