Qualcomm FastCV Library
1.7.1
|
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. |
Machine learning functions such as SVM prediction, etc.
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.
kernelType | kernelType 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) |
degree | Parameter degree of a kernel function (FASTCV_SVM_POLY). NOTE: Degree should be positive integer. |
gamma | Parameter of a kernel function (FASTCV_SVM_POLY / FASTCV_SVM_RBF / FASTCV_SVM_SIGMOID). NOTE: gamma > 0 for FASTCV_SVM_Ploy and FASTCV_SVM_RBF |
coef0 | Parameter coef0 of a kernel function (FASTCV_SVM_LINEAR / FASTCV_SVM_POLY / FASTCV_SVM_SIGMOID). |
sv | Support vectors. |
svLen | Feature length, (support vector length = feature length). |
svNum | Number of support vectors. |
svStride | support 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. |
svCoef | Coefficent of support vectors, length equals to the Number of SV. |
rho | SVM bias. |
vec | Test vectors, it has same width as sv. |
vecNum | Number of test vectors. |
vecStride | Stride 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. |
confidence | Output, store confidence value of each test vector. The length is vecNum. |