mcpField
T
tao-train-sparse4d

tao-train-sparse4d

github.com/promptingcompanyData & databases039 installsUpdated 17w ago
Repository

About tao-train-sparse4d

tao-train-sparse4d is a TAO Toolkit skill for training and operating Sparse4D models for multi-camera temporal 3D detection and tracking. It guides AutoML training and actions including dataset conversion, evaluation, inference, export, and quantization.

Key features

  1. 01Multi-camera temporal 3D detection and tracking
  2. 02Sparse queries with deformable attention
  3. 03AutoML training workflow support
  4. 04Dataset conversion, evaluation, and inference
  5. 05Export and quantization configuration guidance

Use cases

  1. 01Train multi-camera 3D perception models
  2. 02Track detected instances across sequences
  3. 03Evaluate or run inference with trained models
  4. 04Prepare model export or quantization jobs

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/promptingcompany/nv-skills --skill tao-train-sparse4d

After installing, type/tao-train-sparse4din Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

BENCHMARK.md
skill-card.md
skill.oms.sig
evals/
evals.json
references/
skill_info.yaml
spec_template_dataset_convert.yaml
spec_template_evaluate.yaml
spec_template_export.yaml
spec_template_inference.yaml
spec_template_quantize.yaml
spec_template_train.yaml
schemas/
dataset_convert.schema.json
evaluate.schema.json
export.schema.json
inference.schema.json
manifest.json
quantize.schema.json
train.schema.json

Details

From the project README

Sparse4D

Sparse4D for multi-camera temporal 3D object detection and tracking. Uses sparse queries with deformable attention across camera views and time for end-to-end 3D perception. Includes instance bank for temporal tracking.

Requires pretrained ResNet-101 backbone. Set train.pretrained_model_path.

Dataclass Schemas

Generated TAO Core schemas are packaged in schemas/<action>.schema.json, with schemas/manifest.json listing available actions. Each generated schema also emits references/spec_template_<action>.yaml from the schema top-level default field. AutoML enablement is declared at the model layer in references/skill_info.yaml via automl_enabled. Runnable AutoML still requires schemas/train.schema.json and references/spec_template_train.yaml to exist and parse. Use the packaged train schema for automl_default_parameters, automl_disabled_parameters, defaults, min/max bounds, enums, option weights, math conditions, dependencies, and popular parameters. Do not expect ~/tao-core at runtime; maintainers regenerate schemas/templates before packaging the skill bank.

Train Action Policy

This model is AutoML-enabled at the model layer. Before handling any train-stage request, read references/skill_info.yaml and resolve the run override from either an explicit automl_policy value or the user's workflow request. Treat phrases like "turn off AutoML", "disable AutoML", "no HPO", or "plain training" as automl_policy: off for this run only; otherwise default to auto. When automl_policy: auto, automl_enabled: true, and both schemas/train.schema.json and references/spec_template_train.yaml are packaged, route the train action through tao-skill-bank:tao-run-automl by default with this model's skill_dir. Preserve workflow/application overrides for datasets, specs, output directories, GPU/platform settings, parent checkpoints, and automl_policy. Use direct model training only when automl_policy: off 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.

Non-train actions such as evaluate, inference, export, and deploy flows stay in this model skill. The per-run automl_policy override does not change model metadata.

Training Requirements

  • Dataset type: sparse4d
  • Formats: ovpkl
  • Monitoring metric: val_mAP
Per-Action Dataset Requirements
ActionSpec KeySourceFilesList?
dataset_convertaicity.rootidNo
evaluatedataset.data_rooteval_dataset(from convert job, spec: aicity.split)No
evaluatemodel.head.instance_bank.anchortrain_datasets/results/{dataset_convert_job_id}/anchor_init.npyNo
evaluatedataset.train_dataset.ann_filetrain_datasets(from convert job, spec: aicity.split)No
evaluatedataset.val_dataset.ann_fileeval_dataset(from convert job, spec: aicity.split)No
evaluatedataset.test_dataset.ann_fileinference_dataset(from convert job, spec: aicity.split)No
exportmodel.head.instance_bank.anchortrain_datasets/results/{dataset_convert_job_id}/anchor_init.npyNo
inferencedataset.data_rootinference_dataset(from convert job, spec: aicity.split)No
inferencemodel.head.instance_bank.anchortrain_datasets/results/{dataset_convert_job_id}/anchor_init.npyNo
inferencedataset.train_dataset.ann_filetrain_datasets(from convert job, spec: aicity.split)No
inferencedataset.val_dataset.ann_fileeval_dataset(from convert job, spec: aicity.split)No
inferencedataset.test_dataset.ann_fileinference_dataset(from convert job, spec: aicity.split)No
quantizedataset.data_roottrain_datasets(from convert job, spec: aicity.split)No
quantizemodel.head.instance_bank.anchortrain_datasets/results/{dataset_convert_job_id}/anchor_init.npyNo
quantizedataset.train_dataset.ann_filetrain_datasets(from convert job, spec: aicity.split)No
quantizedataset.val_dataset.ann_fileeval_dataset(from convert job, spec: aicity.split)No
quantizedataset.test_dataset.ann_fileinference_dataset(from convert job, spec: aicity.split)No
quantizedataset.quant_calibration_dataset.images_dirtrain_datasetsNo
traindataset.data_roottrain_datasets(from convert job, spec: aicity.split)No
trainmodel.head.instance_bank.anchortrain_datasets/results/{dataset_convert_job_id}/anchor_init.npyNo
traindataset.train_dataset.ann_filetrain_datasets(from convert job, spec: aicity.split)No
traindataset.val_dataset.ann_fileeval_dataset(from convert job, spec: aicity.split)No
traindataset.test_dataset.ann_fileinference_dataset(from convert job, spec: aicity.split)No
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 spec_overrides.

S3_TRAIN = "s3://bucket/data/train"
S3_EVAL = "s3://bucket/data/eval"

train (mandatory data sources):

{
    "train.num_epochs": 30,
    "train.checkpoint_interval": 10,
    "train.validation_interval": 10,
    "train.num_gpus": 1,
    "dataset.sequences.split_num": 90,
    "train_dataset.sequences_split_num": 90,
    "dataset.data_root": {"spec": f"{S3_TRAIN}/aicity.split)"},
    "model.head.instance_bank.anchor": f"{S3_TRAIN}//results/{dataset_convert_job_id}/anchor_init.npy",
    "dataset.train_dataset.ann_file": {"spec": f"{S3_TRAIN}/aicity.split)"},
    "dataset.val_dataset.ann_file": {"spec": f"{S3_EVAL}/aicity.split)"},
    "dataset.test_dataset.ann_file": {"spec": f"{S3_EVAL}/aicity.split)"},
}

evaluate (mandatory data sources):

{
    "dataset.data_root": {"spec": f"{S3_EVAL}/aicity.split)"},
    "model.head.instance_bank.anchor": f"{S3_TRAIN}//results/{dataset_convert_job_id}/anchor_init.npy",
    "dataset.train_dataset.ann_file": {"spec": f"{S3_TRAIN}/aicity.split)"},
    "dataset.val_dataset.ann_file": {"spec": f"{S3_EVAL}/aicity.split)"},
    "dataset.test_dataset.ann_file": {"spec": f"{S3_EVAL}/aicity.split)"},
}

export (mandatory data sources):

{
    "model.head.instance_bank.anchor": f"{S3_TRAIN}//results/{dataset_convert_job_id}/anchor_init.npy",
}

inference (mandatory data sources):

{
    "dataset.data_root": {"spec": f"{S3_EVAL}/aicity.split)"},
    "model.head.instance_bank.anchor": f"{S3_TRAIN}//results/{dataset_convert_job_id}/anchor_init.npy",
    "dataset.train_dataset.ann_file": {"spec": f"{S3_TRAIN}/aicity.split)"},
    "dataset.val_dataset.ann_file": {"spec": f"{S3_EVAL}/aicity.split)"},
    "dataset.test_dataset.ann_file": {"spec": f"{S3_EVAL}/aicity.split)"},
}

quantize (mandatory data sources):

{
    "dataset.data_root": {"spec": f"{S3_TRAIN}/aicity.split)"},
    "model.head.instance_bank.anchor": f"{S3_TRAIN}//results/{dataset_convert_job_id}/anchor_init.npy",
    "dataset.train_dataset.ann_file": {"spec": f"{S3_TRAIN}/aicity.split)"},
    "dataset.val_dataset.ann_file": {"spec": f"{S3_EVAL}/aicity.split)"},
    "dataset.test_dataset.ann_file": {"spec": f"{S3_EVAL}/aicity.split)"},
    "dataset.quant_calibration_dataset.images_dir": f"{S3_TRAIN}",
}

Eval Dataset

Optional. Val/test splits configured via dataset ann_file paths.

Important Parameters

  • model.backbone: Backbone. Default resnet_101.
  • model.neck.out_channels: FPN output channels. Default 256. num_outs=4.
  • model.input_shape: Input image shape [W, H]. Default [1408, 512].
  • model.head.num_output: Number of detection output queries. Default 300.
  • model.head.num_decoder: Number of decoder layers. Default 6.
  • model.head.temporal: Enable temporal reasoning. Default True.
  • model.head.instance_bank.num_anchor: Instance bank anchors. Default 900.
  • model.head.instance_bank.num_temp_instances: Temporal instance count. Default 600.
  • model.depth_branch.loss_weight: Depth supervision loss weight. Default 0.2.
  • dataset.batch_size: Per-GPU batch size. Default 2.
  • dataset.num_frames: Sequence length. Default 200.
  • dataset.classes: Detection classes. Default [person, gr1_t2, agility_digit, nova_carter]. num_ids=70 for tracking.
  • train.optim.lr: Learning rate. Default 5e-5. img_backbone lr_mult=0.2.
  • train.lr_scheduler: Cosine scheduler with linear warmup (500 iters, ratio 0.333).
  • train.grad_clip.max_norm: Gradient clipping. Default 25.
  • train.precision: Options: bf16, fp16, fp32. Default bf16.
  • evaluate.metrics: Eval metrics. Default ["detection"]. Optional tracking evaluation.
  • evaluate.tracking.enabled: Enable tracking evaluation. tracking_threshold=0.2.

Multi-GPU / Multi-Node

Launch method: Lightning-managed (single python process, Lightning spawns workers).

Spec KeyDescriptionDefault
train.num_gpusNumber of GPUs1
train.gpu_idsGPU device indices[0]
train.num_nodesNumber of nodes1
  • Multi-GPU strategy: ddp_find_unused_parameters_true (no fsdp support)
  • sync_batchnorm is always enabled (True)
  • Iterations per epoch computed as: num_frames * num_bev_groups / (num_nodes * num_gpus * batch_size)
  • Scaling: When increasing GPUs, effective batch size grows and iterations-per-epoch shrinks proportionally

Multi-node env vars (set by orchestrator): WORLD_SIZE, NODE_RANK, MASTER_ADDR, MASTER_PORT, NUM_GPU_PER_NODE.

Hardware

Minimum 2 GPU(s), recommended 8 GPU(s). 40GB+ (A100 recommended) VRAM per GPU. Multi-camera temporal model is memory intensive. bf16 required for practical training. Multi-GPU strongly recommended. Instance bank requires substantial memory for temporal reasoning.

Error Patterns

dataset_convert required: Must run dataset_convert first to produce annotation pickles and anchor_init.npy.

Missing anchor file: Set model.head.instance_bank.anchor to the anchor_init.npy path from dataset_convert results.

Temporal OOM: Reduce dataset.num_frames or dataset.batch_size if running out of memory during temporal training.

Spec Param / Parent Model Inference

Model-specific inference mappings belong in this MD file, not in config.json. Generated runners should read this section and apply the mappings with SDK helpers before create_job(). This mirrors the old microservices infer_params.py flow.

Inference mappings from TAO Core sparse4d.config.json:

ActionSpec FieldInference FunctionMeaning
dataset_convertresults_diroutput_dircurrent job results directory
evaluateencryption_keykeyencryption key
evaluateevaluate.checkpointparent_modelmodel file inferred from the parent job results folder
evaluateresults_diroutput_dircurrent job results directory
exportencryption_keykeyencryption key
exportexport.checkpointparent_modelmodel file inferred from the parent job results folder
exportexport.onnx_filecreate_onnx_fileoutput ONNX path
exportresults_diroutput_dircurrent job results directory
inferenceencryption_keykeyencryption key
inferenceinference.checkpointparent_modelmodel file inferred from the parent job results folder
inferenceresults_diroutput_dircurrent job results directory
quantizeencryption_keykeyencryption key
quantizequantize.model_pathparent_modelmodel file inferred from the parent job results folder
quantizeresults_diroutput_dircurrent job results directory
trainencryption_keykeyencryption key
trainresults_diroutput_dircurrent job results directory
traintrain.pretrained_model_pathptm_if_no_resume_modelPTM when no resume checkpoint exists
traintrain.resume_training_checkpoint_pathresume_modelmodel file inferred from the current job results folder

For parent_model or parent_model_folder, pass the upstream train/export/AutoML child job id as parent_job_id. 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 config.json and do not patch generated runner scripts to guess checkpoint paths.

Comments

Markdown supported