资源简介
C++版本DPM的行人检测,效果比hog要好,速度没Hog快。
代码片段和文件信息
#include “FastDPM.h“
FastDPM::FastDPM( string model_file )
{
// 1.
load_model( model_file model );
analyze_model( model );
}
Mat FastDPM::prepareImg( Mat &img_uint8 )
// Make a uint8 type image into a float type mat with 3 channels
{
if( img_uint8.depth()!=CV_8U || (img_uint8.channels()!=1 && img_uint8.channels()!=3) ){
printf(“Function prepareImg() only takes as input an image of 1 or 3 channels of uint8 type!“);
throw runtime_error(““);
}
if( img_uint8.channels()==1 )
cvtColor( img_uint8 img_color CV_GRAY2RGB );
else if( img_uint8.channels()==3 )
img_color = img_uint8;
Mat img;
img_color.convertTo( img CV_32FC3 );
return img;
}
void loadPyramid( const string FileName FEATURE_PYRAMID &pyra );
void FastDPM::detect( Mat &img float score_thresh /* = -FLOAT_INF */ bool show_hints /* = true */ bool show_img /* = true */ string save_img /* = */ )
{
hints = show_hints;
detections.clear();
prag_start = yuGetCurrentTime(‘M‘);
// 1. Feature pyramid <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
if( hints ){ printf(“Calculating feature pyramid ...\t“); start_clock = prag_start; }
/* method 1. */
featpyramid( img model pyra );
//loadPyramid( “pyramid.txt“ pyra );
/* method 2. */
//featpyramid2( img model pyra );
if( hints ){ end_clock = yuGetCurrentTime(‘M‘); printf(“_featpyramid takes %gs\n“(end_clock-start_clock)/1000.f); }
update_ruleData( model pyra.num_levels );
// 2. Filter responses & Deformation rules & Structural rules<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
if( hints ){ printf(“Applying rules ...\t“); start_clock = end_clock; }
/* method 1. */
//apply_rules( model pyra );
/* method 2. */
//apply_rules2( model pyra );
/* method 3. */
apply_rules3( model pyra );
if( hints ){ end_clock = yuGetCurrentTime(‘M‘); printf(“_apply_rules takes %gs\n“(end_clock-start_clock)/1000.f); }
// 3. Parse detections <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
if( hints ){ printf(“Parsing detections ...\t“); start_clock = end_clock; }
detections = parse_detections( model pyra score_thresh );
if( detections.empty() ) { printf(“NO DETECTIONS!\n“); return; }
if( hints ){ end_clock = yuGetCurrentTime(‘M‘); printf(“_parse_detections takes %gs\n“(end_clock-start_clock)/1000.f); }
// 4. Show results <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
float Elapsed_Time = 0;
if (hints) { prag_end = end_clock; Elapsed_Time = (prag_end - prag_start) / 1000.f; }
if (show_img || !save_img.empty()){
draw_img(img_color detections Elapsed_Time);
if (show_img)
imshow(“FAST_DPM“ img_color);
if (!save_img.empty())
imwrite(save_img img_color);
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2016-09-22 19:23 FastDPM-2015-Nov\
目录 0 2016-09-22 19:23 FastDPM-2015-Nov\FastDPM-2014-May\
文件 71237632 2016-09-22 18:45 FastDPM-2015-Nov\FastDPM-2014-May.sdf
文件 915 2014-06-13 21:55 FastDPM-2015-Nov\FastDPM-2014-May.sln
文件 20992 2014-05-05 15:19 FastDPM-2015-Nov\FastDPM-2014-May.suo
文件 65536 2016-09-22 18:45 FastDPM-2015-Nov\FastDPM-2014-May.v12.suo
文件 35236 2016-07-22 08:44 FastDPM-2015-Nov\FastDPM-2014-May\2.jpg
目录 0 2016-09-22 19:23 FastDPM-2015-Nov\FastDPM-2014-May\auxiliary\
文件 1049 2014-05-05 12:33 FastDPM-2015-Nov\FastDPM-2014-May\auxiliary\cvPrint.cpp
文件 327 2013-11-27 22:23 FastDPM-2015-Nov\FastDPM-2014-May\auxiliary\getCurrentTime.cpp
文件 194 2013-11-30 22:13 FastDPM-2015-Nov\FastDPM-2014-May\auxiliary\yuSaveMat.cpp
文件 7628 2014-05-05 12:54 FastDPM-2015-Nov\FastDPM-2014-May\FastDPM-2014-May.vcproj
文件 1427 2014-05-05 15:19 FastDPM-2015-Nov\FastDPM-2014-May\FastDPM-2014-May.vcproj.BYQLMZZOY8QMW15.Administrator.user
文件 8007 2016-09-22 18:29 FastDPM-2015-Nov\FastDPM-2014-May\FastDPM-2014-May.vcxproj
文件 5043 2016-07-26 12:36 FastDPM-2015-Nov\FastDPM-2014-May\FastDPM-2014-May.vcxproj.filters
文件 164 2015-09-09 22:09 FastDPM-2015-Nov\FastDPM-2014-May\FastDPM-2014-May.vcxproj.user
文件 2688 2016-09-22 18:41 FastDPM-2015-Nov\FastDPM-2014-May\FastDPM.cpp
文件 934 2013-11-25 17:03 FastDPM-2015-Nov\FastDPM-2014-May\FastDPM.h
目录 0 2016-09-22 19:23 FastDPM-2015-Nov\FastDPM-2014-May\funs\
文件 3505 2014-06-13 22:21 FastDPM-2015-Nov\FastDPM-2014-May\funs\analyze_model.cpp
文件 4612 2015-11-04 23:11 FastDPM-2015-Nov\FastDPM-2014-May\funs\apply_rules.cpp
文件 4603 2015-11-04 23:12 FastDPM-2015-Nov\FastDPM-2014-May\funs\apply_rules2.cpp
文件 5477 2015-11-04 23:12 FastDPM-2015-Nov\FastDPM-2014-May\funs\apply_rules3.cpp
文件 2211 2015-09-17 22:06 FastDPM-2015-Nov\FastDPM-2014-May\funs\bboxpred_get.cpp
文件 1735 2013-11-30 22:10 FastDPM-2015-Nov\FastDPM-2014-May\funs\bboxpred_input.cpp
文件 2788 2013-11-30 13:02 FastDPM-2015-Nov\FastDPM-2014-May\funs\bounded_dt.cpp
文件 2701 2013-11-30 13:35 FastDPM-2015-Nov\FastDPM-2014-May\funs\bounded_dt2.cpp
文件 1194 2013-11-30 19:52 FastDPM-2015-Nov\FastDPM-2014-May\funs\clipboxes.cpp
文件 1307 2013-11-14 12:32 FastDPM-2015-Nov\FastDPM-2014-May\funs\cvPermutate.cpp
文件 2504 2013-11-30 20:49 FastDPM-2015-Nov\FastDPM-2014-May\funs\detections_trees2.cpp
文件 1868 2016-09-22 18:43 FastDPM-2015-Nov\FastDPM-2014-May\funs\draw_img.cpp
............此处省略24个文件信息
评论
共有 条评论