Qualcomm FastCV Library  1.7.1
Machine Learning

Functions

FASTCV_API fcvStatus fcvSVMPredict2Classf32 (fcvSVMKernelType kernelType, uint32_t degree, float32_t gamma, float32_t coef0, const float32_t *__restrict sv, uint32_t svLen, uint32_t svNum, uint32_t svStride, const float32_t *__restrict svCoef, float32_t rho, const float32_t *__restrict vec, uint32_t vecNum, uint32_t vecStride, float32_t *__restrict confidence)
 SVM prediction for two classes.

Detailed Description

Machine learning functions such as SVM prediction, etc.


Function Documentation

FASTCV_API fcvStatus fcvSVMPredict2Classf32 ( fcvSVMKernelType  kernelType,
uint32_t  degree,
float32_t  gamma,
float32_t  coef0,
const float32_t *__restrict  sv,
uint32_t  svLen,
uint32_t  svNum,
uint32_t  svStride,
const float32_t *__restrict  svCoef,
float32_t  rho,
const float32_t *__restrict  vec,
uint32_t  vecNum,
uint32_t  vecStride,
float32_t *__restrict  confidence 
)

SVM prediction for two classes.

The function returns the confidence scores for test vectors using the equation: confidence(i) = sum_j( svCoef[j] * Kernel(vec_i, sv_j) - rho; The SVM model(svCoef, sv, rho) can be obtained using the training function of libSVM or openCV.

Parameters:
kernelTypekernelType options: 'FASTCV_SVM_LINEAR','FASTCV_SVM_POLY','FASTCV_SVM_RBF','FASTCV_SVM_SIGMOID'. FASTCV_SVM_LINEAR: Kernel(xi, xj) = xi'*xj FASTCV_SVM_POLY: Kernel(xi, xi) = (gamma * xi' * xj + coef0)^degree, (gamma>0 , degree is positive integer). FASTCV_SVM_RBF: Kernel(xi,xj) = exp(-gamma*||xi-xj||^2), (gamma>0). FASTCV_SVM_SIGMOID: Kernel(xi, xj) = tanh(gamma * xi' * xj + coef0)
degreeParameter degree of a kernel function (FASTCV_SVM_POLY).
NOTE: Degree should be positive integer.
gammaParameter of a kernel function (FASTCV_SVM_POLY / FASTCV_SVM_RBF / FASTCV_SVM_SIGMOID).
NOTE: gamma > 0 for FASTCV_SVM_Ploy and FASTCV_SVM_RBF
coef0Parameter coef0 of a kernel function (FASTCV_SVM_LINEAR / FASTCV_SVM_POLY / FASTCV_SVM_SIGMOID).
svSupport vectors.
svLenFeature length, (support vector length = feature length).
svNumNumber of support vectors.
svStridesupport vector stride. Stride of support vector 2D matrix (i.e., how many bytes between column 0 of row 1 and column 0 of row 2).
NOTE: if 0, svStride is set as svLen*sizeof(float32_t).
WARNING: should be multiple of 8, and at least as much as svLen if not 0.
svCoefCoefficent of support vectors, length equals to the Number of SV.
rhoSVM bias.
vecTest vectors, it has same width as sv.
vecNumNumber of test vectors.
vecStrideStride of test vectors. Stride of test vector 2D matrix (i.e., how many bytes between column 0 of row 1 and column 0 of row 2).
NOTE: if 0, vecStride is set as svLen*sizeof(float32_t).
WARNING: should be multiple of 8, and at least as much as svLen if not 0.
confidenceOutput, store confidence value of each test vector. The length is vecNum.
Returns:
FASTCV_SUCCESS upon success. Other status codes upon failure.
 All Data Structures Files Functions Variables Enumerations Enumerator Defines