Realsearch is a proof-of-concept search tool that utilizes Milvus as the vector database to enable personalized text and image search, leveraging state-of-the-art machine learning models like CLIP and SBERT, and employing cosine similarity for tailored recommendations based on user preferences and purchase history.
Realsearch is a proof-of-concept search tool that offers personalized text and image search capabilities based on user preferences. It harnesses an extensive fashion e-commerce dataset to power its search functionality. Leveraging Milvus as the underlying vector database, Realsearch effectively stores and indexes vectors encoded by state-of-the-art machine learning models like CLIP (OpenAI) and SBERT, facilitated by the Sentence-Transformers library. At the core of Realsearch's personalized search capabilities is the utilization of cosine similarity. This technique allows the tool to rearrange search results based on the user's purchase history, ensuring that relevant and tailored recommendations are provided. By incorporating the user's preferences and historical interactions, Realsearch enhances the search experience by delivering more meaningful and accurate results.
- Users:
- Versatile Search Modes: Realsearch offers users various search modes to find products. In the default mode (Mode 0), semantic search enables users to search based on product descriptions. In Mode 1, users can describe the physical appearance or use reverse image search for their searches.
- Personalized Search: Users can build their preference data by making purchases, allowing Realsearch to personalize future searches according to their interests and preferences.
- Clone the repository.
git clone https://github.com/quachhengtony/climan.net.git
- Run the docker-compose.local.yml file.
docker compose -f docker-compose.local.yml up -d
- Create the appropriate Milvus indexes and load the collections into memory.
Build the indexes:
curl -X 'POST' \ 'http://localhost:9091/api/v1/index' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "collection_name": "product", "field_name": "text_vector", "extra_params": [ { "key": "metric_type", "value": "IP" }, { "key": "index_type", "value": "IVF_FLAT" }, { "key": "params", "value": "{\"nlist\":2048}" } ] }'
curl -X 'POST' \ 'http://localhost:9091/api/v1/index' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "collection_name": "product_image", "field_name": "image_vector", "extra_params": [ { "key": "metric_type", "value": "IP" }, { "key": "index_type", "value": "IVF_FLAT" }, { "key": "params", "value": "{\"nlist\":512}" } ] }'
Load the collections into memory:curl -X 'POST' \ 'http://localhost:9091/api/v1/index' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "collection_name": "user_product_preference", "index_name": "buyer_email_index", "field_name": "buyer_email" }'
curl -X 'POST' \ 'http://localhost:9091/api/v1/collection/load' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "collection_name": "product" }'
curl -X 'POST' \ 'http://localhost:9091/api/v1/collection/load' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "collection_name": "product_image" }'
curl -X 'POST' \ 'http://localhost:9091/api/v1/collection/load' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "collection_name": "user_product_preference" }'
- Perform searches with the API using server reflection (localhost:5154) or the product.proto file in API.Contracts/Protos to build requests.
- Clone the repository.
- Comment out the api service and run the docker-compose.local.yml file.
- Configure the input/output folder paths and run the image preprocessor.
- Configure the urls, input file paths, Milvus metadata and run the ingestor.
- Uncomment the api service and run the docker-compose.local.yml file again.
- Create the appropriate Milvus indexes and load the collections into memory (see above).
- Perform searches with the API by using server reflection (localhost:5154) or the product.proto file in API.Contracts/Protos to build requests.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.