pub struct Detectron2Model { /* private fields */ }
Expand description
A Detectron2
-based model.
Implementations§
Source§impl Detectron2Model
impl Detectron2Model
Sourcepub const REQUIRED_WIDTH: u32 = 800u32
pub const REQUIRED_WIDTH: u32 = 800u32
Required input image width.
Sourcepub const REQUIRED_HEIGHT: u32 = 1_035u32
pub const REQUIRED_HEIGHT: u32 = 1_035u32
Required input image height.
Sourcepub const DEFAULT_CONFIDENCE_THRESHOLD: f32 = 0.800000011f32
pub const DEFAULT_CONFIDENCE_THRESHOLD: f32 = 0.800000011f32
Default confidence threshold for detections.
Sourcepub fn pretrained(p_model: Detectron2PretrainedModels) -> Result<Self>
pub fn pretrained(p_model: Detectron2PretrainedModels) -> Result<Self>
Construct a Detectron2Model
with a pretrained model downloaded from Hugging Face.
Sourcepub fn configure_pretrained(
p_model: Detectron2PretrainedModels,
confidence_threshold: f32,
session_builder: SessionBuilder,
) -> Result<Self>
pub fn configure_pretrained( p_model: Detectron2PretrainedModels, confidence_threshold: f32, session_builder: SessionBuilder, ) -> Result<Self>
Construct a configured Detectron2Model
with a pretrained model downloaded from Hugging Face.
Sourcepub fn new_from_file(
file_path: &str,
model_name: &str,
label_map: &[(i64, &str)],
confidence_threshold: f32,
confidence_score_index: usize,
session_builder: SessionBuilder,
) -> Result<Self>
pub fn new_from_file( file_path: &str, model_name: &str, label_map: &[(i64, &str)], confidence_threshold: f32, confidence_score_index: usize, session_builder: SessionBuilder, ) -> Result<Self>
Construct a Detectron2Model
from a model file.
Sourcepub fn predict(&self, img: &DynamicImage) -> Result<Vec<LayoutElement>>
pub fn predict(&self, img: &DynamicImage) -> Result<Vec<LayoutElement>>
Predict LayoutElement
s from the image provided.
Auto Trait Implementations§
impl Freeze for Detectron2Model
impl !RefUnwindSafe for Detectron2Model
impl Send for Detectron2Model
impl Sync for Detectron2Model
impl Unpin for Detectron2Model
impl !UnwindSafe for Detectron2Model
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more