All Projects → yu4u → Cutout Random Erasing

yu4u / Cutout Random Erasing

Licence: mit
Cutout / Random Erasing implementation, especially for ImageDataGenerator in Keras

Projects that are alternatives of or similar to Cutout Random Erasing

Python Tutorial Notebooks
Python tutorials as Jupyter Notebooks for NLP, ML, AI
Stars: ✭ 52 (-63.38%)
Mutual labels:  jupyter-notebook, deeplearning
Mit Deep Learning
Tutorials, assignments, and competitions for MIT Deep Learning related courses.
Stars: ✭ 8,912 (+6176.06%)
Mutual labels:  jupyter-notebook, deeplearning
Polyaxon Examples
Code for polyaxon tutorials and examples
Stars: ✭ 57 (-59.86%)
Mutual labels:  jupyter-notebook, deeplearning
Keras basic
keras를 이용한 딥러닝 기초 학습
Stars: ✭ 39 (-72.54%)
Mutual labels:  jupyter-notebook, deeplearning
Ngsim env
Learning human driver models from NGSIM data with imitation learning.
Stars: ✭ 96 (-32.39%)
Mutual labels:  jupyter-notebook, deeplearning
Adaptive Multispeaker Separation
Adaptive and Focusing Neural Layers for Multi-Speaker Separation Problem
Stars: ✭ 42 (-70.42%)
Mutual labels:  jupyter-notebook, deeplearning
Deep learning for biologists with keras
tutorials made for biologists to learn deep learning
Stars: ✭ 74 (-47.89%)
Mutual labels:  jupyter-notebook, deeplearning
Advanced Gradient Obfuscating
Take further steps in the arms race of adversarial examples with only preprocessing.
Stars: ✭ 28 (-80.28%)
Mutual labels:  jupyter-notebook, deeplearning
Classification Of Hyperspectral Image
Classification of the Hyperspectral Image Indian Pines with Convolutional Neural Network
Stars: ✭ 93 (-34.51%)
Mutual labels:  jupyter-notebook, deeplearning
Machine learning code
机器学习与深度学习算法示例
Stars: ✭ 88 (-38.03%)
Mutual labels:  jupyter-notebook, deeplearning
Coursera Natural Language Processing Specialization
Programming assignments from all courses in the Coursera Natural Language Processing Specialization offered by deeplearning.ai.
Stars: ✭ 39 (-72.54%)
Mutual labels:  jupyter-notebook, deeplearning
Seq2seq tutorial
Code For Medium Article "How To Create Data Products That Are Magical Using Sequence-to-Sequence Models"
Stars: ✭ 132 (-7.04%)
Mutual labels:  jupyter-notebook, deeplearning
Relativistic Average Gan Keras
The implementation of Relativistic average GAN with Keras
Stars: ✭ 36 (-74.65%)
Mutual labels:  jupyter-notebook, deeplearning
Algorithmmap
建立你的算法地图:如何高效学习算法;算法工程师:从小白到专家
Stars: ✭ 47 (-66.9%)
Mutual labels:  jupyter-notebook, deeplearning
Minecraft Reinforcement Learning
Deep Recurrent Q-Learning vs Deep Q Learning on a simple Partially Observable Markov Decision Process with Minecraft
Stars: ✭ 33 (-76.76%)
Mutual labels:  jupyter-notebook, deeplearning
Sru Deeplearning Workshop
دوره 12 ساعته یادگیری عمیق با چارچوب Keras
Stars: ✭ 66 (-53.52%)
Mutual labels:  jupyter-notebook, deeplearning
Concise Ipython Notebooks For Deep Learning
Ipython Notebooks for solving problems like classification, segmentation, generation using latest Deep learning algorithms on different publicly available text and image data-sets.
Stars: ✭ 23 (-83.8%)
Mutual labels:  jupyter-notebook, deeplearning
Servenet
Service Classification based on Service Description
Stars: ✭ 21 (-85.21%)
Mutual labels:  jupyter-notebook, deeplearning
Novel Deep Learning Model For Traffic Sign Detection Using Capsule Networks
capsule networks that achieves outstanding performance on the German traffic sign dataset
Stars: ✭ 88 (-38.03%)
Mutual labels:  jupyter-notebook, deeplearning
Spectralnormalizationkeras
Spectral Normalization for Keras Dense and Convolution Layers
Stars: ✭ 100 (-29.58%)
Mutual labels:  jupyter-notebook, deeplearning

Cutout / Random Erasing

This is a Cutout [1] / Random Erasing [2] implementation. In particular, it is easily used with ImageDataGenerator in Keras. Please check random_eraser.py for implementation details.

About Cutout / Random Erasing

Cutout or Random Erasing is a kind of image augmentation methods for convolutional neural networks (CNN). They are very similar methods and were proposed almost at the same time.

They try to regularize models using training images that are randomly masked with random values.

Usage

With ImageDataGenerator in Keras

It is very easy to use if you are using ImageDataGenerator in Keras; get eraser function by get_random_eraser(), and then pass it to ImageDataGenerator as preprocessing_function. By doing so, all images are randomly erased before standard augmentation done by ImageDataGenerator.

Please check cifar10_resnet.py, which is imported from official Keras examples.

What I did is adding only two lines:

...
from random_eraser import get_random_eraser  # added
...

    datagen = ImageDataGenerator(
    ...
        preprocessing_function=get_random_eraser(v_l=0, v_h=1))  # added

Erase a single image

Of cause, you can erase a single image using eraser function. Please note that eraser function works in inplace mode; the input image itself will be modified (therefore, img = eraser(img) can be replaced by eraser(img) in the following example).

from random_eraser import get_random_eraser
eraser = get_random_eraser()

# load image to img
img = eraser(img)

Pleae check example.ipynb for complete example.

Parameters

Parameters are fully configurable as:

get_random_eraser(p=0.5, s_l=0.02, s_h=0.4, r_1=0.3, r_2=1/0.3,
                  v_l=0, v_h=255, pixel_level=False)
  • p : the probability that random erasing is performed
  • s_l, s_h : minimum / maximum proportion of erased area against input image
  • r_1, r_2 : minimum / maximum aspect ratio of erased area
  • v_l, v_h : minimum / maximum value for erased area
  • pixel_level : pixel-level randomization for erased area

Results

The original cifar10_resnet.py result (w/o cutout / random erasing):

Test loss: 0.539187009859
Test accuracy: 0.9077

With cutout / random erasing:

Test loss: 0.445597583055
Test accuracy: 0.9182

With cutout / random erasing (pixel-level):

Test loss: 0.446407950497
Test accuracy: 0.9213

References

[1] T. DeVries and G. W. Taylor, "Improved Regularization of Convolutional Neural Networks with Cutout," in arXiv:1708.04552, 2017.

[2] Z. Zhong, L. Zheng, G. Kang, S. Li, and Y. Yang, "Random Erasing Data Augmentation," in arXiv:1708.04896, 2017.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].