GithubHelp home page GithubHelp logo

shlokk / jigsawpuzzlepytorch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bbrattoli/jigsawpuzzlepytorch

0.0 0.0 0.0 80 KB

Pytorch implementation of the method from the paper "Unsupervised Learning of Visual Representations by Solving Jigsaw Puzzles"

Python 98.70% Shell 1.30%

jigsawpuzzlepytorch's Introduction

JigsawPuzzlePytorch

Pytorch implementation of the paper "Unsupervised Learning of Visual Representations by Solving Jigsaw Puzzles" by Mehdi Noroozi GitHub

Partially tested Performances Coming Soon

Dependencies

  • Tested with Python 2.7
  • Pytorch v0.3
  • Tensorflow is used for logging. Remove the Logger all scripts if tensorflow is missing

Train the JigsawPuzzleSolver

Setup Loader

Two DataLoader are provided:

  • ImageLoader: per each iteration it loads data in image format (jpg,png ,...)
    • Dataset/JigsawImageLoader.py uses PyTorch DataLoader and iterator
    • Dataset/ImageDataLoader.py custom implementation.

The default loader is JigsawImageLoader.py. ImageDataLoader.py is slightly faster when using single core.

The images can be preprocessed using produce_small_data.py which resize the image to 256, keeping the aspect ratio, and crops a patch of size 255x255 in the center.

Run Training

Fill the path information in run_jigsaw_training.sh. IMAGENET_FOLD needs to point to the folder containing ILSVRC2012_img_train.

./run_jigsaw_training.sh [GPU_ID]

or call the python script

python JigsawTrain.py [*path_to_imagenet*] --checkpoint [*path_checkpoints_and_logs*] --gpu [*GPU_ID*] --batch [*batch_size*]

By default the network uses 1000 permutations with maximum hamming distance selected using select_permutations.py.

To change the file name loaded for the permutations, open the file JigsawLoader.py and change the permutation file in the method retrive_permutations

Details:

  • The input of the network should be 64x64, but I need to resize to 75x75, otherwise the output of conv5 is 2x2 instead of 3x3 like the official architecture
  • Jigsaw trained using the approach of the paper: SGD, LRN layers, 70 epochs
  • Implemented shortcuts: spatial jittering, normalize each patch indipendently, color jittering, 30% black&white image
  • The LRN layer crushes with a PyTorch version older than 0.3

ToDo

  • TensorboardX
  • LMDB DataLoader

jigsawpuzzlepytorch's People

Contributors

biagiobrattoli avatar topiaruss avatar bbrattoli 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.