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_active_states()

Get the last state of every active track in this object as a State.

get_states()

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.

reset_deleted()

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

N

age

ages

Get the age of all the tracks (in frames).

ids

Get all the track-IDs in this object.

ids_active

Get all the track-IDs currently active.

ids_inactive

Get all the track-IDs currently inactive.

ids_removed

Get all the track-IDs that have been deleted.

nof_active

Get the number of active Tracks.

nof_inactive

Get the number of inactive Tracks.

nof_removed

Get the number of Tracks that have been removed.

data

All the Tracks that are currently tracked, including inactive Tracks as mapping 'Track-ID -> Track'.

inactive

All the inactive Tracks as 'Track-ID -> number of inactive frames / steps'.

inactivity_threshold

The number of steps a Track can be inactive before deleting it.

removed

All the Tracks that have been removed, to be able to reactivate them.