params
sleap_nn.tracking.mot.params
¶
Resolved parameters and presets for the modern MOT trackers.
Every tracker in :mod:sleap_nn.tracking.mot is driven by one frozen
:class:MOTParams. :meth:MOTParams.for_tracker starts from a per-tracker
preset and applies user overrides on top:
"paper": the constants published with each algorithm (and its reference implementation), adapted only where pose/mask geometry forces it (see the module docs of each tracker). Use it to compare against the literature."animal"(default): sleap-nn's defaults for animal pose/mask tracking. They start from"paper"and change what does not transfer to SLEAP data: SLEAP detection scores (mean point confidences) sit well below a pedestrian detector's (so scores are normalized per video,normalize_scores), the reference re-ID thresholds assume a person re-ID embedder, per-track appearance is better smoothed with a shorter EMA memory, and the pedestrianxyahKalman filter (a slowly varying aspect ratio) cannot follow a turning animal, so DeepSORT, StrongSORT and ByteTrack usexywh.
All user-facing thresholds are SIMILARITIES in [0, 1] (higher is stricter),
whatever the geometric similarity in use (iou, oks or centroid); each
tracker converts them to the costs its algorithm minimizes.
Classes:
| Name | Description |
|---|---|
MOTParams |
Resolved parameters for one MOT tracker run. |
Functions:
| Name | Description |
|---|---|
parse_mot_param |
Parse one |
MOTParams
¶
Resolved parameters for one MOT tracker run.
Attributes:
| Name | Type | Description |
|---|---|---|
tracker |
str
|
Tracker name, one of :data: |
preset |
str
|
Preset the defaults came from ( |
similarity |
str
|
Geometric similarity between a track's prediction and a
detection: |
body_size |
Optional[float]
|
Animal size in px (box diagonal), or |
oks_stddev |
float
|
OKS per-node standard deviation for |
box_padding |
float
|
Padding added to each side of a keypoint/mask box, as a
fraction of |
score_mode |
str
|
Detection confidence: |
normalize_scores |
bool
|
Divide every detection score by the video's
95th-percentile score ( |
kalman |
str
|
Kalman filter state parameterization; |
time_base |
str
|
How time advances between processed frames: |
track_buffer |
int
|
Steps a lost track is kept alive for re-association
( |
min_hits |
int
|
Matches required before a track is confirmed ( |
track_high_threshold |
float
|
Detections with a score above this are
high-confidence (ByteTrack's |
track_low_threshold |
float
|
Detections with a score at or below this are ignored. |
new_track_threshold |
float
|
Minimum score for an unmatched detection to start a track. |
min_match_similarity |
float
|
Minimum geometric similarity for a first-stage
match (cost cap |
low_stage_min_similarity |
float
|
ByteTrack/BoT-SORT second (low-score) stage. |
unconfirmed_min_similarity |
float
|
ByteTrack/BoT-SORT unconfirmed-track stage. |
duplicate_similarity |
float
|
ByteTrack/BoT-SORT tracked-vs-lost duplicate removal. |
fuse_score |
bool
|
Multiply the geometric similarity by the detection score
(ByteTrack |
appearance_threshold |
Union[float, str]
|
Minimum cosine similarity for appearance to support
a match, or |
proximity_threshold |
float
|
BoT-SORT: minimum geometric similarity for the appearance term to apply at all. |
ema_alpha |
float
|
Appearance EMA momentum (weight on the old feature). |
adaptive_ema |
bool
|
Deep OC-SORT score-adaptive EMA. |
gallery_size |
int
|
Per-track gallery of recent confident vectors. |
gallery_budget |
int
|
DeepSORT gallery budget ( |
mc_lambda |
float
|
StrongSORT motion-cost weight on appearance ( |
nsa |
bool
|
StrongSORT NSA Kalman (measurement noise scaled by detection score). |
delta_t |
int
|
OC-SORT observation lookback (steps) for velocity direction. |
inertia |
float
|
OC-SORT weight of the observation-centric momentum term. |
use_byte |
bool
|
OC-SORT optional BYTE second stage. |
w_assoc_emb |
float
|
Deep OC-SORT base appearance weight. |
aw_param |
float
|
Deep OC-SORT adaptive-weighting cap. |
aw_off |
bool
|
Disable Deep OC-SORT adaptive weighting (constant |
rescue |
bool
|
Deep OC-SORT: accept a weak-geometry match when appearance is decisive (BoostTrack rule). |
rescue_min_similarity |
float
|
Minimum geometric similarity for a rescue. |
link_tracklets |
bool
|
Run identity linking (long-term memory) at the end of each video. |
max_tracks |
Optional[int]
|
Known number of animals; closed-set identity linking. |
link_swap_correction |
bool
|
Correct identity swaps at crossings during linking. |
link_spatial_gate_frames |
int
|
Gap (steps) above which linking applies no spatial gate (long absences can end anywhere). |
Methods:
| Name | Description |
|---|---|
__attrs_post_init__ |
Validate cross-field constraints. |
as_dict |
Return the parameters as a JSON-serializable dict. |
field_names |
Names of every overridable field. |
for_tracker |
Resolve a tracker's preset and apply user overrides. |
Source code in sleap_nn/tracking/mot/params.py
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 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 | |
link
property
¶
Whether identity linking runs at the end of each video.
Linking runs when requested explicitly, and always when the animal count
is known: max_tracks is enforced by closed-set linking, never by
refusing to start tracks online.
__attrs_post_init__()
¶
Validate cross-field constraints.
Source code in sleap_nn/tracking/mot/params.py
as_dict()
¶
field_names()
classmethod
¶
for_tracker(tracker, preset='animal', **overrides)
classmethod
¶
Resolve a tracker's preset and apply user overrides.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tracker
|
str
|
One of :data: |
required |
preset
|
str
|
|
'animal'
|
**overrides
|
Any
|
Field values that replace the preset's. |
{}
|
Returns:
| Type | Description |
|---|---|
MOTParams
|
The resolved, validated :class: |
Raises:
| Type | Description |
|---|---|
ValueError
|
Unknown tracker, preset or override key, or an invalid value. |
Source code in sleap_nn/tracking/mot/params.py
parse_mot_param(text)
¶
Parse one KEY=VALUE override for :class:MOTParams.
The value is coerced to the field's type: true/false for booleans,
none for optional fields (max_tracks, body_size), auto or a
number for appearance_threshold, int/float/str otherwise. preset is
accepted too.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
|
required |
Returns:
| Type | Description |
|---|---|
tuple
|
|
Raises:
| Type | Description |
|---|---|
ValueError
|
Malformed text, unknown key, or a value of the wrong type. |