您的位置:首页 > 产品设计 > 产品经理

DPM v5源码阅读(未完成)

2016-04-11 21:08 731 查看
TTransposition在他博客里面提到了,v3的版本和论文最接近,v4增加了模型数由2个增加为6个,v5提取了语义特征。

对比v3和v5的代码,发现代码的风格和结构都有不少的变化。

Here we go~

Demo.m

function demo()
startup;

fprintf('compiling the code...');
compile;
fprintf('done.\n\n');

load('VOC2010/car_final');
model.vis = @() visualizemodel(model, ...
1:2:length(model.rules{model.start}));
test('000034.jpg', model, -0.3);

load('INRIA/inriaperson_final');
model.vis = @() visualizemodel(model, ...
1:2:length(model.rules{model.start}));
test('000061.jpg', model, -0.3);

load('VOC2010/person_grammar_final');
model.class = 'person grammar';
model.vis = @() visualize_person_grammar_model(model, 6);
test('000061.jpg', model, -0.6);

load('VOC2010/bicycle_final');
model.vis = @() visualizemodel(model, ...
1:2:length(model.rules{model.start}));
test('000084.jpg', model, -0.3);

function test(imname, model, thresh)
cls = model.class;
fprintf('///// Running demo for %s /////\n\n', cls);

% load and display image
im = imread(imname);
clf;
image(im);
axis equal;
axis on;
disp('input image');
disp('press any key to continue'); pause;
disp('continuing...');

% load and display model
model.vis();
disp([cls ' model visualization']);
disp('press any key to continue'); pause;
disp('continuing...');

% detect objects
[ds, bs] = imgdetect(im, model, thresh);
top = nms(ds, 0.5);
clf;
if model.type == model_types.Grammar
bs = [ds(:,1:4) bs];
end
showboxes(im, reduceboxes(model, bs(top,:)));
disp('detections');
disp('press any key to continue'); pause;
disp('continuing...');

if model.type == model_types.MixStar
% get bounding boxes
bbox = bboxpred_get(model.bboxpred, ds, reduceboxes(model, bs));
bbox = clipboxes(im, bbox);
top = nms(bbox, 0.5);
clf;
showboxes(im, bbox(top,:));
disp('bounding boxes');
disp('press any key to continue'); pause;
end

fprintf('\n');


参考链接

1、 DPM(Defomable Parts Model) 源码分析-检测(二)

2、 DPM(Defomable Parts Model) 源码分析-训练(三)
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  源码 DPM