#[cfg(feature = "layout-detection")]
pub mod pp_doclayout_v3;
pub mod rtdetr;
#[cfg(all(feature = "layout-detection", feature = "pdf"))]
pub mod slanet;
#[cfg(feature = "pdf")]
pub mod table_classifier;
#[cfg(all(feature = "layout-detection", feature = "pdf"))]
pub mod tatr;
#[cfg(feature = "layout-detection")]
pub mod yolo;
use image::RgbImage;
use crate::layout::error::LayoutError;
use crate::layout::types::LayoutDetection;
#[cfg_attr(alef, alef(skip))]
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;
}