Contents

timestamp

fprintf(1,'Started on %s\n', datestr(now));
Started on 10-Apr-2010 03:42:52

load data and create inverted file

% path to the preprocessed data
load('mpvdb_haff2.mat');
idf = getidf(VW, 10000);
DB  = createdb_tfidf(VW, 10000, idf);

opt = [];
opt.max_tc=600;
opt.max_MxN=10;
opt.max_spatial=50;
% directory where you unzipped mpvimgs.zip
opt.root_dir='.';
% opt.subplot=1;
opt.threshold=8;

check corrm2m correspondences on a single pair

qid = 290;
did = 340;
bbx = [780 625 940 720];

im1 = im2double(rgb2gray(imread(fullfile(opt.root_dir, NAMES{qid}))));
im2 = im2double(rgb2gray(imread(fullfile(opt.root_dir, NAMES{did}))));

qidx = ptsinbbx(GEOM{qid}, bbx);
corrs = corrm2m(VW{qid}(qidx), VW, did, opt); corr=corrs{1};

qgeom = GEOM{qid}(:,qidx);
dgeom = GEOM{did};

showcorrs(im1, qgeom, im2, dgeom, corr, 1:size(corr,2));
showbbx(bbx, eye(3));

fprintf('\nTentative correspondences: '); fprintf(1, '(%d,%d) ',corr); fprintf(1,'\n');
Tentative correspondences: (96,1594) (99,1827) (7,1313) (18,1362) (68,805) (65,661) (30,247) (107,1193) (56,1219) (32,902) (66,652) (105,1966) (2,679) (71,1200) (13,1339) (87,1444) (100,1826) (51,294) (49,229) (106,1963) (48,227) (75,1468) (53,931) (89,415) (54,970) (47,853) (97,1712) (52,258) (78,1466) (84,145) (76,438) (72,1201) (102,1607) (102,1805) (44,639) (44,951) (57,946) (57,1220) (88,815) (88,1443) (109,1845) (109,1964) (27,811) (41,811) (77,25) (77,599) (94,1401) (94,1617) (94,1685) (70,263) (70,935) (70,1387) 

check ransacm2m on a single pair

qgeom = GEOM{qid}(:,qidx);
dgeom = GEOM{did};

[score A] = ransacm2m(qgeom, GEOM, corrs, did, opt);

pts1=qgeom(1:2,corr(1,:)); pts1(3,:)=1;
pts2=dgeom(1:2,corr(2,:)); pts2(3,:)=1;

threshold = opt.threshold*opt.threshold;

inl = adist(A, pts1, pts2)<threshold;

showcorrs(im1, qgeom, im2, dgeom, corr, inl);
showbbx(bbx, eye(3));
showbbx(bbx, A, double([SIZES(1,qid)+10+1 1]));

fprintf('\nInlier pairs: '); fprintf(1, '(%d,%d) ',corr(:,inl)); fprintf(1,'\n');
Inlier pairs: (65,661) (30,247) (56,1219) (66,652) (105,1966) (71,1200) (49,229) (106,1963) (48,227) (53,931) (97,1712) (72,1201) (44,639) (57,946) (57,1220) 

process few queries, planar object

qid = 100;
bbx = [188 415 846 745];
tic
[scores, img_ids, A]=querysp(VW{qid}, GEOM{qid}, bbx, VW, GEOM, DB, idf, opt);
toc
% show top 5 results
showresults(img_ids(1:5), scores, A, bbx, opt, NAMES);
fprintf('\nTop 5 scores: '); fprintf(1, '%f ',scores(1:5)); fprintf(1,'\n');
fprintf('\nTop 5 ids: '); fprintf(1, '%d ',img_ids(1:5)); fprintf(1,'\n');
Correspondences in 0.240 sec.
Verified in 4.000 sec.
Elapsed time is 4.259352 seconds.

Top 5 scores: 532.922104 32.280968 18.188291 18.183699 12.186820 

Top 5 ids: 100 99 96 97 98 

part of planar object

qid = 1;
bbx = [744  206  850  596];
tic
[scores, img_ids, A]=querysp(VW{qid}, GEOM{qid}, bbx, VW, GEOM, DB, idf, opt);
toc

% show top 5 results
showresults(img_ids(1:5), scores, A, bbx, opt, NAMES);
fprintf('\nTop 5 scores: '); fprintf(1, '%f ',scores(1:5)); fprintf(1,'\n');
fprintf('\nTop 5 ids: '); fprintf(1, '%d ',img_ids(1:5)); fprintf(1,'\n');
Correspondences in 0.100 sec.
Verified in 2.480 sec.
Elapsed time is 2.603252 seconds.

Top 5 scores: 309.448472 12.141927 10.101917 9.116392 8.123826 

Top 5 ids: 1 2 4 3 5 

UK bench

qid = 831;
bbx = [124 22 297 217];
tic
[scores, img_ids, A]=querysp(VW{qid}, GEOM{qid}, bbx, VW, GEOM, DB, idf, opt);
toc
% show top 5 results
showresults(img_ids(1:5), scores, A, bbx, opt, NAMES);
fprintf('\nTop 5 scores: '); fprintf(1, '%f ',scores(1:5)); fprintf(1,'\n');
fprintf('\nTop 5 ids: '); fprintf(1, '%d ',img_ids(1:5)); fprintf(1,'\n');
Correspondences in 0.130 sec.
Verified in 3.750 sec.
Elapsed time is 3.882039 seconds.

Top 5 scores: 203.455642 30.155045 14.152357 7.114456 6.095707 

Top 5 ids: 831 832 834 833 950 

can we find all pokemons?

qid = 280;
bbx = [338  377  480  510];
% verification performance test
opt.max_spatial=100;
tic
[scores, img_ids, A]=querysp(VW{qid}, GEOM{qid}, bbx, VW, GEOM, DB, idf, opt);
toc;
% show last 5 good results (in case we have all out of 73 pokemon images)
showresults(img_ids(68:73), scores(68:73), A(:,:,68:73), bbx, opt, NAMES);
fprintf('\nScores: '); fprintf(1, '%f ',scores(68:73)); fprintf(1,'\n');
fprintf('\nIds: '); fprintf(1, '%d ',img_ids(68:73)); fprintf(1,'\n');
Correspondences in 0.190 sec.
Verified in 4.800 sec.
Elapsed time is 4.996137 seconds.

Scores: 23.089472 21.103207 20.106529 13.080517 12.116890 12.094858 

Ids: 293 310 294 290 295 291 

query expansion? without...

qid = 67;
bbx = [370   464   495   564];

opt.max_spatial=20;
tic
[scores, img_ids, A]=querysp(VW{qid}, GEOM{qid}, bbx, VW, GEOM, DB, idf, opt);
toc

% show top 5 results
showresults(img_ids(1:5), scores, A, bbx, opt, NAMES);
fprintf('\nTop 5 scores: '); fprintf(1, '%f ',scores(1:5)); fprintf(1,'\n');
fprintf('\nTop 5 ids: '); fprintf(1, '%d ',img_ids(1:5)); fprintf(1,'\n');
Correspondences in 0.020 sec.
Verified in 0.690 sec.
Elapsed time is 0.717640 seconds.

Top 5 scores: 89.283054 18.092623 6.095239 6.074269 6.073626 

Top 5 ids: 67 70 501 390 500 

query expansion? with...

opt.max_qe=5;
tic
[scores, img_ids, A]=querysp(VW{qid}, GEOM{qid}, bbx, VW, GEOM, DB, idf, opt);
toc
% show top 5 results
showresults(img_ids(1:5), scores, A, bbx, opt, NAMES);
fprintf('\nTop 5 scores: '); fprintf(1, '%f ',scores(1:5)); fprintf(1,'\n');
fprintf('\nTop 5 ids: '); fprintf(1, '%d ',img_ids(1:5)); fprintf(1,'\n');
Correspondences in 0.020 sec.
Verified in 0.690 sec.
Elapsed time is 0.716702 seconds.

Top 5 scores: 89.283054 18.092623 6.095239 6.074269 6.073626 

Top 5 ids: 67 70 501 390 500