-
Notifications
You must be signed in to change notification settings - Fork 1
/
calc_assoc_prob_lbp.m
81 lines (67 loc) · 2.01 KB
/
calc_assoc_prob_lbp.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
function [betac, nc] = calc_assoc_prob_lbp(Omega, F, PDt, lambda, V)
%CALC_ASSOC_PROB_LBP Calculate table with all marginal probabilities of
% association events for the joint probabilistic data association filter
% by loopy belief propagation
%
% Usage:
% [beta, nc] = calc_assoc_prob_lbp(Omega, F, PDt, lambda, V)
%
% Inputs:
% Omega = Validation matrix with all possible association events
% F = Matrix of joint probabilities of measurements to targets
% type = method of calculation of the marginal probabilities for assignments:
% 'parametric' = default JPDAF with parametric clutter model
% 'non_parametric' = default JPDAF with parametric clutter model
% PDt = detection probability of target
% lambda = spatial density of false measurements / clutter density
% V = volume of validation region (row vector - for each target)
%
% Outputs:
% beta = Matrix of marginal probabilities of association events
% nc = Number of combinations for valid events
%
% Coded by:
% Flavio Eler de Melo (flavio.eler@gmail.com)
% University of Liverpool, February, 2014
%
if isempty(Omega) || isempty(F)
betac = [];
nc = 0;
return;
end
%% Generation of validation matrices for all possible combinations of valid events
mk = size(Omega,1);
Nt = size(Omega,2)-1;
P = zeros(size(F));
% P(wjt)
for t = 1:Nt+1
for j = 1:mk
P1 = PDt*F(j,t)/lambda;
P2 = (1-PDt);
P(j,t) = (t > 1)*P1 + (t == 1)*P2;
end
end
%% Jason Willians code
% Initialisation
w = P(:,2:end)'/(1-PDt);
n = mk;
m = Nt;
om = ones(1,m);
on = ones(1,n);
muba = ones(m,n);
muab = zeros(size(w));
muba0 = 0.1*muba;
muab0 = 0.1*ones(size(w));
while max(max(abs(muba0-muba))) > 1e-9 && max(max(abs(muab0-muab))) > 1e-9
muba0 = muba;
muab0 = muab;
prodfact = muba .* w;
sumprod = 1 + sum(prodfact);
muab = w ./ (sumprod(om,:) - prodfact);
summuab = 1 + sum(muab,2);
muba = 1 ./ (summuab(:,on) - muab);
end
bf = [on; (muba .* w)];
betac = (bf./(ones(m+1,1)*sum(bf,1)))';
nc = 0;
end