inference/
lib.rs

1pub mod factory;
2pub mod plugin;
3
4#[cfg(feature = "backend-wgpu")]
5pub type InferenceBackend = burn_wgpu::Wgpu<f32>;
6#[cfg(not(feature = "backend-wgpu"))]
7pub type InferenceBackend = burn_ndarray::NdArray<f32>;
8
9#[cfg(feature = "bigdet")]
10pub type InferenceModel<B> = models::BigDet<B>;
11#[cfg(feature = "bigdet")]
12pub type InferenceModelConfig = models::BigDetConfig;
13#[cfg(not(feature = "bigdet"))]
14pub type InferenceModel<B> = models::TinyDet<B>;
15#[cfg(not(feature = "bigdet"))]
16pub type InferenceModelConfig = models::TinyDetConfig;
17
18pub use factory::{InferenceFactory, InferenceThresholds};
19pub use plugin::InferencePlugin;
20
21pub mod prelude {
22    pub use crate::factory::{InferenceFactory, InferenceThresholds};
23    pub use crate::plugin::{InferencePlugin, InferenceState};
24    pub use crate::{InferenceBackend, InferenceModel, InferenceModelConfig};
25}
26
27#[cfg(test)]
28mod tests {
29    use super::*;
30    #[test]
31    fn inference_factory_falls_back_without_weights() {
32        let factory = InferenceFactory;
33        let mut detector = factory.build(InferenceThresholds::default(), None);
34        // Should not panic and should produce a detector.
35        assert!(
36            detector
37                .detect(&vision_core::interfaces::Frame {
38                    id: 0,
39                    timestamp: 0.0,
40                    rgba: None,
41                    size: (1, 1),
42                    path: None,
43                })
44                .frame_id
45                == 0
46        );
47    }
48}