20#include <tl/expected.hpp>
58 ConfigFileNotFound = 0,
59 ModelFileNotFound = 1,
62 DuplicateClassIds = 4,
89 bool selected =
false;
102 static tl::expected<ModelConfig, ModelConfig::Error>
loadFromFile(
const QString& jsonPath);
105 const std::vector<float>&
getMean() const noexcept;
108 const std::vector<
float>&
getStd() const noexcept;
161 std::vector<
float> mean_;
162 std::vector<
float> std_;
164 std::
string modelPath_;
165 uint inputAlignment_ = 1;
166 bool applyMeanStd_ = true;
167 bool normalizeTo01_ = true;
Stores one parsed model configuration and runtime class-selection state.
Definition ModelConfig.h:52
ErrorCode
Error codes returned by loadFromFile().
Definition ModelConfig.h:57
const std::vector< float > & getMean() const noexcept
Get the per-channel mean vector from config.
Definition ModelConfig.cpp:131
bool getApplyMeanStd() const noexcept
Check whether mean/std normalization is enabled.
Definition ModelConfig.cpp:170
bool getNormalizeTo01() const noexcept
Check whether [0,255] -> [0,1] normalization is enabled.
Definition ModelConfig.cpp:174
const std::string & getModelPath() const noexcept
Get the resolved absolute path to the ONNX model file.
Definition ModelConfig.cpp:139
const std::vector< ClassInfo > & getClasses() const noexcept
Get all configured classes.
Definition ModelConfig.cpp:147
const ClassInfo * getClassById(ClassId id) const noexcept
Get class info by ID.
Definition ModelConfig.cpp:151
void setInputAlignment(uint alignment) noexcept
Set the input alignment value.
Definition ModelConfig.cpp:186
static tl::expected< ModelConfig, ModelConfig::Error > loadFromFile(const QString &jsonPath)
Load a model configuration from a JSON file Performs validation:
Definition ModelConfig.cpp:12
void setNormalizeTo01(bool normalize) noexcept
Set whether to normalize input to [0,1].
Definition ModelConfig.cpp:182
uint32_t ClassId
Unsigned integer type used for class identifiers.
Definition ModelConfig.h:76
bool setClassSelected(ClassId id, bool selected) noexcept
Set the selected state of a class.
Definition ModelConfig.cpp:160
void setApplyMeanStd(bool apply) noexcept
Set whether to apply mean/std normalization.
Definition ModelConfig.cpp:178
uint getInputAlignment() const noexcept
Get input alignment requirement (multiple-of value for H/W).
Definition ModelConfig.cpp:143
const std::vector< float > & getStd() const noexcept
Get the per-channel standard deviation vector from config.
Definition ModelConfig.cpp:135
Namespace containing model-configuration components used by iVS3D plugins.
Definition ModelConfig.h:35
Description of one output class.
Definition ModelConfig.h:81
QString name
Definition ModelConfig.h:85
ClassId id
Definition ModelConfig.h:83
QColor color
Definition ModelConfig.h:87
Error object returned on failed config loading.
Definition ModelConfig.h:68
ErrorCode code
Definition ModelConfig.h:70