-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetW_W.m
36 lines (28 loc) · 765 Bytes
/
getW_W.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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Precompute all w_{ij}
% Xp is the likelihood of the optimal assignments given
% the current output set
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [W, Xp] = getW_W(B, S)
P = zeros(size(B,3));
C=permute(B,[1 3 2]);
C=reshape(C,[],size(B,2),1);
sz=size(B(:,:,1),1);
C=zero2one(C);
B=zero2one(B);
for i = 1:size(B,3)
i
M =bboxOverlapRatio(zero2one(B(:,:,i)),C);
ti=1;
for j=1:1:size(B,3)
P(i,j)=sum(diag(M(:,ti:ti+sz-1)))/sz;
ti=ti+sz;
end
end
param.lambda=0.075;
P = bsxfun(@times, P, S(:));
P = [P param.lambda*ones(size(B,3),1)];
P = bsxfun(@times, P, 1./sum(P,2));
W = log(P);
Xp = W(:,end);
W = W(:,1:end-1);