pub struct LicensePlateRecognizer {
pub config: PlateConfig,
pub model_name: String,
/* private fields */
}Expand description
Inference class for license-plate OCR using tract-onnx.
Fields§
§config: PlateConfigPlate configuration (image size, alphabet, etc.).
model_name: StringHuman-readable model name.
Implementations§
Source§impl LicensePlateRecognizer
impl LicensePlateRecognizer
Sourcepub fn from_files(
onnx_model_path: impl AsRef<Path>,
plate_config_path: impl AsRef<Path>,
) -> Result<Self>
pub fn from_files( onnx_model_path: impl AsRef<Path>, plate_config_path: impl AsRef<Path>, ) -> Result<Self>
Build a recognizer from an existing ONNX model file and config file.
Sourcepub fn from_hub(model: OcrModel, force_download: bool) -> Result<Self>
pub fn from_hub(model: OcrModel, force_download: bool) -> Result<Self>
Download (if necessary) and load a model from the hub.
Sourcepub fn from_hub_to_dir(
model: OcrModel,
save_dir: &Path,
force_download: bool,
) -> Result<Self>
pub fn from_hub_to_dir( model: OcrModel, save_dir: &Path, force_download: bool, ) -> Result<Self>
Download (if necessary) and load a model from the hub, saving to a specific directory.
Sourcepub fn run(
&self,
inputs: &[PlateInput<'_>],
return_confidence: bool,
remove_pad_char: bool,
) -> Result<Vec<PlatePrediction>>
pub fn run( &self, inputs: &[PlateInput<'_>], return_confidence: bool, remove_pad_char: bool, ) -> Result<Vec<PlatePrediction>>
Run plate recognition on one or more plate images.
inputs is a slice of PlateInput (paths or pre-loaded images).
Returns one PlatePrediction per input.
Sourcepub fn run_one(
&self,
input: PlateInput<'_>,
return_confidence: bool,
remove_pad_char: bool,
) -> Result<PlatePrediction>
pub fn run_one( &self, input: PlateInput<'_>, return_confidence: bool, remove_pad_char: bool, ) -> Result<PlatePrediction>
Convenience wrapper for a single image.
Sourcepub fn benchmark(
&self,
n_iter: usize,
batch_size: usize,
warmup: usize,
include_processing: bool,
) -> Result<()>
pub fn benchmark( &self, n_iter: usize, batch_size: usize, warmup: usize, include_processing: bool, ) -> Result<()>
Run a simple throughput benchmark and print the results to stdout.
n_iter– number of timed iterationsbatch_size– images per “batch” (each is run individually due to tract’s fixed shape)warmup– number of warm-up iterations (not counted)include_processing– iftrue, preprocessing / postprocessing are included in the timing.
Auto Trait Implementations§
impl Freeze for LicensePlateRecognizer
impl !RefUnwindSafe for LicensePlateRecognizer
impl Send for LicensePlateRecognizer
impl Sync for LicensePlateRecognizer
impl Unpin for LicensePlateRecognizer
impl UnsafeUnpin for LicensePlateRecognizer
impl !UnwindSafe for LicensePlateRecognizer
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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