pub struct ImageEmbedding { /* private fields */ }image-models only.Implementations§
Source§impl ImageEmbedding
impl ImageEmbedding
Sourcepub fn try_new(options: ImageInitOptions) -> Result<Self>
Available on crate feature hf-hub only.
pub fn try_new(options: ImageInitOptions) -> Result<Self>
hf-hub only.Try to generate a new ImageEmbedding Instance
Uses the highest level of Graph optimization
Uses the total number of CPUs available as the number of intra-threads
Sourcepub fn try_new_from_user_defined(
model: UserDefinedImageEmbeddingModel,
options: ImageInitOptionsUserDefined,
) -> Result<Self>
pub fn try_new_from_user_defined( model: UserDefinedImageEmbeddingModel, options: ImageInitOptionsUserDefined, ) -> Result<Self>
Create a ImageEmbedding instance from model files provided by the user.
This can be used for ‘bring your own’ embedding models
Sourcepub fn list_supported_models() -> Vec<ModelInfo<ImageEmbeddingModel>>
pub fn list_supported_models() -> Vec<ModelInfo<ImageEmbeddingModel>>
Retrieve a list of supported models
Sourcepub fn get_model_info(
model: &ImageEmbeddingModel,
) -> ModelInfo<ImageEmbeddingModel>
pub fn get_model_info( model: &ImageEmbeddingModel, ) -> ModelInfo<ImageEmbeddingModel>
Get ModelInfo from ImageEmbeddingModel
Sourcepub fn preprocessor(&self) -> ImagePreprocessor
pub fn preprocessor(&self) -> ImagePreprocessor
Return a cloneable CPU preprocessor configured for this image model.
Use it to preprocess images on worker threads, then pass the resulting arrays to
Self::embed_preprocessed.
Sourcepub fn embed_bytes(
&mut self,
images: &[&[u8]],
batch_size: Option<usize>,
) -> Result<Vec<Embedding>>
pub fn embed_bytes( &mut self, images: &[&[u8]], batch_size: Option<usize>, ) -> Result<Vec<Embedding>>
Method to generate image embeddings for a Vec of image bytes
Sourcepub fn embed<S: AsRef<Path> + Send + Sync>(
&mut self,
images: impl AsRef<[S]>,
batch_size: Option<usize>,
) -> Result<Vec<Embedding>>
pub fn embed<S: AsRef<Path> + Send + Sync>( &mut self, images: impl AsRef<[S]>, batch_size: Option<usize>, ) -> Result<Vec<Embedding>>
Method to generate image embeddings for a collection of image paths.
Accepts anything that can be referenced as a slice of elements implementing
AsRef<Path>, such as Vec<String>, Vec<PathBuf>, &[&str], or &[&Path].
Sourcepub fn embed_images(
&mut self,
imgs: Vec<DynamicImage>,
) -> Result<Vec<Embedding>>
pub fn embed_images( &mut self, imgs: Vec<DynamicImage>, ) -> Result<Vec<Embedding>>
Embed DynamicImages
Sourcepub fn embed_preprocessed(
&mut self,
inputs: Vec<Array3<f32>>,
) -> Result<Vec<Embedding>>
pub fn embed_preprocessed( &mut self, inputs: Vec<Array3<f32>>, ) -> Result<Vec<Embedding>>
Embed images already prepared by this model’s ImagePreprocessor.
This separates CPU image preprocessing from mutable ONNX Runtime inference, allowing callers to prepare later batches while the accelerator processes the current batch.
Auto Trait Implementations§
impl !RefUnwindSafe for ImageEmbedding
impl !UnwindSafe for ImageEmbedding
impl Forget for ImageEmbedding
impl Freeze for ImageEmbedding
impl Move for ImageEmbedding
impl Send for ImageEmbedding
impl Sync for ImageEmbedding
impl Unpin for ImageEmbedding
impl UnsafeUnpin for ImageEmbedding
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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> ⓘ
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