iVS3D v2.0.9
Loading...
Searching...
No Matches
MCFG::ModelConfig Class Reference

Stores one parsed model configuration and runtime class-selection state. More...

#include <ModelConfig.h>

Classes

struct  ClassInfo
 Description of one output class. More...
 
struct  Error
 Error object returned on failed config loading. More...
 

Public Types

enum class  ErrorCode
 Error codes returned by loadFromFile().
 
using ClassId = uint32_t
 Unsigned integer type used for class identifiers.
 

Public Member Functions

const std::vector< float > & getMean () const noexcept
 Get the per-channel mean vector from config.
 
const std::vector< float > & getStd () const noexcept
 Get the per-channel standard deviation vector from config.
 
const std::string & getModelPath () const noexcept
 Get the resolved absolute path to the ONNX model file.
 
uint getInputAlignment () const noexcept
 Get input alignment requirement (multiple-of value for H/W).
 
bool getApplyMeanStd () const noexcept
 Check whether mean/std normalization is enabled.
 
bool getNormalizeTo01 () const noexcept
 Check whether [0,255] -> [0,1] normalization is enabled.
 
const std::vector< ClassInfo > & getClasses () const noexcept
 Get all configured classes.
 
const ClassInfogetClassById (ClassId id) const noexcept
 Get class info by ID.
 
bool setClassSelected (ClassId id, bool selected) noexcept
 Set the selected state of a class.
 
void setApplyMeanStd (bool apply) noexcept
 Set whether to apply mean/std normalization.
 
void setNormalizeTo01 (bool normalize) noexcept
 Set whether to normalize input to [0,1].
 
void setInputAlignment (uint alignment) noexcept
 Set the input alignment value.
 

Static Public Member Functions

static tl::expected< ModelConfig, ModelConfig::ErrorloadFromFile (const QString &jsonPath)
 Load a model configuration from a JSON file Performs validation:
 

Detailed Description

Stores one parsed model configuration and runtime class-selection state.

A configuration is loaded from a JSON file via loadFromFile(), validated, and then used by ModelManager and UI components.

The expected JSON format is documented in ModelConfig.md.

Author
Dominik Wüst (domin.nosp@m.ik.w.nosp@m.uest@.nosp@m.iosb.nosp@m..frau.nosp@m.nhof.nosp@m.er.de)
Date
March 2026

Member Function Documentation

◆ getClassById()

const ModelConfig::ClassInfo * MCFG::ModelConfig::getClassById ( ClassId  id) const
noexcept

Get class info by ID.

Parameters
idClass ID to look up
Returns
Pointer to ClassInfo if found, nullptr otherwise

◆ loadFromFile()

tl::expected< ModelConfig, ModelConfig::Error > MCFG::ModelConfig::loadFromFile ( const QString &  jsonPath)
static

Load a model configuration from a JSON file Performs validation:

  • Checks for duplicate class IDs
  • Verifies model file exists (or defaults to config path with .onnx extension)
    Parameters
    jsonPathPath to the JSON configuration file
    Returns
    ModelConfig if successful, Error otherwise
    See also
    ModelConfig.md.

◆ setApplyMeanStd()

void MCFG::ModelConfig::setApplyMeanStd ( bool  apply)
noexcept

Set whether to apply mean/std normalization.

Parameters
applytrue to enable mean/std application, false to disable

◆ setClassSelected()

bool MCFG::ModelConfig::setClassSelected ( ClassId  id,
bool  selected 
)
noexcept

Set the selected state of a class.

Parameters
idClass ID to update
selectedWhether the class should be selected
Returns
true if class was found and updated, false otherwise

◆ setInputAlignment()

void MCFG::ModelConfig::setInputAlignment ( uint  alignment)
noexcept

Set the input alignment value.

Parameters
alignmentAlignment value for input dimensions

◆ setNormalizeTo01()

void MCFG::ModelConfig::setNormalizeTo01 ( bool  normalize)
noexcept

Set whether to normalize input to [0,1].

Parameters
normalizetrue to enable normalization, false to disable

The documentation for this class was generated from the following files: