在检测的demo 中 主要的code 有两部分:
1.[dets, boxes] = imgdetect(im, model, -0.3); 对图像检测出很多小框框放在dets里面。
2. top = nms(dets, 0.5); 对检测到的框框进行NMS 抑制。
imgdetect 里面 主要的函数是:[dets, boxes, info] = gdetect(pyra, model, thresh, bbox, overlap);
此处 pyra 为图像的金字塔。整幅图像的金字塔。
model 就是训练之后的model
thresh 为-0.3 是设置好的阈值
bbox 是空的 什么都没有
overlap 为 0
看到gdetect 这个函数我们是不是相当的熟悉:
gdetect 这个函数主要包含四个步骤:
1. model = filterresponses(model, pyra, latent, bbox, overlap);
model 是之前训练结果的model
pyra 是整幅图像的金字塔
latent =0
bbox =0
overlap=0;
下面解析 filterresponses:
filterresponses 函数里面:
for s = model.symbols (训练后的model 的symbols,在此处的model 中 个数给37)
if s.type == 'T'
filters{i} = model.filters(s.filter).w;
filter_to_symbol(i) = s.i;
i = i + 1;
end
end
我们可以得到 其中有18个滤波器,位置分别在:
1 4 6 8 10 12 14 16 18 20 22 24 26 28 30 32 34 36
2. L = model_sort(model);
3. for s = L
for r = model.rules{s}
model = apply_rule(model, r, pyra.pady, pyra.padx);
end
model = symbol_score(model, s, latent, pyra, bbox, overlap);
end
4.[dets, boxes, info] = getdetections(model, pyra.padx, pyra.pady, ...pyra.scales, X, Y, L, S);
经过getdetections 之后
444.3547 159.3409 496.1350 316.6819 2.0000 -0.2014
227.5306 158.5865 275.7763 305.3238 2.0000 -0.2472
boxes =
Columns 1 through 15
0 0 0 0 444.3547 159.3409 496.1350 316.6819 0 0 0 0 449.6327 159.3409 480.3009
0 0 0 0 227.5306 158.5865 275.7763 305.3238 0 0 0 0 237.3797 163.5111 265.9272
Columns 16 through 30
190.0091 0 0 0 0 449.6327 301.8478 480.3009 332.5160 0 0 0 0 460.1888 180.4531
192.0585 0 0 0 0 207.8323 281.7009 236.3797 310.2484 0 0 0 0 247.2289 188.1340
Columns 31 through 45
490.8569 211.1213 0 0 0 0 449.6327 254.3455 480.3009 285.0137 0 0 0 0 449.6327
275.7763 216.6814 0 0 0 0 237.3797 242.3043 265.9272 270.8518 0 0 0 0 232.4551
Columns 46 through 60
180.4531 480.3009 211.1213 0 0 0 0 470.7448 217.3993 501.4130 248.0675 0 0 0 0
183.2094 261.0026 211.7568 0 0 0 0 237.3797 217.6814 265.9272 246.2289 0 0 0 0
Columns 61 through 74
454.9107 212.1213 485.5789 242.7895 0 0 0 0 460.1888 291.2917 490.8569 321.9599 2.0000 -0.2014
227.5306 217.6814 256.0780 246.2289 0 0 0 0 266.9272 286.6255 295.4747 315.1730 2.0000 -0.2472
我们知道bbox 的列数为 74 .(74-2)/4=18 为什么在2 4 6 8 10 12 14 16 18 的位置上有数,有什么原因吗?
也不知道info 这个里面包含的信息是什么意思?