NI Vision for LabVIEW

IMAQ Train SVM VI

  • Updated2023-02-21
  • 8 minute(s) read
Owning Palette: Classifier Engines
Requires: NI Vision Development Module

Sets the Classifier Session to use the SVM Classifier engine, and configures the SVM parameters it will use.

IMAQ Train SVM

crn.gif

Classifier Session is the reference to the classifier session on which this VI operates.

cnclst.gif

Kernel Options is a cluster of parameters to configure the kernel to be used.

cenum.gif

Kernel specifies the kernel that the classifier uses to determine if a sample is a texture or contains a defect. The default value is RBF.

The SVM classifier is a linear classifier. Use a nonlinear kernel to transform samples with nonlinear feature information to a dimension where the feature information is linearly separable. Refer to the NI Vision Concepts Help for more information about kernels and one-class SVM classifiers. The following options are available.

Linear (0)

Applies a linear kernel to the sample. Use this kernel If the number of features per sample is high.

Polynomial (1)

Applies a polynomial kernel to the sample.

Gaussian (2)

Applies a Gaussian kernel to the sample.

RBF (3)

(Default) Applies a radial basis function (RBF) kernel to the sample.

ci32.gif

Degree specifies the degree of the polynomial kernel. The polynomial kernel becomes a linear kernel if you specify a degree of 1. Refer to the NI Vision Concepts Help for more information about kernel parameters and one-class SVM classifiers.

cdbl.gif

Gamma specifies the gamma value for the polynomial and RBF kernels. A high value requires more support vectors to classify the sample. Use a high value for samples with regularly distributed feature information, and a low value for samples with irregularly distributed feature information. Refer to the NI Vision Concepts Help for more information about kernel parameters and one-class SVM classifiers.

cdbl.gif

Coefficient specifies the coefficient of the polynomial kernel. Refer to the NI Vision Concepts Help for more information about kernel parameters and one-class SVM classifiers.

cdbl.gif

Sigma specifies the sigma value for the Gaussian kernel. The default value is 1. A higher value produces a smoother Gaussian function and fewer support vectors. Use a high value for samples with regularly distributed feature information, and a low value for samples with irregularly distributed feature information. Refer to the NI Vision Concepts Help for more information about kernel parameters and one-class SVM classifiers.

cdbl.gif

Cache(MB) specifies the cache size, in megabytes, for kernel operations.

ccclst.gif

Model Options is a cluster of parameter to configures the SVM model.

cenum.gif

SVM Model specifies the SVM model that will be used to train the classifier. Refer to the NI Vision Concepts Help for information about support vector machine models.

C-SVC (0)

The C-SVC model allows the SVM algorithm to clearly separate samples that are separated by a very narrow margin. If the SVM algorithm cannot define a clear margin, it uses the cost parameter to allow some training errors and produce a soft margin. If the cost value is too high it prohibits training errors, producing a narrow margin and rigid classification.

nu-SVC (1)

In the Nu-SVC model, the Nu parameter controls training errors and the number of support vectors. The nu value specifies both the maximum ratio of training errors and the minimum number of support vectors relative to the number of samples. Nu must be greater than 0 and cannot exceed 1. A higher nu value increases tolerance for variation in the texture, but may also increase tolerance for texture defects. If nu is too high, training produces too many training errors to be useful.

One Class (2)

(Default) In the one-class model, the SVM algorithm considers the spatial distribution information for each sample to determine whether the sample belongs to the known class.

cdbl.gif

Tolerance specifies the maximum gradient of the quadratic function used to compute support vectors. The default value is 0.001. You typically do not need to change this value. Refer to the NI Vision Concepts Help for more information about tolerance and one-class SVM classifiers.

ci32.gif

Max. Iteration specifies a maximum number of iterations.

cdbl.gif

Nu specifies the value of Nu. Values range from 0.1 to 1. The default value is 0.1 A higher Nu value increases tolerance for variation in the texture, but may also increase tolerance for defects. If the texture classifier does not perform as expected because the trained texture samples do not represent every possible variation of the texture, try increasing the value of Nu. Refer to the NI Vision Concepts Help for more information about nu and one-class SVM classifiers.

cbool.gif

Shrinking When enabled, the classifier uses shrinking heuristics to attempt to reduce the number of variables involved in the classification computation. Shrinking may reduce processing time if the number of iterations is large.

cdbl.gif

Cost specifies the penalty for training errors. If the cost value is too high it prohibits training errors, producing a narrow margin and rigid classification. Decrease the cost value to allow more training errors and produce a softer margin between classes.

c1dcclst.gif

Weighted Cost is the cost weight for each label.

cstr.gif

Label is the label associated with the Weight coefficient.

cdbl.gif

Weight is the weighted coefficient for the Label.

cerrcodeclst.gif

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. If an error occurs while this VI or function runs, it runs normally and sets its own error status in error out. Use the Simple Error Handler or General Error Handler VIs to display the description of the error code. Use error in and error out to check errors and to specify execution order by wiring error out from one node to error in of the next node.

cbool.gif

status is TRUE (X) if an error occurred before this VI or function ran or FALSE (checkmark) to indicate a warning or that no error occurred before this VI or function ran. The default is FALSE.

ci32.gif

code is the error or warning code. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.

cstr.gif

source describes the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning. The default is an empty string.

irn.gif

Classifier Session (dup) is the reference to the classifier session this VI creates.

i1dcclst.gif

Training Results is an array of statistical information for each class in the classifier.

istr.gif

Class is the class into which the classifier session categorizes the input sample.

isgl.gif

Standard Deviation is the standard deviation from the mean of all samples in Class.

ii32.gif

Number of Samples is the number of samples in Class.

ii32.gif

Number of SVs is the number of support vectors in Class.

i2dsgl.gif

Class Distance Table is a table giving the mean distance from each class to each other class.

ierrcodeclst.gif

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.

ibool.gif

status is TRUE (X) if an error occurred or FALSE (checkmark) to indicate a warning or that no error occurred.

ii32.gif

code is the error or warning code. If status is TRUE, code is a nonzero error code. If status is FALSE, code is 0 or a warning code.

istr.gif

source describes the origin of the error or warning and is, in most cases, the name of the VI or function that produced the error or warning. The default is an empty string.

Log in to get a better experience