GithubHelp home page GithubHelp logo

githubpgq / deepimageranking Goto Github PK

View Code? Open in Web Editor NEW

This project forked from arkindharawat/deepimageranking

0.0 1.0 0.0 4.55 MB

Implementation of `Learning Fine-grained Image Similarity with Deep Ranking` using ResNet-101 and implemented in Pytorch

Python 100.00%

deepimageranking's Introduction

DeepImageRanking

Image Similarity using Deep Ranking

Documentation

  1. For this particular implementation of Deep Ranking we are using TinyImageNet as our training dataset. Download the TinyImageNet dataset here

  2. Change the folder structure of the validation set by running:

    python transform_validation.py

    This will aid later when generating the image embeddings

  3. Now to sample triplets we run:

    python triplet_sampler.py --training 1 --num_pos_images 1 --num_neg_images 1

    Our command-line arugments are as follows:

    • training: 0 or 1 to sample from train or validation set
    • num_pos_images: the number of positive images per query image
    • num_neg_images: the number of negative images per query image

    This should generate training_triplet_sample.csv or val_triplet_sample.csv based on the argument provided.

  4. To implement we use a pre-trained ResNet-101 with two sub-sampling layers. We finetune the earlier layers of the ResNet and train the rest. The PyTorch implementation can be found in the file deep_rank_net.py

  5. To train the network run:

     python train_net.py --epochs 1 --optim sgd

    Our command-line arugments are as follows:

    • epochs: the number of training epochs to run
    • optim: thee optimizer to use, can be sgd or adam or rms. Will default to sgd.

    Other hyperparameters are set inside the file. These include BATCH_SIZE=25 and LEARNING_RATE=0.001 This should generate a fully trained model file called deepranknet.model and other intermediate files called temp_*.model

  6. To generate embeddings:

    python gen_emebeddings.py

    This will generate the train and test embeddings in the files train_embedding.txt and test_embedding.txt respectively.

  7. To evaluate the model run:

    python eval.py
  8. If you wish to change the architecture, change the hyperparameters or understand the implementation further see the report file

Presentation & Report

Further Resources:

deepimageranking's People

Contributors

haseeb33 avatar

Watchers

James Cloos 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.