Skip to content

How To Use SDK (LabView Version)

1. Overview

  • This tutorial is intended to introduce you to the use of the SDK (LabView version). The SDK toolkit is designed to assist engineers in AI vision development. For software development, you need to download it from official website

    1. The trained model file trained at [workbench] (https://www.neurobot.co/modelDevelopmentTool2)

    2. SDK toolkit (LabView Version)

2.Environment setup

Only supports NVIDIA GPU, does not support AMD and other brands.

3. Quick start with SDK

  • Here is an example to help you quickly understand how to complete LabView software development using the SDK. This example uses LabView (Q3 2022 version) and the LabView Vision Development module (Q3 2022 version).

3.1 Decompress SDK

  • Decompress the downloaded SDK file to a secure directory, as shown below: alt text

3.2 Add environment path

  • Now start to add system environment variables, open "This computer", right-click the blank position, then select "Properties", click "advanced system Settings", click "environment variables", the following interface appears. Then select "Path" and click "Edit". alt text

  • Click "New", then click "Browse": alt text

  • Select the bin folder under the SDK folder: alt text

  • Move this environment variable up to the first one: alt text alt text

Click "OK" when the operation is complete.

3.3 Configuring the License File

3.4 Modify and run the sample code

  1. Double-click on the dllrun0525.vi file in the SDK folder, as follows: alt text

  2. Click the folder icon next to test image path to select a single test image: alt text alt text alt text

  3. Modifying the model name alt text

  4. Click the folder icon next to model path to select a folder to store the model file alt text alt text alt text

  5. Select device name (For CPU processing please select cpu; for GPU processing please select cuda) alt text

  6. Set detect threshold(Detection threshold. If the detection threshold is exceeded, it is regarded as the target object. detect threshold = -1 indicates the default value. The default detection threshold is 0.7) alt text

  7. Select color mode (For color Image (RGB), Please select color; For grayscale images, select gray) alt text

  8. Click the (run) button in the upper left corner to run the program. alt text The results are as follows: alt text

  9. If an error occurs in the program, look at these four places to analyze the cause of the error:is img,is loaded,load() return and predict() return.

  10. If is img is green on, the image is successfully loaded. Otherwise, the image fails to be loaded.
  11. If is loaded is green on, indicates that the model is loaded. Otherwise, the model is not loaded.
  12. If load() return displays 0, the model has been successfully loaded. Otherwise, the module fails to be loaded.
  13. If predict() return displays 0, the model prediction success. Otherwise, model prediction failure. Function Call Explanation section defines the various return values for load() return and predict() return. alt text Attention: If an error occurs in the program, the problem is found and corrected, and the error still occurs when running again, please restart LabView and run again!!

4. Format of inference result

  • The result of the model's inference on a single image is a string type, which is stored in predict results, as follows: alt text
  • There can be multiple inference results for a single photo, and the specific format of a single result is:
x0,y0,x1,y1,score,label,label_index,row_index,col_index;mask_width;mask_height;

Note: Results are separated by "," or ";" with no space between them

variable definition
x0 x value of the top left corner of the detect rectangular box(bounding box)
y0 y value of the top left corner of the detect rectangular box(bounding box)
x1 x value of the bottom right corner of the detect rectangular box(bounding box)
y1 y value of the bottom right corner of the detect rectangular box(bounding box)
score The confidence of the detection result(confidence score)
label The label of the detection result
label_index The label index of the detection result
row_index OCR is used for the automatic arrangement, in development, can be ignored for the time being
col_index OCR is used for the automatic arrangement, in development, can be ignored for the time being
mask_width Used for pixel segmentation, in development, can be ignored for the time being
mask_height Used for pixel segmentation, in development, can be ignored for the time being

5. Function Call Explanation

  • dllrun0525.vi cited several vi SDK directory file, which is important:DestroyModel_525.vi, LoadModel_525.vi and PredictModel_525.vi These three files respectively refer: load_model() in neurobot_LabVIEW_Model_SDK_CN_V3.0\bin\neuro_det_sdk.dll, The newPredict_modelVec() and destroy_model() functions (you can open the Block Diagram to see it).

5.1 load_model()

int load_model(const char* model_name, const char* model_path, const char* device_name = "cuda", const int device_index = 0);
  • Definition:

    • This function is used to load the model.
  • Parameter Explanation:

Parameter Explanation
model_name The name of the model
model_Path The path of the model
device_name "device_name=cpu" for running CPU; "device_name="cuda" for running GPU
device_index The graphics card device number to load the model. The default value is 0 (the default), you can also modify the number for other devices.
  • Return value:
    • Returns an int type variable. 0 indicates success, and any other numbers are error codes, as shown here:
Return value Definition
0 Successful execution
1 Configuration file not found
2 Batch parameter not found
3 dete_thres parameter not found
4 Class parameter not found
5 Missing required DLL files for execution
6 ARG - NVIDIA GPU error
7 Not supported
8 Out of bounds
9 Insufficient memory
10 Model-related files for loading do not exist
11 Loading failed
12 Status count
50 Model type error or unable to read model.conf file
100 Using the wrong model type

5.2 newPredict_modelVec()

int newPredict_modelVec(const char* model_name, uchar* ImgVec, int length, int row, int col, char* ret, float detect_thres = -1.0);
  • Definition:

    • This function is used to predict the image to be tested.
  • Parameter Explanation:

Parameter Explanation
model_name The name of the model
ImgVec Image rgb array (u8 type array)
length Image rgb array length
row height of the image
col width of the image
ret Predicting return values
detect_threshold detect the threshold, If the detection threshold is exceeded, it is regarded as the target object. detectThreshold=-1 represents the default value, which is 0.7.
  • Return value:
    • Returns an int variable. 0 indicates successful execution, and any other numbers are error codes, status code are as follows:
status definition
0 Successful execution
1 Nvidia graphics card error
2 Not supported
3 Seams
4 Out of memory
5 Used to predict the related file does not exist
6 predict failure
7 state count
50 license file does not exist or without permission to read
51 License file format is incorrect
52 license file format can not match the fingerprint
53 Authorization start time is not reached
54 Expiration of authorization
55 System time has been rolled back
56 No write authorization file permission
57 An unknown error related authorized
58 Authorization file version is different from the SDK version
59 The number of tags exceeds the limit

5.3 destroy_model()

void destroy_model(const char* model_name);
  • Definition:

    • This function is used to clear the model from the graphics card
  • Parameter Explanation:

Parameter Explanation
model_name Name of Model
  • Return value:
    • None