Skip to content

A visual search engine based on Elasticsearch and Tensorflow

License

Notifications You must be signed in to change notification settings

nilportugues/visual_search

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A visual search engine based on Elasticsearch and Tensorflow

Visual search enging

Requirements

There are serveral python libraries you must to install before building the search engine.

  • elasticsearch==5.2.0
  • Tensorflow==1.12.1
  • Flask
  • opencv-python

Setup

  • Setup Elasticsearch

The easiest way to setup is using Docker with Docker Compose. With docker-compose everything you have to do is so simple:

cd visual_search/elasticsearch
docker-compose up -d
  • Building elasticsearch plugin

We need to build Elasticsearch plugin to compute distance between feature vectors. Make sure that you have Maven installed.

cd visual_search/es-plugin
mvn install

cd target/release
// create simple server to serve plugin
python -m 'SimpleHTTPServer' &

//install plugin
cd ../elasticsearch
docker exec -it elasticsearch_elasticsearch_1 elasticsearch-plugin install http://localhost:8000/esplugin-0.0.1.zip
docker-compose restart
  • Index preparation
curl -XPUT http://localhost:9200/img_data -d @schema_es.json
  • Setup faster r-cnn

I use faster r-cnn version implemented by @Endernewton for object detection. Follow the link for the guide how to setup faster r-cnn and download VGG16 model trained on COCO dataset.

Indexing images to elasticsearch

export WEIGHT_PATH=...
export MODEL_PATH=...
export INPUT=..
cd visual_search
python index_es.py --weight $WEIGHT_PATH --model_path $MODEL_PATH --input $INPUT

Start server

Before starting the server, you must to update IMGS_PATH variable in visual_search/server.py to the location of folder where images are stored.

cd visual_search
python server.py

and access the link http://localhost:5000/static/index.html to test the search engine.

Have fun =))

About

A visual search engine based on Elasticsearch and Tensorflow

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 79.8%
  • Python 17.6%
  • Java 0.9%
  • HTML 0.6%
  • Cuda 0.5%
  • CSS 0.4%
  • Other 0.2%