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";
82 std::string graph_name = "preproc";
84 std::string element_name;
89 std::string upstream_name = "decoder";
90 std::string graph_input_name = "input_image";
92 int num_buffers = 0;
93 int num_buffers_model = 0;
94 bool num_buffers_locked = false;
95 bool model_managed_contract = false;
101 void set_input_shape(std::vector<int> shape) {
102 input_shape = std::move(shape);
106 void set_output_shape(std::vector<int> shape) {
107 output_shape = std::move(shape);
111 void set_slice_shape(std::vector<int> shape) {
112 slice_shape = std::move(shape);
121 static int shape_channels(const std::vector<int>& shape) {
126 int input_height() const {
127 return shape_dim(input_shape, 0);
131 int input_width() const {
132 return shape_dim(input_shape, 1);
136 int input_channels() const {
137 return shape_channels(input_shape);
141 int output_height() const {
142 return shape_dim(output_shape, 0);
146 int output_width() const {
147 return shape_dim(output_shape, 1);
151 int output_channels() const {
152 return shape_channels(output_shape);
156 int slice_height() const {
157 return shape_dim(slice_shape, 0);
161 int slice_width() const {
162 return shape_dim(slice_shape, 1);
166 int slice_channels() const {
167 return shape_channels(slice_shape);
171 bool has_input_shape() const {
172 return input_height() > 0 && input_width() > 0 && input_channels() > 0;
176 bool has_output_shape() const {
177 return output_height() > 0 && output_width() > 0 && output_channels() > 0;
181 bool has_slice_shape() const {
182 return slice_height() > 0 && slice_width() > 0 && slice_channels() > 0;
201 explicit Preproc(PreprocOptions opt = {});
208 NodeCapsBehavior caps_behavior() const override {
212 std::string backend_fragment(int node_index) const override;
214 std::vector<std::string> element_names(int node_index) const override;
216 OutputSpec output_spec(const OutputSpec& input) const override;
218 void apply_input_contract(const InputContract& contract, std::string* err) override;
220 NodeContractDefinition contract_definition() const override;
222 bool compile_node_contract(const ContractCompileInput& input, CompiledNodeContract* out,
225 void apply_compiled_contract(const CompiledNodeContract& contract, std::string* err) override;
228 const PreprocOptions& options() const {
232 const std::string& config_path() const {
236 const std::string& config_snapshot_path() const {
240 const nlohmann::json* config_json() const;
246 PreprocOptions opt_;
253namespace simaai::neat::nodes {
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.