Skip to main content

Preproc.h File

SimaAI pre-processing node wrapper. More...

Included Headers

#include "builder/ConfigJsonOverride.h" #include "builder/ConfigJsonProvider.h" #include "builder/NextCpuConfigurable.h" #include "builder/Node.h" #include "builder/OutputSpec.h" #include <functional> #include <memory> #include <optional> #include <string> #include <vector>

Namespaces Index

namespacesimaai
namespaceneat
namespacenodes

Classes Index

structPreprocOptions
classPreproc

Description

SimaAI pre-processing node wrapper.

File Listing

The file content with the documentation metadata removed is:

1
6#pragma once
7
8#include "builder/ConfigJsonOverride.h"
9#include "builder/ConfigJsonProvider.h"
10#include "builder/NextCpuConfigurable.h"
11#include "builder/Node.h"
12#include "builder/OutputSpec.h"
13
14#include <functional>
15#include <memory>
16#include <optional>
17#include <string>
18#include <vector>
19
20namespace simaai::neat {
21class Model;
22
24 PreprocOptions() = default;
25 explicit PreprocOptions(const simaai::neat::Model& model);
26
27 int input_width = 1280;
28 int input_height = 720;
29 int output_width = 640;
30 int output_height = 640;
31 int scaled_width = 640;
32 int scaled_height = 640;
33
36 int batch_size = 1;
37
38 bool normalize = true;
39 bool aspect_ratio = true;
40 bool tessellate = true;
41 bool dynamic_input_dims = true;
42
43 int tile_width = 128;
44 int tile_height = 32;
45 int tile_channels = 3;
46
47 int input_offset = 0;
48 int input_stride = 1;
49 int output_stride = 1;
50
51 int q_zp = -128;
52 double q_scale = 255.06967737092486;
53
54 std::vector<float> channel_mean = {0.0f, 0.0f, 0.0f};
55 std::vector<float> channel_stddev = {1.0f, 1.0f, 1.0f};
56
57 std::string input_img_type = "NV12";
58 std::string output_img_type = "RGB";
59 std::string output_dtype = "EVXX_INT8";
60 std::string scaling_type = "BILINEAR";
61 std::string padding_type = "CENTER";
62
63 std::string graph_name = "preproc";
64 std::string node_name = "preproc";
65 std::string element_name;
66 std::string cpu = "CVU";
67 std::string next_cpu = "CVU";
68 std::string debug = "EVXX_DBG_DISABLED";
69
70 std::string upstream_name = "decoder";
71 std::string graph_input_name = "input_image";
72
73 std::vector<std::string> output_memory_order;
74
75 int num_buffers = 0;
77 bool num_buffers_locked = false;
78
79 std::string config_path;
80 std::string config_dir;
81 bool keep_config = false;
82 std::optional<nlohmann::json> config_json;
83};
84
85class Preproc final : public Node,
86 public OutputSpecProvider,
87 public ConfigJsonProvider,
88 public ConfigJsonOverride,
89 public NextCpuConfigurable {
90public:
91 explicit Preproc(PreprocOptions opt = {});
92
93 std::string kind() const override {
94 return "Preproc";
95 }
96 NodeCapsBehavior caps_behavior() const override {
97 return NodeCapsBehavior::Static;
98 }
99 bool has_config_json() const override {
100 return true;
101 }
102 bool wire_input_names(const std::vector<std::string>& upstream_names,
103 const std::string& tag) override;
104 std::string backend_fragment(int node_index) const override;
105 std::vector<std::string> element_names(int node_index) const override;
106 OutputSpec output_spec(const OutputSpec& input) const override;
107 bool set_next_cpu_if_auto(const std::string& next_cpu) override;
108 bool override_config_json(const std::function<void(nlohmann::json&)>& edit,
109 const std::string& tag) override;
110
111 const PreprocOptions& options() const {
112 return opt_;
113 }
114 const std::string& config_path() const {
115 return config_path_;
116 }
117 const std::string& config_snapshot_path() const {
118 return config_snapshot_path_;
119 }
120 const nlohmann::json* config_json() const override;
121
122private:
123 struct PreprocConfigHolder;
124
125 PreprocOptions opt_;
126 std::shared_ptr<PreprocConfigHolder> config_holder_;
127 std::string config_path_;
128 std::string config_snapshot_path_;
129};
130
131} // namespace simaai::neat
132
133namespace simaai::neat::nodes {
134std::shared_ptr<simaai::neat::Node> Preproc(PreprocOptions opt = {});
135} // namespace simaai::neat::nodes

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.1.