Mask Grounding DINO
Mask Grounding DINO 是 TAO 中包含的一个开放词汇实例分割模型。它支持以下任务
训练
评估
推理
导出
这些任务可以使用 TAO Launcher 从命令行调用,使用以下约定
tao model mask_grounding_dino <sub_task> <args_per_subtask>
其中,args_per_subtask
是给定子任务所需的命令行参数。每个子任务在以下章节中详细解释。
Mask Grounding DINO 期望训练文件的图像目录采用 ODVG 格式的 JSONL,验证文件采用 COCO 格式的 JSON 注释文件。
与 TAO 中的其他实例分割模型不同,Mask Grounding DINO 的 COCO JSON 文件中的 category_id
从 0 开始,并且每个类别 ID 必须是连续的。意味着类别范围从 0 到 num_classes - 1
。由于原始 COCO 注释没有连续的类别 ID,请参阅 TAO Data Service tao dataset annotations convert
。
Mask Grounding DINO 的训练实验规范文件包括 model
、train
和 dataset
参数。这是一个使用 swin_tiny_224_1k
主干在 COCO 数据集上微调 Mask Grounding DINO 模型的示例规范文件。
dataset:
train_data_sources:
- image_dir: /path/to/coco/train2017/
json_file: /path/to/coco/annotations/instances_train2017.jsonl # odvg format
label_map: /path/to/coco/annotations/instances_train2017_labelmap.json
val_data_sources:
- image_dir: /path/to/coco/val2017/
json_file: /path/to/coco/annotations/instances_val2017_contiguous.json # category ids need to be contiguous
max_labels: 80 # Max number of postive + negative labels passed to the text encoder
batch_size: 4
workers: 8
dataset_type: serialized # To reduce the system memory usage
augmentation:
scales: [480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800]
input_mean: [0.485, 0.456, 0.406]
input_std: [0.229, 0.224, 0.225]
horizontal_flip_prob: 0.5
train_random_resize: [400, 500, 600]
train_random_crop_min: 384
train_random_crop_max: 600
random_resize_max_size: 1333
test_random_resize: 800
model:
backbone: swin_tiny_224_1k
train_backbone: True
num_feature_levels: 4
dec_layers: 6
enc_layers: 6
num_queries: 300
num_queries: 900
dropout_ratio: 0.0
dim_feedforward: 2048
log_scale: auto
class_embed_bias: True # Adding bias in the contrastive embedding layer for training stability
train:
optim:
lr_backbone: 2e-5
lr: 2e-4
lr_steps: [10, 20]
num_epochs: 30
freeze: ["backbone.0", "bert"] # if only finetuning
pretrained_model_path: /path/to/your-gdino-pretrained-model # if only finetuning
precision: bf16 # for efficient training
字段 |
value_type |
描述 |
default_value |
valid_min |
valid_max |
valid_options |
automl_enabled |
---|---|---|---|---|---|---|---|
encryption_key |
string | FALSE | |||||
results_dir |
string | /results | FALSE | ||||
wandb |
collection | FALSE | |||||
model |
collection | 用于构建 Mask Grounding DINO 实验模型的Configurable参数。 | FALSE | ||||
dataset |
collection | 用于构建 Mask Grounding DINO 实验数据集的Configurable参数。 | FALSE | ||||
训练 |
collection | 用于构建 Mask Grounding DINO 实验训练器的Configurable参数。 | FALSE | ||||
评估 |
collection | 用于构建 Mask Grounding DINO 实验评估器的Configurable参数。 | FALSE | ||||
推理 |
collection | 用于构建 Mask Grounding DINO 实验推理器的Configurable参数。 | FALSE | ||||
导出 |
collection | 用于构建 Mask Grounding DINO 实验导出器的Configurable参数。 | FALSE | ||||
gen_trt_engine |
collection | 用于构建 Mask Grounding DINO 实验 TensorRT 引擎构建器的Configurable参数。 | FALSE |
model
model
参数提供了更改 Mask Grounding DINO 架构的选项。
model:
pretrained_model_path: /path/to/your-gdino-pretrained-model
backbone: swin_tiny_224_1k
train_backbone: True
num_feature_levels: 4
dec_layers: 6
enc_layers: 6
num_queries: 300
num_queries: 900
dropout_ratio: 0.0
dim_feedforward: 2048
log_scale: auto
class_embed_bias: True
loss_types: ['labels', 'boxes', 'masks']
字段 |
value_type |
描述 |
default_value |
valid_min |
valid_max |
valid_options |
automl_enabled |
---|---|---|---|---|---|---|---|
pretrained_backbone_path |
string | [可选] 预训练主干文件的路径。 | FALSE | ||||
|
string |
模型的主干名称。 |
swin_tiny_224_1k |
|
|
swin_tiny_224_1k,swin_base_224_22k,swin_base_384_22k,swin_large_224_22k,swin_large_384_22k |
FALSE |
num_queries |
int | 查询的数量 | 900 | 1 | inf | TRUE | |
num_feature_levels |
int | 模型中使用的特征级别数 | 4 | 1 | 5 | FALSE | |
set_cost_class |
float | 匹配成本中分类误差的相对权重。 | 1.0 | 0.0 | inf | FALSE | |
set_cost_bbox |
float | 匹配成本中边界框坐标 L1 误差的相对权重。 | 5.0 | 0.0 | inf | FALSE | |
set_cost_giou |
float | 匹配成本中边界框 GIoU 损失的相对权重。 | 2.0 | 0.0 | inf | FALSE | |
cls_loss_coef |
float | 最终损失中分类误差的相对权重。 | 2.0 | 0.0 | inf | FALSE | |
bbox_loss_coef |
float | 最终损失中边界框坐标 L1 误差的相对权重。 | 5.0 | 0.0 | inf | FALSE | |
giou_loss_coef |
float | 最终损失中边界框 GIoU 损失的相对权重。 | 2.0 | 0.0 | inf | FALSE | |
num_select |
int | 后处理期间选择的 Top-K 预测的数量 | 300 | 1 | TRUE | ||
interm_loss_coef |
float | 1.0 | FALSE | ||||
no_interm_box_loss |
bool | 无中间 bbox 损失。 | False | FALSE | |||
pre_norm |
bool | 用于在编码器中添加层归一化的标志。 | False | FALSE | |||
two_stage_type |
string | DINO 中两阶段的类型 | standard | standard,no | FALSE | ||
decoder_sa_type |
string | 解码器自注意力类型。 | sa | sa,ca_label,ca_content | FALSE | ||
embed_init_tgt |
bool | 用于添加目标嵌入的标志 | True | FALSE | |||
|
int |
如果此值为 -1,则宽度和高度将为每个框分别学习。 |
-1 |
-2 |
inf |
|
FALSE |
pe_temperatureH |
int | 应用于位置正弦嵌入高度维度的温度。 | 20 | 1 | inf | FALSE | |
pe_temperatureW |
int | 应用于位置正弦嵌入宽度维度的温度。 | 20 | 1 | inf | FALSE | |
return_interm_indices |
list | 模型中使用的特征级别索引。长度必须与 num_feature_levels 匹配。 | [1, 2, 3, 4] | FALSE | |||
use_dn |
bool | 一个标志,指定是否在 DINO 中启用对比去噪训练 | True | FALSE | |||
dn_number |
int | DINO 中的去噪查询数量。 | 0 | 0 | inf | FALSE | |
dn_box_noise_scale |
float | 应用于对比去噪期间框的噪声比例。如果此值为 0,则不应用噪声。 | 1.0 | 0.0 | inf | FALSE | |
|
float |
应用于标签噪声的比例,在 |
0.5 |
0.0 |
|
|
FALSE |
focal_alpha |
float | 焦点损失中的 alpha 值。 | 0.25 | FALSE | |||
focal_gamma |
float | 焦点损失中的 gamma 值。 | 2.0 | FALSE | |||
clip_max_norm |
float | 0.1 | FALSE | ||||
nheads |
int | 头的数量 | 8 | FALSE | |||
dropout_ratio |
float | 丢弃隐藏单元的概率。 | 0.0 | 0.0 | 1.0 | FALSE | |
hidden_dim |
int | 隐藏单元的维度。 | 256 | FALSE | |||
enc_layers |
int | Transformer 中编码器层的数量 | 6 | 1 | TRUE | ||
dec_layers |
int | Transformer 中解码器层的数量 | 6 | 1 | TRUE | ||
dim_feedforward |
int | 前馈网络的维度 | 2048 | 1 | FALSE | ||
dec_n_points |
int | 解码器中参考点的数量。 | 4 | 1 | FALSE | ||
enc_n_points |
int | 编码器中参考点的数量。 | 4 | 1 | FALSE | ||
|
bool |
一个标志,指定是否使用辅助 |
True |
|
|
|
FALSE |
dilation |
bool | 一个标志,指定是否在主干中启用扩张。 | False | FALSE | |||
|
bool |
用于将主干权重设置为可训练或冻结的标志。 |
True |
|
|
|
FALSE |
|
string |
BERT 编码器类型。如果仅提供类型名称, |
bert-base-uncased |
|
|
|
FALSE |
max_text_len |
int | BERT 的最大文本长度。 | 256 | 1 | FALSE | ||
class_embed_bias |
bool | 用于在对比嵌入中设置偏差的标志。 | False | FALSE | |||
|
string |
[可选] 可学习参数的初始值,用于乘以相似度 |
none |
|
|
|
FALSE |
loss_types |
list | 训练期间要使用的损失类型 | [‘labels’, ‘boxes’] | FALSE | |||
backbone_names |
list | 与主干对应的张量名称前缀。 | [‘backbone.0’, ‘bert’] | FALSE | |||
linear_proj_names |
list | 线性投影层名称。 | [‘reference_points’, ‘sampling_offsets’] | FALSE | |||
has_mask |
bool | 用于在 Grounding Dino 中启用掩码头的标志 | True | FALSE | |||
mask_loss_coef |
float | 最终损失中掩码误差的相对权重。 | 2.0 | FALSE | |||
dice_loss_coef |
float | 最终损失中分割的 Dice 损失的相对权重。 | 5.0 | FALSE |
训练
train
参数定义了训练过程的超参数。
train:
optim:
lr: 0.0002
lr_backbone: 0.00002
momentum: 0.9
weight_decay: 0.0001
lr_scheduler: MultiStep
lr_steps: [10, 20]
lr_decay: 0.1
num_epochs: 30
checkpoint_interval: 1
precision: bf16
distributed_strategy: ddp
activation_checkpoint: True
num_gpus: 8
num_nodes: 1
freeze: ["backbone.0", "bert"]
pretrained_model_path: /path/to/pretrained/model
字段 |
value_type |
描述 |
default_value |
valid_min |
valid_max |
valid_options |
automl_enabled |
---|---|---|---|---|---|---|---|
num_gpus |
int | 运行训练作业的 GPU 数量。 | 1 | 1 | FALSE | ||
gpu_ids |
list | 用于运行训练的 GPU ID 列表。此列表的长度必须等于 train.num_gpus 中的 GPU 数量。 | [0] | FALSE | |||
num_nodes |
int | 运行训练的节点数。如果 > 1,则启用多节点。 | 1 | FALSE | |||
seed |
int | PyTorch 中初始化程序的种子。如果 < 0,则禁用固定种子。 | 1234 | -1 | inf | FALSE | |
cudnn |
collection | FALSE | |||||
num_epochs |
int | 运行训练的 epoch 数。 | 10 | 1 | inf | TRUE | |
checkpoint_interval |
int | 保存检查点的时间间隔(以 epoch 为单位)。有助于恢复训练。 | 1 | 1 | FALSE | ||
validation_interval |
int | 在验证数据集上触发评估的时间间隔(以 epoch 为单位)。 | 1 | 1 | FALSE | ||
resume_training_checkpoint_path |
string | 用于从中恢复训练的检查点路径。 | FALSE | ||||
results_dir |
string | 存储从任务生成的所有资产的路径。 | FALSE | ||||
|
list |
要冻结的层名称列表。 |
[] |
|
|
|
FALSE |
pretrained_model_path |
string | 预训练的 Deformable DETR 模型路径,用于初始化当前的训练。 | FALSE | ||||
|
float |
按 L2 范数剪裁梯度的量。 |
0.1 |
|
|
|
FALSE |
|
bool |
是否在 Dry Run 模式下运行训练器。这用作 |
False |
|
|
|
FALSE |
optim |
collection | 用于配置优化器的超参数。 | FALSE | ||||
precision |
string | 运行训练的精度。 | fp32 | fp16,fp32,bf16 | FALSE | ||
|
string |
多 GPU 训练策略。 |
ddp |
|
|
ddp,fsdp |
FALSE |
|
bool |
True 值指示训练在向后传递中重新计算以节省 GPU 内存, |
True |
|
|
|
FALSE |
verbose |
bool | 用于启用打印来自优化器的详细学习率缩放的标志。 | False | FALSE |
optim
optim
参数定义了训练中优化器的配置,包括学习率、学习率调度器和权重衰减。
optim:
lr: 0.0002
lr_backbone: 0.00002
momentum: 0.9
weight_decay: 0.0001
lr_scheduler: MultiStep
lr_steps: [10, 20]
lr_decay: 0.1
字段 |
value_type |
描述 |
default_value |
valid_min |
valid_max |
valid_options |
automl_enabled |
---|---|---|---|---|---|---|---|
optimizer |
string | 用于训练网络的优化器类型。 | AdamW | AdamW,SGD | FALSE | ||
monitor_name |
string | 要为 AutoReduce 调度器监控的指标值。 |
val_loss | val_loss,train_loss | FALSE | ||
lr |
float | 训练模型(不包括主干)的初始学习率。 | 0.0002 | TRUE | |||
lr_backbone |
float | 训练主干的初始学习率。 | 2e-05 | TRUE | |||
lr_linear_proj_mult |
float | 训练线性投影层的初始学习率。 | 0.1 | TRUE | |||
momentum |
float | AdamW 优化器的动量。 | 0.9 | TRUE | |||
weight_decay |
float | 权重衰减系数。 | 0.0001 | TRUE | |||
|
string |
学习率调度器 |
MultiStep |
|
|
MultiStep,StepLR |
FALSE |
|
list |
必须减小学习率的步数。 |
[10] |
|
|
|
FALSE |
lr_step_size |
int | 在 StepLR 中减小学习率的步数。 | 10 | TRUE | |||
lr_decay |
float | 学习率调度器的递减因子。 | 0.1 | TRUE |
dataset
dataset
参数定义了数据集源、训练批大小和增强。
dataset:
train_data_sources:
- image_dir: /path/to/coco/train2017/
json_file: /path/to/coco/annotations/instances_train2017.jsonl # odvg format
label_map: /path/to/coco/annotations/instances_train2017_labelmap.json
- image_dir: /path/to/coco/train2017/
json_file: /path/to/coco/annotations/refcoco.jsonl # grounding dataset which doesn't require label_map
val_data_sources:
image_dir: /path/to/coco/val2017/
json_file: /path/to/coco/annotations/instances_val2017_contiguous.json # category ids need to be contiguous
test_data_sources:
image_dir: /path/to/coco/images/val2017/
json_file: /path/to/coco/annotations/instances_val2017.json
infer_data_sources:
- image_dir: /path/to/coco/images/val2017/
captions: ["blackcat", "car"]
max_labels: 80
batch_size: 4
workers: 8
字段 |
value_type |
描述 |
default_value |
valid_min |
valid_max |
valid_options |
automl_enabled |
---|---|---|---|---|---|---|---|
|
list |
训练数据源列表 |
[{‘image_dir’: ‘’, ‘json_file’: ‘’, ‘label_map’: ‘’}, {‘image_dir’: ‘’, ‘json_file’: ‘’}] |
|
|
|
FALSE |
|
collection |
验证的数据源 |
{‘image_dir’: ‘’, ‘json_file’: ‘’} |
|
|
|
FALSE |
|
collection |
测试的数据源 |
{‘image_dir’: ‘’, ‘json_file’: ‘’} |
|
|
|
FALSE |
|
collection |
推理的数据源 |
{‘image_dir’: [‘’], ‘captions’: [‘’]} |
|
|
|
FALSE |
batch_size |
int | 训练和验证的批大小 | 4 | 1 | inf | TRUE | |
workers |
int | 并行处理数据的 worker 数量 | 8 | 1 | inf | TRUE | |
|
bool |
启用数据加载器为更快分配页锁定内存的标志 |
True |
|
|
|
FALSE |
|
string |
如果设置为 default,我们遵循标准的 map-style 数据集结构 |
serialized |
|
|
serialized,default |
FALSE |
|
int |
要从中采样的标签总数。在采样正标签后, |
50 |
1 |
inf |
|
FALSE |
eval_class_ids |
list | 用于评估的类 ID。 | [1] | FALSE | |||
augmentation |
collection | 数据增强的配置参数 | FALSE | ||||
has_mask |
bool | 用于从数据集加载掩码注释的标志。 | FALSE |
augmentation
augmentation
参数包含增强的超参数。
augmentation:
scales: [480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800]
input_mean: [0.485, 0.456, 0.406]
input_std: [0.229, 0.224, 0.225]
horizontal_flip_prob: 0.5
train_random_resize: [400, 500, 600]
train_random_crop_min: 384
train_random_crop_max: 600
random_resize_max_size: 1333
test_random_resize: 800
字段 |
value_type |
描述 |
default_value |
valid_min |
valid_max |
valid_options |
automl_enabled |
---|---|---|---|---|---|---|---|
scales |
list | 执行随机调整大小的尺寸列表。 | [480, 512, 544, 576, 608, 640, 672, 704, 736, 768, 800] | FALSE | |||
input_mean |
list | RGB 帧的输入均值 | [0.485, 0.456, 0.406] | FALSE | |||
input_std |
list | RGB 帧的每个像素的输入标准差 | [0.229, 0.224, 0.225] | FALSE | |||
train_random_resize |
list | 用于训练数据的随机调整大小的尺寸列表 | [400, 500, 600] | FALSE | |||
horizontal_flip_prob |
float | 训练期间水平翻转的概率 | 0.5 | 0.0 | 1.0 | TRUE | |
train_random_crop_min |
int | 训练数据的最小随机裁剪大小 | 384 | 1 | inf | TRUE | |
train_random_crop_max |
int | 训练数据的最大随机裁剪大小 | 600 | 1 | inf | TRUE | |
random_resize_max_size |
int | 训练数据的最大随机调整大小 | 1333 | 1 | inf | TRUE | |
test_random_resize |
int | 测试数据的随机调整大小 | 800 | 1 | inf | TRUE | |
|
bool |
一个标志,指定是否将图像(不带填充)调整为 |
TRUE |
|
|
|
FALSE |
|
int |
用于启用大规模抖动的标志,该抖动用于 ViT 主干。 |
1024 |
1 |
inf |
|
FALSE |
要训练 Mask Grounding DINO 模型,请使用以下命令
tao model mask_grounding_dino train [-h] -e <experiment_spec>
必需参数
-e, --experiment_spec
:用于设置训练实验的实验规范文件
可选参数
-h, --help
:显示此帮助消息并退出。
示例用法
这是 train
命令的示例
tao mask_grounding_dino model train -e /path/to/spec.yaml
优化用于训练 Groudning DINO 的资源
训练 Mask Grounding DINO 需要强大的 GPU(例如:V100/A100),至少具有 15GB 的 VRAM 和大量 CPU 内存,才能在像 COCO 这样的标准数据集上进行训练。本节概述了您可以使用的一些策略,以便仅使用有限的资源启动训练。
优化 GPU 内存
有多种方法可以优化 GPU 内存使用率。一种技巧是减少 dataset.batch_size
。但是,这可能会导致您的训练花费比平常更长的时间。我们建议设置以下配置以优化 GPU 消耗。
将
train.precision
设置为bf16
以启用自动混合精度训练。这可以将您的 GPU 内存使用率降低 50%。将
train.activation_checkpoint
设置为True
以启用激活检查点。通过重新计算激活而不是将它们缓存到内存中,可以提高内存使用率。将
train.distributed_strategy
设置为fsdp
以启用完全分片数据并行训练。这将跨不同进程共享梯度计算,以帮助减少 GPU 内存。尝试使用更轻量级的主干,如
swin_tiny_224_1k
,或通过将model.train_backbone
设置为 False 来冻结主干。尝试根据您的数据集在
dataset.augmentation
中更改增强分辨率。
优化 CPU 内存
为了加速数据加载,通常的做法是设置大量 worker 以生成多个进程。但是,如果您的注释文件很大,这可能会导致您的 CPU 内存耗尽。因此,我们建议设置以下配置以优化 CPU 消耗。
将
dataset.dataset_type
设置为serialized
,以便可以跨不同的子进程共享基于 COCO 的注释数据。将
dataset.augmentation.fixed_padding
设置为 True,以便在批次形成之前填充图像。由于训练期间的随机调整大小和随机裁剪增强,变换后生成的图像分辨率可能因图像而异。这种可变的图像分辨率可能会导致内存泄漏,并且 CPU 内存会缓慢堆积,直到在训练过程中内存耗尽。这是 PyTorch 的限制,因此我们建议将fixed_padding
设置为 True,以帮助稳定 CPU 内存使用率。
评估
evaluate
参数定义了评估过程的超参数。
evaluate:
checkpoint: /path/to/model.pth
conf_threshold: 0.0
num_gpus: 1
字段 |
value_type |
描述 |
default_value |
valid_min |
valid_max |
valid_options |
automl_enabled |
---|---|---|---|---|---|---|---|
num_gpus |
int | 1 | FALSE | ||||
gpu_ids |
list | [0] | FALSE | ||||
num_nodes |
int | 1 | FALSE | ||||
checkpoint |
string | ??? | FALSE | ||||
results_dir |
string | FALSE | |||||
input_width |
int | 输入图像张量的宽度。 | 1 | FALSE | |||
input_height |
int | 输入图像张量的高度。 | 1 | FALSE | |||
|
string |
用于评估的 TensorRT 引擎路径。 |
|
|
|
|
FALSE |
|
float |
用于筛选最终框列表时要使用的置信度阈值。 |
0.0 |
|
|
|
FALSE |
要使用 Mask Grounding DINO 模型运行评估,请使用以下命令
tao model mask_grounding_dino evaluate [-h] -e <experiment_spec> \
evaluate.checkpoint=<model to be evaluated>
必需参数
-e, --experiment_spec
:用于设置评估实验的实验规范文件
可选参数
evaluate.checkpoint
:要评估的.pth
模型
示例用法
这是使用 evaluate
命令的示例
tao model mask_grounding_dino evaluate -e /path/to/spec.yaml evaluate.checkpoint=/path/to/model.pth
推理
inference
参数定义了推理过程的超参数。
inference:
checkpoint: /path/to/model.pth
conf_threshold: 0.5
num_gpus: 1
color_map:
"blackcat": red
car: blue
dataset:
infer_data_sources:
image_dir: /data/raw-data/val2017/
captions: ["blackcat", "cat"]
字段 |
value_type |
描述 |
default_value |
valid_min |
valid_max |
valid_options |
automl_enabled |
---|---|---|---|---|---|---|---|
num_gpus |
int | 1 | FALSE | ||||
gpu_ids |
list | [0] | FALSE | ||||
num_nodes |
int | 1 | FALSE | ||||
checkpoint |
string | ??? | FALSE | ||||
results_dir |
string | FALSE | |||||
|
string |
用于评估的 TensorRT 引擎路径。 |
|
|
|
|
FALSE |
color_map |
collection | 用于渲染框的按类别的颜色字典。 | FALSE | ||||
|
float |
用于筛选最终框列表时要使用的置信度阈值。 |
0.5 |
|
|
|
FALSE |
is_internal |
bool | 用于使用内部目录结构渲染的标志。 | False | FALSE | |||
input_width |
int | 输入图像张量的宽度。 | 960 | 32 | FALSE | ||
input_height |
int | 输入图像张量的高度。 | 544 | 32 | FALSE | ||
outline_width |
int | 边界框轮廓的像素宽度。 | 3 | 1 | FALSE |
Mask Grounding DINO 模型的推理工具可用于可视化边界框,并在图像目录上生成逐帧 KITTI 格式标签。
tao model mask_grounding_dino inference [-h] -e <experiment spec file>
inference.checkpoint=<model to be inferenced>
必需参数
-e, --experiment_spec
:用于设置推理实验的实验规范文件
可选参数
inference.checkpoint
:要推理的.pth
模型
示例用法
这是使用 inference
命令的示例
tao model mask_grounding_dino inference -e /path/to/spec.yaml inference.checkpoint=/path/to/model.pth
导出
export
参数定义了导出过程的超参数。
export:
checkpoint: /path/to/model.pth
onnx_file: /path/to/model.onnx
on_cpu: False
opset_version: 17
input_channel: 3
input_width: 960
input_height: 544
batch_size: -1
字段 |
值类型 |
描述 |
default_value |
valid_min |
valid_max |
valid_options |
automl_enabled |
---|---|---|---|---|---|---|---|
results_dir |
string | 存储从任务生成的所有资产的路径。 | FALSE | ||||
gpu_id |
int | 用于构建 TensorRT 引擎的 GPU 索引。 | 0 | FALSE | |||
checkpoint |
string | 要运行导出的检查点文件路径。 | ??? | FALSE | |||
onnx_file |
string | ONNX 模型文件的路径。 | ??? | FALSE | |||
on_cpu |
bool | 用于导出 CPU 兼容模型的标志。 | False | FALSE | |||
input_channel |
int | 输入张量中的通道数。 | 3 | 3 | FALSE | ||
input_width |
int | 输入图像张量的宽度。 | 960 | 32 | FALSE | ||
input_height |
int | 输入图像张量的高度。 | 544 | 32 | FALSE | ||
opset_version |
int |
|
17 | 1 | FALSE | ||
batch_size |
int |
|
-1 | -1 | FALSE | ||
verbose |
bool | 用于启用详细 TensorRT 日志记录的标志。 | False | FALSE |
tao model mask_grounding_dino export [-h] -e <experiment spec file>
export.checkpoint=<model to export>
export.onnx_file=<onnx path>
必需参数
-e, --experiment_spec
:实验规范文件的路径
可选参数
export.checkpoint
:要导出的.pth
模型export.onnx_file
:保存.onnx
模型的路径
示例用法
这是使用 export
命令的示例
tao model mask_grounding_dino export -e /path/to/spec.yaml export.checkpoint=/path/to/model.pth export.onnx_file=/path/to/model.onnx