visloc_objects/lib.rs
1#![forbid(unsafe_code)]
2//! Image-space multi-object tracking: the first stage of metric object
3//! estimation from monocular VI-SLAM (`docs/object_metric_slam_plan.md`,
4//! Phase 1).
5//!
6//! [`ByteTracker`] links per-frame detections into tracks with stable IDs,
7//! the ByteTrack way: a box Kalman filter ([`BoxKalmanFilter`]), IoU costs,
8//! an optimal assignment ([`assign_with_cost_limit`]), and a second pass over
9//! the low-score detections that keeps partly occluded objects. It takes
10//! [`Detection`]s from any [`ObjectDetector`]: [`ReplayDetector`] replays
11//! stored boxes, and [`YoloxOnnxDetector`] runs a YOLOX model with ONNX
12//! Runtime (the `onnx-inference` feature; [`yolox`] has its pre- and
13//! post-processing). [`MotAccumulator`] scores tracks against ground truth
14//! with the CLEAR MOT metrics.
15//!
16//! With metric camera poses from the VIO, the tracks become metric objects
17//! (Phase 3): [`metric`] triangulates static objects and fits upright boxes,
18//! and [`ground`] puts objects that stand on the ground, moving or not, on
19//! it for their height, position and speed.
20//!
21//! ```
22//! use visloc_objects::{BBox, ByteTracker, Detection};
23//!
24//! let mut tracker = ByteTracker::default();
25//! for frame in 0..3 {
26//! let x = 100.0 + 5.0 * frame as f64;
27//! let detections = [Detection::new(BBox::from_xywh(x, 50.0, 40.0, 80.0), 0.9, 0)];
28//! let tracks = tracker.update(&detections);
29//! assert_eq!(tracks.len(), 1);
30//! assert_eq!(tracks[0].id.0, 1);
31//! }
32//! ```
33
34pub mod assignment;
35pub mod bbox;
36pub mod byte_track;
37pub mod detector;
38pub mod ground;
39pub mod image;
40pub mod kalman;
41pub mod metric;
42pub mod mot_eval;
43pub mod yolox;
44pub mod yolox_onnx;
45
46pub use assignment::{assign_with_cost_limit, Assignment};
47pub use bbox::{BBox, Detection};
48pub use byte_track::{ByteTrackConfig, ByteTracker, TrackId, TrackedObject};
49pub use detector::{ObjectDetector, ReplayDetector, ReplayExhausted};
50pub use ground::{
51 estimate_ground_height, place_on_ground, place_on_local_ground, plausible_height,
52 summarize_ground_track, BoxRays, GroundObservation, GroundParams, GroundTrack,
53 GroundTrackParams, GroundView, PathGround,
54};
55pub use image::{ImageSizeError, RgbImage};
56pub use kalman::{BoxKalmanFilter, BoxKalmanState};
57pub use metric::{
58 estimate_static_object, fit_upright_box, plausible_size, triangulate, BearingObservation,
59 BoxFitParams, ObjectEstimate, ScaleSource, TriangulationParams, UprightBox,
60};
61pub use mot_eval::{MotAccumulator, MotSummary};
62pub use yolox::{YoloxConfig, COCO_CLASSES, MOVABLE_COCO_CLASSES};
63pub use yolox_onnx::{YoloxOnnxDetector, YoloxOnnxError};