❗❗ This repo will no longer be maintained, please visit https://github.com/milvus-io/bootcamp ❗ ❗
This project implements a picture and recipe retrieval system based on milvus. That is, input a food picture and return the recipe corresponding to the picture.
This project is based on the project im2recipe-Pytorch.
Data introduction
The data for this project comes from recipe1M. Recipe1M+ is a new large-scale, structured corpus of over one million cooking recipes and 13 million food images.
Loading data
The dataset in recipe1M is used in this project. You can download the dataset from the recipe1M website. This project also provides some data sets and models.
Link: https://pan.baidu.com/s/1GpPqRTjiBen0qoudAWZn6g Extraction code: bptf
This project contains two parts, service and webclient.
service provides the code of the back-end service. webclient provides scripts for the front-end interface.
The configuration file config.py in service explains:
Parameter | Description | Default |
---|---|---|
MILVUS_HOST | Milvus service ip | 127.0.0.1 |
MILVUS_PORT | Milvus service port | 19530 |
MYSQL_HOST | MySql service ip | 127.0.0.1 |
MYSQL_PORT | MySql service port | 3306 |
MYSQL_USER | MySql user name | root |
MYSQL_PASSWORD | MySql password | 123456 |
MYSQL_DATABASE | MySql database name | mysql |
TABLE_NAME | Default table name | recipe |
data_path | The path of the dataset lmdb |
data/test_lmdb |
file_keys_pkl | The path of the file test_keys.pkl |
data/test_keys.pkl |
recipe_json_fname | The path of the file recipe1M/layer1.json |
data/recipe1M/layer1.json |
im_path | When querying, the client upload image storage path | data/ima_test |
model_path | tThe path of the model | data/model/model_e500_v-8.950.pth.tar |
ingrW2V | Parameters of the Milvus collection | data/vocab.bin |
temp_file_path | The path of the Temporary file | temp.csv |
collection_param | Parameters of the Milvus collection | default |
search_param | Parameters of Milvus search | 16 |
top_k | The number of recipes displayed as a result | 5 |
- Install Milvus0.10.4.
- Install MySql.
- Clone project
git clone https://github.com/milvus-io/bootcamp.git
cd bootcanp/solution/im2recipe
- Installation dependencies
pip3 install -r requirement.txt
- import data
python load.py
Before importing, check whether the path of the parameter
data_path
inconfig.py
is correct. Note: This process takes a long time
- start service
uvicorn main:app
- start client
docker run -d -p 80:80 -e API_URL=http://127.0.0.1:8000 zilliz/milvus-search-food-recipes:latest
API_URL specifies the IP and port of the server