Giter Site home page Giter Site logo

vishash's Introduction

Visual hash for comparing visual similarity of images; which works on a wide variety of image types such as photos, logos, figures, diagrams and drawings.

VisHash

This repository is the official implementation of VisHash: Visual Similarity Preserving Image Hashing for Diagram Retrieval.

Figure from paper depicting example of relative brightness of regions on three drawings of toy cars.

Requirements

  • PIL or pillow
  • scikit-image
  • matplotlib
  • cairosvg (optional: necessary for reading SVG images)

Calculate image hashes

calc_vishash.py --dataname example --image_path /path/to/images

Input is a directory containing images. A hash will be computed for each image. Two files are written: filenames_example.csv and signatures_example.npy, so that the order of the hashes (signatures) matches the order given in filenames_example.csv. Any unreadable or unsupported files will generate a log message, but processing on other images will continue.

Find duplicate images

calc_matches.py --postfix example --threshold 0.2

This script will read filenames_example.csv and signatures_example.npy (such as produced by calc_vishash.py). The distance between pairs of image hashes is calculated, then filtered based on the given threshold to output a list of matches in matches_example.csv.

Evaluation

Evaluation of the algorithm is performed by finding the closest matches in a given dataset, and then evaluating (by hand) whether these matches are correct. The results of this analysis are used to generate a plot of precision versus number of retrieved pairs.

calc_mindist_allpairs.py --postfix example --n_matches 1000

The above example will generate a list of 1000 image-pairs with the lowest distance. The script will read filenames_example.csv and signatures_example.npy (such as produced by calc_vishash.py); and write mindist_example.csv with the list of 1000 matches.

calc_query_matches.py --postfix example -k 5

The above match-per-query example will generate a list of the top-5 matches (hashes with lowest distance) for each of the hashes in the given array of hashes. The script will read filenames_example.csv and signatures_example.npy (such as produced by calc_vishash.py); and write topk_example.csv with the list of top-5 matches per hash.

Contributing

Send email to contact author (dianeoyen) with any suggestions, concerns or interest in contributing. See license.

vishash's People

Contributors

dianeoyen avatar

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.