Giter Site home page Giter Site logo

profintegra / demo-gnes-flow Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hanxiao/demo-gnes-flow

0.0 0.0 0.0 2.43 MB

Demo of building a flower image search using GNES Flow API

License: Apache License 2.0

Jupyter Notebook 99.75% Python 0.25%

demo-gnes-flow's Introduction

GNES Flow Demo: Flower Image Retrieval

Since v0.0.46 GNES Flow has become the main interface of GNES. GNES Flow provides a pythonic and intuitive way to implement a pipeline, enabling users to run or debug GNES on a local machine. By default, GNES Flow orchestrates all microservices using multi-thread or multi-process backend, it can be also exported to a Docker Swarm/Kubernetes YAML config, allowing one to deliver GNES to the cloud.

In this demo, we will learn to build a toy image search engine using GNES Flow API. The task is to retrieve similar flowers given query flowers.

Files

For first-time users, simply open flower.ipynb and follow the steps there.

  • flower.ipynb: a self-contained Jupyter notebook with a step-by-step explanation
  • index.py: the indexing part of flower.ipynb, for indexing all images.
  • query.py: the querying part of flower.ipynb, for querying sampled images and plotting top-10 results

Requirements

gnes>=0.0.46
image
tensorflow==1.12

You can install them via pip install .. However, you may want to do that in a virtual env though as it will replace your local Tensorflow with tensorflow==1.12. Feel free to contribute and waive this particular requirement.

Troubleshooting

Can not load indexer when indexing twice

I didn't implement features like "incremental indexing" in this simple demo. So please make sure you clean up the existing index before doing python index.py.

rm $TEST_WORKDIR/*.bin

OSError: [Errno 24] Too many open files

This often happens when replicas/num_parallel is set to a big number. Solution to that is to increase this (session-wise) allowance via:

ulimit -n 4096

objc[15934]: +[__NSPlaceholderDictionary initialize] may have been in progress in another thread when fork() was called.

Probably MacOS only.

export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES

Why tensorflow==1.12, why not 2.0?

In this demo, I simply use the inceptionV4 model from tf.contrib.slim. There are some major changes in TF2.0, and the model can not be directly used. Fortunately, contribute/port an external model to GNES is extremely simple. Feel free to follow the instruction in GNES Hub and make a contribution to this demo.

It stuck/crash in Jupyter Notebook

Please try running python index.py or python query.py outside the Jupyter Notebook. As far as I know, Jupyter Notebook is employing ZeroMQ in the backend and this can sometimes mess up with GNES sockets (or the other way around). If you find the demo still crash/stuck when running as independent Python script, then please report an issue to this repository or the GNES main repository.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.