Multi-Modal Inference Library
For Semantic Search Applications
UForm is a Multi-Modal Modal Inference package, designed to encode Multi-Lingual Texts, Images, and, soon, Audio, Video, and Documents, into a shared vector space!
This is model card of the English only model with:
4 layers BERT (2 layers for unimodal encoding and rest layers for multimodal encoding)
There are two options to calculate semantic compatibility between an image and a text: Cosine Similarity and Matching Score.
Cosine Similarity
python
1import torch.nn.functional as F
23similarity = F.cosine_similarity(image_embedding, text_embedding)
The similarity will belong to the [-1, 1] range, 1 meaning the absolute match.
Pros:
Computationally cheap.
Only unimodal embeddings are required, unimodal encoding is faster than joint encoding.
Suitable for retrieval in large collections.
Cons:
Takes into account only coarse-grained features.
Matching Score
Unlike cosine similarity, unimodal embedding are not enough.
Joint embedding will be needed and the resulting score will belong to the [0, 1] range, 1 meaning the absolute match.