YOLO-DETR#

YOLO-DETR wraps detection models that export decoded query predictions as a single [1, N, 6] tensor. Each prediction row contains:

[cx, cy, width, height, confidence, class_id]

The box coordinates are normalized to the model input dimensions. The wrapper converts them to xyxy coordinates, applies the configured confidence threshold, and rescales them to the original image dimensions.

The wrapper uses fit_to_window_letterbox resizing and a default confidence threshold of 0.5. Non-maximum suppression is disabled by default because the YOLO-DETR decoder already selects its query predictions. It can be enabled explicitly with nms_execute=True when required by a downstream workflow.

from model_api.models import Model

model = Model.create_model("yolo_detr.xml")
result = model(image)

The exported model should contain YOLODETR in model_info.model_type, allowing Model.create_model() to select this wrapper automatically.

YOLO-DETR detection model wrapper.

class model_api.models.yolo_detr.YOLODETR(inference_adapter, configuration={}, preload=False)#

Bases: DetectionModel

Detection wrapper for decoded YOLO-DETR query outputs.

The model output is a single tensor with shape [1, N, 6]. Each row is [center_x, center_y, width, height, confidence, class_id] with box coordinates normalized to the model input dimensions.

Detection Model constructor

It extends the ImageModel construtor.

Parameters:
  • inference_adapter (InferenceAdapter) – allows working with the specified executor

  • configuration (dict) – it contains values for parameters accepted by specific wrapper (confidence_threshold, labels etc.) which are set as data attributes

  • preload (bool) – a flag whether the model is loaded to device while initialization. If preload=False, the model must be loaded via load method before inference

Raises:

WrapperError – if the model has more than 1 image inputs

classmethod parameters()#

Defines the description and type of configurable data parameters for the wrapper.

See types.py to find available types of the data parameter. For each parameter the type, default value and description must be provided.

The example of possible data parameter:
‘confidence_threshold’: NumericalValue(

default_value=0.5, description=”Threshold value for detection box confidence”

)

The method must be implemented in each specific inherited wrapper.

Returns:

  • the dictionary with defined wrapper data parameters

postprocess(outputs, meta)#

Convert decoded normalized query detections to ModelAPI results.

Return type:

DetectionResult