OpenCV Face Recognition奇怪的结果

时间:2014-09-26 09:56:30

标签: c++ opencv face-recognition

我一直在使用OpenCV的SVM和RF来解决11类的多类人脸识别问题,每班只有5张图像。我使用了两种功能 - 最初是玩具强度图像功能(只是每个图像调整为32x32灰度),然后第二个功能只是使用Tan Triggs预处理(link)的另一个玩具功能。这是功能代码:

void Feature::makeFeature(cv::Mat &image, cv::Mat &result)
{
    cv::resize( image, image, cv::Size(32, 32), 0, 0, cv::INTER_CUBIC );
    cv::equalizeHist(image, image);
// Images must be aligned - Only pitch executed, yaw and roll assumed   negligible
    algmt->getAlignedImage( image, image ); // image alignment
// tan triggs
{
tan_triggs_preprocessing(image, result);
result = result.reshape(0, 1); // make a single row vector, needed for the training samples matrix
}
// if plain intensity
{
//    image.copyTo(result);
//    result.convertTo(result, CV_32F, 1.0f/255.0f);
//    result = result.reshape(0, 1); // make a single row vector, needed for the training samples matrix
}
}

tan_triggs_preprocessing函数与链接中给出的Tan Triggs预处理函数相同。我添加了一步 - 我将结果归一化为0和1之间。

两者的测试结果都不是很好,正如预期的那样,但后来我犯了一个愚蠢的错误并发现了一些奇怪的事情:当我不小心将训练目录作为训练和测试的输入时,我获得了100%的结果普通强度特征,但Tan Triggs特征给出了以下结果:

SVM培训完成 正确总数:51,准确度:92.7273 RF培训完成 正确总数:53,准确度:96.3636

我确实知道,当训练集输入到测试时,你的过度拟合结果应该是完美的。其他一切都是标准的,SVM和RF都是OpenCV示例中的标准。此外,我获得100%的普通强度功能,所以我当然在使用Tan Triggs时在这里搞砸了。任何人都知道我在犯什么错误? 我已经使用了其他复杂的功能,如LTP和LQP没有问题,但这种预处理方法是我想要使用的。我使用Jain-Learned Miller凝固算法进行对齐,因为我假设人脸识别的正面,没有姿势校正。

0 个答案:

没有答案
相关问题