npx skills add ...
npx skills add nvidia/deepstream --skill rtvi-cv-customize-model
How to swap the DeepStream CV detection model in the VSS Alerts Blueprint verification (2d_cv) mode - covers ONNX export, custom bbox parsers, compose mount gotchas, nvinfer config, runtime TRT engine build, deployment, and a segmentation-capable model addendum handoff.
npx skills add nvidia/deepstream --skill rtvi-cv-customize-model
2d_cv mode only)The RT-CV perception container (vss-rt-cv) runs a DeepStream pipeline with a configurable primary GIE (GPU Inference Engine). By default it uses GDINO or RTDETR. This guide covers replacing it with any ONNX-format model, using YOLOv11 COCO 80 as the worked example.
This only applies to --mode verification (2d_cv). Real-time alerts mode (2d_vlm) has no CV detector.
For instance-segmentation or detection-plus-mask models, complete references/segmentation-model-contract.md before writing parser or handoff code.
Use this skill when the user wants to:
vss-rt-cv detector for another ONNX model in verification mode,dlsym failed on the bbox parser symbol.Do not use this skill for:
2d_vlm real-time alerts mode,rtvi-cv-scaffold-vss-service).2d_cv) unless the user explicitly asks to compare modes.deploy/docker/ are relative to the VSS Blueprint repository, not the DeepStream repository. Clone or reuse a VSS checkout that is v3.2.1 or compatible, then run these commands from that repository root (see VSS Quickstart).${VSS_DATA_DIR}/models/yolo, and re-stage the ONNX file after any dev-profile.sh up that recreates the models directory.parse-bbox-func-name, the extern "C" function symbol, and CHECK_CUSTOM_PARSE_FUNC_PROTOTYPE(...), then rebuild the .so with both DeepStream and CUDA include paths present.perception-alerts."dlsym failed for the bbox parser after loading the custom parser library. What should I check?"This skill is documentation-only and does not ship the VSS deployment sources. Use a VSS v3.2.1 or compatible checkout; run all paths and commands from that repository root. Clone/LFS setup, stock Alerts profile files, and the YOLOv11 customization file tree are in references/vss-source-layout.md.
YOLOv11 COCO 80 is the worked example throughout all steps below. The same pattern applies to any ONNX-format detector — substitute at these points:
| Step | What to change |
|---|---|
| Step 1 | Replace the export procedure with whatever your model's training library requires. Confirm the resulting .onnx exists on the host before continuing. |
| Steps 2–3 | Inspect your model's actual output tensor name, shape, layout, and whether NMS is applied in-graph. Do not assume it matches YOLOv11. The deepstream-dev skill (skills/deepstream-dev/) has a generation-by-generation YOLO output format table and references/nvinfer_config.md for full property reference. |
| Step 4 | Update output-blob-names to your tensor name, infer-dims to your input shape, and cluster-mode to match whether NMS is in-graph (4) or not (2). |
| Step 5 | Update the --onnx path, the input tensor name in --minShapes/--optShapes/--maxShapes (not images for non-YOLO models), and the sed commands to reference your nvinfer .txt file. Add a new if [[ $MODEL_NAME_2D == "YOURMODEL" ]] block rather than editing the YOLO block. |
Obtain a TensorRT-compatible ONNX model and place it at ${VSS_DATA_DIR}/models/yolo/yolo11s.onnx before continuing.
See references/yolov11-onnx-export.md for the export settings and tensor layout used in this reference. Adapt the parser and nvinfer config in later steps to match your model's actual output.
After every full dev-profile.sh up, restore ownership of the recreated models/yolo directory and re-stage your ONNX file:
Read and follow
references/yolov11-parser.md before creating
${VSS_PROFILE_DIR}/deepstream/custom_parser/nvdsparseyolov11.cpp or editing
the parser build in Dockerfiles/perception.Dockerfile.
Before writing any parser code, confirm these four things for your model:
output-blob-names and infer-dims in Step 4cluster-mode in Step 4; see deepstream-dev Rule 13 for the generation-by-generation breakdowncx/cy/w/h center-format or x1/y1/x2/y2 corner-format; the YOLOv11 example uses center-format (see references/yolov11-parser.md)extern "C" function name must match parse-bbox-func-name in Step 4 and CHECK_CUSTOM_PARSE_FUNC_PROTOTYPE(...) exactlyConfirm the model output tensor layout instead of assuming it matches
YOLOv11. Keep the parser symbol identical in the exported C++
function, CHECK_CUSTOM_PARSE_FUNC_PROTOTYPE(...), and the Step 4
parse-bbox-func-name setting.
For instance segmentation or detection-plus-mask models, complete the contract decisions table in references/segmentation-model-contract.md before writing parser or handoff code.
${VSS_PROFILE_DIR}/deepstream/configs/yolov11.txt — the primary GIE sub-config referenced by the DeepStream run config.
model-engine-file and batch-size are patched at container startup by the ds-start.sh block in Step 5. Copy the values below as-is; Step 5 will overwrite both with the correct engine path and sensor count before DeepStream reads the file.
ds-start.sh)TRT engines are GPU-architecture-specific. Build the engine on first startup when it is missing, then reuse it on subsequent restarts. Rebuild an existing engine only when FORCE_REBUILD=true. The stock Alerts compose file bind-mounts ${VSS_DATA_DIR}/models/ at /opt/storage/, so the generated engine persists on the host.
Which ds-start.sh? Stock Alerts runs services/rtvi/rtvi-cv/ds-start.sh (via extends), not ${VSS_PROFILE_DIR}/deepstream/init-scripts/ds-start.sh. This skill edits the profile copy, then remounts it in Step 6 so those edits actually run. Full map of the three paths, remount trade-offs, and DS_CONFIG_FILE pairing: references/ds-start-entrypoint.md.
Edit ${VSS_PROFILE_DIR}/deepstream/init-scripts/ds-start.sh, then override the stock rtvi-cv ds-start.sh bind mount in the Alerts profile compose file as shown in Step 6. Without that override, profile-script edits never execute.
Critical — honor DS_CONFIG_FILE. The profile script sets CONFIG_FILE=${1:-...} and never reads DS_CONFIG_FILE. The Alerts compose command invokes ds-start.sh with no positional args, while Step 6 sets DS_CONFIG_FILE to the absolute mounted-configs run config (not the stock .../configs/... path). Replace the script's existing CONFIG_FILE=... assignment with:
Then add the YOLO block (before the GDINO/RT-DETR model branches is fine):
To add a different model, add a new if [[ $MODEL_NAME_2D == "YOURMODEL" ]] block. Update:
--onnx path and --saveEngine output path--minShapes/--optShapes/--maxShapes input tensor name and dimensions for your modelsed commands to point at your nvinfer .txt fileIn the existing ${VSS_PROFILE_DIR}/compose.yml, update the perception-alerts service:
Set in ${VSS_PROFILE_DIR}/.env:
Keep FORCE_REBUILD=false for normal starts. Compose's --force-recreate option recreates the container but does not rebuild the TensorRT engine unless FORCE_REBUILD=true.
Gotcha — generated.env wins at restart. Step 7's redeploy uses --env-file .../generated.env, which is produced by dev-profile.sh from .env. Editing .env alone does not change FORCE_REBUILD for that compose command. For a one-shot engine rebuild, pass the override on the shell (see Step 7). To persist the value for later dev-profile.sh runs, edit .env and re-run dev-profile.sh so it regenerates generated.env.
Run from the video-search-and-summarization repository root
(VSS_ROOT / VSS_DEPLOY_DIR / VSS_PROFILE_DIR from VSS source location):
1. Single-GPU host (only GPU 0): edit ${VSS_PROFILE_DIR}/.env so these
keys match the required final values below. Edit the source profile env file,
not generated.env (dev-profile.sh regenerates that). Stock Alerts reserves
GPU 0 and puts RT-VLM / LLM / VLM on GPU 1; dev-profile.sh CLI flags cannot
clear RESERVED_DEVICE_IDS or set FIXED_SHARED_DEVICE_IDS. Confirm device
IDs exist with nvidia-smi --query-gpu=index --format=csv,noheader,nounits
before deploying.
2. Deploy the official Alerts verification profile. Select the hardware profile supported by your host, as documented by the VSS Quickstart. Do not present the remaining commands as a copy-paste handoff unless execution is blocked.
TRT engine build takes approximately 15–30 seconds on Blackwell hardware.
Subsequent restarts reuse the engine persisted under
${VSS_DATA_DIR}/models/.
See references/common-gotchas.md for single-GPU reservation failures, wipe/restage after dev-profile.sh up, ghost file mounts, dlsym parser mismatches, and Redis stream contamination.