Understanding SVM Machine Learning Algorithm Based on FastCV Vision Library

SVM is a commonly used machine learning algorithm. It has a wide range of applications in artificial intelligence, pattern recognition, image recognition, etc. This section will introduce the principle and usage of SVM in combination with the fcvSVMPredict2Classf32 machine learning function API provided by the FastCV library. Follow-up is to provide reference for the application development of image recognition classes using FastCV.

First, Introduction to FastCV

FastCV is a computer vision library dedicated to mobile platforms developed by Qualcomm. The library is designed for the ARM platform and optimized for Qualcomm processors. Its performance is quite large compared to OpenCV and JavaCv. Improve, very suitable for various image processing of mobile devices, such as 3D reconstruction, target tracking, face recognition and so on.

The API structure provided by FastCV is shown in Figure 1. According to the function classification provided by it, it mainly includes mathematics/quantity calculation, image processing, image transformation, feature detection, object detection, 3D reconstruction, color conversion, clustering and search, motion and object. Tracking, shape and drawing, memory management and SVM machine learning 13 parts, through the API interface provided by fastcv you can easily complete the design of various image processing applications. Greatly simplified design process to improve program stability and reliability. The SVM machine learning provided by fastcv will be described in detail later.

Figure 1 fastCV functional structure

Second, the basic principles of SVM machine learning

Support vector machine, because its English name is support vector machine, it is generally referred to as SVM. In general, it is a two-class classification model. Its basic model is defined as the linear classifier with the largest interval in the feature space. Its learning strategy The interval is maximized and can ultimately be transformed into a solution to a convex quadratic programming problem. The principle of a specific SVM is very esoteric. It involves a lot of mathematical theories, and usually involves multidimensional space. It is difficult to understand the basic principles of SVM from the mathematical theory of existence, and introduces the mathematical principles of SVM. There are also many (such as http:// on the principle of SVM), here will introduce the basic principles of SVM through a classic SVM classification example.

Suppose now that you are a farmer and have a group of sheep in captivity, but in order to prevent the wolves from attacking the flock, you need to build a fence to surround the flock. But where should the fence be built? You probably need to build a "classifier" based on the location of the herd and the wolves. Compare the different classifiers in the figure below. We can see that the SVM has completed a perfect solution, as shown in Figure 2 below. This is the SVM classification principle of the attraction.

Figure 2 Schematic diagram of a classic example of a farmer setting up a fence SVM

Third, fastCV SVM interface parameter analysis

The SVM method call API interface is provided in fastCV, and the SVM learning function can be conveniently implemented by calling the interface. The API function prototype is as follows:

FASTCV_API fcvStatus fcvSVMPredict2Classf32( fcvSVMKernelType kernelType,

Uint32_tdegree,

Float32_tgamma,

Float32_tcoef0,

Const float32_t *__restrictsv,

uint32_tsvLen,

uint32_tsvNum,

uint32_tsvStride,

Const float32_t *__restrictsvCoef,

Float32_trho,

Const float32_t *__restrictvec,

uint32_tvecNum,

uint32_tvecStride,

Float32_t *__restrictconfidence

)

This function returns the confidence of the current sample calculated by the SVM learning strategy, which is calculated as follows (the value can also be obtained by SVM training provided by libSVM and OpenCV):

Confidence(i) = sum_j( svCoef[j] * Kernel(vec_i, sv_j) - rho;

In order to learn to call this function, you need to understand the meaning of each parameter of the above function and the specific setting method. The following is a summary of the meaning and setting method of the above parameters:

kernelType: nuclear function type Here you can select 'FASTCV_SVM_LINEAR', 'FASTCV_SVM_POLY', 'FASTCV_SVM_RBF', 'FASTCV_SVM_SIGMOID', etc.;

Degree: sets the depth of the kernel function, which is an integer, usually set to 3;

Gamma: gamma function setting in kernel function (for polynomial /rbf/sigmoid kernel function) (default 1 / k);

Coef0: coef0 setting in the kernel function (for polynomial / sigmoid kernel function) ((default 0);

Sv : support feature vector;

svLen: feature length, (support vector length = feature length).

svNum: support the number of feature vectors

svStride: support vector span;

svCoef: sv coefficient, the length is set to sv number;

Rho SVM offset parameter;

Vec detection vector;

vecNum detects the number of vectors;

vecStride monitors the vector span;

The above is the introduction of SVM interface provided in fastCV. In the following chapters, we will further combine image processing to bring you SVM to realize related classification and image recognition. If you want to know more about the contents of fastcv library, you can access Qualcomm. See https://developer.qualcomm.com/docs/fastcv/api/index.html for more information.

Load Cell Accessories

Weighing equipment accessories include multiple product accessories, such as sensor feet, dust cover, weighing instrument interface, Junction Box housing, and motherboard.
Mainly used for product maintenance and so on.Weighing Equipment Small Zero Point,Rs232 Interface,Sensor Accessories,Weighing Instrument Accessories,Sensor Feet,Weighing Accessories,Junction Box Accessories

Sensor accessories, weighing instrument accessories, junction box accessories, Weighing accessories, weighing equipment small zero point, sensor feet, RS232 interface

Ningbo Santwell Imp & Exp Co.,Ltd , https://www.santwell.com