nvidia/skills · Official

tao-train-image-classification

PyTorch-based TAO image classification. Supports a wide range of backbones (FAN, EfficientNet, ResNet, etc.) with distillation and quantization for deployment. Use when training, evaluating, distilling, quantizing, exporting, or running inference for a TAO image-classification (PyT) model. Trigger phrases include "train image classifier", "TAO classification", "ResNet/EfficientNet/FAN backbone classifier", "classification-pyt".

All-time #7432 First seen Jun 8, 2026
8-week activity · all time api

Installation

$ npx skills add nvidia/skills --skill tao-train-image-classification

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from nvidia/skills · top by installs.

npx skills add nvidia/skills

Browse all from nvidia/skills

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

Stars 3.2K
License LICENSE-APACHE
Default branch main
Open issues 5
Status Active

Skill metadata

Parsed from SKILL.md frontmatter.

Version0.1.0
LicenseApache-2.0
CompatibilityRequires docker + nvidia-container-toolkit.
Allowed toolsRead Bash
More metadata
version
0.1.0
author
NVIDIA Corporation

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 13,101 B
  • docs SUMMARY.md 466 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 1,600 installs

SKILL.md

Classification PyT

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).

PyTorch image classification. Supports a wide range of backbones (FAN, EfficientNet, ResNet, etc.) with distillation and quantization for deployment.

Set model.backbone.pretrainedbackbonepath for backbone weights or train.pretrainedmodelpath for full model.

For TAO Deploy TensorRT actions (gentrtengine, TensorRT evaluate, and TensorRT inference), read references/tao-deploy-image-classification.md first. Deploy spec templates live in this skill's references/ folder with the spectemplatedeploy_*.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/spectemplate<action>.yaml from the schema top-level default field. AutoML enablement is declared at the model layer in references/skillinfo.yaml via automlenabled. Runnable AutoML for an action requires schemas/<action>.schema.json and references/spectemplate<action>.yaml to exist and parse. Use the packaged selected-action schema for automldefaultparameters, automldisabledparameters, 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/skillinfo.yaml and resolve the run override from either an explicit automlpolicy value or the user's workflow request. Use automlpolicy: 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 automlpolicy: off for this run only. When automlpolicy: on, automlenabled: true, and both schemas/train.schema.json and references/spectemplatetrain.yaml are packaged, route the train action through tao-skill-bank:tao-run-automl by default with this model's skilldir. Preserve workflow/application overrides for datasets, specs, output directories, GPU/platform settings, parent checkpoints, and automlpolicy. 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: image_classification
  • Formats: classification_pyt
  • Monitoring metric: valacc1

Per-Action Dataset Requirements

Action Spec Key Source Files List?
distill dataset.traindataset.imagesdir train_datasets images_train.tar.gz No
distill dataset.classes_file train_datasets classes.txt No
distill dataset.valdataset.imagesdir eval_dataset images_val.tar.gz No
evaluate dataset.valdataset.imagesdir eval_dataset images_val.tar.gz No
evaluate dataset.classes_file eval_dataset classes.txt No
evaluate dataset.testdataset.imagesdir inference_dataset images_test.tar.gz No
export dataset.root_dir train_datasets No
inference dataset.valdataset.imagesdir eval_dataset images_val.tar.gz No
inference dataset.classes_file eval_dataset classes.txt No
inference dataset.testdataset.imagesdir inference_dataset images_test.tar.gz No
quantize dataset.traindataset.imagesdir train_datasets images_train.tar.gz No
quantize dataset.classes_file train_datasets classes.txt No
quantize dataset.valdataset.imagesdir eval_dataset images_val.tar.gz No
quantize dataset.quantcalibrationdataset.images_dir calibration_dataset images_train.tar.gz No
train dataset.traindataset.imagesdir train_datasets images_train.tar.gz No
train dataset.classes_file train_datasets classes.txt No
train dataset.valdataset.imagesdir eval_dataset images_val.tar.gz 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.

TRAIN_IMAGES_DIR = "/workspace/data/extracted/train/images_train"
VAL_IMAGES_DIR = "/workspace/data/extracted/val/images_val"
TEST_IMAGES_DIR = "/workspace/data/extracted/test/images_test"
CLASSES_FILE = "/workspace/data/s3/classes.txt"

For local Docker, download the S3 archives, extract them first, and point dataset.*.imagesdir at the extracted class-root folder. Do not pass imagestrain.tar.gz, imagesval.tar.gz, or imagestest.tar.gz directly to local Docker specs; the skill metadata declares these inputs as folders.

train (mandatory data sources):

{
    "train.num_epochs": 2,
    "train.validation_interval": 2,
    "train.checkpoint_interval": 2,
    "train.num_gpus": 1,
    "dataset.train_dataset.images_dir": TRAIN_IMAGES_DIR,
    "dataset.classes_file": CLASSES_FILE,
    "dataset.val_dataset.images_dir": VAL_IMAGES_DIR,
}

export (mandatory data sources):

{
    "export.input_height": 224,
    "export.input_width": 224,
    "dataset.root_dir": "/workspace/data/extracted",
}

gentrtengine:

{
    "gen_trt_engine.tensorrt.data_type": "fp16",
}

inference (mandatory data sources):

{
    "dataset.batch_size": 1,
    "dataset.val_dataset.images_dir": VAL_IMAGES_DIR,
    "dataset.classes_file": CLASSES_FILE,
    "dataset.test_dataset.images_dir": TEST_IMAGES_DIR,
}

distill (mandatory data sources):

{
    "dataset.train_dataset.images_dir": TRAIN_IMAGES_DIR,
    "dataset.classes_file": CLASSES_FILE,
    "dataset.val_dataset.images_dir": VAL_IMAGES_DIR,
    "train.optim.policy": "step",
}

evaluate (mandatory data sources):

{
    "dataset.val_dataset.images_dir": VAL_IMAGES_DIR,
    "dataset.classes_file": CLASSES_FILE,
    "dataset.test_dataset.images_dir": TEST_IMAGES_DIR,
}

quantize (mandatory data sources):

{
    "dataset.train_dataset.images_dir": TRAIN_IMAGES_DIR,
    "dataset.classes_file": CLASSES_FILE,
    "dataset.val_dataset.images_dir": VAL_IMAGES_DIR,
    "dataset.quant_calibration_dataset.images_dir": TRAIN_IMAGES_DIR,
}

Eval Dataset

Optional. Validation images are provided as a separate tar alongside training images. For small smoke datasets that do not provide a separate imagestest.tar.gz, set dataset.testdataset.images_dir to the validation archive so evaluate and inference still exercise the checkpoint handoff.

Important Parameters

  • dataset.num_classes: Number of classes. Default 20. Must match the number of subdirectories in your image tarballs.
  • model.backbone.type: Default fansmall12p4hybrid. Supported backbones and their head inchannels (from modelparamsmapping.py): FAN: fantiny, fansmall12p4hybrid, fanbase16p4hybrid, fanlarge16p4hybrid. GCViT: gcvittiny through gcvitlarge. FasterViT: fastervit0 through fastervit6. ViT/EVA/DINO: vitlargepatch14dinov2, eva02large_patch14, etc. SigLIP-CLIPA: ViT-H-14-SigLIP-CLIPA-224, etc. Some backbones require non-default input resolution (384, 512, 768).
  • dataset.classes_file: Path to classes.txt listing class names.
  • train.optim.lr: Learning rate. Default 6e-5.
  • dataset.img_size: Input image size. Default 224.
  • dataset.batch_size: Per-GPU batch size. Default 8.

Multi-GPU / Multi-Node

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

Spec Key Description Default
train.num_gpus Number of GPUs 1
train.gpu_ids GPU device indices [0]
train.num_nodes Number of nodes 1
  • Multi-GPU strategy: ddpfindunusedparameterstrue
  • No fsdp support

Multi-node env vars (set by orchestrator): WORLDSIZE, NODERANK, MASTERADDR, MASTERPORT, NUMGPUPER_NODE.

Hardware

Minimum 1 GPU(s), recommended 2 GPU(s). 16GB+ (V100 or A100) VRAM per GPU. Classification is generally lightweight. Most backbones at 224x224 fit well on 16GB GPUs with batch_size=8.

Error Patterns

CUDA out of memory: Reduce batch_size or use a smaller backbone.

numclasses mismatch: Ensure dataset.numclasses matches the actual class directories in your image tarballs and classes.txt.

Empty class directory: Every class in classes.txt must have at least one image in the corresponding subdirectory.

Distill scheduler default: The bundled distill template and schema use train.optim.policy: step. Keep that setting for distill specs unless the container implementation is updated; the 7.0 PyT distiller does not assign a scheduler interval for train.optim.policy: linear.

Checkpoint handoff: Training produces modelepoch*.pth checkpoints and a classifiermodellatest.pth symlink. For evaluate, inference, export, quantize, distill, and resume, select the exact intended epoch checkpoint through the SDK resolver; use the latest symlink only when the user explicitly requests latest.

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 createjob(). This mirrors the old microservices inferparams.py flow.

Inference mappings from TAO Core classification_pyt.config.json:

Action Spec Field Inference Function Meaning
distill distill.pretrainedteachermodel_path parent_model model file inferred from the parent job results folder
distill results_dir output_dir current job results directory
evaluate evaluate.checkpoint parent_model model file inferred from the parent job results folder
evaluate results_dir output_dir current job results directory
export export.checkpoint parent_model model file inferred from the parent job results folder
export export.onnx_file createonnxfile output ONNX path
export results_dir output_dir current job results directory
gentrtengine gentrtengine.onnx_file parent_model model file inferred from the parent job results folder
gentrtengine gentrtengine.trt_engine createenginefile output TensorRT engine path
gentrtengine results_dir output_dir current job results directory
inference inference.checkpoint parent_model model file inferred from the parent job results folder
inference inference.trt_engine parent_model model file inferred from the parent job results folder
inference results_dir output_dir current job results directory
quantize quantize.model_path parent_model model file inferred from the parent job results folder
quantize results_dir output_dir current job results directory
train model.backbone.pretrainedbackbonepath ptmifnoresumemodel PTM when no resume checkpoint exists
train results_dir output_dir current job results directory
train train.pretrainedmodelpath ptmifnoresumemodel PTM when no resume checkpoint exists
train train.resumetrainingcheckpoint_path resume_model model file inferred from the current job results folder

For parentmodel or parentmodelfolder, pass the upstream train/export/AutoML child job id as parentjob_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

  • [tao-deploy-image-classification](references/tao-deploy-image-classification.md)