Coder Social home page Coder Social logo

similarity's Introduction

Similarity

A fork of the original similarity project meant to clean up the code and streamline the process of installing and launching this application (for complete novices in ML such as myself).

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. This program and its requirements have only been tried out for the CPU version of tensorflow.

Prerequisites

Python (3.5.x or 3.6.x) 64bit - as of right now, tensorflow only runs on these versions of python.
pip 19.0 or later - for manylinux2010 support (pip install -U pip for upgrade).

Installing

The requirements for the program can be installed by running:

pip install -r requirements.txt

Before the program can be run, you will need to setup a couple of things.
First and foremost, you will need images to train this network with. Training data should be provided as 224x224 RGB images.
The data should be structured as given:

  • Train data folder:

    {train_folder}/train_a/0/ -- anchor images
    {train_folder}/train_p/0/ -- positive images 
    {train_folder}/train_n/0/ -- negative images
    
    {train_folder}/valid_a/0/ -- anchor images
    {train_folder}/valid_p/0/ -- positive images 
    {train_folder}/valid_n/0/ -- negative images
    
  • Test data folder:

    {test_folder}/test_a/0/ -- anchor images
    {test_folder}/test_p/0/ -- positive images
    {test_folder}/test_n/0/ -- negative images
    

Change the config.json file values for train_data_folder and test_data_folder to point to appropriate folders where your data is contained.

Using

The core part of the program that runs both the training and testing is contained in the file top.py.
This file can be run with the following arguments:

  • -r, --train-model - train triplet network with images provided in train_data_folder config value.
  • -e {num}, --epochs {num} - amount of epochs to run training with. Only used when training.
  • -s, --test-model - test triplet network with images provided in test_data_folder config value.

Example:

python top.py -r -e 16
python top.py -s

Training logs can be viewed using tensorboard by running the following command:

tensorboard --logdir=runtime_files/logs

An alternative way to launch tensorboard is to simply run tb.sh from your terminal.

Disclaimer

I am a complete novice in anything ML related and these changes are purely for ease of use from my own point of view. I cannot guarantee the correctness of the program or documentation in any way, shape or form.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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.