can somebody explain me the concept of assignment threshold for trackers (trackergnn, trackerJPDA, trackerTOMHT etc), like how can i use it to control the association?
26 views (last 30 days)
Show older comments
% Code Implementation
% 1. make the simulating environment using the "trackingScenario" object.
% 2. make the theaterplot for visualization of tracking Scene and plot the scenario origin.
% 3. define the target in the simualting environment using the platform.
% 4. define the trajectory of target and plot this in the environment.
% 5. assign the defined trajectory to be followed to target.
% 6. check if the target follows the trajectory using the simulation.
% 7. tracker implementation in the simulation to detect the track of tracker.
% 8.
% passing detections to tracker.
clear all;clc;close all;
% ============================= 1.tracking scenario=========================%
% The IsEarthCentered parameter of radarScenario determines the global frame for the entire scenario.
% whether it will be geographic coordinate system or .
scene = trackingScenario("UpdateRate",2);
% =============================2.TheaterPlot for visualization=========================%
tp = theaterPlot("XLimits",[-5 5],"YLimits",[-5 5],"ZLimits",[-10 10],"AxesUnits",["m" "m" "m"]);
title('Radar Scenario');grid on;
% ploting the origin of scenario.
scenePlotter = platformPlotter(tp,"DisplayName",'Scenario Origin','Marker','o');
plotPlatform(scenePlotter,[0 0 0])
% =============================3.Target Definition=========================%
target = platform(scene,Position=[-4 1 10],orientation=[0 0 0]); % it can also be initialized using target.Trajectory.Position([]) .
% target = platform(scene); % it can also be initialized using target.Trajectory.Position([]) .
% plotting the target in scenario.
targetPlotter = platformPlotter(tp,"DisplayName","Target");
plotPlatform(targetPlotter ,target.Position)
% =============================4.waypoint trajectory definition=========================%
h = 10; % 10m above the ground.
waypoints = [0 3 3 0 -3 -3 0;
1 1 3 3 3 1 1;
h h h h h h 10]';
timeOfArrival = [0 1 2 3 4 5 6] ;
traj = waypointTrajectory('Waypoints',waypoints,'TimeOfArrival',timeOfArrival);
% ploting the trajectory.
trajPlooter = trajectoryPlotter(tp,"DisplayName",'TargetTrack','Color','b','LineWidth',2);
plotTrajectory(trajPlooter,{waypoints})
% =============================5.Trajectory Assignment To Target=========================%
target.Trajectory = traj;
% =============================6. Checking the target path by simulating=========================%
% i = 1;
% while advance(scene)
% i
% time = scene.SimulationTime;
% poseTar = pose(target,'True');
% plotPlatform(targetPlotter,poseTar.Position)
% i = i + 1;
% pause(0.1)
% end
% =============================7. Tracker Implementation In The Simulation=========================%
% making track plotter object to plot track of tracker.
TrackPlot = trackPlotter(tp,"DisplayName",'Track From Tracker','MarkerFaceColor',[1 0 0],'ConnectHistory','off'...
,'HistoryDepth',10)
TrackPlotConectHist = trackPlotter(tp,'MarkerFaceColor',[1 0 0],'ConnectHistory','on')
% restart(scene)
i = 1;
while advance(scene)
time = scene.SimulationTime;
poseTarget = pose(target,'True');
plotPlatform(targetPlotter,poseTarget.Position);
% object detection formulation for the tracker.
detection = objectDetection(time,poseTarget.Position);
% tracker definition
tracker = trackerGNN("FilterInitializationFcn",'initcvekf',Assignment='Munkres',...
AssignmentClustering='off',AssignmentThreshold=[1e-14 2e-5],...
TrackLogic='History',ConfirmationThreshold=[1 3],DeletionThreshold=[3 3]);
% AssignmentClustering='on',AssignmentThreshold=[-6 0],...
% tracker taking the detections from the sensor/radar
[confirmedTracks,~,~] = tracker(detection,time)
% extracting estimated position and velocity from tracker output.
pause(0.4) % delay to visualize the tracking by tracker.
[pos,covar] = getTrackPositions(confirmedTracks,'constvel');
vel = getTrackVelocities(confirmedTracks,'constvel')
% ploting the estimated position by tracker.
% plotTrack(TrackPlot,pos,vel,covar,{'Target'},[1]) % with label argument.
plotTrack(TrackPlot,pos,vel,{'Target'},[1]) % with label argument.
plotTrack(TrackPlotConectHist,pos,vel,{'Target'},[1]) % with label argument.
% plotTrack(TrackPlot,pos,vel,covar,[1]) % with trackID argument.
% keyboard;
% i
i = i + 1;
% pause(0.1) % can pause if its too fast.
end
0 Comments
Answers (2)
Rishi
on 22 Jan 2024
Hi Sheikh Muhammad,
I understand from your query that you would like to know how assignment threshold works for trackers.
The concept of an assignment threshold in multi-target tracking algorithms is used to control the association of detections to tracks. The assignment threshold determines how detections are associated with existing tracks based on a cost metric.
In case of 'trackerGNN' tracker, the Assignment threshold is specified as a either a positive sacalar, or a 1-by-2 vector [C1, C2], where C1<=C2. If the value is specified as a scalar, the second element of the matrix will be taken as 'inf'.
Initially, the tracker executes a coarse estimation for the normalized distance between all the tracks and detections. The tracker only calculates the accurate normalized distance for the combinations whose coarse normalized distance is less than C2. Also, the tracker can only assign a detection to a track if their accurate normalized distance is less than C1.
tracker = trackerGNN("FilterInitializationFcn",'initcvekf',Assignment='Munkres',...
AssignmentClustering='off',AssignmentThreshold=[1e-14 2e-5],...
TrackLogic='History',ConfirmationThreshold=[1 3],DeletionThreshold=[3 3]);
In the code you have provided, the 'AssignmentThreshold' is set to [1e-14 2e-5]. This means that an accurate distance for a detection will only be calculated if the coarse estimation is below 1e-14, and it will only be assigned if its accurate estimation is below 2e-5.
You can learn more about 'Assignment Threshold' parameter of 'trackerGNN', 'trackerJPDA', and 'trackerTOMHT' from the following documentations:
Hope this helps!
Elad Kivelevitch
on 22 Jan 2024
Hello Sheikh Muhammad Hamayun,
To understand how assignment works, let us first start with why it is needed.
A multi-object tracking algorithm gets new sensor data (we call them 'detections') that the sensors provide after measuring the state of many objects. The tracking algorithm (also called a 'tracker') has to take the many detection and decide which estimated objects the tracker maintains (we call them 'tracks') could give rise to these detections. Thus, the tracker has to perform a step of assignment or association. The workings of a tracker are explained in this page:
The association of detections to tracks step usually takes a few sub-steps:
- Prediction: The tracker predicts the existing tracks it maintains to the time of each detection in the input.
- Cost: For each pair of detection and track, the tracker computes the distance, sometimes called assignment cost, or likelihood of the association. This is done by comparing the track's expected measuerment (based on the track state and measurement function) and the detection measurement, taking into account the uncertainty in both. A typical cost method used by our trackers is related to the negative log likelihood (NLL) of assignment, where y = z-h(x) is the innovation and S=(R+HPH') is the innovation covariance. The NLL cost is then y' * inv(S) * y + log(det(S)). The first part of the expression is the well-known Mahalonobis cost and the second part is a compensation term in case S is getting to large.
- Gating: In many cases, the tracker will limit the acceptable cost for association by a certain value. This is done to exclude highly unlikely associations from happening.
- Association: The tracker makes a decision about which detections can be assigned to which tracks.
The type of assignment or association algorithm used by the tracker often defines how the tracker works.
This document explains assignment methods: https://www.mathworks.com/help/fusion/ug/introduction-to-assignment-methods-in-tracking-systems.html
For a Global Nearest Neighbor (GNN) tracker, the tracker makes an optimization over all the possible assocations and missing associations. Each detection can be assigned to at most one track and each track can be assigned to at most one detection. Some detection may be unassigned and some tracks may be unassigned, depending on the gating.
For a Joint Probabilisitc Data Association (JPDA) tracker, the tracker computes the assignment likelihoods of each pair of detection and track. Then, it creates a matrix of possible associations, called events. Finally, the tracker computes the joint probability of all association events. Each track can be probabilistically associated with multiple detections, but the probabilities of all joint events cannot exceed 1. Similarly, each detection can be probabilistically association with multiple tracks, but the sum of all the probabilities cannot exceed 1.
For a TOMHT tracker, the tracker considers all the detections that fall within the association gate of each track. Every track then creates the following branches: The track was not assigned, the track was assigned to detection 1 in the gate, the track was assigned to detection 2 in the gate, etc. Additionally, each detection may be considered as unassigned to any tracker. For nearly perfect associations (small cost of association), the tracker may immediately discard the unassigned branch. Similarly, it may also discard the case of unassigned detections. Please see the link above more a more rigorous explanation.
In your code, I see two things that seem to be wrong:
- You construct the tracker in every run of the while loop. You should not do that, because the tracker needs to maintain a state of existing objects over time and should not be recreated.
- You use an AssignmentThreshold that seems to be very small. Typical values of AssignmentThreshold are in much larger, in the 10^1 or 10^3 range.
Good luck,
Elad
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!