具有直方图交集内核和概率估计的 Svm

问题描述 投票:0回答:0

我在我的数据上测试了 Opencv 的

SVM
,当我将
KernelType
设置为
INTER
时,我在训练数据上获得 100% 的准确率,在测试数据上获得 95% 的准确率,但在其他
KernelTypes
上我得到更少准确性。

但是,据我所知,Opencv 的

SVM
没有
probability estimation
,所以我检查了
libsvm
有一个
probability estimation
,但我没有找到如何在
libsvm
中定义
KernelType
将是
Histogram intersection kernel
.

所以我的问题是如何通过使用

Histogram intersection kernel
probability estimation
opencv
libsvm
中的另一个库来同时拥有
C++
C#

Opencv
libsvm
都是开源的,所以我想尝试在
intersection kernel
中添加一个
libsvm
,在我看来,这比在
Probability estimation
中添加
Opencv
更容易。但是如何开始呢?

libsvm
检查内核 here
Opencv
实现
intersection kernel
here.

如何在

libsvm
中集成以下功能?

/// Histogram intersection kernel
void calc_intersec( int vcount, int var_count, const float* vecs,
                    const float* another, Qfloat* results )
{
    int j, k;
    for( j = 0; j < vcount; j++ )
    {
        const float* sample = &vecs[j*var_count];
        double s = 0;
        for( k = 0; k <= var_count - 4; k += 4 )
            s += std::min(sample[k],another[k]) + std::min(sample[k+1],another[k+1]) +
            std::min(sample[k+2],another[k+2]) + std::min(sample[k+3],another[k+3]);
        for( ; k < var_count; k++ )
            s += std::min(sample[k],another[k]);
        results[j] = (Qfloat)(s);
    }
}
c# c++ opencv machine-learning svm
© www.soinside.com 2019 - 2024. All rights reserved.