A visual search engine based on Elasticsearch and Tensorflow
A visual search engine based on Elasticsearch and Tensorflow (now fully dockerized to run it in up-to-date development environments).
This repository contains code in
Python 2.7and utilizes
VGG-16as backbone) implemented in
Tensorflow 0.12.1to extract features from images. An
Elasticsearchinstance is used to store feature vectors of the corresponding images, along with a plugin to compute distance between them.
TODO: Replace the outdated
Faster-RCNNwith a faster and more accurate model (suggestions or any collaboration is welcomed).
The setup assumes you have a running installation of nvidia-docker and driver version 367.48 or above.
First, we need to build the
Elasticsearchplugin to compute distance between feature vectors. Make sure that you have Maven installed.
cd elasticsearch/es-plugin mvn install
Next, we need to create a docker network so that all other containers can resolve the IP address of our
docker network create vs_es_net
Finally, start the
elasticsearchcontainer. It will automatically add the plugin, create a named docker volume for persistent storage and connect the container to the network we just created:
cd ../ && docker-compose up -d
In order to populate the
elasticsearchdb with images, we need to first process them with a feature extractor (
indexerservices can do this for any image we place inside
First we build a dockerized environment for the object detection model to run in:
cd visual_search && docker build --tag visual_search_env .
visual_search/models/folder. Optionally, you can run:
mkdir models && cd models curl https://github.com/tuan3w/visual_search/releases/download/v0.0.1/model.tar.gz tar -xvf model.tar.gz
To index the desired images, copy the corresponding compose file to the proper directory and start the indexing service:
cd ../ && cp indexer/docker-compose.yml . docker-compose up
Before starting the server, again copy the corresponding compose file (overwrite the one used for indexing data) into the proper directory and start the containerized
cp server/docker-compose.yml . docker-compose up -d
Now, you can access the link
http://localhost:5000/static/index.htmlto test the search engine.