c++ - dlib 的 scan_fhog_pyramid : set max_pyramid_levels

标签 c++ dlib

我正在使用具有以下类型的对象检测器:

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

我的代码是这样的:

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);

基本上我正在做的是定义一个对象检测器。反序列化一个已经训练过的 svm进入这个物体检测器。在最后一行中,我尝试通过更改 pig 金字塔的层数来配置检测器。

最后一行没有编译为 get_scanner()返回 const image_scanner_type & .这么变max_pyramid_levels不会工作。我想知道是否有办法改变它以扫描更少的图像(即金字塔将有更少的图像)。

我的目标是提高检测器的性能,在我的例子中,我确信金字塔中只需要很少的图像尺度。

感谢您的回复。

最佳答案

您可以使用新的图像扫描仪构建新的对象检测器:

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());

或者使用const_cast。

关于c++ - dlib 的 scan_fhog_pyramid : set max_pyramid_levels,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37529251/

相关文章:

c++ - 如何在 dlib 的 array2d<rgb_pixel> 图像上从 dlib::rectangle 创建 cv::Mat?

c++ - Dlib人脸识别,多张图片检测

python - 属性错误 : 'module' object has no attribute 'get_frontal_face_detector'

c++ - QTableView:从模型中删除行 -> 空行和 "QSortFilterProxyModel: index from wrong model passed to mapFromSource"

c++ - 使用 clang++、-fvisibility=hidden、typeinfo 和 type-erasure

c++ - 无锁pop()中使用引用参数返回值的缺点

c++ - 无法访问私有(private)函数

c++ - 为什么 dlib 的神经网络 xml 导出包含与培训师指定的层不同的参数?

c++ - 如何使用 Cmake 构建可执行文件,其中所有依赖项都包含在项目 DIR 中?

c++ - 使用基于范围的for循环打印多维数组