clip-as-service icon indicating copy to clipboard operation
clip-as-service copied to clipboard

rank function, sorting images according to text returns empty results, only scores

Open kkiskkk opened this issue 1 year ago • 3 comments

image no image name displayed

kkiskkk avatar Jul 10 '23 02:07 kkiskkk

Hi, could you please provide a minimum code snippet and a data sample that demonstrate how you obtained the result shown in your screenshot?

ZiniuYu avatar Jul 10 '23 03:07 ZiniuYu

Hi,

i have the same issue using the sample from the docs: "Given sentence, rank images" https://clip-as-service.jina.ai/user-guides/client/#rank-api

code:

from docarray import Document
from client.clip_client import Client

c = Client('grpc://172.17.0.2:51000')
# c.profile()

d = Document(
    text='a photo of a table',
    matches=[
        Document(uri='imagexyzsdfdsf'),
        Document(uri='imagexyz45435'),
        Document(uri='imagexyz68768'),
        Document(uri='imagexyz7865756'),
    ],
)
r = c.rank([d])

**replace image urls

result:

[['', '', '', ''], [0.9542718529701233, 0.0419040322303772, 0.002422966528683901, 0.0014011985622346401]]

kindziora avatar Jul 26 '23 12:07 kindziora

found the problem, the docs are using the wrong label in the sample:

print(c.rank(da)['@m', ['text', 'scores__clip_score__value']]) print(c.rank(da)['@m', ['uri', 'scores__clip_score__value']])

text --> uri

kindziora avatar Jul 26 '23 14:07 kindziora