Mech-DLK SDK (C++) 3.0.0
Mech-DLK SDK (C++) Reference Documentation
 
Loading...
Searching...
No Matches
mmind::dl::MMindInferEngine Class Reference

Defines the inference engine for Mech-DLK model packages. More...

#include <MMindInferEngine.h>

Public Member Functions

 MMindInferEngine ()
 Constructs a new MMindInferEngine object.
 
 ~MMindInferEngine ()
 Destroys the MMindInferEngine object and releases resources.
 
StatusCode create (const std::wstring &dlkpackPath)
 Creates an inference engine for the specified model package.
 
void release ()
 Releases all resources held by the inference engine.
 
StatusCode load ()
 Loads the model into memory and prepares it for inference.
 
StatusCode infer (const std::vector< MMindImage > &images)
 Performs inference on the input images.
 
StatusCode getModuleResult (const std::string &moduleName, std::vector< MMindResult > &results)
 Gets inference results for a specific module.
 
std::vector< std::string > moduleNames () const
 Gets the list of all module names in the loaded model package.
 
StatusCode setBatchSize (const std::string &moduleName, const unsigned int batchSize)
 Sets the batch size for a specific module.
 
StatusCode setFloatPrecision (const std::string &moduleName, const PrecisionType floatPrecisionType)
 Sets the float precision type for a specific module.
 
StatusCode setDeviceId (const unsigned int deviceId)
 Sets the GPU device ID for inference.
 
StatusCode setInferDeviceType (const InferDeviceType type)
 Sets the inference device type.
 
StatusCode setRuntimeConfigs (const std::string &runtimeConfigs)
 Sets runtime configurations (e.g., thresholds for unsupervised segmentation).
 
StatusCode resultVisualization (std::vector< MMindImage > &images)
 Draws all module results onto the input images.
 
StatusCode moduleResultVisualization (const std::string &moduleName, std::vector< MMindImage > &images)
 Draws results of a specific module onto the input images.
 

Detailed Description

Defines the inference engine for Mech-DLK model packages.

This class provides core inference functionality for deep learning models exported from Mech-DLK. It supports multiple modules within a single model package and various deployment scenarios.

Note
Typical Usage:
  1. Create engine instance
  2. Configure inference settings (device type, batch size, etc.)
  3. Create and load model with create() and load()
  4. Perform inference with infer()
  5. Retrieve results with getModuleResult()
  6. Release resources with release()
See also
MMindImage Input image format specification
MMindResult Output result structure
StatusCode Return status codes

Definition at line 89 of file MMindInferEngine.h.

Constructor & Destructor Documentation

◆ MMindInferEngine()

mmind::dl::MMindInferEngine::MMindInferEngine ( )
explicit

Constructs a new MMindInferEngine object.

◆ ~MMindInferEngine()

mmind::dl::MMindInferEngine::~MMindInferEngine ( )

Destroys the MMindInferEngine object and releases resources.

Member Function Documentation

◆ create()

StatusCode mmind::dl::MMindInferEngine::create ( const std::wstring & dlkpackPath)

Creates an inference engine for the specified model package.

Parameters
[in]dlkpackPathPath to the model package (.dlkpack) exported from Mech-DLK.
Returns
See StatusCode for details.

◆ getModuleResult()

StatusCode mmind::dl::MMindInferEngine::getModuleResult ( const std::string & moduleName,
std::vector< MMindResult > & results )

Gets inference results for a specific module.

Parameters
[in]moduleNameName of the module to retrieve results from.
[out]resultsResults for the specified module.
Returns
See StatusCode for details.

◆ infer()

StatusCode mmind::dl::MMindInferEngine::infer ( const std::vector< MMindImage > & images)

Performs inference on the input images.

Parameters
[in]imagesInput images to process. See MMindImage for format details.
Returns
See StatusCode for details.

◆ load()

StatusCode mmind::dl::MMindInferEngine::load ( )

Loads the model into memory and prepares it for inference.

Returns
See StatusCode for details.
Note
When using GpuOptimization device type, this may take 1-5 minutes for model optimization.

◆ moduleNames()

std::vector< std::string > mmind::dl::MMindInferEngine::moduleNames ( ) const

Gets the list of all module names in the loaded model package.

Returns
Vector containing names of all available modules.
Note
Returns empty vector if no model is loaded.

◆ moduleResultVisualization()

StatusCode mmind::dl::MMindInferEngine::moduleResultVisualization ( const std::string & moduleName,
std::vector< MMindImage > & images )

Draws results of a specific module onto the input images.

Parameters
[in]moduleNameName of the module to visualize.
[in,out]imagesImages to visualize results on.
Returns
See StatusCode for details.

◆ release()

void mmind::dl::MMindInferEngine::release ( )

Releases all resources held by the inference engine.

◆ resultVisualization()

StatusCode mmind::dl::MMindInferEngine::resultVisualization ( std::vector< MMindImage > & images)

Draws all module results onto the input images.

Parameters
[in,out]imagesImages to visualize results on.
Returns
See StatusCode for details.

◆ setBatchSize()

StatusCode mmind::dl::MMindInferEngine::setBatchSize ( const std::string & moduleName,
const unsigned int batchSize )

Sets the batch size for a specific module.

Parameters
[in]moduleNameName of the module to configure.
[in]batchSizeDesired batch size for inference.
Returns
See StatusCode for details.

◆ setDeviceId()

StatusCode mmind::dl::MMindInferEngine::setDeviceId ( const unsigned int deviceId)

Sets the GPU device ID for inference.

Parameters
[in]deviceIdGPU index to use (0-based).
Returns
See StatusCode for details.
Note
This setting is ignored when inference device type is CPU.

◆ setFloatPrecision()

StatusCode mmind::dl::MMindInferEngine::setFloatPrecision ( const std::string & moduleName,
const PrecisionType floatPrecisionType )

Sets the float precision type for a specific module.

Parameters
[in]moduleNameName of the module to configure.
[in]floatPrecisionTypePrecision type. See PrecisionType for details.
Returns
See StatusCode for details.

◆ setInferDeviceType()

StatusCode mmind::dl::MMindInferEngine::setInferDeviceType ( const InferDeviceType type)

Sets the inference device type.

Parameters
[in]typeDevice type. See InferDeviceType for details.
Returns
See StatusCode for details.
Note
CPU mode requires Intel CPU. GPU modes require NVIDIA GPU.

◆ setRuntimeConfigs()

StatusCode mmind::dl::MMindInferEngine::setRuntimeConfigs ( const std::string & runtimeConfigs)

Sets runtime configurations (e.g., thresholds for unsupervised segmentation).

Parameters
[in]runtimeConfigsConfiguration string in JSON format.
Returns
See StatusCode for details.
Example
"modules":[{"name":"UnsupSegmentation_0","nodes":[{"defectThreshold":0.62,"nodeType":"UnsupSegmentation","nonDefectThreshold":0.61}]]}

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