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 Mech-DLK-2.3.0 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

    Hint

    Please comment out line 73 in Form1.cs, if an error “CS1061: ‘PackInfer’ does not contain a definition for ‘setVisible’ and no accessible extension method ‘setVisible’ accepting a first argument of type ‘PackInfer’ could be found (are you missing a using directive or an assembly reference?)” is reported.

  4. 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.