Mech-DLK SDK (C++) 3.0.0
Mech-DLK SDK (C++) Reference Documentation
 
Loading...
Searching...
No Matches
MMindInferEngine.h
Go to the documentation of this file.
1/*******************************************************************************
2 *BSD 3-Clause License
3 *
4 *Copyright (c) 2016-2026, Mech-Mind Robotics
5 *All rights reserved.
6 *
7 *Redistribution and use in source and binary forms, with or without
8 *modification, are permitted provided that the following conditions are met:
9 *
10 *1. Redistributions of source code must retain the above copyright notice, this
11 * list of conditions and the following disclaimer.
12 *
13 *2. Redistributions in binary form must reproduce the above copyright notice,
14 * this list of conditions and the following disclaimer in the documentation
15 * and/or other materials provided with the distribution.
16 *
17 *3. Neither the name of the copyright holder nor the names of its
18 * contributors may be used to endorse or promote products derived from
19 * this software without specific prior written permission.
20 *
21 *THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 *AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 *IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 *DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 *FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 *DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 *SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 *CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 *OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 *OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 ******************************************************************************/
32
33#pragma once
34#include <vector>
35#include <string>
36#include "common/macro.h"
37#include "common/status.h"
38#include "common/type.h"
39#include "common/MBbox.h"
40#include "common/MContour.h"
41#include "MMindImage.h"
42
43namespace mmind::dl {
44
45class MMindInferEnginePrivate;
46
65{
66 std::vector<MRotatedBbox> bboxes;
67 std::vector<MContour> contours;
68};
69
90{
91public:
95 explicit MMindInferEngine();
96
101
107 StatusCode create(const std::wstring& dlkpackPath);
108
112 void release();
113
121
127 StatusCode infer(const std::vector<MMindImage>& images);
128
135 StatusCode getModuleResult(const std::string& moduleName, std::vector<MMindResult>& results);
136
142 std::vector<std::string> moduleNames() const;
143
150 StatusCode setBatchSize(const std::string& moduleName, const unsigned int batchSize);
151
158 StatusCode setFloatPrecision(const std::string& moduleName,
159 const PrecisionType floatPrecisionType);
160
167 StatusCode setDeviceId(const unsigned int deviceId);
168
176
186 StatusCode setRuntimeConfigs(const std::string& runtimeConfigs);
187
193 StatusCode resultVisualization(std::vector<MMindImage>& images);
194
201 StatusCode moduleResultVisualization(const std::string& moduleName,
202 std::vector<MMindImage>& images);
203
204private:
205 MMindInferEnginePrivate* d_ptr;
206};
207
218
219} // namespace mmind::dl
StatusCode setInferDeviceType(const InferDeviceType type)
Sets the inference device type.
StatusCode moduleResultVisualization(const std::string &moduleName, std::vector< MMindImage > &images)
Draws results of a specific module onto the input images.
StatusCode create(const std::wstring &dlkpackPath)
Creates an inference engine for the specified model package.
StatusCode load()
Loads the model into memory and prepares it for inference.
StatusCode setBatchSize(const std::string &moduleName, const unsigned int batchSize)
Sets the batch size for a specific module.
~MMindInferEngine()
Destroys the MMindInferEngine object and releases resources.
StatusCode setRuntimeConfigs(const std::string &runtimeConfigs)
Sets runtime configurations (e.g., thresholds for unsupervised segmentation).
StatusCode infer(const std::vector< MMindImage > &images)
Performs inference on the input images.
void release()
Releases all resources held by the inference engine.
StatusCode setDeviceId(const unsigned int deviceId)
Sets the GPU device ID for inference.
MMindInferEngine()
Constructs a new MMindInferEngine object.
StatusCode setFloatPrecision(const std::string &moduleName, const PrecisionType floatPrecisionType)
Sets the float precision type for a specific module.
StatusCode resultVisualization(std::vector< MMindImage > &images)
Draws all module results onto the input images.
std::vector< std::string > moduleNames() const
Gets the list of all module names in the loaded model package.
StatusCode getModuleResult(const std::string &moduleName, std::vector< MMindResult > &results)
Gets inference results for a specific module.
#define MMIND_DL_SDK_CC_API
Definition macro.h:21
PrecisionType
Definition type.h:53
InferDeviceType
Definition type.h:55
MBlobValue blobValueFromContour(const MContour &contour)
Computes region feature values (area, width, height, aspect ratio, etc.) for a contour.
mmind::base::StatusCode StatusCode
Definition status.h:140
Represents a contour with hierarchical structure and associated blob features.
Definition MContour.h:65
Represents the generic result data structure for algorithm modules.
std::vector< MRotatedBbox > bboxes
std::vector< MContour > contours