Neural Network API for LabVIEW
The ANNHUB API for LabVIEW (ANNAPI) can be downloaded from the Customer Portal. Please use your username and password to login the ANSCENTER website to access this Portal page.
The ANNAPI (annhub_lv_api-x.x.x.x.vip) has vip extension and will be distributed via JKI VI Package Manager (https://vipm.jki.net).
Install VI Package Manager (optional)
If the VI Package Manager has not been installed in the host PC, it can be downloaded from JKI website.
Install ANNAPI via VI Package Manager
Double click on "annhub_lv_api-x.x.x.x.vip" to load ANNAPI into VI Package Manager.
Figure 5.1: Open ANNAPI package in JKI VI Package Manager.
This ANNAPI package then can be opened in JKI VI Package manager as shown in Figure 5.1. Select an appropriate LabVIEW version and click Install button to start installation process (Figure 5.2).
Figure 5.2: Install ANNAPI for different LabVIEW versions (Support LabVIEW 2016 and later versions)
After being installed, the ANNAPI can be accessed via ANNAPI Function Palette that contains 2 sub palettes as shown in Figure 5.3.
Figure 5.3: ANNAPI function palettes.
ANNAPI Function Palettes
There are 4 main API VIs provided by ANNAPI Palette
- Create: That VI allows user to load/import a trained Neural Network model directly from a file (".ann" extension) or from a string constant containing structure information of the trained model.
- Predict: For given inputs, this VI always can predict the Neural Network outputs.
- Evaluate: This VI allows user to load test data-set to test the trained Neural Network prediction performance. The test data-set will contain input-target pairs.
- CleanUp: Clean up LabVIEW resource before exit an application.
This palette contains utility functions to help getting license content, generating a license file, and reading a license file to be used in Create function in main palette.
ANNAPI contains 4 ready-to-use examples to give an user starting point to use ANNAPI in LabVIEW applications correctly. These examples cover classification and regression tasks in machine learning applications.
Use ANNAPI Function in LabVIEW applications
Step 1: Generate a trained model from ANNHUB.
ANNHUB software is designed to simplify machine learning design tasks. That means the design procedure, including configuring a neural network structure, training this network, evaluating, and testing is accomplished in ANNHUB.
When an user decides to deploy a trained model into actual applications used for production, he/she can export a trained model from ANNHUB to his/her desired programming environment. This trained model is exported to a special text file that contains the neural network structure and its parameters. This is done via export function from ANNHUB: Click on Export Neural Network (1), select programming environment to export (2), and export the trained model to special text file (weight). The content of this weight file will be copied and used in Create function in the main palette in Step 3.
Step 2: Get correct ANNAPI license.
Before ANNAPI can be used in LabVIEW environment, a correct license file or license content is required. This license information can be easily obtained via GetLicenseContent function in Utility palette.
Open the "GetLicenseContent" and enter username/password into correct fields (1) and hit run button (2), the License Content and License File will be generated and will be used in Create function in the Main palette.
If the host computer does not have internet connection, the Request License Information will provide an user a Request License information and an instruction will be displayed to guide an user how to get a License Content from the ANSCENTER website.
- The generated license file will be specified by License File Path or will be "ANNLV.lic" located in current directory if the License File Path is not specified.
- This license content can be reused in the same target PC. That means if user develops a new LabVIEW application/project, he/she can skip this step if he/she has the license content for the same PC.
Step 3: Use ANNAPI
To use ANNAPI, first the neural network model will be created based on a trained model exported from ANNHUB software and License Content obtained from step 2 using Create function in the main palette (1). For any given input, the neural network model can compute an according output (2) using Predict function. If an user needs to evaluate a new data-set, Evaluate function can be used to give how accurate the neural network can perform in percentage (3), and before exiting the application, CleanUp function can be used to release memory usage (4).
If an user does not copy License Content as string constant, the ReadFileFile function can be used to load License Content from a file.