local_queues
sleap_nn.tracking.candidates.local_queues
¶
Module to generate Tracking local queue candidates.
Classes:
| Name | Description |
|---|---|
LocalQueueCandidates |
Track local queues method for candidate generation. |
LocalQueueCandidates
¶
Track local queues method for candidate generation.
This module handles tracker_queue using the local queues method, where track assignments
are determined based on the last window_size instances for each track.
Attributes:
| Name | Type | Description |
|---|---|---|
window_size |
Number of previous frames to compare the current predicted instance with. Default: 5. |
|
max_tracks |
Maximum number of new tracks that can be created. Default: None. |
|
min_new_track_points |
We won't spawn a new track for an instance with fewer than this many points. Default: 0. |
|
tracker_queue |
Dictionary that stores the past frames of all the tracks identified
so far as |
|
current_tracks |
List of track IDs that are being tracked. |
Methods:
| Name | Description |
|---|---|
__init__ |
Initialize class variables. |
add_new_tracks |
Add new track IDs to the |
available_new_tracks |
Fresh track IDs still mintable under |
get_features_from_track_id |
Return list of |
get_instances_groupby_frame_idx |
Return dictionary with list of |
get_new_track_id |
Return a new track_id. |
get_track_instances |
Return a list of |
update_tracks |
Assign tracks to |
Source code in sleap_nn/tracking/candidates/local_queues.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | |
__init__(window_size=5, max_tracks=None, min_new_track_points=0)
¶
Initialize class variables.
Source code in sleap_nn/tracking/candidates/local_queues.py
add_new_tracks(current_instances)
¶
Add new track IDs to the TrackInstanceLocalQueue objects and to the tracker queue.
Source code in sleap_nn/tracking/candidates/local_queues.py
available_new_tracks()
¶
Fresh track IDs still mintable under max_tracks, or None if uncapped.
Mirrors get_new_track_id's cap arithmetic (the next ID is
max(current_tracks) + 1, refused once it reaches max_tracks) WITHOUT
mutating the queue. Read by Tracker.assign_tracks: an infeasible pairing
is only safe to drop if the detection can spawn a fresh track instead, and
at the cap get_new_track_id returns None -> update_tracks filters
the detection out entirely. With no headroom the forced match is kept.
Source code in sleap_nn/tracking/candidates/local_queues.py
get_features_from_track_id(track_id, candidates_list=None)
¶
Return list of TrackedInstanceFeature objects for instances in tracker queue with the given track_id.
If candidates_list is None, then features of all the instances in the
tracker queue are returned by default. Else, only the features from the given candidates_list are returned.
Source code in sleap_nn/tracking/candidates/local_queues.py
get_instances_groupby_frame_idx(candidates_list)
¶
Return dictionary with list of TrackInstanceLocalQueue objects grouped by frame index.
Source code in sleap_nn/tracking/candidates/local_queues.py
get_new_track_id()
¶
Return a new track_id.
Source code in sleap_nn/tracking/candidates/local_queues.py
get_track_instances(feature_list, untracked_instances, frame_idx, image)
¶
Return a list of TrackInstanceLocalQueue instances for the untracked_instances.
Source code in sleap_nn/tracking/candidates/local_queues.py
update_tracks(current_instances, row_inds, col_inds, tracking_scores)
¶
Assign tracks to TrackInstanceLocalQueue objects based on the output of track matching algorithm.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
current_instances
|
List[TrackInstanceLocalQueue]
|
List of TrackInstanceLocalQueue objects with features and unassigned tracks. |
required |
row_inds
|
array
|
List of indices for the |
required |
col_inds
|
array
|
List of track IDs that have been assigned a new instance. |
required |
tracking_scores
|
List[float]
|
List of tracking scores from the cost matrix. |
required |