Giter VIP home page Giter VIP logo

blur-training_imagenet's Introduction

Blur-Training with 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

Preparation

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

Or pull and run docker image (e.g. blur-training:latest) I made for this training.

  • Get ImageNet images & set the path. If you already have ImageNet, set IMAGENET_PATH variable in training/main.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/ 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 --arch alexnet --mode normal -e 60 -b 64 --lr 0.01 -n alexnet_normal

You can also specify GPU by --gpu.
(You don't need it if you have only single GPU in your machine.)

$ python -u main.py --gpu 0 -a alexnet --mode normal -n alexnet_normal
  • all
    This mode blurs ALL images in the training mode.
    usage example:
$ python main.py --arch alexnet --mode all -s1 -n alexnet_all_s1
  • mix
    This mode blurs half training data. usage example:
$ python main.py --arch alexnet --mode mix -s 1 -n alexnet_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 --arch alexnet --mode single-step -s 1 -n alexnet_single-step_s1
  • fixed-single-step
    This mode blurs first half epochs in the training, then fixes the weights of 1st Conv layer. usage example:
python -u main.py -a alexnet --mode fixed-single-step -s 1 -n alexnet_fixed-single-step_s1
  • reversed-single-step
    This mode is reversed order of single-step (blurs second half epochs). usage example:
$ python -u main.py -a alexnet --mode reversed-single-step --reverse_sigma 1 -n alexnet_reversed-single-step_s1
  • multi-steps
    This mode blurs images step by step (e.g. every 10 epochs).
    usage example:
$ python main.py --arch alexnet --mode multi-steps -n alexnet_multi-steps
  • --blur_val
    This option blurs validation data as well. usage example:
$ python main.py --arch alexnet --mode mix -s 1 --blur_val -n alexnet_mix_lur-val_s1
  • --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 

Multi GPUs

If you want to use multi GPUs trainig, see pytorch imagenet trainning example. e.g.:

$ python main.py -a resnet50 --seed 42 --lr 0.2 --mode normal --epochs 60 -b 512 --dist_url 'tcp://127.0.0.1:10000' --dist_backend 'nccl' --multiprocessing_distributed --world_size 1 --rank 0 -n resnet50_normal_b512

citation

Training scripts and functions are based on pytorch tutorial and pytorch imagenet trainning example.

blur-training_imagenet'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.