-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add support for image dataset #571
Conversation
@taranjeet @cachho Can you please take a look? |
@taranjeet Can you please take a look? New merge conflicts are coming into this every few days. |
I'm sure this is a great feature! I couldn't test it yet or do a thorough review, I hope you can just answer a few questions here. What's happening behind the scenes? Is your image embedded as an image, or is it transformed to text and that text is embedded? After adding it, can you only query it as an image (is that what We're definitely going to need documentation for the Can you provide a full test script (with creative commons images)? What kind of question can you ask? |
Thanks @cachho for taking a look. Please find the response inline
We create an embedding for each image, which is stored in the DB(CharomDB or ES of whatever is configured). By embedding, I mean an array of floating numbers. This conversion is done using https://github.com/openai/CLIP. You should be able to find how exactly this is being done in
After adding the images, you query it using text context of the added images. Example if you add an image of a mountain, a beach, a forest, a boy to embedchain, we should then be able to search using queries like "A lush green set of trees", which should return the image of a forest.
Does it work with all LLMs?
Nice suggestion. I have created https://github.com/rupeshbansal/embedchain_imagetest/ which has the steps to test it. Will add it to the PR description as well |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good to me. Great work @rupeshbansal ❤️
Please resolve the comments and incorporate minor suggestions and we are good to go here.
Codecov ReportAttention:
📢 Thoughts on this report? Let us know!. |
Hey @rupeshbansal , glad to know that Image search has come to embedchain. It would be great if there is a default -> Before this commit, the typical flow of creating a bot would be like this
-> After this commit, we need to explicitly provide the query type like the below
-> if the old style is followed, then throws it out an error -> One work around would be, to check if the
-> And as @cachho as mentioned, this needs to be in documentation, I myself was confused (when I did a git pull) and all of a sudden like why wasn't the code working and was backtracking and finally found this. |
Description
This adds support for image as a new dataset in embedchain. Users will be able to feed in an image/directory(containing a set of images) to embedchain, and then issue query searches on the context of images.
NOTE: Docs are yet to be updated. Unsure about the convention of the repository, but planning to add those in a followup!
Setup
Run
poetry install -E images
to install all the additional dependenciesPreparation of the data
Create a new folder and put all the images on which the embedchain is to be trained in it
Add the Images to Embedchain
Query on the context
Test
You can test this feature by following instructions in https://github.com/rupeshbansal/embedchain_imagetest/
Fixes #511
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Please delete options that are not relevant.
Checklist:
Maintainer Checklist