Skip to content

A vector database for images, with the possibility to run a similarity search. I implemented this as I needed to make a project with GPT4o vision API

License

Notifications You must be signed in to change notification settings

BBurgarella/PymvDB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PymvDB

logo

Description

PymvDB is a Python library designed to create and manage a vector database for images. it comes with the ability to use Hugging Face image feature extraction models as encoders.

running it with google/vit-base-patch16-224-in21k takes 0.41 seconds to encode an image on my machine (Ryzen 7 2700)

Installation

You can install PymvDB using pip (coming soon):

pip install pymvdb

while waiting for me to publish it on pip, you can download and install PymvDB using:

git clone https://github.com/BBurgarella/PymvDB.git
cd PymvDB
pip install .

Local Usage

# Initialize the client with an embedding model
embedding_model = YourEmbeddingModel()  # Replace with your actual embedding model
db = Client(embedding_model, persistent_path='database.sqlite')

# Create a new collection
collection = db.create_collection(Name='my_collection')

# Add an image to the collection
collection.add_image('path/to/image', metadata={"..."})

# Find similar images
target_image = Image.open('path/to/target_image')
similar_images = collection.find_similar_images(target_image, top_N=5)
print(similar_images)

You can run a quick example by using the StartingPoint file. All the images used here come from Wikipedia

python StartingPoint.py Test_car.jpg

About

A vector database for images, with the possibility to run a similarity search. I implemented this as I needed to make a project with GPT4o vision API

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages