[dets, boxes] = imgdetect(im, model, 0.4); bbox = bboxpred_get(model.bboxpred, dets, reduceboxes(model, boxes)); bbox = clipboxes(im, bbox); top = nms(bbox, 0.5); result = bbox(top,:);
其中[dets, boxes, info] = imgdetect(input, model, thresh, bbox, overlap)
调用了:gdetect(pyra, model, thresh, bbox, overlap);
pyra为Hog的金字塔特征值,model为模型参数,thresh为分数的阈值。后面两个参数可以不写。
之后我们会得到dets和boxes两个矩阵
代码里面的解释为:
% dets is a matrix with 6 columns and one row per detection. Columns 1-4 % give the pixel coordinates (x1,y1,x2,y2) of each detection bounding box. % Column 5 specifies the model component used for each detection and column % 6 gives the score of each detection. % % boxes is a matrix with one row per detection and each sequential group % of 4 columns specifies the pixel coordinates of each model filter bounding % box (i.e., where the parts were placed). The index in the sequence is % the same as the index in model.filters.
是root filter的检测结果其实已经不错了(就是hog的检查结果)
bboxpred_get用来得到预测的结果,我觉得更像是一个检测结果融合
clipboxes用来优化窗体结构,不影响结果
nms用来去除重叠的检测窗口
其实我觉得程序可以简化成这样:
[dets, boxes] = imgdetect(im, model, 0.4); bbox = clipboxes(im, dets); top = nms(bbox, 0.5); result = bbox(top,:);不过这样就没用用到parts model的意思了
完全就是hog检测了。没有意义了。自娱自乐写就好。
最后用:
showboxes(im, dets);来显示检测的结果。