项目作者: yangboz

项目描述 :
visual search microservices for go game sgf files .
高级语言: JavaScript
项目地址: git://github.com/yangboz/visual_search_go.git
创建时间: 2017-11-28T01:49:55Z
项目社区:https://github.com/yangboz/visual_search_go

开源协议:MIT License

下载


Computing-Thinking

A visual search engine(for go) based on Elasticsearch, and A Tensorflow implementation of faster RCNN detection.

Visual search enging

Requirements

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

  • elasticsearch==5.2.0
  • Tensorflow==0.12.1
  • Flask
  • opencv-python
  • easydict
  • cython
  • numpy

  • Or

    1. pip install -r requirements.txt
  • Then
  1. cd visual_search/lib & make

Setup

  • Setup Elasticsearch5

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

    1. cd visual_search/elasticsearch
    2. 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.

    1. cd visual_search/es-plugin
    2. mvn install
    3. cd target/release
    4. // create simple server to serve plugin
    5. python -m 'SimpleHTTPServer' &
    6. //install plugin
    7. cd ../elasticsearch
    8. docker exec -it elasticsearch_elasticsearch_1 elasticsearch-plugin install http://localhost:8000/esplugin-0.0.1.zip
    9. docker-compose restart
  • Index preparation

    1. curl -XPUT http://localhost:9200/im_data -d @schema_es.json
  • Setup faster r-cnn

    I used earlier faster r-cnn version implemented by @Endernewton for object detection. You can fetch pre-trained model here.

    Indexing images to elasticsearch

    1. export WEIGHT_PATH=...
    2. export MODEL_PATH=...
    3. export INPUT=..
    4. cd visual_search
    5. python index_es.py --weight $WEIGHT_PATH --model_path $MODEL_PATH --input $INPUT

    Example

  1. sudo python index_es.py --weight ./models/imagenet_weights/vgg16.weights --model_path ./models/faster_rcnn_models/coco_2014_train+coco_2014_valminusminival/default/vgg16_faster_rcnn_iter_490000.ckpt --input ../KGSoutput/2002-01-01-9.png

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.

  1. cd visual_search
  2. python server.py

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

Have fun =))

Issue

  1. export CFLAGS="-I /usr/local/lib/python3.5/dist-packages/numpy/core/include $CFLAGS"

https://github.com/tensorflow/tensorflow/issues/251

References

https://blog.algorithmia.com/deep-dive-into-object-detection-with-open-images-using-tensorflow/