nvidia/skills · Official

tao-train-ocdnet

OCDNet for scene text detection. Detects arbitrary-oriented text regions in natural images using a differentiable binarization approach. Use when training, evaluating, exporting, pruning, quantizing, retraining, or running inference for a TAO OCDNet model. Trigger phrases include "train OCDNet", "scene text detection", "arbitrary-oriented text boxes", "differentiable binarization detector".

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

Installation

$ npx skills add nvidia/skills --skill tao-train-ocdnet

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 14,194 B
  • docs SUMMARY.md 414 B

History

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

SKILL.md

OCDNet

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

OCDNet for scene text detection. Detects arbitrary-oriented text regions in natural images using a differentiable binarization approach.

Set model.pretrainedmodelpath for pretrained weights.

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

The PyT OCDNet CLI supports train, evaluate, export, inference, prune, quantize, and defaultspecs. It does not expose PyT-side retrain or gentrtengine subcommands. The model skill exposes retrain by running ocdnet train with model.loadprunedgraph: true and model.prunedgraphpath. Resume from an epoch checkpoint uses ocdnet train plus train.resumetrainingcheckpointpath. TensorRT engine generation is owned by the deploy workflow.

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.

For AutoML train, use trainlossepoch or trainloss as the optimization metric with direction=minimize. The Lightning progress log emits trainlossepoch, and TAO status.json records the same final value under trainloss. For one-epoch local AutoML smoke runs, set train.lrscheduler.args.warmupepoch: 0; leaving warmup equal to the epoch budget causes the trainer to fail before a recommendation can report a metric. 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: ocdnet
  • Formats: default
  • Monitoring metric: hmean

Per-Action Dataset Requirements

Action Spec Key Source Runtime value List?
evaluate dataset.validatedataset.datapath eval_dataset extracted validation split folder with img/ and gt/ Yes
inference inference.input_folder inferencedataset or evaldataset extracted image folder No
prune dataset.validatedataset.datapath eval_dataset extracted validation split folder with img/ and gt/ Yes
quantize dataset.traindataset.datapath train_datasets extracted train split folder with img/ and gt/ Yes
quantize dataset.validatedataset.datapath eval_dataset extracted validation split folder with img/ and gt/ Yes
quantize dataset.quantcalibrationdataset.images_dir traindatasets or calibrationdataset extracted calibration image folder No
train dataset.traindataset.datapath train_datasets extracted train split folder with img/ and gt/ Yes
train dataset.validatedataset.datapath eval_dataset extracted validation split folder with img/ and gt/ Yes
retrain dataset.traindataset.datapath train_datasets extracted train split folder with img/ and gt/ Yes
retrain dataset.validatedataset.datapath eval_dataset extracted validation split folder with img/ and gt/ Yes

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. OCDNet does not unpack dataset archives at runtime. If the source is train.tar.gz, test.tar.gz, or img.tar.gz, extract it first and pass the split folder or image folder into the spec. The split folder must contain img/ and gt/; alternatively, pass a UTF-8 datalist text file whose lines map image paths to label paths.

TRAIN_ROOT = "/path/to/extracted/train"
EVAL_ROOT = "/path/to/extracted/test"
INFER_IMG_DIR = "/path/to/extracted/test/img"
CALIB_IMG_DIR = "/path/to/extracted/train/img"

train (mandatory data sources):

{
    "train.num_epochs": 30,
    "train.checkpoint_interval": 10,
    "train.validation_interval": 10,
    "train.num_gpus": 1,
    "dataset.train_dataset.loader.batch_size": 16,
    "dataset.train_dataset.data_path": [TRAIN_ROOT],
    "dataset.validate_dataset.data_path": [EVAL_ROOT],
}

evaluate (mandatory data sources):

{
    "evaluate.checkpoint": "<selected train/AutoML checkpoint>",
    "dataset.validate_dataset.data_path": [EVAL_ROOT],
}

inference (mandatory data sources):

{
    "inference.checkpoint": "<selected train/AutoML checkpoint>",
    "inference.input_folder": INFER_IMG_DIR,
}

prune (mandatory data sources):

{
    "prune.checkpoint": "<selected train/AutoML checkpoint>",
    "dataset.validate_dataset.data_path": [EVAL_ROOT],
}

quantize (mandatory data sources):

{
    "quantize.model_path": "<selected train checkpoint or exported ONNX>",
    "dataset.train_dataset.data_path": [TRAIN_ROOT],
    "dataset.validate_dataset.data_path": [EVAL_ROOT],
    "dataset.quant_calibration_dataset.images_dir": CALIB_IMG_DIR,
}

resume training (mandatory data sources):

{
    "train.resume_training_checkpoint_path": "<exact model_epoch checkpoint>",
    "dataset.train_dataset.data_path": [TRAIN_ROOT],
    "dataset.validate_dataset.data_path": [EVAL_ROOT],
}

retrain from prune output (mandatory data sources):

{
    "model.load_pruned_graph": True,
    "model.pruned_graph_path": "<selected prune output>",
    "dataset.train_dataset.data_path": [TRAIN_ROOT],
    "dataset.validate_dataset.data_path": [EVAL_ROOT],
}

default_specs:

{
    "results_dir": "<writable output directory>",
}

Eval Dataset

Optional. Test dataset provided as separate tarball.

Important Parameters

  • model.backbone: Default deformable_resnet18. Deformable convolutions improve text region detection for irregular text.
  • train.optimizer.args.lr: Learning rate. Default 0.001 (Adam).
  • postprocess.thresh: Binarization threshold for text region extraction.
  • postprocess.box_thresh: Box confidence threshold for filtering detections.

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.distributed_strategy ddp, fsdp, or deepspeedstage3_offload ddp
  • ddp with activation checkpointing: findunusedparameters=False
  • ddp without: findunusedparameters=True
  • fsdp forces FP16
  • deepspeedstage3_offload is uniquely supported for OCDNet (forces FP16)
  • FAN backbones auto-enable sync_batchnorm

Hardware

Minimum 1 GPU(s), recommended 1 GPU(s). 8GB+ VRAM per GPU. OCDNet is lightweight. Single GPU is sufficient for most datasets.

Error Patterns

Low detection rate: Tune postprocess.thresh and box_thresh. Default thresholds may be too aggressive for some datasets.

One-epoch smoke train with default scheduler: train.numepochs must not equal train.lrscheduler.args.warmupepoch. For one-epoch validation, set warmupepoch: 0; for normal starter runs, keep numepochs > warmupepoch.

Archive passed as dataset path: dataset.*.data_path is not an archive path for OCDNet. Passing train.tar.gz or test.tar.gz directly causes the dataloader to open the gzip as a UTF-8 datalist. Extract the archive and pass the split folder containing img/ and gt/, or pass a real UTF-8 datalist file.

Quantize checkpoint type: Do not pass modelbest.pth to the PyTorch quantize path. Some older PyT runtimes wrote modelbest.pth without full Lightning checkpoint metadata. The default torchao quantize path should use the intended full modelepoch<epoch>step<step>.pth checkpoint and write quantizedmodeltorchao.pth.

Default specs output directory: ocdnet defaultspecs requires a writable resultsdir override, for example resultsdir=/workspace/run/results/defaultspecs.

Checkpoint Handoff

OCDNet train writes modelbest.pth plus full Lightning epoch checkpoints such as modelepoch001step00046.pth; it may also write ocdmodellatest.pth as a latest symlink. Use modelbest.pth for evaluate.checkpoint, inference.checkpoint, export.checkpoint, and prune.checkpoint when the user asks for the best checkpoint. Use a specific modelepoch<epoch>step<step>.pth for train.resumetrainingcheckpointpath and for any action that explicitly needs a full Lightning checkpoint. Prune writes artifacts such as pruned<chsparsity>.pth; use the exact pruned .pth artifact for model.prunedgraph_path when retraining from a pruned graph. Use a latest checkpoint only when the user explicitly asks for latest.

If quantize is retried with a PyTorch backend, resolve the full modelepoch<epoch>step<step>.pth that corresponds to the intended best epoch or requested epoch; do not pass modelbest.pth to the PyTorch quantize path. If quantize is retried with modelopt.onnx, pass the exported ONNX as quantize.modelpath and verify that the runtime image actually contains modelopt.onnx.quantization.

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.

Model handoff mappings:

Action Spec Field Inference Function Meaning
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
inference inference.checkpoint parent_model model file inferred from the parent job results folder
inference results_dir output_dir current job results directory
prune prune.checkpoint parent_model model file inferred from the parent job results folder
prune 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
retrain from prune model.prunedgraphpath parent_model exact pruned model file inferred from the parent prune results folder
retrain from prune results_dir output_dir current job results directory
train model.pretrainedmodelpath ptmifnoresumemodel PTM when no resume checkpoint exists
train results_dir output_dir current job results directory
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-ocdnet](references/tao-deploy-ocdnet.md)