Generated banner for Tao Train Metric Learning Recognition
Generated logo for Tao Train Metric Learning Recognition

Tao Train Metric Learning Recognition

NVIDIAOfficialCreated by NVIDIA Corporation

  • Skill
  • Tool integration
  • Data and AI
  • Apache-2.0
  • Medium risk

From the author

Metric-learning recognition (ml-recog) for fine-grained visual recognition. Learns embeddings for retrieval-based matching (e.g., retail product recognition) using triplet / contrastive losses. Use when training, evaluating, exporting, or running inference for a TAO metric-learning recognition model. Trigger phrases include "train metric learning", "ml-recog", "retrieval embeddings", "triplet loss recognition", "fine-grained matching".
— the description by NVIDIA Corporation

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a comprehensive workflow for training, evaluating, and deploying metric-learning recognition models. It is designed for fine-grained visual recognition tasks, such as retail product identification, by learning embeddings that facilitate retrieval-based matching. The workflow supports AutoML-enabled training, model evaluation using Precision at Rank 1 metrics, and export for deployment via TensorRT.

What it does

  • Trains metric-learning recognition models using triplet or contrastive losses.
  • Supports AutoML-driven hyperparameter optimization for model training.
  • Evaluates model performance using retrieval-based metrics like Precision at Rank 1.
  • Exports trained models to ONNX format for downstream deployment.
  • Provides integration with TAO Deploy for TensorRT engine generation and inference.
  • Manages dataset requirements for reference and query image sets.

When to use it

  • When building a system for fine-grained visual retrieval or product recognition.
  • When you need to train a model that learns robust embeddings for similarity matching.
  • When you want to leverage AutoML to optimize training parameters for recognition tasks.
  • When deploying models to production environments requiring TensorRT acceleration.

Advantages

  • Optimized for retrieval-based matching tasks.
  • Automated hyperparameter tuning simplifies the training process.
  • Supports standard industry backbones like ResNet and FAN.
  • Seamless transition from training to TensorRT-optimized deployment.

Usage examples

“Train a metric learning recognition model using the default ResNet-50 backbone.”
The agent initiates a training job using the specified dataset paths and default hyperparameters, maximizing Precision at Rank 1.
“Evaluate my trained model on the test dataset.”
The agent runs an evaluation job comparing the model's embeddings against the provided reference and query sets, outputting the final Precision at Rank 1 score.

Install

  1. Download the skill as a ZIP:

    https://mp-staging.autogineer.com/agent-skills/nvidia/tao-train-metric-learning-recognition/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip tao-train-metric-learning-recognition.zip -d .agents/skills

Documentation by NVIDIA Corporation

ML Recog

Standalone install? If this session was not initialized by the TAO skill bank plugin, run the tao-setup skill first (host preflight, credentials, cross-skill discovery).

Metric learning recognition for fine-grained visual recognition. Learns embeddings for retrieval-based matching (e.g., retail product recognition). Uses triplet/contrastive losses.

Set model.pretrained_model_path for pretrained backbone.

For TAO Deploy TensorRT actions (gen_trt_engine, TensorRT evaluate, and TensorRT inference), read references/tao-deploy-metric-learning-recognition.md first. Deploy spec templates live in this skill's references/ folder with the spec_template_deploy_*.yaml prefix.

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 for an action requires schemas/<action>.schema.json and references/spec_template_<action>.yaml to exist and parse. Use the packaged selected-action 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. Use automl_policy: on by default and only expose on / off in new launch prompts. Treat phrases like "turn off AutoML", "disable AutoML", "no HPO", or "plain training" as automl_policy: off for this run only. When automl_policy: on, 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: ml_recog

  • Formats: default

  • Monitoring metric: val Precision at Rank 1

  • AutoML metric contract: Use val Precision at Rank 1 emitted during training and maximize it. Use test Precision at Rank 1 only for standalone selected-checkpoint validation.

  • Standalone evaluation metric: test Precision at Rank 1. Use the training val Precision at Rank 1 KPI for AutoML recommendation ranking and the test KPI only to verify the selected checkpoint on the evaluation reference/query split.

Per-Action Dataset Requirements
ActionSpec KeySourceFilesList?
evaluatedataset.val_datasettrain_datasetsreference: metric_learning_recognition/retail-product-checkout-dataset_classification_demo/unknown_classes/reference.tar.gz, query: metric_learning_recognition/retail-product-checkout-dataset_classification_demo/unknown_classes/test.tar.gzNo
inferencedataset.val_datasettrain_datasetsreference: metric_learning_recognition/retail-product-checkout-dataset_classification_demo/unknown_classes/reference.tar.gz, query:No
inferenceinference.input_pathtrain_datasetsmetric_learning_recognition/retail-product-checkout-dataset_classification_demo/unknown_classes/test.tar.gzNo
traindataset.train_datasettrain_datasetsmetric_learning_recognition/retail-product-checkout-dataset_classification_demo/known_classes/train.tar.gzNo
traindataset.val_datasettrain_datasetsreference: metric_learning_recognition/retail-product-checkout-dataset_classification_demo/known_classes/reference.tar.gz, query: metric_learning_recognition/retail-product-checkout-dataset_classification_demo/known_classes/val.tar.gzNo
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"

train (mandatory data sources):

{
    "train.num_epochs": 30,
    "train.checkpoint_interval": 10,
    "train.validation_interval": 10,
    "train.num_gpus": 1,
    "dataset.train_dataset": f"{S3_TRAIN}/metric_learning_recognition/retail-product-checkout-dataset_classification_demo/known_classes/train.tar.gz",
    "dataset.val_dataset": {"reference": f"{S3_TRAIN}/metric_learning_recognition/retail-product-checkout-dataset_classification_demo/known_classes/reference.tar.gz", "query": f"{S3_TRAIN}/metric_learning_recognition/retail-product-checkout-dataset_classification_demo/known_classes/val.tar.gz"},
}

evaluate (mandatory data sources):

{
    "evaluate.checkpoint": "<selected train/AutoML checkpoint>",
    "dataset.val_dataset": {"reference": f"{S3_TRAIN}/metric_learning_recognition/retail-product-checkout-dataset_classification_demo/unknown_classes/reference.tar.gz", "query": f"{S3_TRAIN}/metric_learning_recognition/retail-product-checkout-dataset_classification_demo/unknown_classes/test.tar.gz"},
}

inference (mandatory data sources):

{
    "inference.checkpoint": "<selected train/AutoML checkpoint>",
    "dataset.val_dataset": {"reference": f"{S3_TRAIN}/metric_learning_recognition/retail-product-checkout-dataset_classification_demo/unknown_classes/reference.tar.gz"},
    "inference.input_path": f"{S3_TRAIN}/metric_learning_recognition/retail-product-checkout-dataset_classification_demo/unknown_classes/test.tar.gz",
}

Eval Dataset

Required. Evaluation requires reference and query datasets for retrieval metrics.

Important Parameters

  • model.backbone: Default resnet_50. Options: resnet_50, resnet_101, fan_small, fan_base, fan_large, fan_tiny, nvdinov2_vit_large_legacy.

  • model.feat_dim: Embedding dimension. Default 256. Output feature vector size for similarity matching.

  • train.batch_size: Per-GPU batch size. Default 4. val_batch_size also 4. For training and AutoML search, train.batch_size must be divisible by dataset.num_instance.

  • dataset.num_instance: Instances per identity in a batch (P/K sampling). Default 4. Controls how many images of the same class appear together. If using a custom AutoML range for train.batch_size, use explicit options that are multiples of this value.

  • train.optim.trunk.base_lr: Learning rate for the trunk (backbone). Default 3.5e-4 (Adam).

  • train.optim.embedder.base_lr: Learning rate for the embedding head. Default 3.5e-4.

  • train.optim.triplet_loss_margin: Margin for triplet loss. Default 0.3. smooth_loss=True by default.

  • train.optim.miner_function_margin: Hard mining margin. Default 0.1. Controls pair mining difficulty.

  • train.optim.steps: LR decay steps. Default [40, 70] with gamma=0.1.

  • dataset.train_dataset: Path to training images organized in class folders.

  • dataset.val_dataset: Dict with 'reference' and 'query' keys pointing to ImageNet-format directories for retrieval evaluation.

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]
  • Strategy: auto (Lightning picks best strategy automatically)

  • No explicit num_nodes or distributed_strategy config — single-node oriented

Hardware

Minimum 1 GPU(s), recommended 2 GPU(s). 16GB+ VRAM per GPU. Metric learning benefits from larger batch sizes for better triplet sampling but is otherwise moderate on memory.

Error Patterns

Reference/query mismatch: Ensure reference and query datasets share compatible class namespaces for evaluation.

PyTorch 2.6 checkpoint load failure on checkpoint actions: Current TAO ML-Recog checkpoints may contain OmegaConf objects. For checkpoints produced by the same trusted TAO train/AutoML workflow, set TORCH_FORCE_NO_WEIGHTS_ONLY_LOAD=1 in downstream evaluate, inference, export, or resume/retrain job env vars so Lightning can load the full checkpoint. Do not use this env var for untrusted checkpoints.

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 ml_recog.config.json:

ActionSpec FieldInference FunctionMeaning
evaluateevaluate.checkpointparent_modelmodel file inferred from the parent job results folder
evaluateresults_diroutput_dircurrent job results directory
exportexport.checkpointparent_modelmodel file inferred from the parent job results folder
exportexport.onnx_filecreate_onnx_fileoutput ONNX path
exportresults_diroutput_dircurrent job results directory
inferenceinference.checkpointparent_modelmodel file inferred from the parent job results folder
inferenceresults_diroutput_dircurrent job results directory
trainmodel.pretrained_model_pathptm_if_no_resume_modelPTM when no resume checkpoint exists
trainresults_diroutput_dircurrent job results directory
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.

Deployment

Files

schemas/export.schema.json

{
  "automl_default_parameters": [
    "train.optim.gamma",
    "train.optim.trunk.base_lr",
    "train.optim.warmup_factor",
    "train.optim.embedder.bias_lr_factor",
    "train.optim.trunk.weight_decay",
    "train.optim.embedder.weight_decay",
    "train.optim.embedder.momentum",
    "train.optim.embedder.weight_decay_bias",
    "train.optim.trunk.momentum",
    "train.optim.trunk.bias_lr_factor",
    "train.optim.embedder.base_lr",
    "train.optim.trunk.weight_decay_bias",
    "train.optim.warmup_iters",
    "train.optim.miner_function_margin",
    "train.optim.triplet_loss_margin"
  ],
  "automl_disabled_parameters": [
    "train.cudnn",
    "gen_trt_engine.tensorrt.calibration.cal_image_dir",
    "train.optim.embedder",
    "train.gpu_ids",
    "dataset.gaussian_blur.sigma",
    "wandb.tags",
    "dataset.pixel_mean",
    "evaluate",
    "inference",
    "train",
    "gen_trt_engine",
    "gen_trt_engine.tensorrt.layers_precision",
    "dataset",
    "gen_trt_engine.tensorrt",
    "train.optim.trunk",
    "dataset.pixel_std",
    "dataset.val_dataset",
    "dataset.gaussian_blur.kernel",
    "model",
    "dataset.color_augmentation",
    "evaluate.gpu_ids",
    "train.optim",
    "dataset.gaussian_blur",
    "gen_trt_engine.tensorrt.calibration",
    "train.optim.steps",
    "export",
    "wandb",
    "inference.gpu_ids"
  ],
  "default": {
    "dataset": {
      "color_augmentation": {
        "brightness": 0.5,
        "contrast": 0.3,
        "enabled": true,
        "hue": 0.1,
        "saturation": 0.1
      },
      "gaussian_blur": {
        "enabled": true,
        "kernel": [
          15,
          15
        ],
        "sigma": [
          0.3,
          0.7
        ]
      },
      "num_instance": 4,
      "pixel_mean": [
        0.485,
        0.456,
        0.406
      ],
      "pixel_std": [
        0.226,
        0.226,
        0.226
      ],
      "prob": 0.5,
      "random_rotation": false,
      "re_prob": 0.5,
      "train_dataset": "",
      "val_dataset": {},
      "workers": 8
    },
    "encryption_key": "",
    "export": {
      "batch_size": -1,
      "gpu_id": 0,
      "on_cpu": false,
      "opset_version": 14,
      "verbose": true
    },
    "model": {
      "backbone": "resnet_50",
      "feat_dim": 256,
      "input_channels": 3,
      "input_height": 224,
      "input_width": 224
    },
    "model_name": "",
    "results_dir": "",
    "train": {
      "batch_size": 4,
      "checkpoint_interval": 1,
      "checkpoint_interval_unit": "epoch",
      "clip_grad_norm": 0.0,
      "cudnn": {
        "benchmark": false,
        "deterministic": true
      },
      "gpu_ids": [
        0
      ],
      "num_epochs": 10,
      "num_gpus": 1,
      "num_nodes": 1,
      "optim": {
        "embedder": {
          "base_lr": 0.00035,
          "bias_lr_factor": 1.0,
          "momentum": 0.9,
          "weight_decay": 0.0005,
          "weight_decay_bias": 0.0005
        },
        "gamma": 0.1,
        "miner_function_margin": 0.1,
        "name": "Adam",
        "steps": [
          40,
          70
        ],
        "triplet_loss_margin": 0.3,
        "trunk": {
          "base_lr": 0.00035,
          "bias_lr_factor": 1.0,
          "momentum": 0.9,
          "weight_decay": 0.0005,
          "weight_decay_bias": 0.0005
        },
        "warmup_factor": 0.01,
        "warmup_iters": 10,
        "warmup_method": "linear"
      },
      "report_accuracy_per_class": true,
      "results_dir": "",
      "resume_training_checkpoint_path": "",
      "seed": 1234,
      "smooth_loss": true,
      "train_embedder": true,
      "train_trunk": true,
      "val_batch_size": 4,
      "validation_interval": 1
    },
    "wandb": {
      "enable": true,
      "entity": "",
      "group": "",
      "name": "TAO Toolkit Training",
      "project": "TAO Toolkit",
      "reinit": false,
      "run_id": "",
      "save_code": false,
      "sync_tensorboard": false,
      "tags": [
        "tao-toolkit"
      ]
    }
  },
  "popular": {
    "evaluate": {
      "gpu_ids": [
        0
      ],
      "num_gpus": 1,
      "num_nodes": 1
    },
    "gen_trt_engine": {
      "batch_size": -1,
      "gpu_id": 0,
      "tensorrt": {
        "calibration": {
          "cal_batch_size": 1,
          "cal_batches": 1
        },
        "max_batch_size": 1,
        "min_batch_size": 1,
        "opt_batch_size": 1
      }
    },
    "inference": {
      "gpu_ids": [
        0
      ],
      "num_gpus": 1,
      "num_nodes": 1
    },
    "train": {
      "checkpoint_interval": 1,
      "gpu_ids": [
        0
      ],
      "num_epochs": 10,
      "num_gpus": 1,
      "num_nodes": 1,
      "validation_interval": 1
    }
  },
  "properties": {
    "automl_disabled_parameters": [
      "wandb",
      "train",
      "model",
      "evaluate",
      "dataset",
      "export",
      "gen_trt_engine",
      "inference"
    ],
    "dataset": {
      "automl_disabled_parameters": [
        "dataset.val_dataset",
        "dataset.pixel_mean",
        "dataset.pixel_std",
        "dataset.gaussian_blur",
        "dataset.color_augmentation"
      ],
      "automl_enabled": false,
      "default": {
        "color_augmentation": {
          "brightness": 0.5,
          "contrast": 0.3,
          "enabled": true,
          "hue": 0.1,
          "saturation": 0.1
        },
        "gaussian_blur": {
          "enabled": true,
          "kernel": [
            15,
            15
          ],
          "sigma": [
            0.3,
            0.7
          ]
        },
        "num_instance": 4,
        "pixel_mean": [
          0.485,
          0.456,
          0.406
        ],
        "pixel_std": [
          0.226,
          0.226,
          0.226
        ],
        "prob": 0.5,
        "random_rotation": false,
        "re_prob": 0.5,
        "train_dataset": "",
        "val_dataset": {},
        "workers": 8
      },
      "description": "The dataset configuration for the experiment.",
      "properties": {
        "class_map": {
          "description": "[Optional] a YAML file mapping dataset class names to desired class names.\n                    If not specified, by default the reported class names are the folder names\n                    in the dataset folder.",
          "title": "class_map",
          "type": "string"
        },
        "color_augmentation": {
          "automl_enabled": false,
          "default": {
            "brightness": 0.5,
            "contrast": 0.3,
            "enabled": true,
            "hue": 0.1,
            "saturation": 0.1
          },
          "description": "The color augmentation configuration for the model.",
          "properties": {
            "brightness": {
              "default": 0.5,
              "description": "The value of jittering brightness",
              "maximum": 2.0,
              "minimum": 0.0,
              "title": "brightness",
              "type": "float"
            },
            "contrast": {
              "default": 0.3,
              "description": "The value of jittering contrast",
              "maximum": 2.0,
              "minimum": 0.0,
              "title": "contrast",
              "type": "float"
            },
            "enabled": {
              "default": true,
              "description": "Flag to add color augmentation to dataloader or not.",
              "title": "enabled",
              "type": "bool"
            },
            "hue": {
              "default": 0.1,
              "description": "The value of jittering hue",
              "maximum": 0.5,
              "minimum": 0.0,
              "title": "hue",
              "type": "float"
            },
            "saturation": {
              "default": 0.1,
              "description": "The value of jittering saturation",
              "maximum": 2.0,
              "minimum": 0.0,
              "title": "saturation",
              "type": "float"
            }
          },
          "title": "color augmentation",
          "type": "collection"
        },
        "gaussian_blur": {
          "automl_disabled_parameters": [
            "dataset.gaussian_blur.kernel",
            "dataset.gaussian_blur.sigma"
          ],
          "automl_enabled": false,
          "default": {
            "enabled": true,
            "kernel": [
              15,
              15
            ],
            "sigma": [
              0.3,
              0.7
            ]
          },
          "description": "The Gaussian blur configuration for the model.",
          "properties": {
            "enabled": {
              "default": true,
              "description": "Flag to add gaussian blur to dataloader or not.",
              "title": "enabled",
              "type": "bool"
            },
            "kernel": {
              "automl_enabled": false,
              "default": [
                15,
                15
              ],
              "depends_on": "model.input_height,model.input_width",
              "description": "The kernel size for the Gaussian blur.",
              "title": "kernel",
              "type": "list_3"
            },
            "sigma": {
              "automl_enabled": false,
              "default": [
                0.3,
                0.7
              ],
              "description": "The sigma value range for the Gaussian blur.",
              "title": "sigma",
              "type": "list"
            }
          },
          "title": "gaussian_blur",
          "type": "collection"
        },
        "num_instance": {
          "default": 4,
          "description": "The number of image instances of the same object in a batch",
          "title": "num_instance",
          "type": "int"
        },
        "pixel_mean": {
          "automl_enabled": false,
          "default": [
            0.485,
            0.456,
            0.406
          ],
          "description": "The pixel mean for image normalization.",
          "title": "pixel mean",
          "type": "list"
        },
        "pixel_std": {
          "automl_enabled": false,
          "default": [
            0.226,
            0.226,
            0.226
          ],
          "description": "The pixel standard deviation for image normalization.",
          "title": "pixel std",
          "type": "list"
        },
        "prob": {
          "default": 0.5,
          "description": "The random horizontal flipping probability for image augmentation",
          "math_cond": "> 0.0",
          "title": "random horizontal flipping probability",
          "type": "float"
        },
        "random_rotation": {
          "default": false,
          "description": "If True, random rotations at 0 ~ 180 degrees to the input data are applied",
          "title": "random rotation augmentation",
          "type": "bool"
        },
        "re_prob": {
          "default": 0.5,
          "description": "The random erasing probability for image augmentation",
          "math_cond": "> 0.0",
          "title": "random erasing probability",
          "type": "float"
        },
        "train_dataset": {
          "default": "",
          "description": "The path to the train dataset. This field is only required for the train task.",
          "title": "train dataset",
          "type": "string"
        },
        "val_dataset": {
          "automl_enabled": false,
          "description": "The map of reference set and query set addresses:\n                    * reference : The directory that contains the ImageNet format reference images\n                    * query : The directory that contains the ImageNet format query images",
          "title": "validation dataset",
          "type": "collection"
        },
        "workers": {
          "default": 8,
          "description": "The number of parallel workers processing data",
          "title": "workers",
          "type": "int"
        }
      },
      "title": "dataset",
      "type": "collection"
    },
    "encryption_key": {
      "default": "",
      "description": "Key for encrypting model checkpoints",
      "title": "Encryption key",
      "type": "string"
    },
    "export": {
      "automl_enabled": false,
      "default": {
        "batch_size": -1,
        "gpu_id": 0,
        "on_cpu": false,
        "opset_version": 14,
        "verbose": true
      },
      "description": "The export configuration for the model.",
      "properties": {
        "batch_size": {
          "default": -1,
          "description": "The export batch size. -1 as dynamic batch size",
          "title": "batch size",
          "type": "int"
        },
        "checkpoint": {
          "description": "[Optional] The path to the .pth torch model to export.",
          "title": "checkpoint",
          "type": "string"
        },
        "gpu_id": {
          "default": 0,
          "description": "The GPU ID for export. Currently, export is only supported on a single GPU.",
          "title": "gpu id",
          "type": "int"
        },
        "on_cpu": {
          "default": false,
          "description": "If True, the Torch-to-ONNX export will be performed on CPU",
          "title": "on cpu",
          "type": "bool"
        },
        "onnx_file": {
          "description": "[Optional] The path to the exported ONNX file. If this value is not\n                    specified, it defaults to model.onnx in export.results_dir",
          "title": "onnx_file",
          "type": "string"
        },
        "opset_version": {
          "default": 14,
          "description": "The version of the default (ai.onnx) opset to target.",
          "title": "opset version",
          "type": "int"
        },
        "results_dir": {
          "description": "\n        [Optional] Path to where export assets generated from a task are stored.\n        ",
          "title": "Results directory",
          "type": "string"
        },
        "verbose": {
          "default": true,
          "description": "If True, prints a description of the model being exported to stdout.",
          "title": "verbose",
          "type": "bool"
        }
      },
      "title": "export",
      "type": "collection"
    },
    "model": {
      "automl_enabled": false,
      "default": {
        "backbone": "resnet_50",
        "feat_dim": 256,
        "input_channels": 3,
        "input_height": 224,
        "input_width": 224
      },
      "description": "The model configuration for the experiment.",
      "properties": {
        "backbone": {
          "default": "resnet_50",
          "description": "The backbone name of the model",
          "enum": [
            "resnet_50",
            "resnet_101",
            "fan_small",
            "fan_base",
            "fan_large",
            "fan_tiny",
            "nvdinov2_vit_large_legacy"
          ],
          "title": "backbone",
          "type": "categorical"
        },
        "feat_dim": {
          "default": 256,
          "description": "The output size of the feature embeddings.",
          "title": "feature dimension",
          "type": "int"
        },
        "input_channels": {
          "default": 3,
          "description": "The number of input channels.",
          "title": "input_channels",
          "type": "int"
        },
        "input_height": {
          "default": 224,
          "description": "The input height of the images.",
          "parent_param": "TRUE",
          "title": "input_height",
          "type": "int"
        },
        "input_width": {
          "default": 224,
          "description": "The input width of the images.",
          "parent_param": "TRUE",
          "title": "input_width",
          "type": "int"
        },
        "pretrained_embedder_path": {
          "description": "[Optional] Path to the pretrained embedder. The weights are only loaded to the embedder part.",
          "title": "pretrained_embedder_path",
          "type": "string"
        },
        "pretrained_model_path": {
          "description": "[Optional] Path to the pretrained model. The weights are only loaded to the whole model.",
          "title": "pretrained model path",
          "type": "string"
        },
        "pretrained_trunk_path": {
          "description": "[Optional] Path to the pretrained trunk. The weights are only loaded to the trunk part.",
          "title": "pretrained_trunk_path",
          "type": "string"
        }
      },
      "title": "model",
      "type": "collection"
    },
    "model_name": {
      "default": "",
      "description": "Name of model if invoking task via :code:`model_agnostic`",
      "title": "Model name",
      "type": "string"
    },
    "results_dir": {
      "default": "",
      "description": "\n        Path to where all the assets generated from a task are stored.\n        ",
      "title": "Results directory",
      "type": "string"
    },
    "train": {
      "automl_disabled_parameters": [
        "train.gpu_ids",
        "train.cudnn",
        "train.optim"
      ],
      "automl_enabled": false,
      "default": {
        "batch_size": 4,
        "checkpoint_interval": 1,
        "checkpoint_interval_unit": "epoch",
        "clip_grad_norm": 0.0,
        "cudnn": {
          "benchmark": false,
          "deterministic": true
        },
        "gpu_ids": [
          0
        ],
        "num_epochs": 10,
        "num_gpus": 1,
        "num_nodes": 1,
        "optim": {
          "embedder": {
            "base_lr": 0.00035,
            "bias_lr_factor": 1.0,
            "momentum": 0.9,
            "weight_decay": 0.0005,
            "weight_decay_bias": 0.0005
          },
          "gamma": 0.1,
          "miner_function_margin": 0.1,
          "name": "Adam",
          "steps": [
            40,
            70
          ],
          "triplet_loss_margin": 0.3,
          "trunk": {
            "base_lr": 0.00035,
            "bias_lr_factor": 1.0,
            "momentum": 0.9,
            "weight_decay": 0.0005,
            "weight_decay_bias": 0.0005
          },
          "warmup_factor": 0.01,
          "warmup_iters": 10,
          "warmup_method": "linear"
        },
        "report_accuracy_per_class": true,
        "results_dir": "",
        "resume_training_checkpoint_path": "",
        "seed": 1234,
        "smooth_loss": true,
        "train_embedder": true,
        "train_trunk": true,
        "val_batch_size": 4,
        "validation_interval": 1
      },
      "description": "The training configuration for the model.",
      "popular": [
        "validation_interval",
        "checkpoint_interval",
        "num_gpus",
        "num_nodes",
        "num_epochs",
        "gpu_ids"
      ],
      "properties": {
        "batch_size": {
          "default": 4,
          "description": "The train batch size",
          "title": "batch_size",
          "type": "int"
        },
        "checkpoint_interval": {
          "default": 1,
          "description": "The interval (in epochs) at which a checkpoint will be saved. Helps resume training.",
          "minimum": 1,
          "popular": true,
          "title": "Checkpoint interval",
          "type": "int"
        },
        "checkpoint_interval_unit": {
          "default": "epoch",
          "description": "The unit of the checkpoint interval.",
          "enum": [
            "epoch",
            "step"
          ],
          "title": "Checkpoint interval unit",
          "type": "categorical"
        },
        "clip_grad_norm": {
          "default": 0.0,
          "description": "The amount to clip the gradient by the L2 norm. A value of 0.0 specifies no clipping.",
          "math_cond": ">= 0.0",
          "title": "clip_grad_norm",
          "type": "float"
        },
        "cudnn": {
          "automl_enabled": false,
          "default": {
            "benchmark": false,
            "deterministic": true
          },
          "properties": {
            "benchmark": {
              "default": false,
              "type": "bool"
            },
            "deterministic": {
              "default": true,
              "type": "bool"
            }
          },
          "type": "collection"
        },
        "gpu_ids": {
          "automl_enabled": false,
          "default": [
            0
          ],
          "description": "\n        List of GPU IDs to run the training on. The length of this list\n        must be equal to the number of gpus in train.num_gpus.",
          "popular": true,
          "title": "GPU IDs",
          "type": "list"
        },
        "num_epochs": {
          "default": 10,
          "description": "Number of epochs to run the training.",
          "maximum": Infinity,
          "minimum": 1,
          "popular": true,
          "title": "Number of epochs",
          "type": "int"
        },
        "num_gpus": {
          "default": 1,
          "description": "The number of GPUs to run the train job.",
          "minimum": 1,
          "popular": true,
          "title": "Number of GPUs",
          "type": "int"
        },
        "num_nodes": {
          "default": 1,
          "description": "Number of nodes to run the training on. If > 1, then multi-node is enabled.",
          "minimum": 1,
          "popular": true,
          "title": "Number of nodes",
          "type": "int"
        },
        "optim": {
          "automl_default_parameters": [
            "train.optim.gamma",
            "train.optim.warmup_factor",
            "train.optim.warmup_iters",
            "train.optim.triplet_loss_margin",
            "train.optim.miner_function_margin"
          ],
          "automl_disabled_parameters": [
            "train.optim.steps",
            "train.optim.embedder",
            "train.optim.trunk"
          ],
          "automl_enabled": false,
          "default": {
            "embedder": {
              "base_lr": 0.00035,
              "bias_lr_factor": 1.0,
              "momentum": 0.9,
              "weight_decay": 0.0005,
              "weight_decay_bias": 0.0005
            },
            "gamma": 0.1,
            "miner_function_margin": 0.1,
            "name": "Adam",
            "steps": [
              40,
              70
            ],
            "triplet_loss_margin": 0.3,
            "trunk": {
              "base_lr": 0.00035,
              "bias_lr_factor": 1.0,
              "momentum": 0.9,
              "weight_decay": 0.0005,
              "weight_decay_bias": 0.0005
            },
            "warmup_factor": 0.01,
            "warmup_iters": 10,
            "warmup_method": "linear"
          },
          "description": "Training optimization config.",
          "properties": {
            "embedder": {
              "automl_default_parameters": [
                "train.optim.embedder.bias_lr_factor",
                "train.optim.embedder.base_lr",
                "train.optim.embedder.momentum",
                "train.optim.embedder.weight_decay",
                "train.optim.embedder.weight_decay_bias"
              ],
              "automl_enabled": false,
              "default": {
                "base_lr": 0.00035,
                "bias_lr_factor": 1.0,
                "momentum": 0.9,
                "weight_decay": 0.0005,
                "weight_decay_bias": 0.0005
              },
              "description": "The learning rate configuration for the embedder part of the model.",
              "properties": {
                "base_lr": {
                  "automl_enabled": true,
                  "default": 0.00035,
                  "description": "The initial learning rate for the training",
                  "math_cond": "> 0.0",
                  "maximum": 1.0,
                  "minimum": 0.0,
                  "title": "base lr",
                  "type": "float"
                },
                "bias_lr_factor": {
                  "automl_enabled": true,
                  "default": 1.0,
                  "description": "The bias learning rate factor for the WarmupMultiStepLR",
                  "math_cond": ">= 1",
                  "maximum": 10.0,
                  "minimum": 1.0,
                  "title": "bias lr factor",
                  "type": "float"
                },
                "momentum": {
                  "automl_enabled": true,
                  "default": 0.9,
                  "description": "The momentum for the WarmupMultiStepLR optimizer",
                  "math_cond": "> 0.0",
                  "maximum": 1.0,
                  "minimum": 0.0,
                  "title": "momentum",
                  "type": "float"
                },
                "weight_decay": {
                  "automl_enabled": true,
                  "default": 0.0005,
                  "description": "The weight decay coefficient for the optimizer",
                  "math_cond": "> 0.0",
                  "maximum": 1.0,
                  "minimum": 0.0,
                  "title": "weight_decay",
                  "type": "float"
                },
                "weight_decay_bias": {
                  "automl_enabled": true,
                  "default": 0.0005,
                  "description": "The weight decay bias for the optimizer",
                  "math_cond": "> 0.0",
                  "maximum": 1.0,
                  "minimum": 0.0,
                  "title": "weight_decay_bias",
                  "type": "float"
                }
              },
              "title": "embedder",
              "type": "collection"
            },
            "gamma": {
              "automl_enabled": true,
              "default": 0.1,
              "description": "The decay rate for the WarmupMultiStepLR scheduler",
              "math_cond": "> 0.0",
              "maximum": 1.0,
              "minimum": 0.0,
              "title": "gamma",
              "type": "float"
            },
            "miner_function_margin": {
              "automl_enabled": true,
              "default": 0.1,
              "description": "Negative pairs are chosen if they have similarity greater than the hardest\n                    positive pair, minus this margin; positive pairs are chosen if they have\n                    similarity less than the hardest negative pair, plus the margin",
              "math_cond": "> 0.0",
              "maximum": 2.0,
              "minimum": 0.0,
              "title": "triplet_loss_margin",
              "type": "float"
            },
            "name": {
              "default": "Adam",
              "description": "The name of the optimizer. The Algorithms in torch.optim are supported.",
              "enum": [
                "Adam",
                "SGD",
                "Adamax"
              ],
              "title": "name",
              "type": "categorical"
            },
            "steps": {
              "automl_enabled": false,
              "default": [
                40,
                70
              ],
              "description": "The steps to decrease the learning rate for the MultiStep scheduler.",
              "title": "steps",
              "type": "list"
            },
            "triplet_loss_margin": {
              "automl_enabled": true,
              "default": 0.3,
              "description": "The desired difference between the anchor-positive distance and the\n                    anchor-negative distance",
              "math_cond": "> 0.0",
              "maximum": 2.0,
              "minimum": 0.0,
              "title": "triplet_loss_margin",
              "type": "float"
            },
            "trunk": {
              "automl_default_parameters": [
                "train.optim.trunk.bias_lr_factor",
                "train.optim.trunk.base_lr",
                "train.optim.trunk.momentum",
                "train.optim.trunk.weight_decay",
                "train.optim.trunk.weight_decay_bias"
              ],
              "automl_enabled": false,
              "default": {
                "base_lr": 0.00035,
                "bias_lr_factor": 1.0,
                "momentum": 0.9,
                "weight_decay": 0.0005,
                "weight_decay_bias": 0.0005
              },
              "description": "The learning rate configuration for the trunk part of the model.",
              "properties": {
                "base_lr": {
                  "automl_enabled": true,
                  "default": 0.00035,
                  "description": "The initial learning rate for the training",
                  "math_cond": "> 0.0",
                  "maximum": 1.0,
                  "minimum": 0.0,
                  "title": "base lr",
                  "type": "float"
                },
                "bias_lr_factor": {
                  "automl_enabled": true,
                  "default": 1.0,
                  "description": "The bias learning rate factor for the WarmupMultiStepLR",
                  "math_cond": ">= 1",
                  "maximum": 10.0,
                  "minimum": 1.0,
                  "title": "bias lr factor",
                  "type": "float"
                },
                "momentum": {
                  "automl_enabled": true,
                  "default": 0.9,
                  "description": "The momentum for the WarmupMultiStepLR optimizer",
                  "math_cond": "> 0.0",
                  "maximum": 1.0,
                  "minimum": 0.0,
                  "title": "momentum",
                  "type": "float"
                },
                "weight_decay": {
                  "automl_enabled": true,
                  "default": 0.0005,
                  "description": "The weight decay coefficient for the optimizer",
                  "math_cond": "> 0.0",
                  "maximum": 1.0,
                  "minimum": 0.0,
                  "title": "weight_decay",
                  "type": "float"
                },
                "weight_decay_bias": {
                  "automl_enabled": true,
                  "default": 0.0005,
                  "description": "The weight decay bias for the optimizer",
                  "math_cond": "> 0.0",
                  "maximum": 1.0,
                  "minimum": 0.0,
                  "title": "weight_decay_bias",
                  "type": "float"
                }
              },
              "title": "trunk",
              "type": "collection"
            },
            "warmup_factor": {
              "automl_enabled": true,
              "default": 0.01,
              "description": "The warmup factor for the WarmupMultiStepLR scheduler",
              "math_cond": "> 0.0",
              "maximum": 1.0,
              "minimum": 0.0,
              "title": "warmup_factor",
              "type": "float"
            },
            "warmup_iters": {
              "automl_enabled": true,
              "default": 10,
              "description": "The number of warmup iterations for the WarmupMultiStepLR scheduler.",
              "math_cond": "> 0",
              "maximum": 10000,
              "minimum": 1,
              "title": "warmup_iters",
              "type": "int"
            },
            "warmup_method": {
              "default": "linear",
              "description": "The warmup method for the optimizer",
              "enum": [
                "linear",
                "constant"
              ],
              "title": "warmup_method",
              "type": "categorical"
            }
          },
          "title": "Optimization config",
          "type": "collection"
        },
        "report_accuracy_per_class": {
          "default": true,
          "description": "Flag to report accuracy per class at valiation or not.",
          "title": "report accuracy per class",
          "type": "bool"
        },
        "results_dir": {
          "default": "",
          "description": "\n        Path to where all the assets generated from a task are stored.\n        ",
          "title": "Results directory",
          "type": "string"
        },
        "resume_training_checkpoint_path": {
          "default": "",
          "description": "Path to the checkpoint to resume training from.",
          "title": "Resume checkpoint path",
          "type": "string"
        },
        "seed": {
          "default": 1234,
          "description": "The seed for the initializer in PyTorch. If < 0, disable fixed seed.",
          "maximum": Infinity,
          "minimum": -1,
          "title": "Seed for randomization",
          "type": "int"
        },
        "smooth_loss": {
          "default": true,
          "description": "Flag to smooth the triplet margin loss or not.",
          "title": "smooth_loss",
          "type": "bool"
        },
        "train_embedder": {
          "default": true,
          "description": "[Optional] If False, the embedder part of the model would be frozen during training",
          "title": "train_embedder",
          "type": "bool"
        },
        "train_trunk": {
          "default": true,
          "description": "[Optional] If False, the trunk part of the model would be frozen during training",
          "title": "train_trunk",
          "type": "bool"
        },
        "val_batch_size": {
          "default": 4,
          "description": "The validation batch size",
          "title": "val_batch_size",
          "type": "int"
        },
        "validation_interval": {
          "default": 1,
          "description": "\n        The interval (in epochs) at which a evaluation\n        will be triggered on the validation dataset.",
          "minimum": 1,
          "popular": true,
          "title": "Validation interval",
          "type": "int"
        }
      },
      "type": "collection"
    },
    "wandb": {
      "automl_disabled_parameters": [
        "wandb.tags"
      ],
      "automl_enabled": false,
      "default": {
        "enable": true,
        "entity": "",
        "group": "",
        "name": "TAO Toolkit Training",
        "project": "TAO Toolkit",
        "reinit": false,
        "run_id": "",
        "save_code": false,
        "sync_tensorboard": false,
        "tags": [
          "tao-toolkit"
        ]
      },
      "properties": {
        "enable": {
          "default": true,
          "type": "bool"
        },
        "entity": {
          "default": "",
          "type": "string"
        },
        "group": {
          "default": "",
          "type": "string"
        },
        "name": {
          "default": "TAO Toolkit Training",
          "type": "string"
        },
        "project": {
          "default": "TAO Toolkit",
          "type": "string"
        },
        "reinit": {
          "default": false,
          "type": "bool"
        },
        "run_id": {
          "default": "",
          "type": "string"
        },
        "save_code": {
          "default": false,
          "type": "bool"
        },
        "sync_tensorboard": {
          "default": false,
          "type": "bool"
        },
        "tags": {
          "automl_enabled": false,
          "default": [
            "tao-toolkit"
          ],
          "type": "list"
        }
      },
      "type": "collection"
    }
  },
  "type": "object",
  "x_tao_schema": {
    "action": "export",
    "core_module": "ml_recog",
    "model": "ml-recog",
    "network_arch": "ml_recog",
    "schema_action": "export",
    "schema_version": 1,
    "source": "tao-core dataclass config"
  }
}

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Declares allowed tools, Needs Python, Needs Node.js

The author says: Requires docker + nvidia-container-toolkit.

Security

What our scanner noticed· Medium risk

  • Large base64-encoded blobs

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Created by
NVIDIA Corporation
Publisher
NVIDIA (Official)
Source
NVIDIA/skills · skills/tao-train-metric-learning-recognition · commit fce3cca
Licence
Apache License 2.0 (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE-APACHE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by NVIDIA Corporation or NVIDIA.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download tao-train-metric-learning-recognition.zip