问题
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.
回答1:
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
来源:https://stackoverflow.com/questions/21010739/how-to-obtain-part-scores-in-object-detection-with-discriminatively-trained-part