pub mod rtdetr;
pub mod tatr;
pub mod yolo;
use image::RgbImage;
use crate::layout::error::LayoutError;
use crate::layout::types::LayoutDetection;
pub trait LayoutModel: Send {
fn detect(&mut self, img: &RgbImage) -> Result<Vec<LayoutDetection>, LayoutError>;
fn detect_with_threshold(&mut self, img: &RgbImage, threshold: f32) -> Result<Vec<LayoutDetection>, LayoutError>;
fn detect_batch(
&mut self,
images: &[&RgbImage],
threshold: Option<f32>,
) -> Result<Vec<Vec<LayoutDetection>>, LayoutError> {
images
.iter()
.map(|img| match threshold {
Some(t) => self.detect_with_threshold(img, t),
None => self.detect(img),
})
.collect()
}
fn name(&self) -> &str;
}