Run the SDK C# Example Project

The SDK_Example project provides examples showing how to use the Mech-DLK SDK to implement the required functions in the application.

Taking defect segmentation as an example, this section provides the required model and image dataset to lead the user to run the SDK project:

  1. Open the example project

    Double-click the file SDK_Example.sln in the path shown below to open it with Visual Studio 2019.

    ../../../_images/sdk_demo.png
  2. Referencing SDK

    Right-click on Reference -> Add Reference. The reference manager window will pop up. Click on Browse…, check the file mmind_dl_sdk_csharp.dll in the folder run_time and click on OK.

    ../../../_images/dll.png
  3. Build solution

    Click on Build -> Build Solution to generate the executable file. Check the path generated by the executable in the output section at the bottom of the interface.

    ../../../_images/build.png
  4. Add the “run_time” library

    Copy all the dll format files in the folder below to the release directory of the executable file generated in the previous step. If there are duplicate files, just overwrite them.

    Original file location:

    ../../../_images/document.png

    Target path:

    ../../../_images/target_path.png
  5. Start project

    Click on Start to run the program.

    ../../../_images/start.png

    Program interface after startup:

    Load Image: Load the image to be inferred.

    Load Model: Load a model in dlkpack format exported by Mech-DLK.

    Infer: perform inference.

    ../../../_images/start_img.png

    Execution result:

    ../../../_images/result.png

    Attention

    It takes a little longer to load the model for the first time. About 5 minutes. It is recommended to use multiple threads to call the corresponding interface.