文档详情

目标检测PASCAL比较冠军算法matlab代码_20131203.docx

发布:2016-08-10约2.65万字共23页下载文档
文本预览下载声明
Object Detection Matlab CodeClipboxes.mfunction boxes = clipboxes(im, boxes) % boxes = clipboxes(im, boxes)% Clips bounding boxes to image boundary.if ~isempty(boxes) boxes(:,1) = max(boxes(:,1), 1); boxes(:,2) = max(boxes(:,2), 1); boxes(:,3) = min(boxes(:,3), size(im, 2)); boxes(:,4) = min(boxes(:,4), size(im, 1));endCompile.mmex resize.ccmex dt.ccmex features.cc%mex fconv.ccmex -Ofconv.ccDemo.mfunction demo() test(image1.jpg, bicycle);test(image2.jpg, person);function test(name, cls)% load test imageim=imread(name);image(im);axis equal;axis on;title(Input image);% pausedisp(press any key to continue); pause;% load modelload([models/ cls _model]);visualizemodel(model);title([cls model]);% pausedisp(press any key to continue); pause;% detect objectsboxes = detect(im, model, -0.5);top = nms(boxes, 0.5);showboxes(im, top);title(Objects found after non-maximum suppression);% pausedisp(press any key to continue); pause; % show root locations clipped to image boundaryroot = top(:, 1:4);clipped = clipboxes(im, root);showboxes(im, clipped);title(Bounding boxes clipped to image boundary); % pausedisp(press any key to continue); pause;Detect.mfunction boxes = detect(input, model, thresh, bbox, overlap, label, fid, maxnum) % boxes = detect(input, model, thresh, bbox, overlap, label, fid, maxnum) Detect objects in input using a model and a score threshold. Higher threshold leads to fewer detections. The function returns a matrix with one row per detected object. The last column of each row gives the score of the detection. The first 4 columns specify the bounding box for the root filter and subsequent columns specify the bounding boxes for the parts. If bbox is not empty, we pick best detection with significant overlap. If label and fid are included, we write the feature vectors of each detection to a data file.if nargin 3 ~isempty(bbox) latent = true;else latent = false;endif nargin 5 write = true;else write = false;end if nargin 8 maxnum = inf;end% we assume
显示全部
相似文档