Mech-DLK SDK C API 2.1.0
C API reference documentation for secondary development with Mech-DLK
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Pages
dl_packInfer.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#ifndef DL_PACKINFER
34#define DL_PACKINFER
35#include "common/Export.h"
36#include "dl_definition.h"
37#include "dl_result.h"
38
39#ifdef __cplusplus
40extern "C" {
41#endif
42
52MMIND_DL_SDK_EXPORT StatusCode createImage(const char* imagePath, MMindImage* image);
53
61MMIND_DL_SDK_EXPORT void releaseImage(const MMindImage* image);
62
70MMIND_DL_SDK_EXPORT StatusCode showImage(const MMindImage* image, const char* windowName);
71
78MMIND_DL_SDK_EXPORT StatusCode saveImage(const MMindImage* image, const char* path);
79
90MMIND_DL_SDK_EXPORT StatusCode createPackInferEngine(Engine* engine, const char* packPath,
91 const BackendType backend,
92 const unsigned int deviceId);
93
101MMIND_DL_SDK_EXPORT void releasePackInferEngine(const Engine* engine);
102
115 const Engine* engine, const unsigned int batchSize, const FloatPrecisionType floatPrecision,
116 const unsigned int moduleIdx);
117
127MMIND_DL_SDK_EXPORT StatusCode setUnsupSegParam(const Engine* engine, const float defectThreshold,
128 const float nonDefectThreshold,
129 const unsigned int moduleIdx);
130
140MMIND_DL_SDK_EXPORT StatusCode infer(const Engine* engine, const MMindImage* images,
141 const unsigned int imageNum);
142
151MMIND_DL_SDK_EXPORT StatusCode getDefectSegmentataionResult(const Engine* engine,
152 const unsigned int moduleIdx,
153 DefectAndEdgeResult** results,
154 unsigned int* resultNum);
155
164MMIND_DL_SDK_EXPORT void releaseDefectSegmentationResult(DefectAndEdgeResult** results,
165 unsigned int resultNum);
166
175MMIND_DL_SDK_EXPORT StatusCode getObjectAndInstanceResult(const Engine* engine,
176 const unsigned int moduleIdx,
177 ObjectAndInsResult** results,
178 unsigned int* resultNum);
179
188MMIND_DL_SDK_EXPORT void releaseObjectAndInstanceResult(ObjectAndInsResult** results,
189 unsigned int resultNum);
190
199MMIND_DL_SDK_EXPORT StatusCode getClassificationResult(const Engine* engine,
200 const unsigned int moduleIdx,
201 ClassificationResult** results,
202 unsigned int* resultNum);
203
212MMIND_DL_SDK_EXPORT void releaseClassificationResult(ClassificationResult** results,
213 unsigned int resultNum);
214
223MMIND_DL_SDK_EXPORT StatusCode getFastPositioningResult(const Engine* engine,
224 const unsigned int moduleIdx,
225 FastPositioningResult** results,
226 unsigned int* resultNum);
227
236MMIND_DL_SDK_EXPORT void releaseFastPositioningResult(FastPositioningResult** results,
237 unsigned int resultNum);
238
247MMIND_DL_SDK_EXPORT StatusCode getTextRecognitionResult(const Engine* engine,
248 const unsigned int moduleIdx,
249 TextRecognitionResult** results,
250 unsigned int* resultNum);
251
260MMIND_DL_SDK_EXPORT void releaseTextRecognitionResult(TextRecognitionResult** results,
261 unsigned int resultNum);
262
271MMIND_DL_SDK_EXPORT StatusCode getTextDetectionResult(const Engine* engine,
272 const unsigned int moduleIdx,
273 TextDetectionResult** results,
274 unsigned int* resultNum);
275
284MMIND_DL_SDK_EXPORT void releaseTextDetectionResult(TextDetectionResult** results,
285 unsigned int resultNum);
286
295MMIND_DL_SDK_EXPORT StatusCode getUnsupSegResult(const Engine* engine, const unsigned int moduleIdx,
296 UnsupSegResult** results, unsigned int* resultNum);
297
306MMIND_DL_SDK_EXPORT void releaseUnsupSegResult(UnsupSegResult** results, unsigned int resultNum);
307
318MMIND_DL_SDK_EXPORT StatusCode moduleResultVisualization(const Engine* engine,
319 const MMindImage* images,
320 const unsigned int moduleIdx,
321 const unsigned int imageNum);
322
332MMIND_DL_SDK_EXPORT StatusCode resultVisualization(const Engine* engine, const MMindImage* images,
333 const unsigned int imageNum);
334
335#ifdef __cplusplus
336}
337#endif
338
339#endif
FloatPrecisionType
This enumeration defines the floating-point format.
Definition dl_definition.h:88
BackendType
This enumeration defines the backend type.
Definition dl_definition.h:79
StatusCode
This enumeration defines the codes of status.
Definition dl_definition.h:43
MMIND_DL_SDK_EXPORT StatusCode saveImage(const MMindImage *image, const char *path)
Save the image to a specified directory.
MMIND_DL_SDK_EXPORT void releaseObjectAndInstanceResult(ObjectAndInsResult **results, unsigned int resultNum)
Release the memory of the object detection or instance segmentation result.  *.
MMIND_DL_SDK_EXPORT StatusCode infer(const Engine *engine, const MMindImage *images, const unsigned int imageNum)
Make image inference using the model package inference engine.
MMIND_DL_SDK_EXPORT StatusCode resultVisualization(const Engine *engine, const MMindImage *images, const unsigned int imageNum)
Draw all the model results onto the images.
MMIND_DL_SDK_EXPORT void releaseDefectSegmentationResult(DefectAndEdgeResult **results, unsigned int resultNum)
Release the memory of the defect segmentation result.
MMIND_DL_SDK_EXPORT void releaseClassificationResult(ClassificationResult **results, unsigned int resultNum)
Release the memory of the classification result.
MMIND_DL_SDK_EXPORT StatusCode getDefectSegmentataionResult(const Engine *engine, const unsigned int moduleIdx, DefectAndEdgeResult **results, unsigned int *resultNum)
Get the defect segmentation result.
MMIND_DL_SDK_EXPORT void releasePackInferEngine(const Engine *engine)
Release the memory of the model package inference engine.
MMIND_DL_SDK_EXPORT StatusCode getUnsupSegResult(const Engine *engine, const unsigned int moduleIdx, UnsupSegResult **results, unsigned int *resultNum)
Get the unsupervised segmentation result.
MMIND_DL_SDK_EXPORT StatusCode setBatchSizeAndFloatPrecision(const Engine *engine, const unsigned int batchSize, const FloatPrecisionType floatPrecision, const unsigned int moduleIdx)
Set the batch size and floating-point precision of the inference engine.
MMIND_DL_SDK_EXPORT StatusCode showImage(const MMindImage *image, const char *windowName)
Visualize an image.
MMIND_DL_SDK_EXPORT void releaseImage(const MMindImage *image)
Release the memory of the image.
MMIND_DL_SDK_EXPORT void releaseTextDetectionResult(TextDetectionResult **results, unsigned int resultNum)
Release the memory of the text detection result.
MMIND_DL_SDK_EXPORT StatusCode moduleResultVisualization(const Engine *engine, const MMindImage *images, const unsigned int moduleIdx, const unsigned int imageNum)
Draw the model results of the specified index onto the images.
MMIND_DL_SDK_EXPORT StatusCode getTextDetectionResult(const Engine *engine, const unsigned int moduleIdx, TextDetectionResult **results, unsigned int *resultNum)
Get the text detection result.
MMIND_DL_SDK_EXPORT StatusCode createImage(const char *imagePath, MMindImage *image)
Create an image from its path.
MMIND_DL_SDK_EXPORT StatusCode setUnsupSegParam(const Engine *engine, const float defectThreshold, const float nonDefectThreshold, const unsigned int moduleIdx)
Set the defect threshold and non-defect threshold for the unsupervised segmentation.
MMIND_DL_SDK_EXPORT void releaseTextRecognitionResult(TextRecognitionResult **results, unsigned int resultNum)
Release the memory of the text recognition result.
MMIND_DL_SDK_EXPORT StatusCode getObjectAndInstanceResult(const Engine *engine, const unsigned int moduleIdx, ObjectAndInsResult **results, unsigned int *resultNum)
Get the object detection or instance segmentation result.
MMIND_DL_SDK_EXPORT StatusCode getClassificationResult(const Engine *engine, const unsigned int moduleIdx, ClassificationResult **results, unsigned int *resultNum)
Get the classification result.
MMIND_DL_SDK_EXPORT void releaseFastPositioningResult(FastPositioningResult **results, unsigned int resultNum)
Release the memory of the fast positioning result.
MMIND_DL_SDK_EXPORT StatusCode getFastPositioningResult(const Engine *engine, const unsigned int moduleIdx, FastPositioningResult **results, unsigned int *resultNum)
Get the fast positioning result.
MMIND_DL_SDK_EXPORT StatusCode getTextRecognitionResult(const Engine *engine, const unsigned int moduleIdx, TextRecognitionResult **results, unsigned int *resultNum)
Get the text recognition result.
MMIND_DL_SDK_EXPORT StatusCode createPackInferEngine(Engine *engine, const char *packPath, const BackendType backend, const unsigned int deviceId)
Create an engine for model package inference.
MMIND_DL_SDK_EXPORT void releaseUnsupSegResult(UnsupSegResult **results, unsigned int resultNum)
Release the memory of the unsupervised segmentation result.
This struct defines the classification result.
Definition dl_result.h:96
This struct defines the defect segmentation and edge detection result.
Definition dl_result.h:106
This struct defines Engine.
Definition dl_definition.h:134
This struct defines the fast positioning result.
Definition dl_result.h:126
This struct defines Image.
Definition dl_definition.h:122
This struct defines the object detection and instance segmentation result.
Definition dl_result.h:116
This struct defines the text detection result.
Definition dl_result.h:147
This struct defines the text recognition result.
Definition dl_result.h:136
This struct defines the unsupervised segmentation result.
Definition dl_result.h:157