Vector Embeddings for Images

imgbeddings helps to generate vectors for a given image. Used the following code for generating vector for an image given an URL . Works well.

def VectorOfImage(strURL):
    import requests
    from PIL import Image
    url = strURL
    image = Image.open(requests.get(url, stream=True).raw)
    from imgbeddings import imgbeddings
    ibed = imgbeddings()
    embedding = ibed.to_embeddings(image)
    #query_vector=list(embedding.flatten())
    vector = embedding.flatten().tolist()
    return vector

Hi @Balachandar_Ganesan !!

THanks! I have edited your post and formatted the code :slight_smile:

Apparently list(embedding.flatten()) method worked for inserting the vectors into weaviate but when I called the query method it did not. There is some inconsistency between insert and query. A similar problem I faced when I did embedding with NLP,FastText as well. Deep down I guess there is some inconsistency in processing the vectors even if they are generated by same function between insert and query
Invalid input provided: The number of target vectors must be equal to the number of vectors… Can one from your team look into this?.

Sure!

Do you have a code where I could reproduce it end to end?

You can see the full code here I have used the cloud version.Code contains steps needed for creating, generating vector embedding and querying.
query_vector=list(embedding.flatten()) works for inserting but not for querying
vector = embedding.flatten().tolist() works both the ways. Similar problem experienced for NLP text vector embedding as well.

Also if you can show me how I can change the code for leveraging async support for new client, it would be great (I already have new python client installed)