tao-train-grounding-dino
NVIDIA/skills
고정된 클래스 어휘집 없이 텍스트 프롬프트로 설명된 물체를 탐지하는 Grounding DINO 모델에 대해 훈련, 평가, 내보내기, 양자화 및 추론 작업을 수행합니다.
...모든 것을 확장하십시오DINO의 그라운딩
오픈 세트 물체 탐지를 위한 Grounding DINO. DINO 방식의 탐지 기술과 BERT 텍스트 인코더를 결합하여 언어 기반 탐지를 수행합니다. 고정된 클래스 어휘 없이 텍스트 프롬프트로 설명된 물체를 탐지합니다.
전체 Grounding DINO 가중치를 사용하려면 train.pretrained_model_path를, 백본만 사용하려면 model.pretrained_backbone_path를 설정하십시오.
TAO Deploy TensorRT 액션(gen_trt_engine, TensorRT evaluate 및 TensorRT inference)을 사용하려면 먼저 references/tao-deploy-grounding-dino.md를 참조하십시오. 배포 사양 템플릿은 이 스킬의 references/ 폴더에 spec_template_deploy_*.yaml 접두사로 저장되어 있습니다.
데이터 클래스 스키마
생성된 TAO Core 스키마는 schemas/ 포함되어 있으며, schemas/manifest.json에는 사용 가능한 액션이 나열되어 있습니다. 또한 생성된 각 스키마는 스키마 최상위 default 필드에서 references/spec_template_ 출력합니다. AutoML 활성화는 references/skill_info.yaml의 모델 계층에서 automl_enabled를 통해 선언됩니다. 실행 가능한 AutoML을 사용하려면 schemas/train.schema.json 및 references/spec_template_train.yaml 파일이 존재하고 파싱되어야 합니다. automl_default_parameters, automl_disabled_parameters, 기본값, 최소/최대 범위, 열거형, 옵션 가중치, 수학적 조건, 종속성 및 자주 사용되는 매개변수의 경우 패키지에 포함된 훈련 스키마를 사용하십시오. 런타임 시 ~/tao-core가 존재할 것이라고 기대하지 마십시오. 관리자는 스킬 뱅크를 패키징하기 전에 스키마/템플릿을 재생성합니다.
훈련 액션 정책
이 모델은 모델 계층에서 AutoML이 활성화되어 있습니다. 훈련 단계 요청을 처리하기 전에 references/skill_info.yaml을 읽고, 명시적인 automl_policy 값이나 사용자의 워크플로 요청 중 하나에서 실행 오버라이드를 해결하십시오. 기본적으로 automl_policy: on을 사용하고, 새로운 실행 프롬프트에서만 on/off를 노출하십시오. "AutoML 끄기", "AutoML 비활성화", "HPO 없음" 또는 "일반 훈련"과 같은 문구는 해당 실행에 한해 automl_policy: off로 간주합니다. automl_policy: on, automl_enabled: true이며, schemas/train.schema.json과 references/spec_template_train.yaml이 모두 패키징된 경우, 기본적으로 이 모델의 skill_dir을 사용하여 train 액션을 tao-skill-bank:tao-run-automl을 통해 라우팅하십시오. 데이터셋, 사양, 출력 디렉터리, GPU/플랫폼 설정, 상위 체크포인트 및 automl_policy에 대한 워크플로/애플리케이션 재정의 사항을 유지합니다. automl_policy: off이거나 패키지된 train 스키마/템플릿이 없는 경우에만 직접 모델 훈련을 사용합니다. 스키마가 없는 경우, 스키마가 생성될 때까지 이 모델에 대해 AutoML이 활성화되어 있지만 실행할 수 없음을 보고합니다.
evaluate, inference, export 및 deploy 플로우와 같은 비훈련 액션은 이 모델 스킬에 그대로 유지됩니다. 실행별 automl_policy 재정의는 모델 메타데이터를 변경하지 않습니다.
훈련 요구 사항
- 데이터셋 유형: object_detection
- 형식: odvg, coco, raw
- 모니터링 지표: val_mAP50
작업별 데이터셋 요구 사항
| 액션 | 사양 키 | 출처 | 파일 | 목록? |
|---|---|---|---|---|
| 평가 | 데이터셋.테스트_데이터_소스 | eval_dataset | image_dir: images.tar.gz, json_file: annotations.json | 아니요 |
| 추론 | 데이터셋.추론_데이터_소스.이미지_디렉터리 | 추론 데이터셋 | images.tar.gz | 예 |
| 추론 | 데이터셋.추론_데이터_소스.캡션 | 워크플로우 프롬프트 | 프롬프트 목록 | 예 |
| 양자화 | 데이터셋.훈련 데이터 소스 | train_datasets | image_dir: images.tar.gz, json_file: annotations_odvg.jsonl, label_map: annotations_odvg_labelmap.json | 예 |
| 양자화 | 데이터셋.val_data_sources | eval_dataset | image_dir: images.tar.gz, json_file: annotations.json | 아니요 |
| 양자화 | 데이터셋.양자화_보정_데이터_소스 | 보정/평가 데이터셋 | image_dir: images.tar.gz, json_file: annotations.json | 아니요 |
| train | 데이터셋.train_data_sources | train_datasets | image_dir: images.tar.gz, json_file: annotations_odvg.jsonl, label_map: annotations_odvg_labelmap.json | 예 |
| train | 데이터셋.val_data_sources | eval_dataset | image_dir: images.tar.gz, json_file: annotations.json | 아니요 |
러너는 images.tar.gz와 같은 이미지 아카이브를 소스로 사용할 수 있지만, 직접 로컬
Docker TAO CLI 사양에서는 image_dir을 압축이 풀린 이미지 디렉터리로 지정해야 합니다.
스킬 메타데이터는 이러한 아카이브 기반 이미지 소스를
runtime: extracted_folder로 표시하므로, 새로운 러너가 TAO를 시작하기 전에
아카이브를 압축 해제할 수 있습니다.
일반적인 사양 재정의
모든 액션에 대해 데이터 소스 재정의는 필수입니다. 에이전트는 반드시 위의 ‘액션별 데이터셋 요구 사항’ 표를 바탕으로 데이터 소스 경로를 구성하고 이를 spec_overrides에 포함해야 합니다.
S3_TRAIN = "s3://bucket/data/train"
S3_EVAL = "s3://bucket/data/eval"
train (필수 데이터 소스):
{
"train.num_epochs": 10,
"train.checkpoint_interval": 10,
"train.validation_interval": 10,
"train.num_gpus": 1,
"dataset.train_data_sources": [{"image_dir": f"{S3_TRAIN}/images.tar.gz", "json_file": f"{S3_TRAIN}/annotations_odvg.jsonl", "label_map": f"{S3_TRAIN}/annotations_odvg_labelmap.json"}],
"dataset.val_data_sources": {"image_dir": f"{S3_EVAL}/images.tar.gz", "json_file": f"{S3_EVAL}/annotations.json"},
}
deploy/gen_trt_engine ( references/tao-deploy-grounding-dino.md 참조):
{
"gen_trt_engine.onnx_file": "",
"gen_trt_engine.trt_engine": "",
"gen_trt_engine.tensorrt.data_type": "FP16",
}
추론 (필수 데이터 소스):
{
"inference.checkpoint": "<선택한 훈련/AutoML 체크포인트>",
"dataset.infer_data_sources.image_dir": [f"{S3_EVAL}/images.tar.gz"],
"dataset.infer_data_sources.captions": [
"소화기",
"콘",
"카트",
"지게차"
],
}
평가 (필수 데이터 소스):
{
"evaluate.checkpoint": "<선택한 훈련/AutoML 체크포인트>",
"dataset.test_data_sources": {"image_dir": f"{S3_EVAL}/images.tar.gz", "json_file": f"{S3_EVAL}/annotations.json"},
}
양자화 (필수 데이터 소스):
{
"quantize.model_path": "",
"dataset.train_data_sources": [{"image_dir": f"{S3_TRAIN}/images.tar.gz", "json_file": f"{S3_TRAIN}/annotations_odvg.jsonl", "label_map": f"{S3_TRAIN}/annotations_odvg_labelmap.json"}],
"dataset.val_data_sources": {"image_dir": f"{S3_EVAL}/images.tar.gz", "json_file": f"{S3_EVAL}/annotations.json"},
"dataset.quant_calibration_data_sources": {"image_dir": f"{S3_EVAL}/images.tar.gz", "json_file": f"{S3_EVAL}/annotations.json"},
}
평가 데이터셋
선택 사항. 훈련 시에는 ODVG 형식을 사용할 수 있지만, 검증 시에는 mAP를 위해 COCO 형식의 주석을 사용합니다.
중요한 매개변수
- model.backbone: 기본값은 swin_tiny_224_1k입니다. resnet_50 및 기타 Swin 변형도 지원합니다. Swin은 일반적으로 그라운딩 작업에서 더 우수한 성능을 보입니다.
- model.text_encoder_type: 텍스트 인코딩을 위한 BERT 모델. 기본값은 bert-base-uncased입니다. max_text_len의 기본값은 256입니다.
- model.max_text_len: 이 값을 데이터셋 라벨/토큰 위치 맵과 일치시켜야 합니다. 해당 라벨 맵이 동일한 길이로 재생성되지 않는 한, 초기 테스트를 위해 이 값을 줄이지 마십시오. 그렇지 않으면 토큰 확률과 위치 맵 간의 행렬 모양 불일치로 인해 검증에 실패할 수 있습니다.
- train.optim.lr: 학습률. 기본값은 2e-4입니다. lr_backbone은 2e-5입니다. fp16/fp32 외에도 bf16 정밀도를 지원합니다.
- dataset.max_labels: 훈련 중 이미지당 최대 레이블 수. 기본값 50. 밀도 높은 주석 데이터셋의 경우 이 값을 늘리십시오.
- model.num_queries: 객체 쿼리 수. 개방형 어휘의 특성상 기본값은 900입니다(DINO의 300보다 높음).
- model.num_queries / model.num_select: 배치 내 일치하는 ODVG 타겟 수에 비해
num_queries 값을충분히 높게 유지하십시오. 20과 같이 매우 작은 smoke 값은 밀도가 높은 이미지에서 헝가리안 타겟 인덱싱 중에 실패할 수 있습니다. 데이터셋이 이미지당 객체 수가 적은 것으로 알려진 경우가 아니라면, 최소한의 Grounding DINO smoke 실행을 위해 최소 100을 사용하십시오. - train.optim.lr_steps: MultiStep LR 스케줄. 기본값 [10].
다중 GPU / 다중 노드
실행 방법: Lightning 관리형 (단일 Python 프로세스, Lightning이 워커를 생성함).
| 사양 키 | 설명 | 기본값 |
|---|---|---|
train.num_gpus |
GPU 수 | 1 |
train.gpu_ids |
GPU 장치 인덱스 | [0] |
train.num_nodes |
노드 수 | 1 |
train.distributed_strategy |
ddp 또는 fsdp |
ddp |
DINO와 동일한 DDP/FSDP 동작을 보입니다. 다중 노드 환경에서는 오케스트레이터가 WORLD_SIZE, NODE_RANK, MASTER_ADDR, MASTER_PORT 환경 변수를 설정해야 합니다.
내보내기 / TRT 기본값
- 내보내기 입력: 960x544 (다른 OD 모델보다 큼), opset 17. 유지
스모크 테스트를 위해 Grounding-DINO 내보내기 사양을 템플릿 내보내기 해상도로 유지하십시오.
내보내기 이미지를 128x128과 같이 매우 작은 크기로 줄이면
torch.onnx.export과정에서 대조적 텍스트 헤드에서 PyTorch ONNX 셰이프 추론 어설션이 발생할 수 있습니다. - 상위 PyTorch
grounding_dinoCLI는훈련,평가,추론,내보내기및양자화를지원합니다.references/tao-deploy-grounding-dino.md를통해 TensorRT 엔진 생성, TensorRT 추론 및 TensorRT 평가를 실행하십시오. - TRT 데이터 유형: FP32, FP16 전용 — INT8은 지원되지 않음
- TRT 작업 공간: 8192 MB (다른 OD 모델보다 8배 큼)
- TRT max_batch_size: 4
하드웨어
최소 1개의 GPU, 권장 4개의 GPU. GPU당 24GB 이상의 VRAM (A100 권장). Grounding DINO는 텍스트 인코더(BERT)로 인해 표준 DINO보다 더 많은 자원을 소모합니다. 24GB 이상의 GPU 메모리를 권장합니다. 16GB GPU의 경우 batch_size를 줄이십시오.
오류 패턴
CUDA 메모리 부족: batch_size를 줄이십시오(4 → 2 → 1). BERT 텍스트 인코더는 비전 백본에 상당한 메모리 오버헤드를 추가합니다.
Val 주석 카테고리 ID: 정확한 손실 계산을 위해 검증 주석의 카테고리 ID는 0부터 시작해야 합니다. 필요한 경우 주석 형식 변환을 사용하십시오.
텍스트 인코더 로딩 오류: 컨테이너가 bert-base-uncased 가중치를 다운로드할 수 있는지 확인하거나 로컬 경로를 지정하십시오.
TAO Toolkit 7.0.0-rc-226에서 PyTorch 체크포인트로 양자화 실패:
컨테이너의 Grounding-DINO 양자화 스크립트가체크포인트를 로드할 때 cap_lists=None을 전달하여
post_process.py에서 오류가 발생합니다. ONNX 양자화는
내보낸 ONNX 아티팩트와 COCO 보정 데이터를 사용하지만, 기본 rc-226
PyTorch 이미지에는 modelopt.onnx.quantization 모듈이 누락되어 있습니다. 이 문제를
체크포인트 해결 문제가 아닌 이미지/SDK 차단 문제로 간주하십시오.
post_process.py에서 mat1과 mat2의 셰이프를 곱할 수 없습니다. 텍스트
토큰 길이와 레이블 위치 맵이 일치하지 않는데, 이는 일반적으로
model.max_text_len이 기본값인 256보다 작게 재정의된 반면, 데이터셋
레이블 맵은 여전히 256 길이의 위치 맵을 사용하기 때문입니다. model.max_text_len을 원래 값으로 복원하거나
동일한 길이로 레이블 맵을 재생성하십시오.
criterion.py에서 차원 0에 대한 인덱스가 범위를 벗어남: model.num_queries
값이 현재 배치의 매칭된 ODVG 타깃 수에 비해 너무 작습니다.
model.num_queries를 늘리고, model.num_select가 이와 호환되도록 유지하십시오.
images.tar.gz/ NotADirectoryError 발생: TAO CLI가
아카이브 경로를 디렉터리로 트래버스하려고 시도하고 있습니다. 아카이브를 추출하고
관련 image_dir 필드를 추출된 이미지 폴더로 설정하십시오. 아카이브 기반
스킬 데이터 소스는 이러한 이유로 runtime:extracted_folder를 사용합니다.
사양 매개변수 / 상위 모델 추론
모델별 추론 매핑은 config.json이 아닌 이 MD 파일에 포함되어야 합니다. 생성된 러너는 이 섹션을 읽고 create_job() 호출 전에 SDK 헬퍼를 사용하여 매핑을 적용해야 합니다. 이는 기존 마이크로서비스의 infer_params.py 흐름을 반영한 것입니다.
TAO Core의 grounding_dino.config.json에서 가져온 추론 매핑:
| 액션 | 사양 필드 | 추론 함수 | 의미 |
|---|---|---|---|
| evaluate | encryption_key |
key |
암호화 키 |
| 평가 | 평가.체크포인트 |
부모 모델 |
부모 작업 결과 폴더에서 추론된 모델 파일 |
| evaluate | evaluate.trt_engine |
parent_model |
상위 작업 결과 폴더에서 추론된 모델 파일 |
| 평가 | results_dir |
output_dir |
현재 작업 결과 디렉터리 |
| 내보내기 | 암호화_키 |
key |
암호화 키 |
| 내보내기 | export.checkpoint |
부모_모델 |
상위 작업 결과 폴더에서 추론된 모델 파일 |
| export | export.onnx_file |
create_onnx_file |
ONNX 출력 경로 |
| 내보내기 | 결과 디렉터리 |
output_dir |
현재 작업 결과 디렉터리 |
| 추론 | 암호화_키 |
키 |
암호화 키 |
| 추론 | 추론.체크포인트 |
부모 모델 |
부모 작업 결과 폴더에서 추론된 모델 파일 |
| 추론 | inference.trt_engine |
parent_model |
상위 작업 결과 폴더에서 추론된 모델 파일 |
| 추론 | results_dir |
output_dir |
현재 작업 결과 디렉터리 |
| 양자화 | 암호화 키 |
key |
quantize암호화 키 |
| 양자화 | quantize.model_path |
parent_model |
상위 작업 결과 폴더에서 추론된 모델 파일 |
| quantize | results_dir |
output_dir |
현재 작업 결과 디렉터리 |
| train | 암호화 키 |
key |
암호화 키 |
| train | model.pretrained_backbone_path |
ptm_if_no_resume_model |
재개 체크포인트가 존재하지 않을 때의 PTM |
| train | results_dir |
output_dir |
현재 작업 결과 디렉터리 |
| train | train.pretrained_model_path |
ptm_if_no_resume_model |
재개 체크포인트가 없을 때의 PTM |
| train | train.resume_training_checkpoint_path |
resume_model |
현재 작업 결과 폴더에서 추론된 모델 파일 |
parent_model 또는 parent_model_folder의 경우, 상위 train/export/AutoML 자식 작업 ID를 parent_job_id로 전달합니다. SDK는 상위 결과 폴더를 나열하고, 체크포인트 아티팩트를 필터링한 후, 선택된 모델 파일 또는 폴더를 반환합니다. 이러한 매핑을 config.json 에 다시 추가하지 말고, 체크포인트 경로를 추측하기 위해 생성된 러너 스크립트를 수정하지 마십시오.
SDK 리졸버 외부에서 Grounding-DINO 체크포인트를 선택할 때는
목표하는 에포크/단계 아티팩트와 정확히 일치해야 합니다(예:
model_epoch_000_step_00046.pth). gdino_model_latest.pth 심볼릭 링크는
'latest'가 명시적으로 요청된 경우에만 유효합니다. model.backbone, model.num_queries, model.num_select,
model.num_feature_levels, model.max_text_len과 같은 구조적 모델 설정 및
입력 해상도 내보내기 설정을
evaluate, inference, export 및 deploy 사양으로 그대로 전달하여 체크포인트와
엔진 구조가 일치하도록 하십시오.
배포
- tao-deploy-grounding-dino
---
name: tao-train-grounding-dino
description: Trains, evaluates, exports, quantizes, and runs inference for a Grounding DINO model that detects objects described by text prompts without a fixed class vocabulary.
license: Apache-2.0
---
# Grounding DINO
Grounding DINO for open-set object detection. Combines DINO-style detection with BERT text encoder for language-guided detection. Detects objects described by text prompts without fixed class vocabulary.
Set train.pretrained_model_path for full Grounding DINO weights or model.pretrained_backbone_path for backbone-only.
For TAO Deploy TensorRT actions (`gen_trt_engine`, TensorRT `evaluate`, and TensorRT `inference`), read `references/tao-deploy-grounding-dino.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 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. 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:** object_detection
- **Formats:** odvg, coco, raw
- **Monitoring metric:** val_mAP50
### Per-Action Dataset Requirements
| Action | Spec Key | Source | Files | List? |
|---|---|---|---|---|
| evaluate | dataset.test_data_sources | eval_dataset | image_dir: images.tar.gz, json_file: annotations.json | No |
| inference | dataset.infer_data_sources.image_dir | inference_dataset | images.tar.gz | Yes |
| inference | dataset.infer_data_sources.captions | workflow prompts | prompt list | Yes |
| quantize | dataset.train_data_sources | train_datasets | image_dir: images.tar.gz, json_file: annotations_odvg.jsonl, label_map: annotations_odvg_labelmap.json | Yes |
| quantize | dataset.val_data_sources | eval_dataset | image_dir: images.tar.gz, json_file: annotations.json | No |
| quantize | dataset.quant_calibration_data_sources | calibration/eval dataset | image_dir: images.tar.gz, json_file: annotations.json | No |
| train | dataset.train_data_sources | train_datasets | image_dir: images.tar.gz, json_file: annotations_odvg.jsonl, label_map: annotations_odvg_labelmap.json | Yes |
| train | dataset.val_data_sources | eval_dataset | image_dir: images.tar.gz, json_file: annotations.json | No |
The runner may source image archives as `images.tar.gz`, but direct local
Docker TAO CLI specs must point `image_dir` to an extracted image directory.
Skill metadata marks these archive-backed image sources with
`runtime: extracted_folder` so a fresh runner can unpack the archive before
launching TAO.
### 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`.
```python
S3_TRAIN = "s3://bucket/data/train"
S3_EVAL = "s3://bucket/data/eval"
```
**train (mandatory data sources):**
```python
{
"train.num_epochs": 10,
"train.checkpoint_interval": 10,
"train.validation_interval": 10,
"train.num_gpus": 1,
"dataset.train_data_sources": [{"image_dir": f"{S3_TRAIN}/images.tar.gz", "json_file": f"{S3_TRAIN}/annotations_odvg.jsonl", "label_map": f"{S3_TRAIN}/annotations_odvg_labelmap.json"}],
"dataset.val_data_sources": {"image_dir": f"{S3_EVAL}/images.tar.gz", "json_file": f"{S3_EVAL}/annotations.json"},
}
```
**deploy/gen_trt_engine (use `references/tao-deploy-grounding-dino.md`):**
```python
{
"gen_trt_engine.onnx_file": "<exported_onnx_uri>",
"gen_trt_engine.trt_engine": "<output_engine_path>",
"gen_trt_engine.tensorrt.data_type": "FP16",
}
```
**inference (mandatory data sources):**
```python
{
"inference.checkpoint": "<selected train/AutoML checkpoint>",
"dataset.infer_data_sources.image_dir": [f"{S3_EVAL}/images.tar.gz"],
"dataset.infer_data_sources.captions": [
"fire extinguisher",
"cone",
"cart",
"forklift"
],
}
```
**evaluate (mandatory data sources):**
```python
{
"evaluate.checkpoint": "<selected train/AutoML checkpoint>",
"dataset.test_data_sources": {"image_dir": f"{S3_EVAL}/images.tar.gz", "json_file": f"{S3_EVAL}/annotations.json"},
}
```
**quantize (mandatory data sources):**
```python
{
"quantize.model_path": "<selected train checkpoint or exported ONNX model>",
"dataset.train_data_sources": [{"image_dir": f"{S3_TRAIN}/images.tar.gz", "json_file": f"{S3_TRAIN}/annotations_odvg.jsonl", "label_map": f"{S3_TRAIN}/annotations_odvg_labelmap.json"}],
"dataset.val_data_sources": {"image_dir": f"{S3_EVAL}/images.tar.gz", "json_file": f"{S3_EVAL}/annotations.json"},
"dataset.quant_calibration_data_sources": {"image_dir": f"{S3_EVAL}/images.tar.gz", "json_file": f"{S3_EVAL}/annotations.json"},
}
```
## Eval Dataset
Optional. Validation uses COCO-format annotations for mAP even though training can use ODVG format.
## Important Parameters
- **model.backbone**: Default swin_tiny_224_1k. Also supports resnet_50 and other Swin variants. Swin generally performs better for grounding tasks.
- **model.text_encoder_type**: BERT model for text encoding. Default bert-base-uncased. max_text_len defaults to 256.
- **model.max_text_len**: Keep this aligned with the dataset label/token
position maps. Do not shrink it for smoke tests unless the corresponding
label maps are regenerated with the same length; otherwise validation can
fail with a matrix shape mismatch between token probabilities and position
maps.
- **train.optim.lr**: Learning rate. Default 2e-4. lr_backbone 2e-5. Supports bf16 precision in addition to fp16/fp32.
- **dataset.max_labels**: Maximum labels per image during training. Default 50. Increase for dense annotation datasets.
- **model.num_queries**: Object queries. Default 900 (higher than DINO's 300) due to open-vocabulary nature.
- **model.num_queries / model.num_select**: Keep `num_queries` high enough
for the number of matched ODVG targets in a batch. Very small smoke values
such as 20 can fail during Hungarian target indexing on dense images; use at
least 100 for minimal Grounding DINO smoke runs unless the dataset is known
to have fewer objects per image.
- **train.optim.lr_steps**: MultiStep LR schedule. Default [10].
## 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 |
| `train.distributed_strategy` | `ddp` or `fsdp` | `ddp` |
Same DDP/FSDP behavior as DINO. Multi-node requires `WORLD_SIZE`, `NODE_RANK`, `MASTER_ADDR`, `MASTER_PORT` env vars set by orchestrator.
## Export / TRT Defaults
- Export input: 960x544 (larger than other OD models), opset 17. Keep
Grounding-DINO export specs at the template export resolution for smoke tests;
reducing export to very small image sizes such as 128x128 can trigger a
PyTorch ONNX shape-inference assertion in the contrastive text head during
`torch.onnx.export`.
- The parent PyTorch `grounding_dino` CLI supports `train`, `evaluate`,
`inference`, `export`, and `quantize`. Run TensorRT engine generation,
TensorRT inference, and TensorRT evaluation through `references/tao-deploy-grounding-dino.md`.
- TRT data types: FP32, FP16 only — **INT8 is NOT supported**
- TRT workspace: 8192 MB (8x larger than other OD models)
- TRT max_batch_size: 4
## Hardware
Minimum 1 GPU(s), recommended 4 GPU(s). 24GB+ (A100 recommended) VRAM per GPU. Grounding DINO is heavier than standard DINO due to the text encoder (BERT). 24GB+ GPU memory recommended. Reduce batch_size for 16GB GPUs.
## Error Patterns
**CUDA out of memory**: Reduce batch_size (4 -> 2 -> 1). The BERT text encoder adds significant memory overhead on top of the vision backbone.
**Val annotation category IDs**: Validation annotations should have category IDs starting from 0 for correct loss computation. Use annotation format conversion if needed.
**Text encoder loading error**: Ensure the container has access to download bert-base-uncased weights or provide a local path.
**Quantize with a PyTorch checkpoint fails in TAO Toolkit 7.0.0-rc-226**:
The container's Grounding-DINO quantize script passes `cap_lists=None` when
loading a checkpoint, which fails in `post_process.py`. ONNX quantization uses
the exported ONNX artifact and COCO calibration data, but the default rc-226
PyTorch image also lacks the `modelopt.onnx.quantization` module. Treat this as
an image/SDK blocker, not a checkpoint resolver issue.
**mat1 and mat2 shapes cannot be multiplied in `post_process.py`**: The text
token length and label position maps are inconsistent, commonly because
`model.max_text_len` was overridden below the default 256 while the dataset
label maps still use 256-length position maps. Restore `model.max_text_len` or
regenerate the label maps with the same length.
**index is out of bounds for dimension 0 in `criterion.py`**: `model.num_queries`
is too small for the matched ODVG targets in the current batch. Increase
`model.num_queries` and keep `model.num_select` compatible with it.
**NotADirectoryError with `images.tar.gz/<image>.jpg`**: The direct TAO CLI is
trying to traverse an archive path as a directory. Extract the archive and set
the relevant `image_dir` field to the extracted image folder; archive-backed
skill data sources use `runtime: extracted_folder` for this reason.
## 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 `grounding_dino.config.json`:
| Action | Spec Field | Inference Function | Meaning |
|---|---|---|---|
| evaluate | `encryption_key` | `key` | encryption key |
| evaluate | `evaluate.checkpoint` | `parent_model` | model file inferred from the parent job results folder |
| evaluate | `evaluate.trt_engine` | `parent_model` | model file inferred from the parent job results folder |
| evaluate | `results_dir` | `output_dir` | current job results directory |
| export | `encryption_key` | `key` | encryption key |
| export | `export.checkpoint` | `parent_model` | model file inferred from the parent job results folder |
| export | `export.onnx_file` | `create_onnx_file` | output ONNX path |
| export | `results_dir` | `output_dir` | current job results directory |
| inference | `encryption_key` | `key` | encryption key |
| 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 | `encryption_key` | `key` | encryption key |
| 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 | `encryption_key` | `key` | encryption key |
| train | `model.pretrained_backbone_path` | `ptm_if_no_resume_model` | PTM when no resume checkpoint exists |
| train | `results_dir` | `output_dir` | current job results directory |
| train | `train.pretrained_model_path` | `ptm_if_no_resume_model` | PTM when no resume checkpoint exists |
| train | `train.resume_training_checkpoint_path` | `resume_model` | model 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.
When selecting a Grounding-DINO checkpoint outside the SDK resolver, match the
intended epoch/step artifact exactly, for example
`model_epoch_000_step_00046.pth`. The `gdino_model_latest.pth` symlink is valid
only when latest is explicitly requested. Carry structural model settings such
as `model.backbone`, `model.num_queries`, `model.num_select`,
`model.num_feature_levels`, `model.max_text_len`, and export input resolution
forward into evaluate, inference, export, and deploy specs so checkpoint and
engine shapes match.
## Deployment
- [tao-deploy-grounding-dino](references/tao-deploy-grounding-dino.md)
모든 파일
24개 파일tao-train-grounding-dino 설치
스킬 파일을 다운로드하여 .claude/skills/ 디렉터리에 압축을 풀어주세요.
ZIP 다운로드저장소를 클론하고 스킬 파일을 프로젝트에 복사하세요.
git clone https://github.com/NVIDIA/skills/tree/main/skills/tao-train-grounding-dino # Copy SKILL.md to your .claude/skills/ directory
복사





집
