CloudRunner

... share your algorithms as a web service

Algorithm: MMOSPA Estimation for Two Targets in 2D

Description:
Calculates the exact MMOSPA estimate for two 2D targets when a particle distribution is given.
Paper: For details, see the following paper:

Marcus Baum, Peter Willett, Uwe D. Hanebeck, Calculating Some Exact MMOSPA Estimates for Particle Distributions, Proceedings of the 15th International Conference on Information Fusion (Fusion 2012), Singapore, July, 2012.
Tags: MMOSPA
Usage: Algorithm is public.
Viewed 2628 times, called 239 times
Upload:
Empty star Empty star Empty star Empty star Empty star
0 votes
Marcus Baum
06/21/2012 8:52 p.m. (version #1)

Run Algorithm

: Number of particles
: Allow cached result?
Close

Please Wait

Computation is running...

Plots

showing plot # of

Result Value(s)


		

Resource Usage

Execution of the algorithm took seconds.
Peak memory usage for running the algorithm was kilobytes (total usage: kilobytes).

Run ID / Link

ID of this run:
Link:

Result from Cache

Result has been delivered from cache and computed on (UTC).

Matlab log

(show)

		

Error

Using this algorithm in your local MATLAB environment is easy: Click here for instructions!

Usage Instructions for CloudRunner Client

  1. Download the CloudRunner Client by clicking here and place the downloaded file in your MATLAB working directory.

  2. Inside MATLAB, initialize the CloudRunner Client by calling CloudRunner:
    >> CloudRunner

    A login dialog will prompt for your CloudRunner mail address and password. For a start, you can leave the dialog empty and just click "Connect".

    Alternatively, you can provide the login credentials (or empty strings to skip login) as a parameter and hence skip the login dialog. This is useful when using CloudRunner in non-interactive scripts.
    >> CloudRunner('mail@example.com', 'password')

  3. Select this algorithm by its URL. Selecting an algorithm creates the lambda function that proxies calls to the algorithm to the server for execution:
    >> CloudRunnerSelect('http://www.cloudrunner.eu/algorithm/30/mmospa-estimation-for-two-targets-in-2d/version/1/')

    For the sake of convenience, you can also use the algorithm ID instead of its URL for public algorithms.

  4. Call functions from the algorithm like any regular local function.

Note: You can find further information on the help page.

Source Code

File:

 1 function  MMOSPA_TwoTargets_2D(nr_particles)
 2 
 3 % Generate particles by sampling from a Gaussian mixture
 4 MU = [2 2  4  0; 4  0 2 2];
 5 SIGMA = cat(3,0.5*eye(4),0.3*eye(4));
 6 weights =[1 2 ];
 7 particles = random(gmdistribution(MU,SIGMA,weights),nr_particles);
 8 
 9 % Calculate point estimates
10 MMSE_estimate = mean(particles);
11 MMOSPA_estimate = exact_MMOSPA_2D(particles);
12 
13 % Plotting
14 figure;
15 axis equal
16 xlabel('x');
17 ylabel('y');
18 hold on
19 
20 % Plot particles
21 plot(particles(:,1), particles(:,2),'o','MarkerEdgeColor','black', 'MarkerFaceColor','magenta','MarkerSize',4);
22 plot(particles(:,3), particles(:,4),'o','MarkerEdgeColor','black', 'MarkerFaceColor','blue', 'MarkerSize',4 );
23 
24 % Plot MMSE estimate
25 plot(MMSE_estimate([1 3]),MMSE_estimate([2 4]),'x','MarkerSize',12,'LineWidth',3,'Color','red');
26  
27 % Plot MMOPSA estimate
28 plot(MMOSPA_estimate([1 3]),MMOSPA_estimate([2 4]),'o','MarkerSize',12,'LineWidth',2,'Color','black','MarkerFaceColor','green');
29 
30 % Plot Legend
31 legend('Particles for Target 1', 'Particles for Target 2', 'MMSE Estimate','MMOSPA Estimate');
32 drawnow;
33 end
34 
35 
36 
37 
38 
39 
40 function MMOSPA = exact_MMOSPA_2D(particles)
41 n = size(particles,1);
42 
43 % Sort particles according to their orientation 
44 d = (particles(:,1:2)-particles(:,3:4));
45 dir = atan(d(:,2)./d(:,1));
46 [sorted_dir perm_dir] = sort(dir);
47 particles = particles(perm_dir,:);
48 
49 % Initial permutation of particles
50 for j = 1:n
51    if   [-1 0] *(particles(j,1:2)-particles(j,3:4))'< 0 
52       particles(j,:) =  particles(j,[3 4 1 2]);
53    end 
54 end
55 
56 % Find Minimum MOSPA
57 MOSPA_temp = mean(particles);
58 reward_temp = MOSPA_temp* MOSPA_temp' ;
59 MMOSPA = MOSPA_temp;
60 max_reward = reward_temp; 
61 for j = 1:n
62     switched_particle= particles(j,[3 4 1 2])/n;
63     temp = MOSPA_temp- particles(j,:)/n; 
64     MOSPA_temp =   temp+   switched_particle;
65     reward_temp =  temp*temp' + 2 * temp *switched_particle' +  switched_particle * switched_particle';
66     if reward_temp > max_reward
67        max_reward = reward_temp;
68        MMOSPA  = MOSPA_temp;   
69     end
70 end
71 end
Download algorithm (1 file) as ZIP

Comments

Please login to post a comment.