Coder Social home page Coder Social logo

apaz-cli / ml-imagehash Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 3.98 MB

A PyTorch implementation of a machine learning perceptual image hash algorithm for near-duplicate detection and fast content-based image retrieval.

License: GNU General Public License v2.0

Jupyter Notebook 97.28% Python 1.22% Shell 0.08% Java 1.42%
perceptual-hashing image-processing imagehash duplicate-detection near-duplicates

ml-imagehash's Introduction

ML-ImageHash

A PyTorch implementation of a machine learning perceptual image hash algorithm for near-duplicate detection and fast content-based image retrieval.

Introduces an algorithm which improves upon Triplet Margin Loss as introduced by the FaceNet paper: https://arxiv.org/abs/1503.03832

Dataset download instructions:

    # Install Java.
    # sudo apt-get install -y default-jdk

    # Enter into the project directory

    # Compile the java code
    ./Compile_Jars.sh

    # Run the link scraper, dumping the links into a text file. This takes 
    # quite a while, depending on internet speeds. I'd recommend running it overnight.
    touch Downloaded_Links.txt
    java -jar Link_Scraper.jar > Downloaded_Links.txt
    
    # Compile and run the image downloader, pointing it at the text file. This 
    # takes way longer. Several days, in fact.
    java -jar Image_Downloader.jar Downloaded_Links.txt

Model training instructions

    # Install python3-pip. For example, on Debian:
    # sudo apt-get install -y python3-pip

    # Install Jupyter Notebooks.

    # Install the required pip packages. This amounts to resolving import errors as they come up.

    # Hit run all. It will train the model, then export it into the Models folder, and then try to test it.

Model testing instructions

At the end of the notebook, there's some code that visually verifies the model using nearest neighbor lookup. The data structure used for this lookup is my implementation of a Vantage Point Tree, which can be found below. Install it, and make sure the bindings are in your PYTHONPATH.

https://github.com/apaz-cli/VPTree

ml-imagehash's People

Contributors

apaz-cli avatar

Watchers

 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.