Low-level API
Auto-generated reference for the building blocks used by the high-level facade. Use these when you want to compose the detector, ReID runtime, and trackers explicitly.
Detector
Public detector wrapper with overrideable stage hooks and source streaming.
Source code in boxmot/detectors/detector.py
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 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 345 346 347 348 349 350 351 352 353 | |
add_callback(event, func)
predict(source, **kwargs)
predict_cli(source, **kwargs)
Consume streaming inference without accumulating outputs in memory.
run_callbacks(event)
setup_source(source, batch=None, vid_stride=None)
Prepare a batched source iterator for predictor-style inference.
Source code in boxmot/detectors/detector.py
stream_inference(source, **kwargs)
Stream detector outputs over any supported BoxMOT source.
Source code in boxmot/detectors/detector.py
warmup()
Warm up the detector backend with a dummy frame once.
Source code in boxmot/detectors/detector.py
Structured detections
One image's detections in the canonical BoxMOT schema.
Axis-aligned rows have shape (N, 6) and contain
[x1, y1, x2, y2, confidence, class]. Oriented rows have shape
(N, 7) and contain [cx, cy, width, height, angle, confidence, class].
Angles are expressed in radians.
Source code in boxmot/detectors/base.py
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 | |
boxes
property
Return native box geometry: xyxy for AABB or xywha for OBB.
schema
property
Canonical schema represented by these detections, including empties.
xyxy
property
Return axis-aligned boxes, enclosing each oriented box when needed.
empty(orig_img, *, is_obb=False, path='', names=None)
classmethod
Build an empty result while preserving its AABB or OBB schema.
Source code in boxmot/detectors/base.py
ReID
Unified ReID runtime that also exposes overrideable public stage hooks.
Source code in boxmot/reid/core/runtime.py
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 | |
from_backend(backend)
classmethod
Build a ReID runtime around an already-instantiated backend.
Source code in boxmot/reid/core/runtime.py
postprocess(features, **kwargs)
Move features to numpy and L2-normalize them.
Source code in boxmot/reid/core/runtime.py
preprocess(inputs, boxes=None, **kwargs)
Build the model-ready input batch (cropping + standardization).
Source code in boxmot/reid/core/runtime.py
process(payload, **kwargs)
Run the ReID model forward pass.
Source code in boxmot/reid/core/runtime.py
Tracker factory
Creates and returns an instance of the specified tracker type.
Parameters:
- tracker_type: The type of the tracker (e.g., 'strongsort', 'ocsort').
- tracker_config: Path to the tracker configuration file.
- reid_weights: Weights for ReID (re-identification). Used to build a ReID backend
when reid_model is not supplied.
- device: Device to run the ReID backend on (only used when building from reid_weights).
- half: Whether to use half-precision for the ReID backend (only used when building from reid_weights).
- per_class: Boolean for class-specific tracking (optional).
- class_ids: Optional detector class IDs allowed by this tracker.
- class_names: Optional detector class names keyed by detector class ID.
- evolve_param_dict: A dictionary of parameters for evolving the tracker.
- tracker_kwargs: Constructor overrides applied after default YAML config resolution.
- reid_preprocess: Preprocessing method for the ReID backend (only used when building from reid_weights).
- reid_model: Pre-built ReID backend (e.g., ReID(...).model). Takes
precedence over reid_weights and lets callers share a single backend across trackers.
- tracker_backend: Backend to use for the tracker. "python" (default)
uses the pure-Python implementation under boxmot.trackers. "cpp"
delegates to the registered native (C++) live backend via
:func:boxmot.native.registry.get_native_live_backend. The native
backend is built on demand if it isn't already compiled.
- precomputed_reid: Whether appearance embeddings will be supplied by the
caller. When enabled, ReID-capable trackers keep appearance matching
active without constructing a live ReID backend from reid_weights.
- warmup_model: Whether to warm a tracker-owned ReID backend after construction.
Disable this when the caller already warmed a backend shared by multiple trackers.
Returns: - An instance of the selected tracker.
- ValueError: If
tracker_typeis not recognized or the requestedtracker_backendis not available for that tracker.
Source code in boxmot/trackers/registry.py
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 | |
Structured tracker output
Bases: ndarray
Thin zero-copy view over the (N, 8) or (N, 9) tracker output array.
Provides named property accessors and export methods. Complete row slices preserve this type and aligned masks; transformations that change the row contract deliberately return plain NumPy arrays.
AABB columns (8): x1, y1, x2, y2, id, conf, cls, det_ind OBB columns (9): cx, cy, w, h, angle, id, conf, cls, det_ind
Source code in boxmot/trackers/results.py
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 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 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 | |
boxes
property
Return native geometry: xyxy for AABB or xywha for OBB.
cls
property
Integer class IDs.
conf
property
Detection confidence scores.
det_ind
property
Detection indices mapping tracks back to input detections (-1 if unmatched).
id
property
Integer track IDs.
is_obb
property
Whether the results contain oriented bounding boxes.
masks
property
Segmentation masks for tracked objects, shape (M, H, W) or None.
schema
property
Canonical schema carried by this result, including empty results.
xywh
property
Bounding boxes as (x_center, y_center, width, height).
xywha
property
Oriented boxes as (cx, cy, w, h, angle). OBB mode only.
xyxy
property
Return AABBs, enclosing each oriented track when in OBB mode.
__array_function__(func, types, args, kwargs)
Keep arbitrary NumPy transformations outside the typed row wrapper.
__array_ufunc__(ufunc, method, *inputs, **kwargs)
Return plain arrays for computations that do not preserve track semantics.
Source code in boxmot/trackers/results.py
__getitem__(key)
Slice optional masks with the same row selection as track rows.
Source code in boxmot/trackers/results.py
reshape(*shape, **kwargs)
save_csv(path, frame_id=None, header=True)
Append track results to a CSV file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
File path to write/append to. |
required |
frame_id
|
int | None
|
Optional frame number to include as the first column. |
None
|
header
|
bool
|
Write header row if the file doesn't exist yet. |
True
|
Source code in boxmot/trackers/results.py
save_mot(path, frame_id=0)
Append track results in canonical MOT or corner-based MMOT format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
str | Path
|
File path to append to. |
required |
frame_id
|
int
|
Frame index to serialize. |
0
|
Source code in boxmot/trackers/results.py
summary()
Convert track results to a list of dictionaries.
Returns:
| Type | Description |
|---|---|
list[dict[str, Any]]
|
list[dict]: One dict per track with keys: id, conf, cls, and either 'box' with x1/y1/x2/y2 (AABB) or cx/cy/w/h/angle (OBB). |
Source code in boxmot/trackers/results.py
to_csv(frame_id=None)
Convert track results to CSV-formatted string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
frame_id
|
int | None
|
Optional frame number to include as the first column. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
CSV string with one row per track. |
Source code in boxmot/trackers/results.py
to_json(indent=None)
Convert track results to a JSON string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
indent
|
int | None
|
JSON indentation level. None for compact output. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
JSON-encoded string of the track summaries. |