Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embeddings vary slightly when done in batches vs. single #3

Open
minimaxir opened this issue Mar 28, 2022 · 0 comments
Open

Embeddings vary slightly when done in batches vs. single #3

minimaxir opened this issue Mar 28, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@minimaxir
Copy link
Owner

minimaxir commented Mar 28, 2022

import requests
from PIL import Image
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)

from imgbeddings import imgbeddings
ibed = imgbeddings()
embedding = ibed.to_embeddings(image)
embedding[:, 0:5] 
array([[ 0.914541  ,  0.45988417,  0.0350069 , -0.9054574 ,  0.08941309]],
      dtype=float32)
embedding = ibed.to_embeddings([image]*4)
embedding[:, 0:5] 
array([[ 0.9133097 ,  0.46032238,  0.03528907, -0.90713847,  0.09063635],
       [ 0.9133097 ,  0.46032238,  0.03528907, -0.90713847,  0.09063635],
       [ 0.9133097 ,  0.46032238,  0.03528907, -0.90713847,  0.09063635],
       [ 0.9133097 ,  0.46032238,  0.03528907, -0.90713847,  0.09063635]],
      dtype=float32)

Probably a side effect of ONNX conversion as that's within tolerances. (or a case where intra op is breaking parallelism?)

@minimaxir minimaxir added the bug Something isn't working label Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant