tao-train-foundation-stereo
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDepth Net Stereo
Depth Net Stereo
Stereo depth estimation using FoundationStereo architecture. Predicts disparity maps from stereo image pairs for 3D reconstruction.
Uses pretrained Depth Anything v2 and EdgeNeXt encoders. Set and .
model.stereo_backbone.depth_anything_v2_pretrained_pathmodel.stereo_backbone.edgenext_pretrained_pathThe mono and stereo skills both invoke the unified TAO CLI inside the container; the mono/stereo family is selected via (e.g., ).
depth_netmodel.model_typeFoundationStereoFor TAO Deploy TensorRT actions (, TensorRT , and TensorRT ), read first. The deploy spec template lives in this skill's .
gen_trt_engineevaluateinferencereferences/tao-deploy-foundation-stereo.mdreferences/spec_template_deploy.yaml使用FoundationStereo架构进行立体深度估计。从立体图像对中预测视差图,用于3D重建。
采用预训练的Depth Anything v2和EdgeNeXt编码器。需设置和。
model.stereo_backbone.depth_anything_v2_pretrained_pathmodel.stereo_backbone.edgenext_pretrained_path单目和立体技能都会调用容器内统一的TAO CLI;通过选择单目/立体系列(例如)。
depth_netmodel.model_typeFoundationStereo对于TAO Deploy TensorRT操作(、TensorRT 和TensorRT ),请先阅读。部署规范模板位于本技能的中。
gen_trt_engineevaluateinferencereferences/tao-deploy-foundation-stereo.mdreferences/spec_template_deploy.yamlTrain Action Policy
训练操作策略
This model is AutoML-enabled at the model layer. Before handling any train-stage request, read and resolve the run override from either an explicit value or the user's workflow request. Treat phrases like "turn off AutoML", "disable AutoML", "no HPO", or "plain training" as for this run only; otherwise default to . When , , and both and are packaged, route the train action through by default with this model's . Preserve workflow/application overrides for datasets, specs, output directories, GPU/platform settings, parent checkpoints, and . Use direct model training only when or the packaged train schema/template is missing; in the missing-schema case, report that AutoML is enabled but not runnable for this model until schemas are generated.
references/skill_info.yamlautoml_policyautoml_policy: offautoautoml_policy: autoautoml_enabled: trueschemas/train.schema.jsonreferences/spec_template_train.yamltao-skill-bank:tao-run-automlskill_dirautoml_policyautoml_policy: offNon-train actions such as , , , and deploy flows stay in this model skill. The per-run override does not change model metadata.
evaluateinferenceexportautoml_policy该模型在模型层支持AutoML。处理任何训练阶段的请求前,请阅读,并通过显式的值或用户的工作流请求解析运行覆盖配置。将“turn off AutoML”、“disable AutoML”、“no HPO”或“plain training”这类表述视为本次运行的;否则默认设为。当、,且已打包和时,默认将训练操作通过路由,并传入该模型的。保留数据集、规范、输出目录、GPU/平台设置、父检查点和的工作流/应用覆盖配置。仅当或打包的训练架构/模板缺失时,才使用直接模型训练;在架构缺失的情况下,需报告AutoML已启用,但在生成架构前无法针对该模型运行。
references/skill_info.yamlautoml_policyautoml_policy: offautoautoml_policy: autoautoml_enabled: trueschemas/train.schema.jsonreferences/spec_template_train.yamltao-skill-bank:tao-run-automlskill_dirautoml_policyautoml_policy: off非训练操作(如、、和部署流程)仍在本模型技能中执行。每次运行的覆盖配置不会更改模型元数据。
evaluateinferenceexportautoml_policyWorkflow
工作流
Prerequisites — data accessibility
前提条件——数据可访问性
Your dataset (left + right images + GT disparity) must be reachable from inside the container:
- SDK runner: place files at the S3 paths the runner resolves (the /
S3_TRAINplaceholders shown in Typical Spec Overrides). The runner handles S3 → container-path mounting transparently.S3_EVAL - Direct (e.g. local testing): mount the host dataset root read-only at the same in-container path:
docker run
docker run ... -v <host_data_root>:<host_data_root>:ro <container> ...The same accessibility requirement applies to the written by all actions.
<output_dir>你的数据集(左图+右图+GT视差)必须能从容器内部访问:
- SDK运行器:将文件放置在运行器解析的S3路径下(即典型规范覆盖中显示的/
S3_TRAIN占位符)。运行器会自动处理S3到容器路径的挂载。S3_EVAL - 直接(例如本地测试):将主机数据集根目录以只读方式挂载到容器内相同路径:
docker run
docker run ... -v <host_data_root>:<host_data_root>:ro <container> ...所有操作写入的也需满足相同的可访问性要求。
<output_dir>Step 1 — Annotation file
步骤1——标注文件
Per-line annotation file referenced by :
data_sources[*].data_file| Columns | Format | Use |
|---|---|---|
| 2 | | Stereo inference (no GT) |
| 3 | | Stereo with GT |
| 4 | | Stereo with GT and occlusion mask |
If you already have one, point to it. Otherwise generate via :
depth_net convertdepth_net convert -e <convert_spec.yaml>convert_spec.yamlyaml
data_root: <directory whose immediate children are scene folders that contain your image+depth files; convert walks data_root recursively but expects per-scene subdirectories at one level below>
image_dir_pattern: [<substring matching left image paths>]
right_dir_pattern: [<substring matching right image paths>]
depth_dir_pattern: [<substring matching GT disparity paths>]
nocc_dir_pattern: [] # optional, occlusion mask paths
image_extension: '.png' # always include the leading dot
depth_extension: '.png' # form must match image_extension (the swap is a substring replace)
nocc_extension: ''
split_ratio: 0.0 # 0.0/1.0 = test-only; 0.8 = 80/20 train+valconvertdata_rootimage_dir_patternimage_dir_pattern[0]im0im1disp0GTdata_sources[*].data_file| 列数 | 格式 | 用途 |
|---|---|---|
| 2 | | 立体推理(无GT) |
| 3 | | 带GT的立体任务 |
| 4 | | 带GT和遮挡掩码的立体任务 |
如果已有标注文件,直接指向它。否则通过生成:
depth_net convertdepth_net convert -e <convert_spec.yaml>convert_spec.yamlyaml
data_root: <目录,其子目录为包含图像+深度文件的场景文件夹;convert会递归遍历data_root,但要求场景子目录位于data_root下一级>
image_dir_pattern: [<匹配左图路径的子字符串>]
right_dir_pattern: [<匹配右图路径的子字符串>]
depth_dir_pattern: [<匹配GT视差路径的子字符串>]
nocc_dir_pattern: [] # 可选,遮挡掩码路径
image_extension: '.png' # 必须包含前导点
depth_extension: '.png' # 格式必须与image_extension匹配(通过子字符串替换实现转换)
nocc_extension: ''
split_ratio: 0.0 # 0.0/1.0 = 仅测试集;0.8 = 80/20 训练+验证集convertdata_rootimage_dir_patternimage_dir_pattern[0]im0im1disp0GTStep 2 — Pair model_type
and dataset_name
based on your data
model_typedataset_name步骤2——根据数据匹配model_type
和dataset_name
model_typedataset_namePrefer the dataset-specific class when your layout matches a supported one — it applies class-specific path conventions, evaluation crops, and (where applicable) occlusion-mask handling. Fall back to only for layouts that do not match any registered class.
GenericDataset| Data category | | |
|---|---|---|
| Middlebury data | | |
| KITTI data | | |
| ETH3D data | | |
| FSD synthetic data | | |
| IsaacReal synthetic data | | |
| Crestereo synthetic data | | |
| Other / non-canonical layout | | |
See Training Requirements → Formats for the full registered-class list. The same value applies across train and evaluate actions (all of which use 3-column or 4-column annotations with GT disparity). The deploy-side action follows the same rule — see . For inference with 2-column annotations (left + right, no GT), use regardless of data layout — the dataset-specific classes ( / / / / / ) require 3-column input and reject 2-column annotations at the dataloader level. For inference with 3-column annotations (left + right + GT), the dataset-specific class is fine.
dataset_nameevaluatereferences/tao-deploy-foundation-stereo.mddataset_name: GenericDatasetMiddleburyKittiEth3dFSDIsaacRealDatasetCrestereo当你的数据布局与支持的数据集匹配时,优先使用特定数据集类——它会应用类特定的路径约定、评估裁剪,以及(如适用)遮挡掩码处理。仅当布局不匹配任何已注册类时,才回退到。
GenericDataset| 数据类别 | | |
|---|---|---|
| Middlebury数据 | | |
| KITTI数据 | | |
| ETH3D数据 | | |
| FSD合成数据 | | |
| IsaacReal合成数据 | | |
| Crestereo合成数据 | | |
| 其他/非标准布局 | | |
查看训练要求→格式获取完整的已注册类列表。同一个值适用于训练和评估操作(这些操作均使用带GT视差的3列或4列标注)。部署端的操作遵循相同规则——请参阅。对于使用2列标注(左图+右图,无GT)的推理,无论数据布局如何,都使用——特定数据集类(/////)要求3列输入,在数据加载器层面会拒绝2列标注。对于使用3列标注(左图+右图+GT)的推理,特定数据集类是适用的。
dataset_nameevaluatereferences/tao-deploy-foundation-stereo.mddataset_name: GenericDatasetMiddleburyKittiEth3dFSDIsaacRealDatasetCrestereoStep 3 — Write spec yaml from Typical Spec Overrides
步骤3——根据典型规范覆盖编写spec yaml
Copy the action block from (per-action , mandatory data sources). Replace:
references/foundation-stereo-spec-overrides.mdspec_overrides- from Step 2 (typically
model.model_type)FoundationStereo - from Step 2
dataset.<...>.data_sources[*].dataset_name - with the path from Step 1
dataset.<...>.data_sources[*].data_file - For deploy-side : enforce
evaluate(seedataset.test_dataset.batch_size: 1).references/tao-deploy-foundation-stereo.md
Shape consistency: the in should match / so the trained-model evaluator and the deploy-side TensorRT evaluator operate at the same shape — see .
crop_sizedataset.test_dataset.augmentation.crop_sizeexport.input_heightinput_widthreferences/foundation-stereo-troubleshooting.md从复制操作块(每个操作的,必填数据源)。替换:
references/foundation-stereo-spec-overrides.mdspec_overrides- 步骤2中的(通常为
model.model_type)FoundationStereo - 步骤2中的
dataset.<...>.data_sources[*].dataset_name - 步骤1中的路径替换
dataset.<...>.data_sources[*].data_file - 对于部署端的:强制设置
evaluate(请参阅dataset.test_dataset.batch_size: 1)。references/tao-deploy-foundation-stereo.md
形状一致性:中的应与/匹配,以便训练模型评估器和部署端TensorRT评估器在相同形状下运行——请参阅。
dataset.test_dataset.augmentation.crop_sizecrop_sizeexport.input_heightinput_widthreferences/foundation-stereo-troubleshooting.mdStep 4 — Run
步骤4——运行
docker run --gpus 'device=0' --shm-size 16G --ipc=host \
--user $(id -u):$(id -g) \
-v <data_root>:<data_root>:ro \
-v <output_dir>:<output_dir> \
<container> \
depth_net <action> -e <spec.yaml>Without the container writes outputs as , blocking host-side cleanup / retry.
--user $(id -u):$(id -g)nobody:nogroupdocker run --gpus 'device=0' --shm-size 16G --ipc=host \
--user $(id -u):$(id -g) \
-v <data_root>:<data_root>:ro \
-v <output_dir>:<output_dir> \
<container> \
depth_net <action> -e <spec.yaml>如果不添加,容器会以身份写入输出,导致主机端无法清理/重试。
--user $(id -u):$(id -g)nobody:nogroupStep 5 — Verify
步骤5——验证
- Container exit code 0
status.jsonblock populatedkpi- For : inspect per-step
traindirectly (the entrypoint reportstrain_losseven when loss is NaN)Execution status: PASS - For : rely on
evaluate/epe/bp1/bp2/bp3/d1(the evaluator also emitsrmse/abs_rel/sq_relwhich are non-meaningful for stereo — seermse_log)references/foundation-stereo-parameters.md - For : artifacts under
inferenceresults_dir
For TAO Deploy TensorRT actions (, TensorRT , and TensorRT ), read first. Deploy spec templates live in this skill's folder with the prefix.
gen_trt_engineevaluateinferencereferences/tao-deploy-foundation-stereo.mdreferences/spec_template_deploy_*.yaml- 容器退出码为0
- 的
status.json块已填充kpi - 对于:直接检查每一步的
train(即使损失为NaN,入口点仍会报告train_loss)Execution status: PASS - 对于:参考
evaluate/epe/bp1/bp2/bp3/d1(评估器还会输出rmse/abs_rel/sq_rel,但这些在立体任务中无意义——请参阅rmse_log)references/foundation-stereo-parameters.md - 对于:
inference下存在输出产物results_dir
对于TAO Deploy TensorRT操作(、TensorRT 和TensorRT ),请先阅读。部署规范模板位于本技能的文件夹中,前缀为。
gen_trt_engineevaluateinferencereferences/tao-deploy-foundation-stereo.mdreferences/spec_template_deploy_*.yamlTraining Requirements
训练要求
- Valid values for stereo
dataset_name(case-insensitive):data_sources,FSD,IsaacRealDataset,Crestereo,Middlebury,Eth3d,KittiGenericDataset - Monitoring metric: val/loss
- 立体的有效
data_sources值(大小写不敏感):dataset_name、FSD、IsaacRealDataset、Crestereo、Middlebury、Eth3d、KittiGenericDataset - 监控指标:val/loss
Per-Action Dataset Requirements
各操作的数据集要求
| Action | Spec Key | Source | Files | List? |
|---|---|---|---|---|
| evaluate | dataset.test_dataset.data_sources | eval_dataset | data_file: annotations.txt + dataset_name | Yes |
| inference | dataset.infer_dataset.data_sources | inference_dataset | data_file: annotations.txt + dataset_name | Yes |
| quantize | dataset.train_dataset.data_sources | train_datasets | data_file: annotations.txt + dataset_name | Yes |
| quantize | dataset.val_dataset.data_sources | eval_dataset | data_file: annotations.txt + dataset_name | Yes |
| quantize | dataset.quant_calibration_dataset.images_dir | train_datasets | images.tar.gz | No |
| train | dataset.train_dataset.data_sources | train_datasets | data_file: annotations.txt + dataset_name | Yes |
| train | dataset.val_dataset.data_sources | eval_dataset | data_file: annotations.txt + dataset_name | Yes |
| 操作 | 规范键 | 来源 | 文件 | 是否为列表? |
|---|---|---|---|---|
| evaluate | dataset.test_dataset.data_sources | eval_dataset | data_file: annotations.txt + dataset_name | 是 |
| inference | dataset.infer_dataset.data_sources | inference_dataset | data_file: annotations.txt + dataset_name | 是 |
| quantize | dataset.train_dataset.data_sources | train_datasets | data_file: annotations.txt + dataset_name | 是 |
| quantize | dataset.val_dataset.data_sources | eval_dataset | data_file: annotations.txt + dataset_name | 是 |
| quantize | dataset.quant_calibration_dataset.images_dir | train_datasets | images.tar.gz | 否 |
| train | dataset.train_dataset.data_sources | train_datasets | data_file: annotations.txt + dataset_name | 是 |
| train | dataset.val_dataset.data_sources | eval_dataset | data_file: annotations.txt + dataset_name | 是 |
Typical Spec Overrides
典型规范覆盖
Data source overrides are mandatory for every action — the agent MUST construct data source paths from the Per-Action Dataset Requirements table above and include them in . Each entry is a dict with two mandatory fields: and .
spec_overridesdata_sourcesdata_filedataset_nameSee for the full per-action blocks (train, evaluate, export, gen_trt_engine, inference, quantize) with / placeholders.
references/foundation-stereo-spec-overrides.mdspec_overridesS3_TRAINS3_EVAL数据源覆盖对每个操作都是必填项——代理必须根据上述各操作数据集要求表构建数据源路径,并将其包含在中。每个条目是一个字典,包含两个必填字段:和。
spec_overridesdata_sourcesdata_filedataset_name完整的各操作块(train、evaluate、export、gen_trt_engine、inference、quantize)及/占位符,请参阅。
spec_overridesS3_TRAINS3_EVALreferences/foundation-stereo-spec-overrides.mdEval Dataset
评估数据集
Optional. Val dataset configured via (each entry needs and ).
dataset.val_dataset.data_sourcesdata_filedataset_name可选。验证数据集通过配置(每个条目需要和)。
dataset.val_dataset.data_sourcesdata_filedataset_nameImportant Parameters
重要参数
Key defaults: = (only selectable type); (top-level, not under ) schema default but FS small NGC ckpt requires , override explicitly; default 416; default 1e-4; fp32 (recommended) or fp16 (no bf16); default . The field name is , not .
model.model_typeFoundationStereomodel.encoderstereo_backbonevitlvitsmodel.max_disparitytrain.optim.lrtrain.precisionexport.batch_size-1workersworkersnum_workersSee for the full parameter glossary (all , , , fields with defaults and ranges) and the Evaluation Metrics reference (which / / / to trust and why / / are non-meaningful for stereo).
references/foundation-stereo-parameters.mdmodel.*dataset.*train.*export.*epebp*d1rmseabs_relsq_relrmse_log关键默认值: = (唯一可选类型);(顶层,不在下)架构默认值为,但FS小型NGC检查点需要显式覆盖为;默认值为416;默认值为1e-4;为fp32(推荐)或fp16(不支持bf16);默认值为。字段名称为,而非。
model.model_typeFoundationStereomodel.encoderstereo_backbonevitlvitsmodel.max_disparitytrain.optim.lrtrain.precisionexport.batch_size-1workersworkersnum_workers完整的参数术语表(所有、、、字段及其默认值和范围)以及评估指标参考(应信任哪些///,以及为何//在立体任务中无意义),请参阅。
model.*dataset.*train.*export.*epebp*d1rmseabs_relsq_relrmse_logreferences/foundation-stereo-parameters.mdMulti-GPU / Multi-Node
多GPU/多节点
Launch method: Lightning-managed (single process, Lightning spawns workers).
python| Spec Key | Description | Default |
|---|---|---|
| Number of GPUs | 1 |
| GPU device indices | [0] |
| Number of nodes | 1 |
| | |
Same DDP/FSDP behavior as depth-net-mono. Multi-node requires , , , env vars.
WORLD_SIZENODE_RANKMASTER_ADDRMASTER_PORT启动方式:Lightning管理(单个进程,Lightning生成工作进程)。
python| 规范键 | 描述 | 默认值 |
|---|---|---|
| GPU数量 | 1 |
| GPU设备索引 | [0] |
| 节点数量 | 1 |
| | |
与depth-net-mono具有相同的DDP/FSDP行为。多节点需要、、、环境变量。
WORLD_SIZENODE_RANKMASTER_ADDRMASTER_PORTExport / TRT Defaults
导出/TRT默认值
TRT data types FP32 / FP16. Static-shape ONNX () and batch-only dynamic ONNX () both support ; height and width are always pinned to the trace shape (H/W-dynamic engines are not supported — build separate engines per (H, W)). For the NGC release (576×960), set , , .
export.batch_size: 1export.batch_size: -1fp16export.batch_size: 1export.opset_version: 17export.on_cpu: TrueSee for the full export / TRT defaults (the opset-vs- pairing rules, determinism notes, GPU-memory thresholds) and the Hardware requirements. See for the three supported deploy paths and the validation table.
references/foundation-stereo-export-trt-hardware.mdon_cpuon_cpureferences/tao-deploy-foundation-stereo.mdFull TAO Deploy reference: tao-deploy-foundation-stereo.
TRT数据类型为FP32/FP16。静态形状ONNX()和仅批量动态ONNX()均支持;高度和宽度始终固定为跟踪形状(不支持H/W动态引擎——需为每个(H, W)构建单独的引擎)。对于NGC版本(576×960),设置、、。
export.batch_size: 1export.batch_size: -1fp16export.batch_size: 1export.opset_version: 17export.on_cpu: True完整的导出/TRT默认值(opset与的配对规则、确定性说明、 GPU内存阈值)以及硬件要求,请参阅。三种支持的部署路径和验证表,请参阅。
on_cpuon_cpureferences/foundation-stereo-export-trt-hardware.mdreferences/tao-deploy-foundation-stereo.md完整TAO Deploy参考:tao-deploy-foundation-stereo。
Error Patterns
错误模式
Common issues: disparity overflow (reduce ); missing pretrained paths (set both and ); ( is top-level ); (each entry needs both and ); (entrypoint is , no suffix).
model.max_disparitymodel.stereo_backbone.depth_anything_v2_pretrained_pathmodel.stereo_backbone.edgenext_pretrained_pathKey 'encoder' not in 'StereoBackBone'encodermodel.encoderKey 'dataset_name' is not in structdata_sourcesdata_filedataset_namebash: exec: depth_net_stereo: not founddepth_netSee for the full error patterns plus the pyt-vs-deploy discussion (the pyt path runs at native image resolution and ignores , with the Middlebury resolution guidance) and the Shape consistency rule.
references/foundation-stereo-troubleshooting.mdcrop_sizeevaluatecrop_size常见问题:视差溢出(减小);缺失预训练路径(设置和);(是顶层的);(每个条目需要和);(入口点是,无后缀)。
model.max_disparitymodel.stereo_backbone.depth_anything_v2_pretrained_pathmodel.stereo_backbone.edgenext_pretrained_pathKey 'encoder' not in 'StereoBackBone'encodermodel.encoderKey 'dataset_name' is not in structdata_sourcesdata_filedataset_namebash: exec: depth_net_stereo: not founddepth_net完整的错误模式,以及pyt与部署端的讨论(pyt的路径以原生图像分辨率运行,忽略,并提供Middlebury分辨率指南)和形状一致性规则,请参阅。
crop_sizeevaluatecrop_sizereferences/foundation-stereo-troubleshooting.mdSpec Param / Parent Model Inference
规范参数/父模型推理
Model-specific inference mappings belong in MD, not in . Generated runners read these mappings and apply them with SDK helpers before (mirrors the old microservices flow). For / , pass the upstream train/export/AutoML child job id as ; the SDK lists the parent result folder, filters checkpoint artifacts, and returns the selected model file or folder. Do not add these mappings back to and do not patch generated runner scripts to guess checkpoint paths.
config.jsoncreate_job()infer_params.pyparent_modelparent_model_folderparent_job_idconfig.jsonSee for the full per-action inference-mapping table (train / evaluate / inference / export / gen_trt_engine / quantize, including the train pretrained-path link/destination and resume-checkpoint mappings).
references/foundation-stereo-spec-param-inference.md模型特定的推理映射应放在MD文件中,而非。生成的运行器会读取这些映射,并在前使用SDK助手应用它们(镜像旧微服务的流程)。对于/,将上游训练/导出/AutoML子任务ID作为传递;SDK会列出父结果文件夹,过滤检查点产物,并返回选中的模型文件或文件夹。不要将这些映射添加回,也不要修改生成的运行器脚本来猜测检查点路径。
config.jsoncreate_job()infer_params.pyparent_modelparent_model_folderparent_job_idconfig.json完整的各操作推理映射表(train/evaluate/inference/export/gen_trt_engine/quantize,包括训练预训练路径链接/目标和恢复检查点映射),请参阅。
references/foundation-stereo-spec-param-inference.md