-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathcarAsgSrc.m
63 lines (57 loc) · 1.47 KB
/
carAsgSrc.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
function wsSrc = carAsgSrc(pFs, nOus)
% Generate Cars source for assignment problem.
%
% Input
% pFs - frame index, 1 x 2
% nOus - #Outliers, 1 x 2,
%
% Output
% wsSrc
% prex - prex
% asgT - ground truth assignment
% Pts - graph node set, 1 x mG (cell), 2 x ni
% ords - order, 1 x mG (cell), 1 x ni
%
% History
% create - Zhen Zhang (zhen@zzhang.org),
% save option
% prex = cellStr(tag, pFs, nIns);
Fname = sprintf('%s_%d.mat', ...
'./Cars_and_Motorbikes_Graph_Matching_Datasets_and_Code/Data_for_Cars_and_Motorbikes/Data_Pairs_Cars/pair', pFs);
prex = sprintf('Motor_pair_%d', pFs);
load(Fname);
nIn = nF1;
Inliers1 = features1(1:nIn, 2:-1:1)';
Inliers2 = features2(1:nIn, 2:-1:1)';
% load
[n1,~] = size(features1);
[n2,~] = size(features2);
n1 = n1 - nIn;
n2 = n2 - nIn;
nOus = min(min(n1, n2), nOus);
ord1 = randperm(n1);
ord1 = ord1(1:nOus);
Outliers1 = features1(nIn + ord1, 2:-1:1)';
ord2 = randperm(n2);
ord2 = ord2(1:nOus);
Outliers2 = features2(nIn + ord2, 2:-1:1)';
Pts{1} = [Inliers1, Outliers1];
Pts{2} = [Inliers2, Outliers2];
% ground-truth assignment
XT = [eye(nIn), zeros(nIn, nOus); zeros(nOus, nIn + nOus)] ;
asgT.alg = 'truth';
asgT.X = XT;
ords = {[1:nIn, ord1 + nIn], [1:nIn, ord2 + nIn]};
Features={features1, features2};
Fs={I1,I2};
% store
wsSrc.prex = prex;
wsSrc.Pts = Pts;
wsSrc.asgT = asgT;
wsSrc.ords = ords;
wsSrc.tag = 'Motor';
wsSrc.pFs = pFs;
wsSrc.nIns = nIn;
wsSrc.Features = Features;
wsSrc.Fs = Fs;
% save