dgs.utils.track.Tracks¶
- class dgs.utils.track.Tracks(N: int, thresh: int | None = None, start_frame: int = 0)[source]¶
Multiple Track objects stored as a dictionary, where the Track is the value and the key is this tracks’ unique ID.
- __init__(N: int, thresh: int | None = None, start_frame: int = 0) None [source]¶
Methods
add
(tracks, new)Given tracks with existing Track-IDs update those and create new Tracks for States without Track-IDs.
add_empty_tracks
([n])Given a Track, compute the next track-ID, and save this track in data using this ID.
clear
()copy
()Return a (deep) copy of this object.
fromkeys
(iterable[, value])get
(k[,d])Get the last state of every active track in this object as a
State
.Get the last state of every track in this object as a
State
.is_active
(tid)Return whether the given Track-ID is active.
is_inactive
(tid)Return whether the given Track-ID is inactive.
is_removed
(tid)Return whether the given Track-ID has been removed.
items
()keys
()pop
(k[,d])If key is not found, d is returned if given, otherwise KeyError is raised.
popitem
()as a 2-tuple; but raise KeyError if D is empty.
reactivate_track
(tid)Given the track-ID of a previously removed track, reactivate it.
remove_tid
(tid)Given a Track-ID, remove the track associated with it from this object.
remove_tids
(tids)reset
()Reset this object.
Fully remove the deleted Tracks.
setdefault
(k[,d])to
(*args, **kwargs)Create function similar to
torch.Tensor.to()
.update
([E, ]**F)If E present and has a .keys() method, does: for k in E: D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v
values
()Attributes
Get the age of all the tracks (in frames).
Get all the track-IDs in this object.
Get all the track-IDs currently active.
Get all the track-IDs currently inactive.
Get all the track-IDs that have been deleted.
Get the number of active Tracks.
Get the number of inactive Tracks.
Get the number of Tracks that have been removed.
All the Tracks that are currently tracked, including inactive Tracks as mapping 'Track-ID -> Track'.
All the inactive Tracks as 'Track-ID -> number of inactive frames / steps'.
The number of steps a Track can be inactive before deleting it.
All the Tracks that have been removed, to be able to reactivate them.