dlib's scan_fhog_pyramid : set max_pyramid_levels

旧巷老猫 提交于 2019-12-11 05:14:11

问题


I am using an object detector that has the following type:

dlib::object_detector<dlib::scan_fhog_pyramid<dlib::pyramid_down<2>>>

My code is like this :

dlib::object_detector<dlib::scan_fhog_pyramid<dlib::pyramid_down<2>>> d;   
dlib::deserialize(svm_path) >> d;
d.get_scanner().set_max_pyramid_levels(max_levels);

So basically what i'm doing is defining an object detector. Deserializing an already trained svm into this object detector. And in the last line, I'm trying to configure the detector by changing the number of levels of the hog pyramid.

The last line does not compile as get_scanner() returns const image_scanner_type &. So changing max_pyramid_levels won't work. I would like to know if there is a way to change that in order to scan less images (ie. The pyramid will have less images).

My goal is to enhance the performance of the detector and in my case I'm sure that only few image scales in the pyramid are needed.

Thank you for your reply.


回答1:


You can construct new object detector with new image scanner:

typedef dlib::scan_fhog_pyramid<dlib::pyramid_down<2> > image_scanner_type;
typedef dlib::object_detector<image_scanner_type> detector_type;
detector_type d;   
dlib::deserialize(svm_path) >> d;
image_scanner_type new_scanner;
new_scanner.copy_configuration(d.get_scanner());
new_scanner.set_max_pyramid_levels(1);
detector_type new_d(new_scanner, d.get_overlap_tester(), d.get_w());

Or use const_cast.



来源:https://stackoverflow.com/questions/37529251/dlibs-scan-fhog-pyramid-set-max-pyramid-levels

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!