tao-train-optical-inspection
Original:🇺🇸 English
Translated
Optical Inspection for defect detection using Siamese networks. Compares image pairs to detect manufacturing defects, anomalies, or quality issues. Use when training, evaluating, exporting, or running inference for a TAO Optical Inspection model on AOI / quality-control data. Trigger phrases include "train optical inspection", "AOI defect detection", "Siamese defect classifier", "PCB / manufacturing inspection".
14installs
Sourcenvidia/skills
Added on
NPX Install
npx skill4agent add nvidia/skills tao-train-optical-inspectionTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Optical Inspection
Optical inspection for defect detection using Siamese networks. Compares image pairs to detect manufacturing defects, anomalies, or quality issues.
Set train.pretrained_model_path for pretrained Siamese weights.
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-optical-inspection.mdreferences/spec_template_deploy_*.yamlDataclass Schemas
Generated TAO Core schemas are packaged in , with listing available actions. Each generated schema also emits from the schema top-level field. AutoML enablement is declared at the model layer in via . Runnable AutoML still requires and to exist and parse. Use the packaged train schema for , , defaults, min/max bounds, enums, option weights, math conditions, dependencies, and popular parameters. Do not expect at runtime; maintainers regenerate schemas/templates before packaging the skill bank.
schemas/<action>.schema.jsonschemas/manifest.jsonreferences/spec_template_<action>.yamldefaultreferences/skill_info.yamlautoml_enabledschemas/train.schema.jsonreferences/spec_template_train.yamlautoml_default_parametersautoml_disabled_parameters~/tao-coreTrain 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_policyTraining Requirements
- Dataset type: optical_inspection
- Formats: default
- Monitoring metric: val_acc
Per-Action Dataset Requirements
| Action | Spec Key | Source | Files | List? |
|---|---|---|---|---|
| evaluate | dataset.test_dataset.images_dir | eval_dataset | images.tar.gz | No |
| evaluate | dataset.test_dataset.csv_path | eval_dataset | dataset.csv | No |
| gen_trt_engine | gen_trt_engine.tensorrt.calibration.cal_image_dir | calibration_dataset | images.tar.gz | Yes |
| inference | dataset.infer_dataset.images_dir | inference_dataset | images.tar.gz | No |
| inference | dataset.infer_dataset.csv_path | inference_dataset | dataset.csv | No |
| train | dataset.train_dataset.images_dir | train_datasets | images.tar.gz | No |
| train | dataset.train_dataset.csv_path | train_datasets | dataset.csv | No |
| train | dataset.validation_dataset.images_dir | eval_dataset | images.tar.gz | No |
| train | dataset.validation_dataset.csv_path | eval_dataset | dataset.csv | No |
| train | dataset.test_dataset.images_dir | eval_dataset | images.tar.gz | No |
| train | dataset.test_dataset.csv_path | eval_dataset | dataset.csv | 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_overridespython
S3_TRAIN = "s3://bucket/data/train"
S3_EVAL = "s3://bucket/data/eval"train (mandatory data sources):
python
{
"train.num_epochs": 30,
"train.checkpoint_interval": 10,
"train.validation_interval": 10,
"train.num_gpus": 1,
"dataset.train_dataset.images_dir": f"{S3_TRAIN}/images.tar.gz",
"dataset.train_dataset.csv_path": f"{S3_TRAIN}/dataset.csv",
"dataset.validation_dataset.images_dir": f"{S3_EVAL}/images.tar.gz",
"dataset.validation_dataset.csv_path": f"{S3_EVAL}/dataset.csv",
"dataset.test_dataset.images_dir": f"{S3_EVAL}/images.tar.gz",
"dataset.test_dataset.csv_path": f"{S3_EVAL}/dataset.csv",
}gen_trt_engine (mandatory data sources):
python
{
"gen_trt_engine.tensorrt.data_type": "fp16",
"gen_trt_engine.tensorrt.calibration.cal_image_dir": [f"{S3_TRAIN}/images.tar.gz"],
}evaluate (mandatory data sources):
python
{
"dataset.test_dataset.images_dir": f"{S3_EVAL}/images.tar.gz",
"dataset.test_dataset.csv_path": f"{S3_EVAL}/dataset.csv",
}inference (mandatory data sources):
python
{
"dataset.infer_dataset.images_dir": f"{S3_EVAL}/images.tar.gz",
"dataset.infer_dataset.csv_path": f"{S3_EVAL}/dataset.csv",
}Eval Dataset
Optional. Eval dataset uses same format (images + CSV).
Important Parameters
- model.model_type: Siamese variant. Options include Siamese, Siamese_3.
- model.model_backbone: Default custom.
- model.embedding_vectors: Number of embedding dimensions. Default 5.
- train.optim.lr: Learning rate. Default 5e-4.
- dataset.num_input: Number of input images per comparison.
- dataset.input_map: Mapping of input channels / image pairs.
Multi-GPU / Multi-Node
Launch method: Lightning-managed (single process, Lightning spawns workers).
python| Spec Key | Description | Default |
|---|---|---|
| Number of GPUs | 1 |
| GPU device indices | [0] |
- Strategy: (Lightning picks best strategy automatically)
auto - No explicit or
num_nodesconfig — single-node onlydistributed_strategy - Lightweight Siamese network, single GPU typically sufficient
Hardware
Minimum 1 GPU(s), recommended 1 GPU(s). 8GB+ VRAM per GPU. Siamese networks for inspection are lightweight. Single GPU sufficient.
Error Patterns
CSV format error: Ensure dataset.csv has the correct column format for image pair paths and labels.
Spec Param / Parent Model Inference
Model-specific inference mappings belong in this MD file, not in . Generated runners should read this section and apply the mappings with SDK helpers before . This mirrors the old microservices flow.
config.jsoncreate_job()infer_params.pyInference mappings from TAO Core :
optical_inspection.config.json| Action | Spec Field | Inference Function | Meaning |
|---|---|---|---|
| evaluate | | | encryption key |
| evaluate | | | model file inferred from the parent job results folder |
| evaluate | | | current job results directory |
| export | | | encryption key |
| export | | | model file inferred from the parent job results folder |
| export | | | output ONNX path |
| export | | | current job results directory |
| gen_trt_engine | | | encryption key |
| gen_trt_engine | | | model file inferred from the parent job results folder |
| gen_trt_engine | | | calibration cache path |
| gen_trt_engine | | | output TensorRT engine path |
| gen_trt_engine | | | current job results directory |
| inference | | | encryption key |
| inference | | | model file inferred from the parent job results folder |
| inference | | | model file inferred from the parent job results folder |
| inference | | | current job results directory |
| train | | | encryption key |
| train | | | current job results directory |
| train | | | PTM when no resume checkpoint exists |
| train | | | model file inferred from the current job results folder |
For or , 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.
parent_modelparent_model_folderparent_job_idconfig.jsonDeployment
- tao-deploy-optical-inspection — Optical Inspection deploy workflow for TensorRT engine generation, TensorRT evaluation, and TensorRT inference using TAO Deploy.