Skip to content

meetjeff/reverse-image-search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Similar Image Search Service Documentation

This documentation explains how to operate a similar image search service developed using the vector database Milvus and the machine learning pipeline framework Towhee. The test image set is randomly selected from the ImageNet dataset, which includes a training set (train) and a test set (test). The training set contains 100 categories with 10 images each, and the test set contains 100 categories with 1 image each. There is a CSV file (reverse_image_search.csv) that includes basic information for 1,000 images from the training set, such as the image ID, path, and category.

1. Create Vector Database

I used Zilliz Cloud, the cloud-hosted version of Milvus:

  • Register and obtain CLUSTER_ENDPOINT and TOKEN.
  • Set these as the values for the environment variables MILVUS_URI and MILVUS_TOKEN.

2. Install Dependencies (via pipenv)

pip3 install pipenv
pipenv install

3. Create Milvus Collection

Invoke the create_collection() method:

pipenv run python prepare/create_collection.py
# Or, if setting PYTHONPATH
$env:PYTHONPATH="src"; python prepare/create_collection.py
  • Set the created collection_name as the value for the environment variable IMAGE_COLLECTION.
  • Optionally, use the drop_collection() method to delete a Collection if needed.

4. Select the Model for Image Vectorization

For example, use resnet50 and set it as the value for the environment variable IMAGE_MODEL.

5. Vectorize Images in images/train Directory Listed in reverse_image_search.csv and Load into Milvus Collection

pipenv run python prepare/load_data.py
# Or, if setting PYTHONPATH
$env:PYTHONPATH="src"; python prepare/load_data.py

6. Start the Application (Uvicorn server)

pipenv run uvicorn main:app --reload
# Or, if setting PYTHONPATH
$env:PYTHONPATH="src"; uvicorn main:app --reload

About

reverse-image-search

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages