Skip to content

hanchaow/caffe-augmentation-1

 
 

Repository files navigation

Caffe Augmentation Extension

This is a recent caffe version (2016/05/25, 4bf4b18607) with additional transformation options in ImageData layer. The following transformations have been added to support:

  • min_side - resize and crop preserving aspect ratio, default 0 (disabled);
  • max_rotation_angle - max angle for an image rotation, default 0;
  • contrast_brightness_adjustment - enable/disable contrast adjustment, default false;
  • smooth_filtering - enable/disable smooth filterion, default false;
  • min_contrast - min contrast multiplier (min alpha), default 0.8;
  • max_contrast - min contrast multiplier (max alpha), default 1.2;
  • max_brightness_shift - max brightness shift in positive and negative directions (beta), default 5;
  • max_smooth - max smooth multiplier, default 6;
  • max_color_shift - max color shift along RGB axes
  • apply_probability - how often every transformation should be applied, default 0.5;
  • debug_params - enable/disable printing tranformation parameters, default false;

How to use

You could specify your network prototxt as:

layer {
name: "data"
type: "ImageData"
top: "data"
top: "label"
include {
  phase: TRAIN
}
transform_param {
    mirror: false
    contrast_brightness_adjustment: true
    smooth_filtering: true
    max_rotation_angle: 10
    min_side: 256
    crop_size: 224
    mean_file: "/home/your/imagenet_mean.binaryproto"
    min_contrast: 0.8
    max_contrast: 1.2
    max_smooth: 6
    apply_probability: 0.5
    max_color_shift: 20
    debug_params: false
}
image_data_param {
  source: "/home/your/image/list.txt"
  batch_size: 32
  shuffle: true
}
}

Setup caffe-augmentation

There are two options:

  1. Pull and run docker container:

    $ docker pull kostyaev/caffe-gpu

    $ nvidia-docker run -it kostyaev/caffe-gpu /bin/bash

  2. Install from source code: Clone this repo, adjust Makefile.config and simply run the following commands:

    $ make all -j8

    $ make test -j8

    $ make runtest -j8

For a faster build, compile in parallel by doing make all -j8 where 8 is the number of parallel threads for compilation (a good choice for the number of threads is the number of cores in your machine).

Acknowledgment

This project is based upon @kevinlin311tw's caffe-augmentation, @ChenlongChen's caffe-windows, @ShaharKatz's Caffe-Data-Augmentation, and @senecaur's caffe-rta.

About

Caffe with realtime augmentation extension

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 80.6%
  • Python 9.0%
  • Cuda 5.5%
  • CMake 2.8%
  • MATLAB 0.9%
  • Makefile 0.7%
  • Other 0.5%