Coder Social home page Coder Social logo

katameronin / meanteacher-sntg-hybridnet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from isarmad/meanteacher-sntg-hybridnet

0.0 0.0 0.0 748 KB

This is the Pytorch Re-Implementation of three Semi Supervised Classification method on Cifar-100 Dataset using ConvLarge Architecture

Python 1.56% Shell 98.44%

meanteacher-sntg-hybridnet's Introduction

Implementation of Mean Teacher, SNTG and HybridNet

This Repo is the implementation of the following three papers

  • Mean Teacher Mean teachers are better role models: Weight-averaged consistency targets improve semi-supervised deep learning results
  • SNTG Smooth Neighbors on Teacher Graphs for Semi-supervised Learning
  • HybridNet HybridNet: Classification and Reconstruction Cooperation for Semi-Supervised Learning

I only used Cifar-10 Dataset. I have used the following architectures:

  1. Convlarge ( Mean Teacher and SNTG)
  2. Convlarge based HybridNet ( For Hybrid Net )

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

What things you need to install:

  1. Pytorch 0.4.1
  2. Python 3.6.6
  3. TensorboardX

I used 2 Titan Xp GPUs. Average training time is 3 hours for hybrid network and 1 hour for other networks.

Dataset

You may set up CIFAR-10 inside the repository by running the following command.

./data-local/bin/prepare_cifar10.sh

Accuracy Achieved on Test Dataset

A step by step series of examples that tell you how to get a development env running

Say what the step will be

1. Supervised Only without BN : 76.6% 
2. Mean Teacher without BN: 
    a) Student Model : 83.58%
    b) Teacher Model : 86.78%
3. Mean Teacher with BN
    a) Student Model : 84.4%
    b) Teacher Model : 87.07%
4. Mean Teacher + SNTG with BN
    a) Student Model : 84.6%
    b) Teacher Model : 87.28%
5. Hybrid Network
    a) Student Model : 84.18%
    b) Teacher Model : 87.00%

Running the Training

Supervised Model Only (4000 labels of Cifar-10)

Go the parameters.py and change the following flags as follows:

  1. supervised_mode = True ( To use only 4000 labels for training)
  2. lr = 0.15 ( setting the learning rate)
  3. BN = False ( for turning batch Normalization on or off)
  4. sntg = False ( Do not use any SNTG loss )
  5. Do not change any other settings and run main.py Note that my baseline has not Batch Normalization in it.

Mean Teacher Only

Go the parameters.py and change the following flags as follows:

  1. supervised_mode = False ( To use only 4000 labels for training)
  2. lr = 0.2 ( setting the learning rate)
  3. BN = False or True ( for turning batch Normalization on or off)
  4. sntg = False ( Do not use any SNTG loss )
  5. Do not change any other settings and run main.py

Note that my baseline has not Batch Normalization in it. However I tested mean teacher with both a BN and without BN

Mean Teacher + SNTG Loss

Go the parameters.py and change the following flags as follows:

  1. supervised_mode = False ( To use only 4000 labels for training)
  2. lr = 0.2 ( setting the learning rate)
  3. BN = True ( for turning batch Normalization on or off)
  4. sntg = True ( Do not use any SNTG loss )
  5. Do not change any other settings and run main.py

HybridNet

Go the parameters.py and change the following flags as follows:

  1. supervised_mode = False ( To use only 4000 labels for training)
  2. lr_hybrid = 0.2 ( setting the learning rate)
  3. BN = True ( for turning batch Normalization on or off)
  4. sntg = False ( Do not use any SNTG loss )
  5. Do not change any other settings and run main_hybrid.py

Tensorboard Visualization

To Visualize on Tensorboard, use the following command

tensorboard --logdir=”path to ./ckpt”

Note that all the checkpoints are in the ./ckpt folder so simply start a tensorboard session to visualize it. Also all the saved checkpoints for student models are also saved there.

1. Baseline : 12-03-18:09/convlarge,Adam,200epochs,b256,lr0.15/test
2. Mean teacher without BN :
   12-03-20:12/convlarge,Adam,200epochs,b256,lr0.15/test
   12-03-23:38/convlarge,Adam,200epochs,b256,lr0.2/test
3. Mean Teacher with BN : 12-05-11:55/convlarge,Adam,200epochs,b256,lr0.2/test
4. Hybrid Net : 12-06-10:58/hybridnet,Adam,200epochs,b256,lr0.2/test
5. SNTG + Meant Teacher: 12-07-00:36/convlarge,Adam,200epochs,b256,lr0.2/test

License

This project is licensed under the MIT License. For specific helper function used in this repository please see the license agreement of the Repo linked in Acknowledgement section

Acknowledgments

My implementation has been inspired from the following sources.

  • Mean Teacher : I have mainly followed the Pytorch Version of this Repo
  • SNTG - I have understood the concept of SNTG and converted Theano Implementation to Pytorch
  • Hybrid Network - I have followed this repository to incorporate reconstruction loss in my implementation.

meanteacher-sntg-hybridnet's People

Contributors

isarmad 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.