pub struct ImagePreprocessor { /* private fields */ }Available on crate feature
image-models only.Expand description
A model-specific image preprocessor that can be shared with CPU worker threads.
The returned arrays are ready to pass to ImageEmbedding::embed_preprocessed.
Implementations§
Source§impl ImagePreprocessor
impl ImagePreprocessor
Sourcepub fn preprocess(&self, image: DynamicImage) -> Result<Array3<f32>>
pub fn preprocess(&self, image: DynamicImage) -> Result<Array3<f32>>
Resize, crop, rescale, and normalize an image according to this model’s configuration.
Sourcepub fn with_resize<F>(self, resize: F) -> Self
pub fn with_resize<F>(self, resize: F) -> Self
Use a custom image resize implementation while retaining the model-specific geometry, cropping, rescaling, and normalization stages.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ImagePreprocessor
impl !UnwindSafe for ImagePreprocessor
impl Forget for ImagePreprocessor
impl Freeze for ImagePreprocessor
impl Move for ImagePreprocessor
impl Send for ImagePreprocessor
impl Sync for ImagePreprocessor
impl Unpin for ImagePreprocessor
impl UnsafeUnpin for ImagePreprocessor
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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