Skip to main content

BoxDecode Decode Types

BoxDecodeType is now a typed API (simaai::neat::BoxDecodeType / neat.BoxDecodeType) and should always be set explicitly for decode stages.

The runtime contract below comes from internals/gst_plugins/genericboxdecode_v2/gstneatboxdecode.cpp (infer_num_classes, infer_yolo_decoupled_classes, infer_yolo_packed_classes, compute_required_output_size).

Core Tensor Contract Rules

  • YOLO-family decode types (yolo, yolov5*, yolov7*, yolov8*, yolov9*, yolov10*):
    • Decoupled heads: class-head depths must be repeatable and > 4.
    • Packed heads: each head depth must satisfy depth = 3 * (num_classes + 5) and be consistent across heads.
  • yolo26: decoupled grouped heads with 4-channel raw l/t/r/b bbox tensors and repeatable class-head depths > 4.
  • detr: class channels are inferred from the maximum depth across heads, and must be > 4.
  • Other non-YOLO decode types (effdet, rcnn-stage1, centernet): fallback class inference uses max depth and requires > 4.
  • Segmentation decode tokens (*-seg) enable segmentation-like output sizing in v2 (adds mask payload per detection).

Type Mapping

API enumBackend tokenExpected contract
BoxDecodeType::YoloyoloYOLO decoupled or packed depth contract
BoxDecodeType::YoloV5yolov5YOLO decoupled or packed depth contract
BoxDecodeType::YoloV5Segyolov5-segYOLO depth contract + segmentation path
BoxDecodeType::YoloV7yolov7YOLO decoupled or packed depth contract
BoxDecodeType::YoloV7Segyolov7-segYOLO depth contract + segmentation path
BoxDecodeType::YoloV8yolov8YOLO decoupled or packed depth contract
BoxDecodeType::YoloV8Segyolov8-segYOLO depth contract + segmentation path
BoxDecodeType::YoloV8Poseyolov8-poseYOLO decoupled or packed depth contract
BoxDecodeType::YoloV9yolov9YOLO decoupled or packed depth contract
BoxDecodeType::YoloV9Segyolov9-segYOLO depth contract + segmentation path
BoxDecodeType::YoloV10yolov10YOLO decoupled or packed depth contract
BoxDecodeType::YoloV10Segyolov10-segYOLO depth contract + segmentation path
BoxDecodeType::YoloV26yolo26YOLO26 grouped raw l/t/r/b bbox heads + class-score heads
BoxDecodeType::Detrdetrnum_classes = max(depth) (must be > 4)
BoxDecodeType::EffDeteffdetfallback max-depth inference (> 4)
BoxDecodeType::RcnnStage1rcnn-stage1fallback max-depth inference (> 4)
BoxDecodeType::Centernetcenternetfallback max-depth inference (> 4)

Fail-Fast Behavior

  • stages::BoxDecodeOptions now requires explicit construction with a decode type.
  • stages::BoxDecode(...) and nodes::SimaBoxDecode(...) fail fast on BoxDecodeType::Unspecified.

Examples

simaai::neat::stages::BoxDecodeOptions opt(simaai::neat::BoxDecodeType::YoloV8);
opt.detection_threshold = 0.25;
opt.nms_iou_threshold = 0.5;
opt.top_k = 100;
opt = neat.ModelOptions()
opt.decode_type = neat.BoxDecodeType.YoloV8