问题描述
该代码位于广泛用于对象检测。有一个返回 ds , bs 和树的 imgdetect 函数。看起来 ds 包含检测框, bs 包含用于检测的过滤器在图像中是否响应,树包含部分信息分数。我无法找到如何使用树和 bs 获取部分分数。基本上,给定一个检测框,我想知道哪些过滤器在检测中响应,以及用于检测对象的每个过滤器(子部分)的分数是多少。
我想出了如何做到这一点,在gdetect_parse.m结束时,添加以下行,边界框(x1,x2,y1,y2) bs 中的第二行,分数将位于树{i}
node_id = 8中的第二行; //确保它是一个叶节点,即树{i}的第二行应为1
tree_id = 1; //检测树之一
scale =(model.sbin / pyra.scales(trees {tree_id}(8,node_id)));
x1 =(trees {tree_id}(6,node_id)-1 - pyra.padx *(2 ^ trees {tree_id}(9,node_id)))* scale + 1
y1 =(trees {tree_id}(7,node_id) - 1 - pyra.pady *(2 ^ trees {tree_id}(9,node_id)))* scale + / p>
filter_id = model.symbols(trees {1}(3,node_id))。filter;
fx = model.filters(filter_id).size(2);
fy = model.filters(filter_id).size(1);
x2 = x1 + fx * scale-1
y2 = y1 + fy * scale- 1
The code which is available at http://www.cs.berkeley.edu/~rbg/latent/voc-release5.tgz is widely used in object detection. There is a imgdetect function which returns ds, bs and trees. It seems ds contains detection boxes and bs contains which of the filters used for detection responded in the image, while trees contains some information about the part scores. I was not able to find out how to get the part scores using trees and bs. Basically, given a detection box, I would like to find out which filters responded in detection and what was the score for each filter (sub part) which was used for detecting an object.
I figured out how to do this, at the end of gdetect_parse.m, add the following lines, the bounding boxes (x1, x2, y1, y2) would correspond to the boxes in bs and the scores would be in the second last row in trees{i}
node_id = 8; //ensure that it is a leaf node, i.e second row of trees{i} should be 1
tree_id = 1; //one of the detection trees
scale = (model.sbin/pyra.scales(trees{tree_id}(8, node_id)));
x1 = (trees{tree_id}(6, node_id) - 1 - pyra.padx*(2^trees{tree_id}(9, node_id)))*scale + 1
y1 = (trees{tree_id}(7, node_id) - 1 - pyra.pady*(2^trees{tree_id}(9, node_id)))*scale + 1
filter_id = model.symbols(trees{1}(3, node_id)).filter;
fx = model.filters(filter_id).size(2);
fy = model.filters(filter_id).size(1);
x2 = x1 + fx*scale - 1
y2 = y1 + fy*scale - 1
这篇关于如何在具有区分训练的基于零件的模型的对象检测中获得零件分数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!