Mech-DLK SDK C++ API 2.0.2
C++ API reference documentation for secondary development with Mech-DLK
All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros Pages
MMindInferEngine.h
Go to the documentation of this file.
1/*******************************************************************************
2 *BSD 3-Clause License
3 *
4 *Copyright (c) 2016-2023, 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 <memory>
37#include "common/Export.h"
38#include "common/StatusCode.h"
39#include "MMindImage.h"
40#include "MMIndResult.h"
41#include "common.h"
42
43namespace mmind::dl {
44
49{
50public:
55
63 StatusCode setBatchSize(const unsigned int batchSize, const unsigned int moduleIdx = 0);
64
71 StatusCode setBatchSize(const std::vector<unsigned int>& batchSize);
72
82 const unsigned int moduleIdx = 0);
83
91 StatusCode setFloatPrecision(const std::vector<FloatPrecisionType>& floatPrecisionType);
92
100 StatusCode setDeviceId(const unsigned int deviceId);
101
110
116 StatusCode create(const std::string& modelPath);
117
125
131 StatusCode infer(const std::vector<MMindImage>& images);
132
138 StatusCode getResults(std::vector<MMindResult>& results);
139
145 StatusCode resultVisualization(std::vector<MMindImage>& images);
146
153 StatusCode moduleResultVisualization(std::vector<MMindImage>& images,
154 const unsigned int moduleIdx);
155
160 std::vector<DeepLearningAlgoType> getDeepLearningAlgoTypes() const;
161
165 void release();
166
167 MMindInferEngine(const MMindInferEngine& rhs) = delete;
172
173private:
174 struct Impl;
175 std::unique_ptr<Impl> _pImpl;
176};
177
178} // namespace mmind::dl
#define MMIND_DL_SDK_EXPORT
Definition Export.h:7
Defines the infer engine.
Definition MMindInferEngine.h:49
StatusCode setInferDeviceType(const InferDeviceType type)
Sets the infer device type.
MMindInferEngine & operator=(const MMindInferEngine &rhs)=delete
StatusCode setBatchSize(const std::vector< unsigned int > &batchSize)
Sets the batch size of the model package.
MMindInferEngine & operator=(MMindInferEngine &&rhs)
StatusCode load()
Loads the model into memory.
StatusCode getResults(std::vector< MMindResult > &results)
Gets the model inference result.
std::vector< DeepLearningAlgoType > getDeepLearningAlgoTypes() const
Gets the model type list.
StatusCode moduleResultVisualization(std::vector< MMindImage > &images, const unsigned int moduleIdx)
Draws the model results of the specified index onto the images.
StatusCode infer(const std::vector< MMindImage > &images)
Makes image inference using the model package inference engine.
MMindInferEngine(const MMindInferEngine &rhs)=delete
void release()
Releases the memory of the model package inference engine.
StatusCode setBatchSize(const unsigned int batchSize, const unsigned int moduleIdx=0)
Sets the batch size of the model package.
StatusCode setDeviceId(const unsigned int deviceId)
Sets the device ID.
MMindInferEngine()
Constructs the infer engine.
StatusCode setFloatPrecision(const std::vector< FloatPrecisionType > &floatPrecisionType)
Sets the float precision of the model package.
StatusCode setFloatPrecision(const FloatPrecisionType floatPrecisionType, const unsigned int moduleIdx=0)
Sets the float precision of the model package.
MMindInferEngine(MMindInferEngine &&rhs)
StatusCode resultVisualization(std::vector< MMindImage > &images)
Draws all the model results onto the images.
StatusCode create(const std::string &modelPath)
Creates an infer engine for model package inference.
Definition common.h:34
FloatPrecisionType
Defines the floating-point format.
Definition common.h:39
InferDeviceType
Defines the infer device type.
Definition common.h:47
StatusCode
Defines the status codes.
Definition StatusCode.h:41