Chao-Jiang / sis

Simple image search engine

Home Page:http://yusukematsui.me/project/sis/sis.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sis: Simple Image Search Engine

Wrokflow

Overview

  • Sis is a simple image-based image search engine using Keras + Flask. You can launch the search engine just by running two python scripts.
  • offline.py: This script extracts deep features from images. Given a set of database images, a 4096D fc6-feature is extracted for each image using the VGG16 network with ImageNet pre-trained weights.
  • server.py: This script runs a web-server. You can send your query image to the server via a Flask web-intereface. Then relevant images to the query are retrieved by the simple nearest neighbor search.
  • On an aws-ec2 instance with t2.large, the feature extraction takes 0.9 s per image. The search for 1000 images takes 10 ms. We tested Sis on Ubuntu 16.04 with Python3.

Links

Usage

# Clone the code and install libraries
$ git clone https://github.com/matsui528/sis.git
$ cd sis
$ pip install -r requirements.txt

# Put your image files (*.jpg) on static/img

$ python offline.py
# Then fc6 features are extracted and saved on static/feature
# Note that it takes time for the first time because Keras downloads the VGG weights.

$ python server.py
# Now you can do the search via localhost:5000

Launch on AWS EC2

  • You can easily launch Sis on AWS EC2. Note that the following configuration is just for the demo purpose, which would not be secure.
  • To run the server on AWS, please first open the port 5000 and launch an EC2 instance. Note that you can create a security group such that port 5000 is opened.
  • A middle-level CPU instance is fine, e.g., m4.large.
  • After you log in the instance by ssh, the easist way to setup the environment is to use anaconda:
$ wget https://repo.continuum.io/archive/Anaconda3-5.0.1-Linux-x86_64.sh
$ bash Anaconda3-5.0.1-Linux-x86_64.sh # Say yes for all settings
$ source ~/.bashrc  # Activate anaconda
  • Then let's run the commands in the above usage section.
  • After you run $ python server.py, you can access the system via http://ec2-XX-XX-XXX-XXX.us-west-2.compute.amazonaws.com:5000
  • (Advanced) If you'd like to deploy the system properly, please consider to run the Sis with the usual web server, e.g., uWSGI + nginx.

Citation

@misc{sis,
    author = {Yusuke Matsui},
    title = {Sis: Simple Image Search Engine},
    howpublished = {\url{https://github.com/matsui528/sis}}
}

About

Simple image search engine

http://yusukematsui.me/project/sis/sis.html

License:MIT License


Languages

Language:Python 75.2%Language:HTML 24.8%