SimaBoxDecode Class
EV74 postprocess Node that converts detection-head tensors into detection results. More...
Declaration
Included Headers
Base classes
| class | Node |
| class | InputContractConfigurable |
| class | OutputSpecProvider |
| class | PreprocessMetaRequirementProvider |
| class | NodeContractProvider |
| class | NodeContractConfigurable |
Public Constructors Index
| SimaBoxDecode (BoxDecodeType decode_type, double detection_threshold=0.0, double nms_iou_threshold=0.0, int top_k=0, const std::string &element_name="", int original_width=0, int original_height=0, int model_width=0, int model_height=0, BoxDecodeTypeOption decode_type_option=BoxDecodeTypeOption::Auto, std::optional< BoxDecodeSourceStorage > source_storage=std::nullopt, std::optional< bool > detess=std::nullopt, std::optional< bool > dequant=std::nullopt) | |
|
Construct from raw geometry — for graphs without a bound Model. More... | |
| SimaBoxDecode (const simaai::neat::Model &model, BoxDecodeType decode_type, double detection_threshold=0.0, double nms_iou_threshold=0.0, int top_k=0, const std::string &element_name="", std::optional< bool > route_tess_needed=std::nullopt, std::optional< bool > route_quant_needed=std::nullopt, int original_width=0, int original_height=0, int model_width=0, int model_height=0, std::optional< ResizeMode > resize_mode_override=std::nullopt, BoxDecodeTypeOption decode_type_option=BoxDecodeTypeOption::Auto) | |
|
Construct from a bound Model — pulls geometry and routing flags from the model. More... | |
Public Member Functions Index
| std::string | kind () const override |
|
Type label for this Node kind. More... | |
| NodeCapsBehavior | caps_behavior () const override |
|
Whether the Node negotiates static or dynamic caps. More... | |
| std::string | backend_fragment (int node_index) const override |
|
GStreamer fragment this Node emits. More... | |
| std::vector< std::string > | element_names (int node_index) const override |
|
Deterministic element names this Node will create. More... | |
| OutputSpec | output_spec (const OutputSpec &input) const override |
|
Negotiated downstream caps produced by this Node. More... | |
| std::optional< PreprocessMetaRequirement > | preprocess_meta_requirement () const override |
|
Preprocess metadata fields this Node requires upstream. More... | |
| NodeContractDefinition | contract_definition () const override |
|
Structural contract definition for this Node. More... | |
| bool | compile_node_contract (const ContractCompileInput &input, CompiledNodeContract *out, std::string *err) const override |
|
Compile this Node's contract from the given input. More... | |
| void | apply_compiled_contract (const CompiledNodeContract &contract, std::string *err) override |
|
Apply a compiled contract back into this Node. More... | |
| void | apply_input_contract (const InputContract &contract, std::string *err) override |
|
Apply an input contract from upstream. More... | |
Private Member Attributes Index
| std::unique_ptr< BoxDecodeOptionsInternal > | opt_ |
| std::optional< InputContract > | input_contract_ |
Description
EV74 postprocess Node that converts detection-head tensors into detection results.
SimaBoxDecode is the postprocessing node used by object-detection graphs after MLA inference. It reads the model output tensors, decodes them according to the selected BoxDecodeType, applies confidence filtering and NMS, and emits a detection tensor. Detection models parse it as boxes; pose and segmentation models can also parse the appended keypoints or masks.
When to use it.
- Use the Model constructor for normal model-pack and Graph applications. The model archive supplies the tensor layout, quantization, class count, and resize information needed by the decoder.
- Use the raw-geometry constructor only when you are wiring detection-head tensors yourself and can provide the original image size, model input size, and decode family.
Inputs.
The node expects the raw detection output tensors produced by the model. For MPK-backed models, Neat reads the packaged contract and preserves the model's tensor order, physical layout, slices, dtype, and score domain automatically. Application code normally only chooses the decode family (BoxDecodeType) and filtering thresholds.
Outputs.
The output starts with a BBOX detection payload. Use decode_bbox_tensor(), decode_bbox(), or stages::BoxDecodeResults() when you only need boxes. For task-specific payloads, use decode_pose() to get boxes plus [N, 17, 3] keypoints, or decode_segmentation() to get boxes plus [N, 160, 160] masks. Use SimaRender downstream when you want an annotated video/image stream.
Supported families.
Supported decode families include YOLO, YOLOv5/v7/v8/v9/v10 detection and segmentation variants, YOLOv8 pose, YOLO26 detection/pose/segmentation, YOLOv6, YOLOX, DETR, EfficientDet, RCNN stage 1, and CenterNet. BoxDecodeType::Unspecified is only a sentinel and fails before runtime.
Score and layout notes.
Some models output probabilities; others output logits that must be activated before thresholding. Model packs carry this information when available. If you are manually wiring tensors, choose the decode type and decode option that match your exported head format. Do not infer correctness from tensor rank alone: sliced, padded, packed, and dense outputs can have the same logical shape while requiring different handling. The model-aware path handles these details for supported model packs.
- See Also
- See Also
- See Also
Definition at line 101 of file SimaBoxDecode.h.
Public Constructors
SimaBoxDecode()
| explicit |
Construct from raw geometry — for graphs without a bound Model.
- Parameters
-
decode_type Decoder variant (see BoxDecodeType).
detection_threshold Score threshold; boxes below are dropped (0 = use default).
nms_iou_threshold NMS IoU threshold (0 = use default).
top_k Max boxes to keep after NMS (0 = unlimited / variant default).
element_name Optional GStreamer element name.
original_width Width of the unscaled source frame (used for box rescaling).
original_height Height of the unscaled source frame.
model_width Input width the model was trained for.
model_height Input height the model was trained for.
decode_type_option Decoder sub-variant selector (Auto to defer to the model).
source_storage Explicit source byte layout of the upstream head tensors. Required for hand-built graphs that decode without a model pack (the upstream contract does not carry packing flags, so it cannot be inferred); leave as std::nullopt when a model pack supplies it. Contract compilation fails fast if it is neither model-pack-supplied nor set.
detess Explicit override: do the upstream heads need detessellation before decode? std::nullopt keeps the standalone default (no detess) / model-pack value. Set for hand-built graphs whose upstream delivers tessellated heads.
dequant Explicit override: do the upstream heads need dequantization before decode? std::nullopt keeps the standalone default (derived from the input dtype) / model-pack value. When true, the upstream must carry quant scale/zero-point.
Definition at line 135 of file SimaBoxDecode.h.
SimaBoxDecode()
| explicit |
Construct from a bound Model — pulls geometry and routing flags from the model.
- Parameters
-
model Source model (provides input shape, routing hints, etc.).
decode_type Decoder variant (see BoxDecodeType).
detection_threshold Score threshold (0 = use default).
nms_iou_threshold NMS IoU threshold (0 = use default).
top_k Max boxes to keep after NMS.
element_name Optional GStreamer element name.
route_tess_needed Override: does the route need a tess stage upstream?
route_quant_needed Override: does the route need a quant stage upstream?
original_width Width of the unscaled source frame.
original_height Height of the unscaled source frame.
model_width Optional override: model-input width. 0 = derive from the model pack (default). When set, the value flows through to the decoder kernel's spatial knobs; the model-managed compiled_contract still drives quant / decode-family / tensor layout, so callers can override geometry without falling off the model-managed contract path.
model_height Optional override: model-input height. Same semantics as model_width. Both must be set together (or both zero).
resize_mode_override Optional override: explicit preprocess resize mode (Stretch/Letterbox/Crop). Use when running the model without an upstream Preproc stage and the per-buffer preproc_resize_mode meta isn't being written by an upstream element. When set, the contract drops preproc_resize_mode from the required-meta list so buffers flow through cleanly; otherwise the value is sourced from per-buffer GstSimaaiPreprocessMeta as before.
decode_type_option Decoder sub-variant selector.
Definition at line 174 of file SimaBoxDecode.h.
Public Member Functions
apply_compiled_contract()
|
Apply a compiled contract back into this Node.
Definition at line 223 of file SimaBoxDecode.h.
apply_input_contract()
|
Apply an input contract from upstream.
Definition at line 225 of file SimaBoxDecode.h.
backend_fragment()
|
GStreamer fragment this Node emits.
Definition at line 210 of file SimaBoxDecode.h.
caps_behavior()
| inline |
Whether the Node negotiates static or dynamic caps.
Definition at line 206 of file SimaBoxDecode.h.
compile_node_contract()
|
Compile this Node's contract from the given input.
Definition at line 220 of file SimaBoxDecode.h.
contract_definition()
|
Structural contract definition for this Node.
Definition at line 218 of file SimaBoxDecode.h.
element_names()
|
Deterministic element names this Node will create.
Definition at line 212 of file SimaBoxDecode.h.
kind()
| inline |
Type label for this Node kind.
Definition at line 202 of file SimaBoxDecode.h.
output_spec()
|
Negotiated downstream caps produced by this Node.
Definition at line 214 of file SimaBoxDecode.h.
preprocess_meta_requirement()
|
Preprocess metadata fields this Node requires upstream.
Definition at line 216 of file SimaBoxDecode.h.
Private Member Attributes
input_contract_
|
Definition at line 250 of file SimaBoxDecode.h.
opt_
|
Definition at line 249 of file SimaBoxDecode.h.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.