changing TrackLogicState manually while running the tracker and making the tracker use manually changed values

3 次查看(过去 30 天)
Hello. I am trying trackerGNN in SORT (simple online real-time tracking) example in MATLAB. I want to change the values of TrackLogicState manually while running the tracker and make the tracker use changed values in the next time steps. (because I want to have an adaptive track deletion condition) Is there any way to do that? Thanks for your time and consideration.

回答(1 个)

Namnendra
Namnendra 2024-10-17
Hi,
To manually change the `TrackLogicState` values in a `trackerGNN` object while running a SORT example in MATLAB, you will need to manipulate the internal states of the tracker. This is not straightforward, as MATLAB's tracking framework is designed to manage these states automatically. However, you can achieve this by accessing and modifying the properties of the tracks directly. Here's a general approach to how you might implement this:
Steps to Modify `TrackLogicState` Manually:
1. Initialize the Tracker:
- Set up your `trackerGNN` object with the desired parameters.
2. Run the Tracker in a Loop:
- Use a loop to process each time step, providing detections to the tracker.
3. Access and Modify Track States:
- After each tracking update, access the tracks and modify their `TrackLogicState` as needed.
4. Reapply Modified States:
- Ensure the tracker uses the modified logic states in subsequent updates.
Example Code:
% Initialize trackerGNN
tracker = trackerGNN('FilterInitializationFcn', @initKalmanFilter, 'AssignmentThreshold', 30);
% Example detections (replace with your data)
detections = {...}; % Cell array of detections per time step
for t = 1:length(detections)
% Update tracker with current detections
confirmedTracks = tracker(detections{t}, t);
% Access and modify TrackLogicState
for i = 1:numel(confirmedTracks)
track = confirmedTracks(i);
% Example: Modify TrackLogicState based on custom logic
if shouldModifyLogic(track) % Define your custom condition
% Access and modify TrackLogicState
track.TrackLogicState = customLogicState(track);
end
end
% (Optional) Reapply modified states to the tracker if necessary
% This might involve directly manipulating the tracker's internal state
end
function state = customLogicState(track)
% Define how you want to modify the TrackLogicState
state = {...}; % Your custom logic
end
function modify = shouldModifyLogic(track)
% Define the condition under which you want to modify the logic state
modify = {...}; % Your condition
end
function filter = initKalmanFilter(detection)
% Initialize a Kalman filter for the tracker
% Define the state transition and measurement models
filter = trackingKF('MotionModel', 'ConstantVelocity', ...
'State', detection.Measurement, ...
'MeasurementModel', eye(2));
end
Important Considerations:
- Direct Access: Directly modifying internal states like `TrackLogicState` might require accessing undocumented properties or methods, which can be risky and may lead to unexpected behavior if not handled properly.
- Custom Logic: Ensure your custom logic for modifying `TrackLogicState` is well-defined and consistent with the overall tracking framework.
- MATLAB Version: The specific properties and methods available can vary between MATLAB versions, so refer to the documentation for your version.
- Testing: Thoroughly test your implementation to ensure that modifications to the track logic do not introduce errors or degrade tracking performance.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by