Preproc.h File
Preproc Node — fused CVU preprocessing kernel (resize + colorconvert + normalize). More...
Included Headers
#include "builder/InputContractConfigurable.h"
#include "builder/NodeContractConfigurable.h"
#include "builder/NodeContractProvider.h"
#include "builder/Node.h"
#include "builder/OutputSpec.h"
#include <nlohmann/json.hpp>
#include <cstdint>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
Namespaces Index
| namespace | simaai |
| namespace | neat |
| namespace | nodes |
Classes Index
| struct | PreprocOptions |
| class | Preproc |
|
Fused CVU preprocessing Node — resize + color-convert + normalize (+ optional tess). More... | |
Description
Preproc Node — fused CVU preprocessing kernel (resize + colorconvert + normalize).
One-shot CVU pre-processor that runs upstream of the MLA: resizes the input image, converts color space, applies per-channel mean/stddev normalization, and (optionally) tessellates the result into MLA-tile geometry. Implements the "Preproc" PreprocessGraphFamily (BF16 path with MLA-side tess); used as the front end of vision pipelines on the BF16 input path.
File Listing
The file content with the documentation metadata removed is:
32namespace simaai::neat {
44struct PreprocOptions {
46 PreprocOptions() = default;
48 explicit PreprocOptions(const simaai::neat::Model& model);
50 std::vector<int> input_shape;
51 std::vector<int> output_shape;
52 std::vector<int> slice_shape;
54 int scaled_width = 0;
55 int scaled_height = 0;
57 int batch_size = 1;
60 bool aspect_ratio = true;
61 bool tessellate = true;
62 bool dynamic_input_dims = true;
63 bool single_output_handoff = true;
65 int input_offset = 0;
66 int input_stride = 1;
67 int output_stride = 1;
72 std::vector<float> channel_mean = {0.0f, 0.0f, 0.0f};
73 std::vector<float> channel_stddev = {1.0f, 1.0f, 1.0f};
75 std::string input_img_type;
76 std::string output_img_type = "RGB";
77 std::string output_dtype = "INT16";
78 std::string scaling_type = "BILINEAR";
79 std::string padding_type = "CENTER";
81 std::string graph_name = "preproc";
83 std::string element_name;
88 std::string upstream_name = "decoder";
89 std::string graph_input_name = "input_image";
91 int num_buffers = 0;
92 int num_buffers_model = 0;
93 bool num_buffers_locked = false;
94 bool model_managed_contract = false;
100 void set_input_shape(std::vector<int> shape) {
101 input_shape = std::move(shape);
105 void set_output_shape(std::vector<int> shape) {
106 output_shape = std::move(shape);
110 void set_slice_shape(std::vector<int> shape) {
111 slice_shape = std::move(shape);
120 static int shape_channels(const std::vector<int>& shape) {
125 int input_height() const {
126 return shape_dim(input_shape, 0);
130 int input_width() const {
131 return shape_dim(input_shape, 1);
135 int input_channels() const {
136 return shape_channels(input_shape);
140 int output_height() const {
141 return shape_dim(output_shape, 0);
145 int output_width() const {
146 return shape_dim(output_shape, 1);
150 int output_channels() const {
151 return shape_channels(output_shape);
155 int slice_height() const {
156 return shape_dim(slice_shape, 0);
160 int slice_width() const {
161 return shape_dim(slice_shape, 1);
165 int slice_channels() const {
166 return shape_channels(slice_shape);
170 bool has_input_shape() const {
171 return input_height() > 0 && input_width() > 0 && input_channels() > 0;
175 bool has_output_shape() const {
176 return output_height() > 0 && output_width() > 0 && output_channels() > 0;
180 bool has_slice_shape() const {
181 return slice_height() > 0 && slice_width() > 0 && slice_channels() > 0;
200 explicit Preproc(PreprocOptions opt = {});
207 NodeCapsBehavior caps_behavior() const override {
211 std::string backend_fragment(int node_index) const override;
213 std::vector<std::string> element_names(int node_index) const override;
215 OutputSpec output_spec(const OutputSpec& input) const override;
217 void apply_input_contract(const InputContract& contract, std::string* err) override;
219 NodeContractDefinition contract_definition() const override;
221 bool compile_node_contract(const ContractCompileInput& input, CompiledNodeContract* out,
224 void apply_compiled_contract(const CompiledNodeContract& contract, std::string* err) override;
227 const PreprocOptions& options() const {
231 const std::string& config_path() const {
235 const std::string& config_snapshot_path() const {
239 const nlohmann::json* config_json() const;
245 PreprocOptions opt_;
252namespace simaai::neat::nodes {
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.