本文へスキップ
SDK Version: 2.5.0

YAML Model Configuration

Every model in DX-ModelZoo is defined by a single YAML file. No Python code is needed — preprocessing, postprocessing, evaluation, and compilation settings are all included.

Full Structure​

name: resnet50_224x224 # Model name
task: image_classification # Task type
reference: # Paper/repository URL
description: # Model description (multiline)

inputs: # Input tensor definitions
- name: input
shape: [1, 3, 224, 224]
dtype: float32
layout: NCHW

preprocessing: # Preprocessing pipeline
- type: resize
size: [256, 256]
- type: centercrop
height: 224
width: 224
# ...

postprocessing: # Postprocessing pipeline
- type: topk
k: [1, 5]

dataset: # Dataset configuration
type: ILSVRC2012
eval_path: ${DATA_ROOT}/ILSVRC2012/val

evaluator: # Evaluator type
type: image_classification

artifacts: # Model file paths
path: ${MODEL_ROOT}/${MODEL_NAME}

calibration: &calibration
method: ema
num: 100
seed: 42

profiles: # Runtime profiles
onnx:
target: onnx
runtime:
device: gpu
batch_size: 1
q-lite:
target: dxnn
compile:
calibration: *calibration
runtime:
device: 0

Section Details​

name / task​

name: YOLOv8s # Unique name (should match filename)
task: object_detection # Task type

Supported tasks:

TaskDescription
image_classificationImage classification
object_detectionObject detection
semantic_segmentationSemantic segmentation
instance_segmentationInstance segmentation
face_detectionFace detection
face_landmarkFacial landmark detection
pose_estimationPose estimation
depth_estimationDepth estimation
super_resolutionSuper resolution
oriented_object_detectionOriented bounding box detection (OBB)

reference / description​

Optional metadata fields for documentation:

reference: https://arxiv.org/abs/1512.03385 # Paper or GitHub URL
description: |
ResNet-50 trained on ImageNet-1K.
Top-1 accuracy: 76.13%
Top-5 accuracy: 93.15%
  • reference: URL to the paper, GitHub repo, or model card
  • description: Multiline string describing the model, training details, and performance

inputs​

Defines the model's input tensors. Multi-input models are supported.

# Single input (most CV models)
inputs:
- name: input
shape: [1, 3, 224, 224]
dtype: float32
layout: NCHW

# Multiple inputs (e.g., BERT NLP models)
inputs:
- name: input_ids
shape: [1, 256]
dtype: int64
- name: attention_mask
shape: [1, 256]
dtype: int64
- name: token_type_ids
shape: [1, 256]
dtype: int64

preprocessing​

The preprocessing pipeline applied to input data. Steps execute in order.

preprocessing:
- type: resize
mode: torchvision
size: [256, 256]
interpolation: BILINEAR
- type: centercrop
height: 224
width: 224
- type: convertcolor
form: BGR2RGB
- type: div
x: 255
- type: normalize
mean: [0.485, 0.456, 0.406]
std: [0.229, 0.224, 0.225]
- type: transpose
axis: [2, 0, 1]
- type: expanddim
axis: 0

Built-in preprocessing types:

TypeParametersDescription
resizesize, mode, interpolationImage resize
centercropheight, widthCenter crop
convertcolorformColor conversion (e.g., BGR2RGB)
divxDivide values (normalization)
normalizemean, stdMean/std normalization
transposeaxisAxis permutation (HWC→CHW)
expanddimaxisAdd dimension (batch)
bgr_to_y_channel—BGR → Y channel conversion
NPU arithmetic behavior

For a target: dxnn profile, arithmetic operations such as div, normalize, transpose, and expanddim are skipped when runtime input dtype is uint8. They remain for float32 input. Set appendix.npu_skip_arithmetic: false when a model requires CPU-side arithmetic preprocessing.

postprocessing​

The postprocessing pipeline applied to model outputs.

# Classification
postprocessing:
- type: topk
k: [1, 5]

# Object Detection
postprocessing:
- type: nms
conf_thres: 0.25
iou_thres: 0.45
max_output_boxes: 300

# Segmentation
postprocessing:
- type: segmentation_argmax

# No postprocessing
postprocessing:
- type: identity

dataset​

Dataset configuration for evaluation. Use ${DATA_ROOT} to specify the root path.

dataset:
type: ILSVRC2012
eval_path: ${DATA_ROOT}/ILSVRC2012/val

Built-in datasets:

TypeTaskExample Path
ILSVRC2012ClassificationILSVRC2012/val
COCODetectionCOCO
PascalVOC2007DetectionVOCdevkit/VOC2007
CityscapesSegmentationcityscapes
ADE20KSegmentationADEChallengeData2016
WiderFaceFace detectionWIDER_FACE
COCOPosePose estimationCOCO
NYUDepthv2Depth estimationNYU_Depth_V2
BSD68DenoisingBSD68
BSD100Super resolutionBSD100/bicubic_4x
DOTAv1Oriented detectionDOTA/val
LFWFace verificationlfw

evaluator​

Specifies the evaluator type for computing metrics.

evaluator:
type: image_classification

The evaluator type typically matches the task type. Common evaluators:

EvaluatorMetrics
image_classificationTop-1, Top-5 Accuracy
object_detectionmAP@0.5, mAP@0.5:0.95
semantic_segmentationmIoU, Pixel Accuracy
instance_segmentationbbox mAP, segm mAP
face_detectionmAP, Recall
pose_estimationAP, AR

artifacts​

Defines where to find model files (ONNX, weights, etc.).

artifacts:
path: ${MODEL_ROOT}/${MODEL_NAME}
  • path: Directory containing model files
  • Uses ${MODEL_ROOT} environment variable + ${MODEL_NAME} (auto-set to the name field)
  • DX-ModelZoo automatically downloads models if not found locally

profiles​

Defines multiple runtime profiles. Each profile specifies its own target, compilation options, and runtime options.

profiles:
# ONNX Runtime profile
onnx:
target: onnx
runtime:
device: gpu # gpu or cpu
batch_size: 4 # Batch size (adjustable for onnx only)
async: false # Default for onnx profiles

# NPU Compile-Lite (opt_level=0)
c-lite:
target: dxnn
compile:
opt_level: 0
calibration: *calibration
runtime:
device: 0
async: true # Default for dxnn profiles
buffer_count: 6 # Engine I/O buffer count (1-100)
use_ort: true # Run unsupported ops on ONNX Runtime

# NPU Quantize-Lite
q-lite:
target: dxnn
compile:
calibration: *calibration
runtime:
device: 0

# NPU Quantize-Pro (automatic Q-PRO pipeline)
q-pro:
target: dxnn
compile:
calibration:
<<: *calibration
num: 1024
use_q_pro: true
runtime:
device: 0
async: true
NOTE

calibration.use_q_pro: true enables dx_com's automatic Q-PRO pipeline. Calibration settings are passed through the profile's compile block.

Profile Naming Convention​

ProfileTargetDescription
onnxonnxONNX Runtime inference
c-litedxnnCompile profile with opt_level: 0
q-litedxnnNPU profile with standard calibration
q-prodxnnNPU profile with calibration.use_q_pro: true

Calibration Options​

These keys are typically defined once in a top-level calibration: block (using a YAML anchor, e.g. calibration: &calibration) and reused across profiles via calibration: *calibration, as shown in Full Structure.

KeyDescription
compile.calibration.methodCalibration method, such as ema
compile.calibration.numNumber of calibration samples
compile.calibration.seedCalibration random seed
compile.calibration.use_q_proEnable automatic Q-PRO calibration

Runtime Options​

KeyTypeDescription
runtime.devicestr | int | listExecution device. ONNX typically uses cpu/gpu; DXNN uses NPU device IDs.
runtime.batch_sizeintEvaluation batch size. Adjustable for ONNX; DXNN evaluation is effectively batch size 1.
runtime.asyncboolEnable async inference. Defaults to false for ONNX profiles and true for DXNN profiles.
runtime.buffer_countintDXNN-only engine I/O buffer count. Must be in [1, 100].
runtime.use_ortboolDXNN-only fallback for unsupported ops via ONNX Runtime. Defaults to true.

compile.ppu_config​

ppu_config is an optional DXNN-only compile block for postprocessing. Types 0 and 1 use PPU hardware; type 2 is a CPU-side TopK optimization for DFL-based YOLO models and does not use PPU hardware.

compile:
ppu_config:
type: 0|1|2 # 0=anchor-based, 1=anchor-free single-head, 2=DFL-based CPU TopK (deprecated)
num_classes: 80
conf_thres: 0.5 # type 0,1 only
activation: sigmoid # type 0 only
topk: 100 # type 2 only
layer: ... # dict for type 0, list for type 1,2
KeyRequired ForDescription
typeallMode: 0 anchor-based PPU, 1 anchor-free single-head PPU, 2 DFL-based CPU TopK (no PPU hardware)
num_classesallNumber of classes
conf_threstype 0, 1Confidence threshold
activationtype 0Activation name such as sigmoid
topktype 2Top-k candidate count
layerallPer-layer PPU description (dict for type 0, list for type 1/2)
PPU type 2 is deprecated

DX-Compiler deprecated type 2 in v2.4.0. Use dx_com.pre_optimize() for the recommended TopK-first optimization instead.

Environment Variable Substitution​

YAML files can reference environment variables using the ${VAR_NAME} syntax:

dataset:
eval_path: ${DATA_ROOT}/ILSVRC2012/val # Substitutes DATA_ROOT env var

artifacts:
path: ${MODEL_ROOT}/${MODEL_NAME} # MODEL_NAME equals the name field

Special variables:

VariableDescriptionExample
${MODEL_NAME}Value of the YAML name field (not an OS environment variable)resnet50_224x224

${DATA_ROOT}, ${MODEL_ROOT}, and ${DXMZ_MODEL_URL} follow the same ${VAR_NAME} substitution syntax — see CLI Reference for the full list and how to set them.

DXMZ_MODEL_URL is used by the session factory to construct download URLs:

  • ONNX: ${DXMZ_MODEL_URL}/onnx/<model_name>.onnx
  • DXNN: ${DXMZ_MODEL_URL}/<profile>-dxnn/latest/<model_name>_<profile>.dxnn

These values can be set via:

  • Environment variables: export DATA_ROOT=/data/datasets
  • .env file in the project root
  • Command-line options: dxmz eval ... --data-root /data/datasets