Views
No views yet
| Dataset | Recall@1 | Recall@5 | Recall@10 |
|---|---|---|---|
| Zero-Shot Flickr | 0.693 | 0.875 | 0.923 |
| Zero-Shot MS-COCO | 0.382 | 0.617 | 0.728 |
pip install uform[onnx]1import uform
2
3model, processor = uform.get_model_onnx('unum-cloud/uform-vl-english-large', device='cpu', dtype='fp32')1from PIL import Image
2
3text = 'a small red panda in a zoo'
4image = Image.open('red_panda.jpg')
5
6image_data = processor.preprocess_image(image)
7text_data = processor.preprocess_text(text)
8
9image_features, image_embedding = model.encode_image(image_data, return_features=True)
10text_features, text_embedding = model.encode_text(text_data, return_features=True)
11score, joint_embedding = model.encode_multimodal(
12 image_features=image_features,
13 text_features=text_features,
14 attention_mask=text_data['attention_mask'],
15 return_scores=True
16)score will belong to the [0, 1] range, 1 meaning the absolute match.