xxxx18一60岁hd中国/日韩女同互慰一区二区/西西人体扒开双腿无遮挡/日韩欧美黄色一级片 - 色护士精品影院www

資源簡介

自己訓練的分類器導入進行視頻行人檢測 代碼親測可行,算法需要再完善 提高實時性

資源截圖

代碼片段和文件信息

#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?



//繼承自CvSVM的類,因為生成setSVMDetector()中用到的檢測子參數時,需要用到訓練好的SVM的decision_func參數,??
//但通過查看CvSVM源碼可知decision_func參數是protected類型變量,無法直接訪問到,只能繼承之后通過函數訪問?

class?MySVM?:?public?CvSVM
{

public:
//獲得SVM的決策函數中的alpha數組??
double?*?get_alpha_vector()
{
return?this->decision_func->alpha;
}

//獲得SVM的決策函數中的rho參數即偏移量??
float?get_rho()
{
return?this->decision_func->rho;
}
};
int?main()
{
//檢測窗口(64128)塊尺寸(1616)塊步長(88)cell尺寸(88)直方圖bin個數9
HOGDescriptor?hog(Size(64?64)?Size(16?16)?Size(8?8)?Size(8?8)?9);//HOG檢測器,用來計算HOG描述子的
int?DescriptorDim;//HOG描述子的維數,由圖片大小、檢測窗口大小、塊大小、細胞單元中直方圖bin個數決定
MySVM?svm;//SVM分類器
svm.load(“D:/vs2013projects/cpractice/hogtrainsvm/hogtrainsvm/SVM_HOG.xml“);//從xml文件讀取訓練好的SVM模型

/*************************************************************************************************
線性SVM訓練完成后得到的xml文件里面,有一個數組,叫做support?vector,還有一個數組,叫做alpha有一個浮點數,叫做rho;
將alpha矩陣同support?vector相乘,注意,alpha*supportVector將得到一個列向量。之后,再該列向量的最后添加一個元素rho。
如此,變得到了一個分類器,利用該分類器,直接替換opencv中行人檢測默認的那個分類器(cv::HOGDescriptor::setSVMDetector()),
就可以利用你的訓練樣本訓練出來的分類器進行行人檢測了。
***************************************************************************************************/
DescriptorDim?=?svm.get_var_count();//特征向量的維數,即HOG描述子的維數
int?supportVectorNum?=?svm.get_support_vector_count();//支持向量的個數
cout?<
Mat?alphaMat?=?Mat::zeros(1?supportVectorNum?CV_32FC1);//alpha向量,長度等于支持向量個數
Mat?supportVectorMat?=?Mat::zeros(supportVectorNum?DescriptorDim?CV_32FC1);//支持向量矩陣
Mat?resultMat?=?Mat::zeros(1?DescriptorDim?CV_32FC1);//alpha向量乘以支持向量矩陣的結果

//將支持向量的數據復制到supportVectorMat矩陣中
for?(int?i?=?0;?i {
const?float?*?pSVData?=?svm.get_support_vector(i);//返回第i個支持向量的數據指針
for?(int?j?=?0;?jriptorDim;?j++)
{
//cout< supportVectorMat.at(i?j)?=?pSVData[j];
}
}

//將alpha向量的數據復制到alphaMat中
double?*?pAlphaData?=?svm.get_alpha_vector();//返回SVM的決策函數中的alpha向量
for?(int?i?=?0;?i {
alphaMat.at(0?i)?=?pAlphaData[i];
}

//計算-(alphaMat?*?supportVectorMat)結果放到resultMat中
//gemm(alphaMat?supportVectorMat?-1?0?1?resultMat);//不知道為什么加負號?
resultMat?=?-1?*?alphaMat?*?supportVectorMat;

//得到最終的setSVMDetector(const?vector&?detector)參數中可用的檢測子
vector?myDetector;
//將resultMat中的數據復制到數組myDetector中
for?(int?i?=?0;?iriptorDim;?i++)
{
myDetector.push_back(resultMat.at(0?i));
}
//最后添加偏移量rho,得到檢測子
myDetector.push_back(svm.get_rho());
cout?< //設置HOGDescriptor的檢測子
????HOGDescriptor?

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2018-09-12?10:06??videopeopledetect\
?????目錄???????????0??2018-07-18?15:43??videopeopledetect\Debug\
?????文件??????128512??2018-08-31?10:43??videopeopledetect\Debug\videopeopledetect.exe
?????文件?????1477776??2018-08-31?10:43??videopeopledetect\Debug\videopeopledetect.ilk
?????文件?????2715648??2018-08-31?10:43??videopeopledetect\Debug\videopeopledetect.pdb
?????目錄???????????0??2018-09-12?10:32??videopeopledetect\videopeopledetect\
?????目錄???????????0??2018-09-12?10:04??videopeopledetect\videopeopledetect\Debug\
?????文件??????609280??2018-09-12?10:04??videopeopledetect\videopeopledetect\Debug\vc120.idb
?????文件?????1404928??2018-09-12?10:04??videopeopledetect\videopeopledetect\Debug\vc120.pdb
?????目錄???????????0??2018-09-12?10:04??videopeopledetect\videopeopledetect\Debug\videopeo.E976BEEB.tlog\
?????文件???????11376??2018-09-12?10:04??videopeopledetect\videopeopledetect\Debug\videopeo.E976BEEB.tlog\CL.read.1.tlog
?????文件?????????502??2018-09-12?10:04??videopeopledetect\videopeopledetect\Debug\videopeo.E976BEEB.tlog\CL.write.1.tlog
?????文件?????????780??2018-09-12?10:04??videopeopledetect\videopeopledetect\Debug\videopeo.E976BEEB.tlog\cl.command.1.tlog
?????文件????????2234??2018-08-31?10:43??videopeopledetect\videopeopledetect\Debug\videopeo.E976BEEB.tlog\link.command.1.tlog
?????文件????????4520??2018-08-31?10:43??videopeopledetect\videopeopledetect\Debug\videopeo.E976BEEB.tlog\link.read.1.tlog
?????文件?????????640??2018-08-31?10:43??videopeopledetect\videopeopledetect\Debug\videopeo.E976BEEB.tlog\link.write.1.tlog
?????文件???????????0??2018-09-12?10:04??videopeopledetect\videopeopledetect\Debug\videopeo.E976BEEB.tlog\unsuccessfulbuild
?????文件?????????179??2018-09-12?10:04??videopeopledetect\videopeopledetect\Debug\videopeo.E976BEEB.tlog\videopeopledetect.lastbuildstate
?????文件????????5342??2018-09-12?10:04??videopeopledetect\videopeopledetect\Debug\videopeopledetect.log
?????文件???????20652??2018-08-31?10:43??videopeopledetect\videopeopledetect\HOGDetectorForOpenCV.txt
?????文件????????6689??2018-09-12?10:32??videopeopledetect\videopeopledetect\videopeopledetect.cpp
?????文件????????4107??2018-07-17?17:52??videopeopledetect\videopeopledetect\videopeopledetect.vcxproj
?????文件?????????958??2018-07-17?17:52??videopeopledetect\videopeopledetect\videopeopledetect.vcxproj.filters
?????文件????18481152??2018-09-12?10:06??videopeopledetect\videopeopledetect.sdf
?????文件?????????997??2018-07-16?20:48??videopeopledetect\videopeopledetect.sln
?????文件???????24064??2018-09-12?10:06??videopeopledetect\videopeopledetect.v12.suo

評論

共有 條評論