Neural Network API for LabVIEW
To use ANNHub trained Neural Network model in LabVIEW environment, it is required to install ANNAPI for LabVIEW. To do that, first ANNAPI package can be downloaded from the ANNHub website (www.anscenter.com) and saved into a desired folder as shown in Figure 5.1.
Figure 5.1: ANNAPI VI package
Figure 5.2: 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.2. Double click on the ANNAPI to bring installation dialog that allows users to install ANNAPI in a desired LabVIEW version (Figure 5.3).
Figure 5.3: 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 4 main APIs and 3 application examples as shown in Figure 5.4.
Figure 5.4: ANNAPI function palette that contains 4 mains APIs and 3 application examples.
There are 4 main API VIs provided by ANNAPI Palette
- Import Neural Network Model: 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 Neural Network Output: For given inputs, this VI always can predict the Neural Network outputs.
- Load Test Dataset: This VI allows user to load test dataset to test the trained Neural Network prediction performance. The test dataset will contain input-target pairs.
- Map Classification Output: In order to compare targets against the trained Neural Network predicted outputs, it is necessary to map both targets and predicted outputs to new variables that facilitate comparison. The threshold is required for mapping procedure.
To use ANNAPI, first a trained Neural Network model is loaded using "Import Neural Network Model" to create a Neural Network reference. The "Predict Neural Network Output" then can be used to compute outputs. Figure 5.5 demonstrates the ANNAPI usage in parity XOR classification application.
Figure 5.5: ANNAPI usage in the parity XOR classification application.