ANNHUB-LV: ANNAPI Functions Overview

This article will provide a quick introduction to each LabVIEW API of ANNHUB

Create.vi 

Description:

Create a neural network model from a neural network weight file. The weight file is the exported trained model file from ANNHUB.


Inputs:

  • Weight: contains the structure of the trained neural network model.   
  • License Content: contains a license information that can be obtained from GetLicenceContent.vi
  • error in (no error): describes the error status before this VI or function runs. The default is no error. If an error occurred before this VI or function runs, the VI or function passes the error in value to error out. This VI or function runs normally only if no error occurred before this VI or function runs.

Outputs:

  • ANNAPI out: The neural network model reference.
  • error out: contains error information. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, it describes the error status that this VI or function produces. Right-click the error out indicator on the front panel and select Explain Error from the shortcut menu for more information about the error.

Predict.vi 

Description:

This function will compute/calculate a trained neural network output for a given input.


Inputs:

  • ANNAPI in: The neural network model reference in.
  • Input: Input data in form of 1D double array.
  • error in(no error): describes the error status before this VI or function runs. The default is no error. If an error occurred before this VI or function runs, the VI or function passes the error in value to error out. This VI or function runs normally only if no error occurred before this VI or function runs.


Outputs:

  • ANNAPI out: The neural network model reference out.
  • Input: Calculated output data in form of 1D double array.
  • error out: contains error information. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, it describes the error status that this VI or function produces. Right-click the error out indicator on the front panel and select Explain Error from the shortcut menu for more information about the error.

Evaluate.vi 

Description:

This function allow to evaluate a trained neural network model on new test data-set.


Inputs:

  • ANNAPI in: The neural network model reference in.
  • Threshold: When classification task is performed, threshold value is used to isolate classes. For example, in a binary classification (0 and 1 classes), if the output is 0. 4 and threshold is 0.3, the output result will be classified as class 1.
  • Test data path: The path that points to the test data in csv format. This test data can content multiple samples, and each sample is in 1 row. This test format has the same structure as the training data set.
  • error in(no error): describes the error status before this VI or function runs. The default is no error. If an error occurred before this VI or function runs, the VI or function passes the error in value to error out. This VI or function runs normally only if no error occurred before this VI or function runs.


Outputs:

  • ANNAPI out: The neural network model reference out.
  • Inputs: The input data read from test data-set
  • Targets: The output data read from test data set (the output column has "output, target, and class" keywords in the header (first row)
  • Outputs: Predicted output calculated by feeding Inputs to a trained neural network model.
  • Accuracy: The predicted outputs will be compared against Targets to identify how many percentage match. The threshold is used in this comparison.
  • error out: contains error information. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, it describes the error status that this VI or function produces. Right-click the error out indicator on the front panel and select Explain Error from the shortcut menu for more information about the error.

Cleanup.vi 

Description:

Clean-up all resources and free memory usage.


Inputs:

  • ANNAPI in: The neural network model reference in.
  • error in(no error): describes the error status before this VI or function runs. The default is no error. If an error occurred before this VI or function runs, the VI or function passes the error in value to error out. This VI or function runs normally only if no error occurred before this VI or function runs.


Outputs:

  • ANNAPI out: The neural network model reference out.
  • error out: contains error information. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, it describes the error status that this VI or function produces. Right-click the error out indicator on the front panel and select Explain Error from the shortcut menu for more information

GetLicenseContent.vi 

Description:

This VI is used to get the "License Content" that can be used in Create.vi. The license content file is also being generated in this VI.


Inputs:

  • UsePCID: If UsePCID= true, then the generated License Content will bind to the target PC. in this case the PC unique identifier will be checked to validate the correct license. With that license type, user can deploy as many applications in the same target PC. If the PCID = false, then the generated License Content will bind to the pre-trained weight. That means, with the same pre-trained weight, users can deploy the same application in multiple targets. When user retrain the model, he/she needs to get new License Content.
  • License File Path: The License Content will also be written into a license file for specified in License File Path. If the License File Path is empty, the "ANNLV.lic" in current directory will be used.
  • User Name: Valid user name that can be used to login
  • Password: Valid password that can be used to login
  • error in(no error): describes the error status before this VI or function runs. The default is no error. If an error occurred before this VI or function runs, the VI or function passes the error in value to error out. This VI or function runs normally only if no error occurred before this VI or function runs.


Outputs:

  • License Content: This license content will be used to activate ANNHUB-LV functionalities in Create.vi 
  • Request License Information: If this host PC does not have internet connection, a Request License Content Information will be generated and instruction will be displayed to show how to get License Content from other PC with internet connection.
  • Status: This status indicate if the generation process is success (0) or not (-1). If the Status =1, that mean the target PC cannot connect to the ANSCENTER website due to the internet connection.
  • error out: contains error information. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, it describes the error status that this VI or function produces. Right-click the error out indicator on the front panel and select Explain Error from the shortcut menu for more information about the error.


Note: In case you don't have internet access, see ANNHUB-LV: ANNAPI Utility for more

ReadLicenseFile.vi 

Description:

This utility is used to get the License Content by reading a license file for specified in License File Path. This "License Content" that can be used in Create.vi 


Inputs:

  • License File Path: The License Content will also be written into a license file for specified in License File Path. If the License File Path is empty, the "ANNLV.lic" in current directory will be used.
  • error in(no error): describes the error status before this VI or function runs. The default is no error. If an error occurred before this VI or function runs, the VI or function passes the error in value to error out. This VI or function runs normally only if no error occurred before this VI or function runs.


Outputs:

  • License Content: This license content will be used to activate ANNHUB-LV functionalities in Create.vi 
  • error out: contains error information. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, it describes the error status that this VI or function produces. Right-click the error out indicator on the front panel and select Explain Error from the shortcut menu for more information about the error.

LoadWeight.vi 

Description:

This utility is used to get a trained neural network model (weight) from a weight file (.ann).


Inputs:

  • Weight path: points to a file path that contains trained neural network model saved in weight file with ".ann" extension by ANNHUB
  • error in(no error): describes the error status before this VI or function runs. The default is no error. If an error occurred before this VI or function runs, the VI or function passes the error in value to error out. This VI or function runs normally only if no error occurred before this VI or function runs.


Outputs:

  • Weight: a neural network weight content used in Create.vi  to create a neural network model.
  • error out: contains error information. If error in indicates that an error occurred before this VI or function ran, error out contains the same error information. Otherwise, it describes the error status that this VI or function produces. Right-click the error out indicator on the front panel and select Explain Error from the shortcut menu for more information about the error.