Giter Site home page Giter Site logo

py-cbir's Introduction

Demo of Content Based Image Retrieval, implemented by Python and Tornado.

Image descriptors

  • perceptual hash
  • Otsu's method
  • gray/RGB/YUV/HSV histograms
  • GIST
  • HoG and LSH (built by Kmeans clustering)
  • SIFT and LSH (built by Kmeans clustering)
  • Dense SIFT

Distance functions

  • Hamming distance, or norm0 distance (L0)
  • abs distance (L1)
  • Eculidean distance (L2)

Simple re-ranking

  • blending: mix results
  • ensembling: weighted sum

Code structure

  • util/: feature descriptors, feature and LSH preparation
  • app/: http server, matching and retrieval
  • templates/: html templates
  • static/: datasets, js, css
  • conf/: log.conf, and for feature data
  • logs/: for log data
  • settings.py: http port, common setting
  • urls.py: server url path

Dependencies

  • Tornado
  • Image
  • numpy, scipy

Run (Linux or Mac)

  • cd util/pyleargist-2.0.5/lear_gist/ && make && cp compute_gist ../../ && cd -
  • cd util && python prepare.py && cd -
  • python main.py
  • access http://localhost:19999/cbir

How to change dataset

  • add a new image folder in static/dataset/
  • in util/prepare.py, change dataset to the folder name, like dataset = 'ferrari'
  • run as previous section

Author

Any question, please contact: Zuotao Liu([email protected])

py-cbir's People

Contributors

fancyspeed avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

py-cbir's Issues

Error while running the code

I run the "cd util && python prepare.py && cd -" in one terminal and "python main.py" in another terminal.
After that I try to upload the image of a car then there is an error :

Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/tornado-4.4.2-py2.7-linux-x86_64.egg/tornado/web.py", line 1467, in _execute
result = method(*self.path_args, **self.path_kwargs)
File "/home/nikhil/F Drive/MTP Test/py-cbir-master/apps/cbir.py", line 247, in post
phash_alg, index_alg = get_global_vars()
File "/home/nikhil/F Drive/MTP Test/py-cbir-master/apps/cbir.py", line 210, in get_global_vars
phash_alg = GlobalMatcher(SETNAME)
File "/home/nikhil/F Drive/MTP Test/py-cbir-master/apps/cbir.py", line 141, in init
self.load('conf/%s_gist.txt' % setname, self.gist)
File "/home/nikhil/F Drive/MTP Test/py-cbir-master/apps/cbir.py", line 144, in load
for line in open(pin):
IOError: [Errno 2] No such file or directory: 'conf/ferrari_gist.txt'

And in the terminal where i run main.py. Error is :

SyntaxError('unexpected EOF while parsing', ('', 1, 8957, '[0.10801810715592972, 0.002326306277452416, 0.002127562225475842, 0.0005990917825768668, 3.4315519765739386e-05, 0.0, 0.0, 0.0, 0.00547189558931186, 0.010420479502196192, 0.0015384791361639824, 0.0014970145497803806, 0.0010022991398243046, 0.00024735770497803805, 0.0, 0.0, 0.0008393004209370425, 0.001455549963396779, 0.0018701958272327964

Please help I am not able to figure out this error.

prepare.py run error

AttributeError("module 'scipy.misc' has no attribute 'imread'")
../static/dataset/ferrari\yellow\4804734303_a36879921b_b.jpg
AttributeError("module 'scipy.misc' has no attribute 'imread'")
../static/dataset/ferrari\yellow\4952282992_833ebb47af_b.jpg
AttributeError("module 'scipy.misc' has no attribute 'imread'")
../static/dataset/ferrari\yellow\5434338226_eb0755f9d8_b.jpg
AttributeError("module 'scipy.misc' has no attribute 'imread'")
../static/dataset/ferrari\yellow\5718148633_85e71969fc_b.jpg

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.