Giter Site home page Giter Site logo

fbuchert / mixmatch-pytorch Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 77 KB

PyTorch implementation of MixMatch: A Holistic Approach to Semi-Supervised Learning

License: MIT License

Python 100.00%
semi-supervised-learning deep-learning deep-neural-networks image-classification machine-learning computer-vision

mixmatch-pytorch's Introduction

PyTorch Implementation: MixMatch

License

PyTorch implementation of MixMatch: MixMatch: A Holistic Approach to Semi-Supervised Learning based on the official tensorflow implementation.

The implementation supports the following datasets:

  • CIFAR-10 / CIFAR-100
  • SVHN
  • Caltech101 / Caltech256
  • STL10
  • HAM10000
  • ImageNet

Installation

Required python packages are listed in requirements.txt. All dependencies can be installed using pip

pip install -r requirements.txt

or using conda

conda install --file requirements.txt

Training

MixMatch training (default configuration) is started by running the following command (--pbar to show progress bar during training):

python main.py --pbar

Configuration

All commandline arguments, which can be used to adapt the configuration of MixMatch are defined and described in arguments.py. By default the following MixMatch configuration is run:

model: 'wide_resnet28_2'
dataset: 'cifar10'
lr: 0.002
wd: 0.00004
num_labeled: 250 (number of labeled samples, i.e. 25 labeled samples per class for cifar10)
epochs: 1024
iters_per_epoch: 1024
batch_size: 64
device: 'cuda'
out_dir: 'mixmatch'
mu: 1
temperature: 0.5
num_augmentations: 2
wu: 75
alpha: 0.75

In addition to these, the following arguments can be used to further configure the MixMatch training process:

  • --device <cuda / cpu>: Specify whether training should be run on GPU (if available) or CPU
  • --num-workers <num_workers>: Number of workers used by torch dataloader
  • --resume <path to run_folder>: Resumes training of training run saved at specified path, e.g. 'out/mixmatch_training/run_0'. Dataset splits, model state, optimizer state, etc. are loaded and training is resumed with specified arguments.

Alternatively, the polyaxon.yaml-file can be used to start MixMatch training on a polyaxon-cluster:

polyaxon run -f polyaxon.yaml -u

For a general introduction to polyaxon and its commandline client, please refer to the official documentation

Monitoring

The training progress (loss, accuracy, etc.) can be monitored using tensorboard as follows:

tensorboard --logdir <result_folder>

This starts a tensorboard instance at localhost:6006, which can be opened in any common browser.

Evaluation

A trained MixMatch model can be evaluated by running:

 python3 eval.py --run-path out/mixmatch_training/run_0 --pbar --device <cuda / cpu>

where --run-path specifies the path at which the run to be evaluated is saved. Alternatively, one can also check all metrics over all epochs using the tensorboard file.

References

@article{berthelot2019mixmatch,
  title={MixMatch: A Holistic Approach to Semi-Supervised Learning},
  author={Berthelot, David and Carlini, Nicholas and Goodfellow, Ian and Papernot, Nicolas and Oliver, Avital and Raffel, Colin},
  journal={arXiv preprint arXiv:1905.02249},
  year={2019}
}

mixmatch-pytorch's People

Contributors

fbuchert avatar

Stargazers

Wang Jie 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.