Replies: 2 comments 1 reply
-
You can iterate through tracker output objects.
Another approach is to create a YAML file with the writer.
https://stonesoup.readthedocs.io/en/v1.4/stonesoup.writer.html#module-stonesoup.writer.yaml
…On Sun, Aug 25, 2024 at 4:20 PM bkev13 ***@***.***> wrote:
Hi, How can I get the content of the tracks set (for instance how many
tracks got initiated, and deleted in total, what/how many measurements
belong to each selected track)? My tracker plot is the same as Tutorial
#10 <#10> from the
documentation. This is my tracker and it works great.
from stonesoup.tracker.simple import MultiTargetMixtureTracker
tracker = MultiTargetMixtureTracker(
initiator=initiator,
deleter=deleter,
detector=detector,
data_associator=data_associator,
updater=updater,
)
detections = set()
tracks = set()
for time, ctracks in tqdm.tqdm(tracker, desc="Tracking...", unit="step",
total=total):
detections.update(detector.detections)
tracks.update(ctracks)
print(f"Number of detections: {len(detections)}")
print(f"Number of tracks: {len(tracks)}")
print(f'tracks: {tracks}')
If I try to print tracks, I get this error message:
Fatal Python error: Cannot recover from stack overflow.
Python runtime state: initialized
—
Reply to this email directly, view it on GitHub
<#1076>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAK5KTM4R7WYWNWT75CYEZTZTI4BNAVCNFSM6AAAAABNC2N6KGVHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZXGA4TINBRGI>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
bkev13
-
Hi, you can control track length with deleters, the composite deleter can
combine length, duration and interval.
https://stonesoup.readthedocs.io/en/v0.1b5/stonesoup.deleter.html
…On Mon, Aug 26, 2024 at 7:51 AM bkev13 ***@***.***> wrote:
@apiszcz <https://github.com/apiszcz> , thank you for your suggestion. I
am attempting the iteration approach and this is what I have so far:
Variables to store track information
detections = set()
tracks = set()
track_details = {}
track_initiation_times = {}
track_deletion_times = {}
for time, ctracks in tqdm.tqdm(tracker, desc="Tracking...", unit="step",
total=total):
detections.update(detector.detections)
tracks.update(ctracks)
for track in ctracks:
track_id = track.id
# Record the track details including associated measurements
if track_id not in track_details:
track_details[track_id] = {
'measurements': [],
'initiated_at': time,
'deleted_at': None
}
track_initiation_times[track_id] = time
# Directly access the measurement from the hypothesis
if track.hypothesis and track.hypothesis.measurement:
track_details[track_id]['measurements'].append(track.hypothesis.measurement)
# Check for deleted tracks
for track in list(tracks): # Convert to list to allow safe removal during iteration
if track not in ctracks:
if track_details[track.id]['deleted_at'] is None:
track_details[track.id]['deleted_at'] = time
track_deletion_times[track.id] = time
tracks.remove(track)
Calculate the lifespan and final status of each track
for track_id, details in track_details.items():
initiated_at = details['initiated_at']
deleted_at = details['deleted_at'] or time # Use final time if still active
lifespan = deleted_at - initiated_at
# Add lifespan and final status to details
track_details[track_id]['lifespan'] = lifespan
track_details[track_id]['final_status'] = 'deleted' if details['deleted_at'] else 'active'
—
Reply to this email directly, view it on GitHub
<#1076 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAK5KTKHI4A53ZNFCDVJWADZTMJETAVCNFSM6AAAAABNC2N6KGVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTANBVGA4DSNQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, How can I get the content of the tracks set (for instance how many tracks got initiated, and deleted in total, what/how many measurements belong to each selected track)? My tracker plot is the same as Tutorial #10 from the documentation. This is my tracker and it works great.
from stonesoup.tracker.simple import MultiTargetMixtureTracker
tracker = MultiTargetMixtureTracker(
initiator=initiator,
deleter=deleter,
detector=detector,
data_associator=data_associator,
updater=updater,
)
detections = set()
tracks = set()
for time, ctracks in tqdm.tqdm(tracker, desc="Tracking...", unit="step", total=total):
detections.update(detector.detections)
tracks.update(ctracks)
print(f"Number of detections: {len(detections)}")
print(f"Number of tracks: {len(tracks)}")
print(f'tracks: {tracks}')
If I try to print tracks, I get this error message:
Fatal Python error: Cannot recover from stack overflow.
Python runtime state: initialized
Beta Was this translation helpful? Give feedback.
All reactions