Getting Started
This chapter introduces how to apply Mech-DLK SDK to achieve inference of the Defect Segmentation model exported from Mech-DLK.
Function Description
In this section, we take the Defect Segmentation model exported from Mech-DLK as an example to show the functions you need to use when using Mech-DLK SDK for model inference.
Create an Input Image
MMindImage input;
createImage("path/to/image.png", &input);
Call the function createImage
to create an input image.
Create an Inference Engine
Engine engine;
createPackInferEngine(&engine, "path/to/xxx.dlkpack", GpuDefault, 0);
Call the function createPackInferEngine
to create an inference engine.
|
Deep Learning Engine Inference
infer(&engine, &input, 1);
Call the function infer
for deep learning engine inference.
In this function, the parameter 1 denotes the number of images for inference, which should equal the number of images in input .
|
Obtain the Defect Segmentation Result
DefectAndEdgeResult* defectAndEdgeResult = NULL;
unsigned int resultNum = 0;
getDefectSegmentataionResult(&engine, 0, &defectAndEdgeResult, &resultNum);
Call the function getDefectSegmentataionResult
to obtain the result of the defect segmentation model.
In this function, the second parameter
|
Result Visualization
resultVisualization(&engine, &input, 1);
showImage(&input, "result");
Call the function resultVisualization
to plot the model inference result on the image(s) in input
.
In this function, the parameter 1 denotes the number of images for inference, which should equal the number of images in input .
|