Giter VIP home page Giter VIP logo

blur-training_imagenet16's Introduction

blur-training_imagenet16

Blur-training with 16-class-ImageNet

Blurred images (GaussianBlur)

Training images are blurred by Gaussian function. The images are more blurred as std.(ฯƒ) of Gaussian kernel is bigger. blurred-images

Schedule

You can try different training schedule as for blurring images. Here is an overview of the training schedule: schedule

CNNs Architecture

Default: AlexNet (16 class)
Since the number of class is 16, I change the number of final units from 1000 to 16. See more in notebook/models.ipynb
You can also use another architecture by using --arch [ARCHITECTURE NAME]. See python main.py -h for the available models (from pytorchvision's model zoo).

Preparation

  • Install Python Packages
$ pip install -r requirements.txt

Or pull and run docker image (e.g. blur-training:latest) which I made for these experiments. You may need to install robustness library in the container like:

$ pip install robustness==1.1
  • Get ImageNet images & set the path. If you already have ImageNet, set in_path variable in training/utils.py.
    If not, Download the ImageNet dataset from http://www.image-net.org/
    (Note that the ImageNet images need to be divided in two subdirectories, train/ and val/.)
    Then set the path.

run examples

General usage example:

$ cd training
$ python main.py --arch [ARCHITECTURE NAME] --mode [TRAINING MODE] -n [EXPERIMENT NAME] 

For main.py, you need to use --exp_name or -n option to define your experiment's name. Then the experiment's name is used for managing results under logs/ directory. logs/ directory will automatically be created when you run main.py.
You can choose the training mode from:
normal, all, mix, reversed-single-step, single-step, multi-steps
by using --mode [TRAINING MODE] option.

  • normal
    This mode trains Normal model (default: AlexNet).
    usage example:
$ python main.py --mode normal -e 60 -b 64 --lr 0.01 -n normal
  • all
    This mode blurs ALL images in the training mode.
    usage example:
$ python main.py --mode all -s1 -n all_s1
  • mix
    This mode blurs half training data. usage example:
$ python main.py --mode mix -s 1 -n mix_s1
  • random-mix
    This mode blurs half training data randomly.
    usage example:
$ python main.py --arch alexnet --mode random-mix --min_sigma 0 --max_sigma 5 -n alexnet_random-mix_s0-5
  • single-step
    This mode blurs first half epochs (e.g. first 30 epochs in 60 entire epochs) in the training. usage example:
$ python main.py --mode single-step -s 1 -n single-step_s1
  • multi-steps
    This mode blurs images step by step (e.g. every 10 epochs).
    usage example:
$ python main.py --mode multi-steps -n multi-steps
  • --resume [PATH TO SAVED MODEL]
    This option trains your saved model starting from the latest epoch.
    usage example:
$ python main.py --arch alexnet --mode mix -s 1 -n alexnet_mix_s1 --resume ../logs/models/alexnet_mix_s1/checkpoint.pth.tar 

notebook

Demonstrations of 16-class-ImageNet, GaussianBlur, and CNN model architectures.

citation

Training scripts and functions are based rely on [pytorch tutorial][pytorch-tutorial] and pytorch imagenet trainning example.

blur-training_imagenet16's People

Contributors

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