Skip to main content

SimaBoxDecode.h File

SimaBoxDecode Node — postprocess box decode + NMS for object-detection models. More...

Included Headers

#include "builder/PreprocessMetaRequirement.h" #include "builder/Node.h" #include "builder/InputContractConfigurable.h" #include "builder/NodeContractConfigurable.h" #include "builder/NodeContractProvider.h" #include "builder/OutputSpec.h" #include "model/PreprocessPlan.h" #include "pipeline/BoxDecodeType.h" #include <memory> #include <optional> #include <string> #include <vector>

Namespaces Index

namespacesimaai
namespaceneat
namespacenodes

Classes Index

classSimaBoxDecode

EV74 postprocess Node that decodes detection-head tensors into object boxes (with NMS). More...

Description

SimaBoxDecode Node — postprocess box decode + NMS for object-detection models.

Runs on the EV74. Consumes the raw detection-head tensor(s) emitted by the MLA, applies detector-specific box decoding (anchor decode, sigmoid/softmax over class scores), and returns surviving boxes after non-maximum suppression. Place at the tail of an object-detection pipeline; the variant family is enumerated in pipeline/BoxDecodeType.h.

See Also

pipeline/BoxDecodeType.h

File Listing

The file content with the documentation metadata removed is:

1
13#pragma once
14
15#include "builder/PreprocessMetaRequirement.h"
16#include "builder/Node.h"
17#include "builder/InputContractConfigurable.h"
18#include "builder/NodeContractConfigurable.h"
19#include "builder/NodeContractProvider.h"
20#include "builder/OutputSpec.h"
23#ifdef SIMA_NEAT_INTERNAL
24#include "model/internal/ModelRouteRetarget.h"
25#include "pipeline/internal/sima/BoxDecodeStaticContractExtractor.h"
26#endif
27
28#include <memory>
29#include <optional>
30#include <string>
31#include <vector>
32
33namespace simaai::neat {
34class Model;
35} // namespace simaai::neat
36
37namespace simaai::neat {
38
39struct BoxDecodeOptionsInternal;
40
53class SimaBoxDecode final : public Node,
54 public InputContractConfigurable,
55 public OutputSpecProvider,
56 public PreprocessMetaRequirementProvider,
57 public NodeContractProvider,
58 public NodeContractConfigurable {
59public:
74 explicit SimaBoxDecode(BoxDecodeType decode_type, double detection_threshold = 0.0,
75 double nms_iou_threshold = 0.0, int top_k = 0,
76 const std::string& element_name = "", int original_width = 0,
77 int original_height = 0, int model_width = 0, int model_height = 0,
110 explicit SimaBoxDecode(const simaai::neat::Model& model, BoxDecodeType decode_type,
111 double detection_threshold = 0.0, double nms_iou_threshold = 0.0,
112 int top_k = 0, const std::string& element_name = "",
113 std::optional<bool> route_tess_needed = std::nullopt,
114 std::optional<bool> route_quant_needed = std::nullopt,
115 int original_width = 0, int original_height = 0, int model_width = 0,
116 int model_height = 0,
117 std::optional<ResizeMode> resize_mode_override = std::nullopt,
119#ifdef SIMA_NEAT_INTERNAL
121 explicit SimaBoxDecode(
122 const pipeline_internal::sima::BoxDecodeStaticContract& contract, BoxDecodeType decode_type,
123 double detection_threshold = 0.0, double nms_iou_threshold = 0.0, int top_k = 0,
124 const std::string& element_name = {},
125 const std::vector<std::string>& required_preprocess_meta_fields = {},
126 std::optional<pipeline_internal::sima::ModelManagedRouteFlags> route_flags = std::nullopt,
127 std::optional<pipeline_internal::sima::ModelBoxdecodeSemantics> model_semantics =
128 std::nullopt,
129 std::optional<bool> expect_resize = std::nullopt,
130 std::optional<bool> expect_normalize = std::nullopt,
131 std::optional<bool> expect_quantize = std::nullopt,
132 std::optional<bool> expect_tessellate = std::nullopt, int original_width = 0,
133 int original_height = 0, int model_width = 0, int model_height = 0,
135#endif
136
138 std::string kind() const override {
139 return "SimaBoxDecode";
140 }
142 NodeCapsBehavior caps_behavior() const override {
143 return NodeCapsBehavior::Static;
144 }
146 std::string backend_fragment(int node_index) const override;
148 std::vector<std::string> element_names(int node_index) const override;
150 OutputSpec output_spec(const OutputSpec& input) const override;
152 std::optional<PreprocessMetaRequirement> preprocess_meta_requirement() const override;
156 bool compile_node_contract(const ContractCompileInput& input, CompiledNodeContract* out,
157 std::string* err) const override;
159 void apply_compiled_contract(const CompiledNodeContract& contract, std::string* err) override;
161 void apply_input_contract(const InputContract& contract, std::string* err) override;
162
163#ifdef SIMA_NEAT_INTERNAL
164 const std::string& factory_internal() const;
165 BoxDecodeType decode_type_internal() const;
166 double detection_threshold_internal() const;
167 double nms_iou_threshold_internal() const;
168 int top_k_internal() const;
169 int original_width_internal() const;
170 int original_height_internal() const;
171 BoxDecodeTypeOption decode_type_option_internal() const;
172 const std::optional<pipeline_internal::sima::ModelBoxdecodeSemantics>&
173 model_semantics_internal() const;
174 const std::optional<pipeline_internal::sima::ModelManagedRouteFlags>&
175 model_route_flags_internal() const;
176 const std::optional<pipeline_internal::sima::BoxDecodeStaticContract>&
177 model_static_contract_internal() const;
178 const std::vector<std::string>& required_preprocess_meta_fields_internal() const;
179 const std::shared_ptr<const internal::ModelLineageBinding>&
180 model_lineage_binding_internal() const;
181 internal::RequestedPostRouteKind requested_post_route_internal() const;
182#endif
183
184private:
185 std::unique_ptr<BoxDecodeOptionsInternal> opt_;
186 std::optional<InputContract> input_contract_;
187};
188
189} // namespace simaai::neat
190
191namespace simaai::neat::nodes {
193std::shared_ptr<simaai::neat::Node>
194SimaBoxDecode(BoxDecodeType decode_type, double detection_threshold = 0.0,
195 double nms_iou_threshold = 0.0, int top_k = 0, const std::string& element_name = "",
196 int original_width = 0, int original_height = 0, int model_width = 0,
197 int model_height = 0,
200std::shared_ptr<simaai::neat::Node>
201SimaBoxDecode(const simaai::neat::Model& model, BoxDecodeType decode_type,
202 double detection_threshold = 0.0, double nms_iou_threshold = 0.0, int top_k = 0,
203 const std::string& element_name = "",
204 std::optional<bool> route_tess_needed = std::nullopt,
205 std::optional<bool> route_quant_needed = std::nullopt, int original_width = 0,
206 int original_height = 0, int model_width = 0, int model_height = 0,
207 std::optional<ResizeMode> resize_mode_override = std::nullopt,
209#ifdef SIMA_NEAT_INTERNAL
211std::shared_ptr<simaai::neat::Node> SimaBoxDecode(
212 const pipeline_internal::sima::BoxDecodeStaticContract& contract, BoxDecodeType decode_type,
213 double detection_threshold = 0.0, double nms_iou_threshold = 0.0, int top_k = 0,
214 const std::string& element_name = {},
215 const std::vector<std::string>& required_preprocess_meta_fields = {},
216 std::optional<pipeline_internal::sima::ModelManagedRouteFlags> route_flags = std::nullopt,
217 std::optional<pipeline_internal::sima::ModelBoxdecodeSemantics> model_semantics = std::nullopt,
218 std::optional<bool> expect_resize = std::nullopt,
219 std::optional<bool> expect_normalize = std::nullopt,
220 std::optional<bool> expect_quantize = std::nullopt,
221 std::optional<bool> expect_tessellate = std::nullopt, int original_width = 0,
222 int original_height = 0, int model_width = 0, int model_height = 0,
224#endif
225} // namespace simaai::neat::nodes

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.