Defines the inference engine for Mech-DLK model packages.
More...
#include <MMindInferEngine.h>
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:
- Create engine instance
- Configure inference settings (device type, batch size, etc.)
- Create and load model with create() and load()
- Perform inference with infer()
- Retrieve results with getModuleResult()
- 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.
◆ MMindInferEngine()
| mmind::dl::MMindInferEngine::MMindInferEngine |
( |
| ) |
|
|
explicit |
◆ ~MMindInferEngine()
| mmind::dl::MMindInferEngine::~MMindInferEngine |
( |
| ) |
|
◆ create()
| StatusCode mmind::dl::MMindInferEngine::create |
( |
const std::wstring & | dlkpackPath | ) |
|
Creates an inference engine for the specified model package.
- Parameters
-
| [in] | dlkpackPath | Path 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] | moduleName | Name of the module to retrieve results from. |
| [out] | results | Results for the specified module. |
- Returns
- See StatusCode for details.
◆ infer()
Performs inference on the input images.
- Parameters
-
| [in] | images | Input images to process. See MMindImage for format details. |
- Returns
- See StatusCode for details.
◆ 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] | moduleName | Name of the module to visualize. |
| [in,out] | images | Images to visualize results on. |
- Returns
- See StatusCode for details.
◆ release()
| void mmind::dl::MMindInferEngine::release |
( |
| ) |
|
Releases all resources held by the inference engine.
◆ resultVisualization()
Draws all module results onto the input images.
- Parameters
-
| [in,out] | images | Images 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] | moduleName | Name of the module to configure. |
| [in] | batchSize | Desired 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] | deviceId | GPU 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] | moduleName | Name of the module to configure. |
| [in] | floatPrecisionType | Precision type. See PrecisionType for details. |
- Returns
- See StatusCode for details.
◆ setInferDeviceType()
Sets the inference device type.
- Parameters
-
- 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] | runtimeConfigs | Configuration 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: