BLIP icon indicating copy to clipboard operation
BLIP copied to clipboard

How to use BLIP for near-duplicate image and text pair detection?

Open smith-co opened this issue 2 years ago • 2 comments

Given pairs of (image,text), I have to detect near duplicate using both features.

Pairs

(image1, text1)
(image2, text2)
...
(imageN, textN)

I am thinking to compute embedding using both image and text features:

multimodal_feature_1 = model(image1, text1, mode='multimodal')[0,0]
multimodal_feature_2 = model(image2, text2, mode='multimodal')[0,0]
matching_score = cosine_similarity(multimodal_feature_1, multimodal_feature_2)

Any feedback about this approach?

Also I would like to know is there a length limit for text that I should be aware of?

smith-co avatar Jun 29 '22 19:06 smith-co

Related:

  • #68
  • #69

woctezuma avatar Jun 29 '22 21:06 woctezuma

Hi, note that the multimodal feature has not been optimized for cosine-similarity. The unimodal features can be used to compute cosine-similarity because of the image-text contrastive loss.

LiJunnan1992 avatar Jul 05 '22 09:07 LiJunnan1992