Image search based on Milvus and ResNet50 (deployment and application)

Official website deployment document ( click here )

The system version of the Xiaobian deployment system is as follows:

 

 1. Start Milvus v2.0

1.1 Download the docker-compose file

wget https://github.com/milvus-io/milvus/releases/download/v2.1.0/milvus-standalone-docker-compose.yml -O docker-compose.yml

 1.2 Start Milvus

sudo docker-compose up -d

 

 2. Start MySQL

docker run -p 3306:3306 -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.7

 3. Start the backend

3.1 Create a path to store images on the host

3.2 Upload image data to this path

 

It is convenient to hang the picture in the container later.

3.3 Start the server using the command

docker run -d \
-v /milvus_test/data:/data \
-p 5000:5000 \
-e "MILVUS_HOST=192.168.220.132" \
-e "MILVUS_PORT=19530" \
-e "MYSQL_HOST=192.168.220.132" \
milvusbootcamp/img-search-server:2.0

Note: The IP and port in the command should be modified according to your own situation.

 4. Start the client

docker run -d -p 8001:80 \
-e API_URL=http://192.168.220.132:5000 \
milvusbootcamp/img-search-client:1.0

Note: The IP and port in the command should be modified according to your own situation.

 At this point, the deployment is complete, open the browser, visit: ip:8001

 5. Load image data

Click the +  on the right ( remember not to click more )

 Use the following command to view the backend container logs in real time

docker logs -tf 572315ef104d

 As shown in the picture above, the picture is trying to load, please wait patiently.

Note: The editor feels that the front-end page of this version does not display the loading process in real time, but it can be seen from the back-end log.

 As shown in the figure above, the loading is complete. Then you can upload images to search.

The resulting pictures are displayed in order of similarity from high to low.

6. Related applications

6.1 Modify the data format returned by the search interface

 

 Observe the data returned by the search interface. If you want to call this interface, but feel that the returned data format is not what you want, you can modify the source code.

In the corresponding source code server directory, in the main.py file in src 

 Just modify as shown in the figure.

6.2 Call the interface to load a single image

Still in the main.py file

 Others need to be decided according to the corresponding issues.

Guess you like

Origin blog.csdn.net/hpl980342791/article/details/126126068