Image Embedding
As of version 0.3.0 fastembed supports computation of image embeddings.
The process is as easy and straightforward as with text embeddings. Let's see how it works.
from fastembed import ImageEmbedding
model = ImageEmbedding("Qdrant/resnet50-onnx")
embeddings_generator = model.embed(
["../../tests/misc/image.jpeg", "../../tests/misc/small_image.jpeg"]
)
embeddings_list = list(embeddings_generator)
embeddings_list
Preprocessing
Preprocessing is encapsulated in the ImageEmbedding class, applied operations are identical to the ones provided by Hugging Face Transformers. You don't need to think about batching, opening/closing files, resizing images, etc., Fastembed will take care of it.
Supported models
List of supported image embedding models can either be found here or by calling the ImageEmbedding.list_supported_models()
method.
ImageEmbedding.list_supported_models()