Skip to main content

SessionOptions.h File

Session/Run options, the Sample type, pull-status enums, and verbosity controls. More...

Included Headers

#include "pipeline/SessionReport.h" #include "pipeline/FormatSpec.h" #include "pipeline/TensorTypes.h" #include "pipeline/Tensor.h" #include "pipeline/TensorCore.h" #include <cstddef> #include <functional> #include <initializer_list> #include <optional> #include <string> #include <utility> #include <vector>

Namespaces Index

namespacecv
namespacesimaai
namespaceneat

Classes Index

structVerboseOptions

Per-topic framework verbosity controls. More...

structRtspServerOptions

Options for Session::run_rtsp() — controls the RTSP server's mount point and ports. More...

structValidateOptions

Options for Session::validate(). More...

structProcessCvuOptions

Simple process-CVU backend placement for model pre/post stages. More...

structProcessMlaOptions

process-MLA execution options. More...

structPreparedRunnerOptions

Experimental prepared-route runner options. More...

structSessionOptions

Per-Session construction options. More...

structOutputTensorOptions

Options for Session::add_output_tensor() — the tensor-friendly output helper. More...

structPullError

Structured error returned by Run::pull() when status is Error. More...

structSample

Typed payload returned by Run::pull() and consumed by Run::push(). More...

Description

Session/Run options, the Sample type, pull-status enums, and verbosity controls.

Defines the option structs the framework consumes at construction/build time and the Sample type that flows out of Run::pull(). Key types here:

  • VerboseOptions / VerbosityLevel — diagnostic verbosity controls (per topic).
  • SessionOptions — per-Session knobs (callback timeout, naming, processor preference).
  • RtspServerOptions / ValidateOptions / OutputTensorOptions — option packs for specific calls.
  • RunMode — Async vs Sync timing mode.
  • Sample / SampleKind — the typed payload pull() returns; can be a Tensor, a TensorSet (multiple physical outputs), or a Bundle (recursive multi-logical-output).
  • PullStatus / PullError — structured pull results.
See Also

Session, Run, Tensor

File Listing

The file content with the documentation metadata removed is:

1
19#pragma once
20
24#include "pipeline/Tensor.h"
26
27#include <cstddef>
28#include <functional>
29#include <initializer_list>
30#include <optional>
31#include <string>
32#include <utility>
33#include <vector>
34
35namespace cv {
36class Mat;
37}
38
39namespace simaai::neat {
40
49enum class VerbosityLevel {
50 Quiet,
52 Verbose,
53};
54
65
67 bool progress = true;
68
70 bool progress_force = false;
71
73 bool gstreamer = false;
74
76 bool planner = false;
77
79 bool graph = false;
80
82 bool pipeline = false;
83
85 bool inputstream = false;
86
88 bool tensor = false;
89
91 bool plugins = false;
92
94 [[nodiscard]] static VerboseOptions quiet() {
97 opt.progress = false;
98 opt.progress_force = false;
99 opt.gstreamer = false;
100 opt.planner = false;
101 opt.graph = false;
102 opt.pipeline = false;
103 opt.inputstream = false;
104 opt.tensor = false;
105 opt.plugins = false;
106 return opt;
107 }
108
110 [[nodiscard]] static VerboseOptions production() {
113 opt.progress = true;
114 opt.progress_force = false;
115 opt.gstreamer = false;
116 opt.planner = false;
117 opt.graph = false;
118 opt.pipeline = false;
119 opt.inputstream = false;
120 opt.tensor = false;
121 opt.plugins = false;
122 return opt;
123 }
124
127 [[nodiscard]] static VerboseOptions debug_plugins() {
129 opt.gstreamer = true;
130 opt.plugins = true;
131 return opt;
132 }
133
135 [[nodiscard]] static VerboseOptions debug_all() {
138 opt.progress = true;
139 opt.progress_force = true;
140 opt.gstreamer = true;
141 opt.planner = true;
142 opt.graph = true;
143 opt.pipeline = true;
144 opt.inputstream = true;
145 opt.tensor = true;
146 opt.plugins = true;
147 return opt;
148 }
149};
150
156 std::string mount =
157 "image";
158 int port = 8554;
166 int rtp_port_base = -1;
168};
169
179 bool parse_launch = true;
180 bool enforce_names = true;
181};
182
192enum class RunMode {
193 Async,
194 Sync,
195};
196
214 std::string pre_run_target = "AUTO";
215 std::string post_run_target = "AUTO";
216
221 bool async = true;
222};
223
231 bool async = true;
232
238
246};
247
258 std::string mode;
259 int ring_depth = 0;
260 bool profile = false;
269 std::string dequant_flags;
270};
271
295 std::string processcvu_requested_run_target = "AUTO";
296
300
303
306
311};
312
323
324 int target_width = -1;
325 int target_height = -1;
326 int target_fps = -1;
327};
328
338enum class SampleKind {
339 Tensor,
340 TensorSet,
341 Bundle,
342 Unknown,
343};
344
349enum class PullStatus {
350 Ok,
351 Timeout,
352 Closed,
353 Error,
354};
355
364struct PullError {
365 std::string message;
366 std::string code;
367 std::optional<SessionReport> report;
368};
369
379struct Sample {
381 bool owned =
382 true;
383
384 std::optional<simaai::neat::Tensor> tensor;
386 std::vector<Sample> fields;
387
388 std::string
390 std::string media_type;
392 std::string payload_tag;
396 std::string format;
397
398 int64_t frame_id = -1;
399 std::string stream_id;
400 std::string stream_label;
401 std::string port_name;
404 int output_index = -1;
406 int memory_index = -1;
407 int route_slot = -1;
408 std::string segment_name;
409 int64_t input_seq = -1;
411 -1;
412 int64_t pts_ns = -1;
413 int64_t dts_ns = -1;
414 int64_t duration_ns = -1;
415
416#if defined(SIMA_WITH_OPENCV)
417 static const char* image_format_string(ImageSpec::PixelFormat fmt) {
418 switch (fmt) {
420 return "RGB";
422 return "BGR";
424 return "GRAY8";
426 return "NV12";
428 return "I420";
430 default:
431 return "UNKNOWN";
432 }
433 }
434
435 static Sample from_image(const cv::Mat& image,
437 bool read_only = true) {
438#if defined(__GNUC__) || defined(__clang__)
439#pragma GCC diagnostic push
440#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
441#endif
442 Tensor tensor = Tensor::from_cv_mat(image, fmt, read_only);
443#if defined(__GNUC__) || defined(__clang__)
444#pragma GCC diagnostic pop
445#endif
446 if (read_only && tensor.storage &&
448 tensor = tensor.clone();
449 tensor.read_only = false;
450 }
451 Sample out;
452 out.kind = SampleKind::TensorSet;
453 out.tensors = TensorList{std::move(tensor)};
454 out.media_type = "video/x-raw";
455 out.format = image_format_string(fmt);
456 out.payload_tag = out.format;
457 return out;
458 }
459#endif
460};
461
463using SampleList = std::vector<Sample>;
464
466inline Sample make_tensor_sample(const std::string& port_name, simaai::neat::Tensor tensor) {
467 Sample out;
469 out.stream_label = port_name;
470 out.tensors = TensorList{std::move(tensor)};
471 return out;
472}
473
474#if defined(SIMA_WITH_OPENCV)
476inline Sample make_image_sample(const cv::Mat& image,
478 bool read_only = true) {
479 return Sample::from_image(image, fmt, read_only);
480}
481#endif
482
484inline Sample make_bundle_sample(std::initializer_list<Sample> fields) {
485 Sample out;
487 out.fields = fields;
488 return out;
489}
490
492inline bool sample_is_multi_output(const Sample& sample) {
493 return sample.kind == SampleKind::Bundle ||
494 (sample.kind == SampleKind::TensorSet && sample.tensors.size() > 1U);
495}
496
498inline bool sample_has_tensor_list(const Sample& sample) {
499 return sample.kind == SampleKind::TensorSet && !sample.tensors.empty();
500}
501
503TensorList& sample_tensor_list(Sample& sample, const char* where = nullptr);
505const TensorList& sample_tensor_list(const Sample& sample, const char* where = nullptr);
507Tensor& require_single_tensor(Sample& sample, const char* where = nullptr);
509const Tensor& require_single_tensor(const Sample& sample, const char* where = nullptr);
511TensorList tensors_from_sample(const Sample& sample, bool require_nonempty = true);
514
515} // namespace simaai::neat

Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.