deepstream-generate-pipeline

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

DeepStream Pipeline Builder

DeepStream 管道构建器

Generate ready-to-run
gst-launch-1.0
pipelines for NVIDIA DeepStream SDK by collecting pipeline requirements through an interactive questionnaire, then assembling the pipeline using a standalone BM25 retrieval backend with structural metadata boosting (similarity search over 270+ verified pipelines, zero external dependencies).
通过交互式问卷收集管道需求,然后使用独立的BM25检索后端(结合结构化元数据增强,对270+已验证管道进行相似度搜索,无外部依赖)组装管道,为NVIDIA DeepStream SDK生成可直接运行的
gst-launch-1.0
管道。

Prerequisites

前提条件

  • Python: 3.8+ (stdlib only — no pip packages required)
  • DeepStream SDK: Installed at
    /opt/nvidia/deepstream/deepstream/
    (for
    gst-inspect-1.0
    validation and element verification)
  • GStreamer:
    gst-launch-1.0
    and
    gst-inspect-1.0
    on
    PATH
    (installed with DeepStream)
  • Platform: x86 dGPU (T4, A100, L40, RTX, etc.) or aarch64 — Jetson (Orin, Xavier, Nano) / SBSA (Grace, GH200)
  • Python: 3.8+(仅需标准库——无需pip包)
  • DeepStream SDK: 安装在
    /opt/nvidia/deepstream/deepstream/
    路径下(用于
    gst-inspect-1.0
    验证和元素校验)
  • GStreamer:
    gst-launch-1.0
    gst-inspect-1.0
    已添加到
    PATH
    (随DeepStream一同安装)
  • 平台: x86独立GPU(T4、A100、L40、RTX等)或aarch64架构——Jetson(Orin、Xavier、Nano)/ SBSA(Grace、GH200)

Usage Examples

使用示例

text
undefined
text
undefined

Fully specified — skips most questions

完全指定需求——跳过大部分问题

detect and track on 4 rtsp streams and display on jetson
detect and track on 4 rtsp streams and display on jetson

Partially specified — asks remaining questions

部分指定需求——询问剩余问题

give me a pipeline to infer on an image
give me a pipeline to infer on an image

Minimal — asks all 7 questions

最小化需求——询问全部7个问题

build a pipeline
undefined
build a pipeline
undefined

Supported Configurations

支持的配置

ParameterOptions
InputLocal video (.mp4/.h264/.h265), local image (.jpg/.png), RTSP stream, USB camera, test pattern
InferenceNone, primary (nvinfer), primary+secondary, with preprocessor, Triton (nvinferserver)
TrackerNone, NvDCF, IOU, NvSORT, DeepSORT
SinkDisplay (dGPU/Jetson), save (JPG/PNG/MP4/H264), RTSP out, fakesink
Platformx86 dGPU (T4, A100, L40, RTX, etc.) or aarch64 — Jetson (Orin, Xavier, Nano) / SBSA (Grace, GH200)
ExtrasResize, rotate/flip, crop, color format conversion
参数选项
Input本地视频(.mp4/.h264/.h265)、本地图像(.jpg/.png)、RTSP流、USB摄像头、测试图案
Inference无、主推理(nvinfer)、主+副推理、带预处理器、Triton(nvinferserver)
Tracker无、NvDCF、IOU、NvSORT、DeepSORT
Sink显示(独立GPU/Jetson)、保存(JPG/PNG/MP4/H264)、RTSP输出、fakesink
Platformx86独立GPU(T4、A100、L40、RTX等)或aarch64架构——Jetson(Orin、Xavier、Nano)/ SBSA(Grace、GH200)
Extras缩放、旋转/翻转、裁剪、颜色格式转换

Scripts

脚本说明

ScriptPurpose
scripts/generate_pipeline.py
BM25 retrieval engine — scores and ranks pipelines from
data/data.csv
. Supports
--format {json,compact,summary}
(default
json
)
scripts/validate_pipeline.py
4-stage validator: syntax, elements, properties, live parse. Supports
--format {json,summary}
(default
json
)
scripts/lint_data.py
Data quality linter for the pipeline CSV (
--fix
to auto-repair)
脚本用途
scripts/generate_pipeline.py
BM25检索引擎——对
data/data.csv
中的管道进行评分和排序。支持
--format {json,compact,summary}
参数(默认值为
json
scripts/validate_pipeline.py
四阶段验证器:语法校验、元素校验、属性校验、实时解析。支持
--format {json,summary}
参数(默认值为
json
scripts/lint_data.py
管道CSV的数据质量检查器(
--fix
参数可自动修复问题)

Workflow

工作流程

Step 1 — Collect Pipeline Requirements

步骤1 — 收集管道需求

You MUST
Read references/requirement-extraction.md
before doing this step.
It contains the query-inference table, compound-extraction examples, the full
AskUserQuestion
question bank (with the default-first ordering contract), the automatic-OSD and extras/flip-method rules, and the dynamic question-reduction examples that this step depends on. Apply them exactly.
Order of operations:
  1. Infer everything you can from the query using the inference table in
    references/requirement-extraction.md
    . The goal is to identify which of the 7 parameters (input source, num sources, inference, tracker, sink, platform, extras) the user has already specified.
  2. Ask the user about the unknowns via
    AskUserQuestion
    in a single call.
    Do not silently default tracker/sink/platform/extras — these are real choices the user should make explicitly (display vs save, no tracker vs NvDCF, x86 dGPU vs aarch64 Jetson/SBSA, etc.). Skip only the questions whose answer is already clear from the query.
  3. Quote the inferred parameters back to the user in the lead-in to the question call so they can see what you already extracted. Example: "From your query I have: 3 mp4 videos, primary inference. Just need a few more details:"
Follow the inference table, question bank, and OSD/extras rules in
references/requirement-extraction.md
to decide which questions to ask and how to place transform elements, then proceed to Step 2.
执行此步骤前必须阅读
references/requirement-extraction.md
。 该文件包含查询推理表、复合提取示例、完整的
AskUserQuestion
问题库(含默认优先顺序约定)、自动OSD和附加功能/翻转方法规则,以及此步骤依赖的动态问题简化示例。请严格遵循这些规则。
操作顺序:
  1. 从查询中推断所有可获取的信息,使用
    references/requirement-extraction.md
    中的推理表。目标是识别用户已指定的7个参数(输入源、源数量、推理类型、跟踪器、输出端、平台、附加功能)。
  2. 通过一次
    AskUserQuestion
    调用询问用户未知参数
    。请勿默认跟踪器/输出端/平台/附加功能的选项——这些是用户应明确选择的实际选项(显示 vs 保存、无跟踪器 vs NvDCF、x86独立GPU vs aarch64 Jetson/SBSA等)。仅跳过从查询中已明确答案的问题。
  3. 在提问前向用户复述已推断的参数,以便用户确认已提取的信息。示例:“从您的查询中我已获取:3个mp4视频、主推理。还需要以下几个细节:”
遵循
references/requirement-extraction.md
中的推理表、问题库和OSD/附加功能规则,确定要询问的问题以及如何放置转换元素,然后进入步骤2。

Step 2 — Build the Natural Language Query

步骤2 — 构建自然语言查询

From the user's answers, construct a single descriptive query string. Follow this pattern:
text
Please provide a GStreamer pipeline that [operation] on [num_sources] [input_type] [input_detail] [tracker_detail] and [output_action] [platform_detail]
Examples of constructed queries:
User SelectionsConstructed Query
Local video, 1 source, Primary detector, No tracker, Display, dGPU"Please provide a GStreamer pipeline that performs primary inference on a single mp4 video and displays the output"
RTSP, 4 sources, Primary+Secondary, NvDCF, Save MP4, dGPU"Please provide a GStreamer pipeline that performs primary and secondary inference with NvDCF tracker on 4 RTSP streams and saves output to MP4 file"
Local video, 2 sources, Primary with preprocessor, IOU, Display, Jetson"Please provide a GStreamer pipeline that performs preprocessing before primary inference with IOU tracker on 2 mp4 streams and displays the output on Jetson"
Local image, 1 source, None, No tracker, Save file, dGPU, Rotate 90° cw"Please provide a GStreamer pipeline that rotates a single jpg image 90° clockwise before processing and saves it to a file"
Local video, 3 sources, Primary detector, NvDCF, Save MP4, dGPU, Rotate 180°"Please provide a GStreamer pipeline that rotates 3 mp4 videos 180° before primary inference with NvDCF tracker and saves output to MP4 file"
根据用户的回答,构造一个单一的描述性查询字符串。遵循以下格式:
text
Please provide a GStreamer pipeline that [operation] on [num_sources] [input_type] [input_detail] [tracker_detail] and [output_action] [platform_detail]
构造查询示例:
用户选择构造的查询
本地视频、1个源、主检测器、无跟踪器、显示、独立GPU"Please provide a GStreamer pipeline that performs primary inference on a single mp4 video and displays the output"
RTSP、4个源、主+副推理、NvDCF、保存为MP4、独立GPU"Please provide a GStreamer pipeline that performs primary and secondary inference with NvDCF tracker on 4 RTSP streams and saves output to MP4 file"
本地视频、2个源、带预处理器的主推理、IOU、显示、Jetson"Please provide a GStreamer pipeline that performs preprocessing before primary inference with IOU tracker on 2 mp4 streams and displays the output on Jetson"
本地图像、1个源、无推理、无跟踪器、保存文件、独立GPU、顺时针旋转90°"Please provide a GStreamer pipeline that rotates a single jpg image 90° clockwise before processing and saves it to a file"
本地视频、3个源、主检测器、NvDCF、保存为MP4、独立GPU、旋转180°"Please provide a GStreamer pipeline that rotates 3 mp4 videos 180° before primary inference with NvDCF tracker and saves output to MP4 file"

Step 3 — Run the Pipeline Generator Script

步骤3 — 运行管道生成脚本

Execute the backend script with the constructed query and user parameters:
bash
python3 <skill-path>/scripts/generate_pipeline.py \
  --query "<constructed_query>" \
  --source-type "<Local video file|Local image file|RTSP stream|USB camera|Test pattern>" \
  --num-sources <N> \
  --inference "<None|primary|primary+secondary|primary+preprocess|primary+secondary+preprocess|primary-triton|primary+secondary-triton>" \
  --tracker "<none|NvDCF|IOU|NvSORT|DeepSORT>" \
  --sink "<display|display-jetson|save-jpg|save-png|save-mp4|save-h264|rtsp-out|fakesink>" \
  --platform "<dGPU|Jetson|SBSA>" \
  --extras "<none|resize|rotate|crop|color-convert|osd>" \
  --format compact
Always pass
--format compact
.
The
compact
mode returns only confidence + the top retrieved pipeline (~25 lines), instead of dumping all 10 retrievals as ~150 lines of JSON in the chat. The
json
mode (default for backward compat) is only useful when debugging the retriever directly. A
summary
mode (single human-readable line) also exists for non-Claude callers.
The script will (zero external dependencies — pure Python stdlib):
  1. Load the pipeline dataset (270+ verified DeepStream pipelines)
  2. Extract structural metadata from each pipeline (platform, source type, sink type, inference mode, tracker, stream count)
  3. Score with BM25 (document-length-normalized) + domain-specific synonym expansion on both queries and documents
  4. Apply structural boosting — results matching the user's platform/source/sink/inference get boosted, mismatches get penalized
  5. Return the top-K results as JSON with a
    confidence
    field (
    high
    /
    medium
    /
    low
    ) based on the top score
  6. Claude uses these retrieved examples + the assembly rules below to construct the final pipeline
When
confidence
is
low
, rely more heavily on the assembly rules below rather than the retrieved examples.
使用构造的查询和用户参数执行后端脚本:
bash
python3 <skill-path>/scripts/generate_pipeline.py \
  --query "<constructed_query>" \
  --source-type "<Local video file|Local image file|RTSP stream|USB camera|Test pattern>" \
  --num-sources <N> \
  --inference "<None|primary|primary+secondary|primary+preprocess|primary+secondary+preprocess|primary-triton|primary+secondary-triton>" \
  --tracker "<none|NvDCF|IOU|NvSORT|DeepSORT>" \
  --sink "<display|display-jetson|save-jpg|save-png|save-mp4|save-h264|rtsp-out|fakesink>" \
  --platform "<dGPU|Jetson|SBSA>" \
  --extras "<none|resize|rotate|crop|color-convert|osd>" \
  --format compact
务必传递
--format compact
参数
compact
模式仅返回置信度和排名第一的检索管道(约25行),而非在聊天中输出所有10个检索结果的约150行JSON。
json
模式(为向后兼容设为默认)仅在调试检索器时有用。还有一种
summary
模式(单行人类可读格式)供非Claude调用者使用。
该脚本将(无外部依赖——纯Python标准库):
  1. 加载管道数据集(270+已验证的DeepStream管道)
  2. 从每个管道中提取结构化元数据(平台、源类型、输出端类型、推理模式、跟踪器、流数量)
  3. 使用BM25(文档长度归一化)+ 领域特定同义词扩展对查询和文档进行评分
  4. 应用结构化增强——匹配用户平台/源/输出端/推理的结果会被提升,不匹配的结果会被惩罚
  5. 返回前K个结果的JSON,基于最高得分带有
    confidence
    字段(
    high
    /
    medium
    /
    low
  6. Claude使用这些检索示例 + 以下组装规则构建最终管道
confidence
low
时,更多依赖以下组装规则而非检索示例。

Step 4 — Validate the Pipeline

步骤4 — 验证管道

Before presenting, run the validation script to catch syntax errors, unknown elements, and linking issues:
bash
python3 <skill-path>/scripts/validate_pipeline.py "<assembled_pipeline>" --format summary
Always pass
--format summary
.
Summary prints a single status line (e.g.
valid · 11 elements · 0 warnings · live-parse skipped (multi-stream)
), with errors/warnings indented underneath only if present. The default
json
mode emits ~40 lines of structured output and is only useful for programmatic callers.
The validator performs 4 checks:
  1. Syntax check — unbalanced quotes, empty pipe segments, missing source/sink
  2. Element check — verifies each element exists via
    gst-inspect-1.0
  3. Property check — validates known properties for DeepStream elements
  4. Live parse check — uses
    gst-launch-1.0
    itself to construct the pipeline graph (with fakesrc/fakesink substituted), catching linking errors and pad mismatches. Automatically skipped for multi-stream pipelines (those with named pad refs like
    m.sink_0
    ) since fakesrc cannot negotiate caps through named pads.
If validation fails (
"valid": false
), fix the errors and re-validate before presenting. Limit validation retries to a maximum of 2 attempts — if the pipeline still fails after 2 fixes, present it as-is (the remaining checks already cover syntax, element, property, and structural correctness). If there are only warnings, present the pipeline but mention the warnings to the user.
在呈现管道前,运行验证脚本以捕获语法错误、未知元素和链接问题:
bash
python3 <skill-path>/scripts/validate_pipeline.py "<assembled_pipeline>" --format summary
务必传递
--format summary
参数
。Summary模式打印单行状态信息(例如
valid · 11 elements · 0 warnings · live-parse skipped (multi-stream)
),仅在存在错误/警告时才会在下方显示缩进的错误/警告信息。默认的
json
模式会输出约40行结构化输出,仅对程序调用者有用。
验证器执行4项检查:
  1. 语法检查——引号不匹配、空管道段、缺少源/输出端
  2. 元素检查——通过
    gst-inspect-1.0
    验证每个元素是否存在
  3. 属性检查——验证DeepStream元素的已知属性
  4. 实时解析检查——使用
    gst-launch-1.0
    本身构建管道图(替换为fakesrc/fakesink),捕获链接错误和pad不匹配问题。多流管道(带有命名pad引用如
    m.sink_0
    )会自动跳过此检查
    ,因为fakesrc无法通过命名pad协商caps。
如果验证失败(
"valid": false
),修复错误后重新验证。验证重试最多限制为2次——如果经过2次修复后管道仍失败,则按原样呈现(剩余检查已覆盖语法、元素、属性和结构正确性)。如果仅存在警告,呈现管道时需向用户提及警告信息。

Step 5 — Present the Pipeline

步骤5 — 呈现管道

5.1 — Output format (THE ONLY ACCEPTED FORM)

5.1 — 输出格式(唯一可接受的形式)

Your response must be exactly five blocks, in this order:
  1. One-line status badge (validation + confidence)
  2. Single bash code block containing the full
    gst-launch-1.0 -e …
    command with concrete absolute paths, on one line (no
    \
    continuations, no shell variables, no shell wrapper)
  3. Breakdown table grouped by stage
  4. Suggestions bullet list
  5. (only if pre-flight failed) a
    line above the status badge stating which default path is missing
That is the ONLY accepted output shape for this step. The Section 5.3 template in
references/output-format.md
is the literal template — match it.
您的回复必须严格按照以下顺序包含五个模块:
  1. 单行状态标识(验证结果 + 置信度)
  2. 单个bash代码块,包含完整的
    gst-launch-1.0 -e …
    命令,使用具体的绝对路径,且仅一行(无
    \
    换行符、无shell变量、无shell包装器)
  3. 按阶段分组的分解表
  4. 建议项目符号列表
  5. (仅当预检查失败时)在状态标识上方添加一行
    ,说明缺失的默认路径
这是此步骤唯一可接受的输出格式。
references/output-format.md
中的第5.3节模板是字面模板——请严格匹配。

5.2 — Pre-flight check (run before composing the response)

5.2 — 预检查(在撰写回复前运行)

Run one
Bash
ls
over the default paths the pipeline will reference (sample video, PGIE config, tracker lib/config). The result tells you whether to mark the badge with
⚠ default path not found: <path>
and bump the matching "Use your own …" suggestion to the top.
bash
ls /opt/nvidia/deepstream/deepstream/samples/streams/sample_1080p_h264.mp4 \
   /opt/nvidia/deepstream/deepstream/samples/configs/deepstream-app/config_infer_primary.txt \
   2>&1
对管道将引用的默认路径(示例视频、PGIE配置、跟踪器库/配置)运行一次Bash
ls
命令。结果将告知您是否需要在标识上标记
⚠ default path not found: <path>
,并将对应的“使用您自己的……”建议移至顶部。
bash
ls /opt/nvidia/deepstream/deepstream/samples/streams/sample_1080p_h264.mp4 \
   /opt/nvidia/deepstream/deepstream/samples/configs/deepstream-app/config_infer_primary.txt \
   2>&1

5.3 / 5.4 — Worked example & forbidden anti-patterns

5.3 / 5.4 — 示例与禁用的反模式

You MUST
Read references/output-format.md
before composing this response.
It contains the literal Section 5.3 template your output must match exactly, and the Section 5.4 gallery of forbidden output shapes (heredoc wrappers, shell-var indirection,
\
line-continuations, stray "Run it" lines,
Write
-to-script). Mirror Section 5.3; never emit any Section 5.4 form.
撰写回复前必须阅读
references/output-format.md
。该文件包含您的输出必须严格匹配的第5.3节字面模板,以及第5.4节禁用的输出格式示例(heredoc包装器、shell变量间接引用、
\
换行符、多余的“Run it”行、
Write
到脚本)。严格遵循第5.3节;绝不使用第5.4节中的任何形式。

5.5 — Self-check before sending the response

5.5 — 发送回复前的自检

Before you emit your reply, mentally tick each box. If any check fails, rewrite the response.
  • The pipeline is on exactly one line inside a single
    ```bash
    code block.
  • The pipeline begins with
    gst-launch-1.0 -e
    and contains only literal absolute paths (e.g.
    /opt/nvidia/deepstream/...
    ) — no
    $VAR
    , no
    ${VAR:-default}
    , no
    cat >
    , no
    EOF
    , no
    \
    line continuations.
  • The response does not contain any of:
    cat > /tmp/pipeline.sh
    ,
    bash /tmp/pipeline.sh
    ,
    <<'EOF'
    ,
    ${VAR:-
    .
  • The response does not call the
    Write
    tool. (Save-to-file is offered as a suggestion bullet, not an action.)
  • The breakdown table is grouped by stage (Source / Mux / Inference / Tracking / Composition / Render — adapt names to the pipeline's actual stages, e.g. add an
    Encode/Mux
    row for file sinks).
  • The "Save it to a script?" line appears in the Suggestions list — never as a primary action.
在发送回复前,逐一检查以下项目。如果任何检查失败,请重写回复。
  • 管道位于恰好一个
    ```bash
    代码块内,且仅一行。
  • 管道以
    gst-launch-1.0 -e
    开头,仅包含字面绝对路径(例如
    /opt/nvidia/deepstream/...
    )——无
    $VAR
    、无
    ${VAR:-default}
    、无
    cat >
    、无
    EOF
    、无
    \
    换行符。
  • 回复不包含以下任何内容:
    cat > /tmp/pipeline.sh
    bash /tmp/pipeline.sh
    <<'EOF'
    ${VAR:-
  • 回复不调用
    Write
    工具。(保存到文件作为建议项目符号提供,而非主要操作。)
  • 分解表按阶段分组(源 / 多路复用 / 推理 / 跟踪 / 合成 / 渲染——根据管道实际阶段调整名称,例如为文件输出端添加
    编码/多路复用
    行)。
  • “是否保存到脚本?”行出现在建议列表中——绝不作为主要操作。

5.6 — Pre-flight failure variant

5.6 — 预检查失败的变体

If the Section 5.2
ls
reported one or more missing default paths, prepend a
line above the status badge and bump the matching "Use your own …" suggestion to the top:
markdown
⚠ default path not found: `/opt/nvidia/deepstream/deepstream/samples/streams/sample_1080p_h264.mp4` — substitute your own video path before running
✓ Validated · 11 elements · 0 warnings · confidence: HIGH

```bash
gst-launch-1.0 -e filesrc location=/opt/nvidia/deepstream/deepstream/samples/streams/sample_1080p_h264.mp4 !
```

[breakdown + suggestions as in Section 5.3, with the "Use your own video" suggestion bumped to the top]
On length: 5–8 stream pipelines run long when on a single line. That is correct and intended — chat clients render bash code blocks faithfully and copy reproduces them correctly. Long ≠ split.
如果第5.2节的
ls
命令报告一个或多个默认路径缺失,在状态标识上方添加一行
,并将对应的“使用您自己的……”建议移至顶部:
markdown
⚠ default path not found: `/opt/nvidia/deepstream/deepstream/samples/streams/sample_1080p_h264.mp4` — 运行前请替换为您自己的视频路径
✓ Validated · 11 elements · 0 warnings · confidence: HIGH

```bash
gst-launch-1.0 -e filesrc location=/opt/nvidia/deepstream/deepstream/samples/streams/sample_1080p_h264.mp4 !
```

[分解表 + 建议与第5.3节相同,将“使用您自己的视频”建议移至顶部]
关于长度: 5-8流的管道在单行中会较长。这是正确且预期的——聊天客户端会忠实地渲染bash代码块,复制时也能完整保留。长≠拆分。

Step 6 — Offer Refinement

步骤6 — 提供优化选项

After presenting the pipeline, ask the user if they want to adjust anything:
Want me to modify anything? For example:
  • Change the number of streams
  • Add/remove tracker or secondary inference
  • Switch between display and file output
  • Change the platform (x86 dGPU / aarch64 Jetson / SBSA)
If the user requests changes, go back to Step 2 with updated parameters — do NOT re-ask all 7 questions. Only ask about the specific parameter that changed, or just apply the change directly if it's clear.
呈现管道后,询问用户是否需要调整任何内容:
需要我修改任何内容吗?例如:
  • 更改流数量
  • 添加/移除跟踪器或副推理
  • 在显示和文件输出之间切换
  • 更改平台(x86独立GPU / aarch64 Jetson / SBSA)
如果用户请求更改,使用更新后的参数返回步骤2——无需重新询问所有7个问题。仅询问更改的特定参数,或如果更改明确则直接应用。

Step 6.5 — Optional: Save Pipeline to a Script

步骤6.5 — 可选:将管道保存到脚本

Only do this step when the user explicitly asks (e.g. "save it", "save to pipeline.sh", "write it to a file", "put it in ~/run.sh"). Do not create the file proactively — Step 5 always shows the concrete pipeline in chat for direct copy-paste; saving is a follow-up convenience.
  1. Filename: Default to
    /tmp/pipeline.sh
    if the user just says "save it". Use the exact path the user named otherwise (e.g.
    ~/run.sh
    ,
    scripts/demo.sh
    ).
  2. File contents: Two lines — shebang + the same single-line pipeline shown in chat (concrete absolute paths, no shell vars). Keep them in sync — what the user runs from the file is bit-for-bit identical to what they could have copy-pasted.
    bash
    #!/usr/bin/env bash
    gst-launch-1.0 -e filesrc location=/opt/nvidia/deepstream/deepstream/samples/streams/sample_1080p_h264.mp4 ! qtdemux ! h264parse ! nvv4l2decoder ! m.sink_0 … ! nvdsosd ! nveglglessink
    Use the
    Write
    tool to create the file.
  3. Confirm to user with the run command:
    Saved to
    <path>
    . Run it with:
    bash
    bash <path>

仅当用户明确要求时执行此步骤(例如*“保存它”“保存到pipeline.sh”“写入文件”“放到~/run.sh”*)。请勿主动创建文件——步骤5始终在聊天中显示具体管道供直接复制粘贴;保存是后续的便利操作。
  1. 文件名: 如果用户仅说*“保存它”*,默认保存到
    /tmp/pipeline.sh
    。否则使用用户指定的精确路径(例如
    ~/run.sh
    scripts/demo.sh
    )。
  2. 文件内容: 两行——shebang + 聊天中显示的同一单行管道(具体绝对路径,无shell变量)。保持两者一致——用户从文件运行的内容与复制粘贴的内容完全相同。
    bash
    #!/usr/bin/env bash
    gst-launch-1.0 -e filesrc location=/opt/nvidia/deepstream/deepstream/samples/streams/sample_1080p_h264.mp4 ! qtdemux ! h264parse ! nvv4l2decoder ! m.sink_0 … ! nvdsosd ! nveglglessink
    使用
    Write
    工具创建文件。
  3. 向用户确认并提供运行命令:
    已保存到
    <path>
    。运行命令:
    bash
    bash <path>

Pipeline Assembly Rules

管道组装规则

When the script is not available or fails, assemble the pipeline using the rules in references/assembly-rules.md. These rules cover source elements, multi-stream patterns, inference chains, tracker configs, sink elements, and extra operations. They also serve as validation for script output.

当脚本不可用或失败时,使用references/assembly-rules.md中的规则组装管道。这些规则涵盖源元素、多流模式、推理链、跟踪器配置、输出端元素和附加操作。它们也可作为脚本输出的验证依据。

Error Handling

错误处理

FailureCauseRecovery
generate_pipeline.py
returns
confidence: low
Query doesn't match any pipeline in the dataset closelyRely on the assembly rules in this skill instead of retrieved examples
validate_pipeline.py
reports unknown element
GStreamer/DeepStream not installed or not on
PATH
Install DeepStream SDK; confirm
gst-inspect-1.0 nvinfer
works
Validation fails after 2 retriesUnusual element combination or linking issuePresent the pipeline as-is with a warning — syntax/element/property checks still passed
Script not found at
<skill-path>/scripts/
Skill not installed correctly or path misconfiguredVerify the skill directory is symlinked into
.claude/skills/
or
.cursor/skills/
故障原因恢复方法
generate_pipeline.py
返回
confidence: low
查询与数据集中的任何管道匹配度较低依赖本技能中的组装规则而非检索示例
validate_pipeline.py
报告未知元素
GStreamer/DeepStream未安装或未添加到
PATH
安装DeepStream SDK;确认
gst-inspect-1.0 nvinfer
可正常运行
经过2次重试后验证仍失败不常见的元素组合或链接问题按原样呈现管道并附带警告——语法/元素/属性检查已通过
脚本未在
<skill-path>/scripts/
路径下找到
技能安装不正确或路径配置错误验证技能目录已链接到
.claude/skills/
.cursor/skills/

Testing

测试

Run the test suite to verify retrieval quality and validator correctness:
bash
python3 -m unittest discover -s <skill-path>/tests -v
The suite includes:
  • Unit tests for the BM25 retriever (tokenizer, synonym expansion, metadata extraction, scoring)
  • Unit tests for the validator (syntax, structure, property, named-pad checks)
  • Golden regression tests — 20+ query→expected-result pairs ensuring retrieval quality doesn't regress
  • Data quality linter — checks the CSV for duplicates, syntax issues, and structural bugs:
bash
python3 <skill-path>/scripts/lint_data.py          # report issues
python3 <skill-path>/scripts/lint_data.py --fix     # auto-fix and overwrite

运行测试套件以验证检索质量和验证器正确性:
bash
python3 -m unittest discover -s <skill-path>/tests -v
测试套件包括:
  • 单元测试:BM25检索器(分词器、同义词扩展、元数据提取、评分)
  • 单元测试:验证器(语法、结构、属性、命名pad检查)
  • 黄金回归测试——20+查询→预期结果对,确保检索质量不会退化
  • 数据质量检查器——检查CSV中的重复项、语法问题和结构错误:
bash
python3 <skill-path>/scripts/lint_data.py          # 报告问题
python3 <skill-path>/scripts/lint_data.py --fix     # 自动修复并覆盖

Security, Limitations & Notes

安全、限制与注意事项

Security posture, known limitations, and operational notes are documented in
references/security-and-limitations.md
. Read that file when you need details on subprocess safety, input validation, platform/SDK requirements, the multi-stream dry-run caveat, or sample-path/config-file reminders.
安全策略、已知限制和操作注意事项记录在
references/security-and-limitations.md
中。当您需要了解子进程安全、输入验证、平台/SDK要求、多流试运行注意事项或示例路径/配置文件提醒的详细信息时,请阅读该文件。