πŸ•ΈοΈ
Deep Learning
  • πŸ’«Deep Learning Notes
  • πŸ’ΌPractical Tools
  • πŸ’ŽConcepts of Neural Networks
    • 🌱Introduction
    • πŸ”ŽThe Problem in General
    • πŸ‘·β€β™€οΈ Implementation Notes
    • πŸ“šCommon Concepts
    • πŸ’₯Activation Functions
    • 🎈Practical Aspects
    • πŸ‘©β€πŸ”§ NN Regularization
    • ✨Optimization Algorithms
    • 🎨Softmax Regression
    • πŸƒβ€β™€οΈ Introduction to Tensorflow
    • πŸ‘©β€πŸ’» Python Code Snippets
  • πŸ™‹β€β™€οΈ Hello World of Deep Learning with Neural Networks
    • 🌱Introduction
    • 🌐CNNs In Browser
  • πŸšͺIntroduction to Computer Vision
    • 🌱Introduction
  • 🚩Concepts of Convolutional Neural Networks
    • 🌱Introduction
    • πŸ“ŒCommon Concepts
    • 🌟Advanced Concepts
    • πŸ‘€Visualization
    • πŸ‘΅Classic Networks
    • ✨Other Approaches
    • πŸ•ΈοΈCommon Applications
  • πŸ‘©β€πŸ’» Works and Notes on CNNs
    • 🌱Introduction
  • πŸ’„Popular Strategies of Deep Learning
    • 🌱Introduction
    • πŸš™Transfer Learning
    • πŸ“šOther Strategies
  • 🀑Image Augmentation
    • 🌱Introduction
  • πŸ€Έβ€β™€οΈ Notes on Applied Machine Learning
    • 🌱Introduction
    • πŸ‘©β€πŸ”§ Notes on Structuring Machine Learning Projects
    • πŸ‘©β€πŸ« Implementation Guidelines
  • πŸ•΅οΈβ€β™€οΈ Basics of Object Detection
    • 🌱Introduction
    • β­•Region-Based CNNs
    • 🀳SSD and YOLO
    • πŸ€–TensorFlow Object Detection API
    • 🐞Model Debugging
  • ➰Sequence Models In Deep Learning
    • 🌱Introduction
    • πŸ“šGeneral Concepts
    • πŸ”„Recurrent Neural Networks
    • 🌌Vanishing Gradients with RNNs
    • 🌚Word Representation
    • πŸ’¬Mixed Info On NLP
  • πŸ’¬NLP
    • 🌱Introduction
  • πŸ’¬Applied NLP
    • πŸ™ŒπŸ» Handling texts
    • 🧩Regex
  • πŸ‘€Quick Visual Info
  • πŸ“šPDFs that I found and recommend
Powered by GitBook
On this page
  • 🚩 Basic Concept of Image Augmentation
  • πŸ€Έβ€β™€οΈ Image Augmentation Techniques
  • βœ… Mirroring
  • 🎨 Color Shifting
  • πŸ“ Shearing Transformation
  • πŸ‘©β€πŸ’» Code Example
  • 🧐 References

Was this helpful?

Export as PDF
  1. Image Augmentation

Introduction

🀑 Concepts of Image Augmentation Technique

  • πŸ’₯ Basics of Image Augmentation which is a technique to avoid overfitting

  • ⭐ When we have got a small dataset we are able to manipluate the dataset without changing the underlying images to open up whole scenarios for training and to be able to train by variuos techniques of image augmentation

Note: Image augmentation is needed for both training and test set πŸ˜…

🚩 Basic Concept of Image Augmentation

πŸ‘©β€πŸ« The concept is very simple though:

If we have limited data, then the chances of you having data to match potential future predictions is also limited, and logically, the less data we have, the less chance we have of getting accurate predictions for data that our model hasn't yet seen.

πŸ™„ If we are training a model to spot cats, and our model has never seen what a cat looks like when lying down, it might not recognize that in future.

  • Augmentation simply amends our images on-the-fly while training using transforms like rotation.

  • So, it could 'simulate' an image of a cat lying down by rotating a 'standing' cat by 90 degrees.

  • As such we get a cheap ✨ way of extending our dataset beyond what we have already.

πŸ”Ž Note: Doing image augmentation in runtime is preferred rather than to do it on memory to keep original data as it is πŸ€”

πŸ€Έβ€β™€οΈ Image Augmentation Techniques

βœ… Mirroring

Flipping the image horizontally

πŸš€ Example

βœ‚ Random Cropping

Picking an image and taking random crops

πŸš€ Example

🎨 Color Shifting

Adding and subtracting some values from color channels

πŸš€ Example

πŸ“ Shearing Transformation

Shear transformation slants the shape of the image

πŸš€ Example

πŸ‘©β€πŸ’» Code Example

The following code is used to do image augmentation

from tensorflow.keras.preprocessing.image import ImageDataGenerator

train_datagenerator = ImageDataGenerator(
      rescale = 1./255,
      rotation_range = 40,
      width_shift_range = 0.2,
      height_shift_range = 0.2,
      shear_range = 0.2,
      zoom_range = 0.2,
      horizontal_flip = True,
      fill_mode = 'nearest')

Parameter

Description

rescale

Rescaling images, NNs work better with normalized data so we rescale images so values are between 0,1

rotation_range

A value in degrees (0–180), a range within which to randomly rotate pictures

Height and width shifting

Randomly shifts pictures vertically or horizontally

shear_range

Randomly applying shearing transformations

zoom_range

Randomly zooming inside pictures

horizontal_flip

Randomly flipping half of the images horizontally

fill_mode

A strategy used for filling in newly created pixels, which can appear after a rotation or a width/height shift.

🧐 References

PreviousImage AugmentationNextπŸ€Έβ€β™€οΈ Notes on Applied Machine Learning

Last updated 4 years ago

Was this helpful?

Full code example is πŸ‘ˆ

🀑
🌱
here 🐾
More About Image Augmentation
More About Image Pre-processing
Detailed Image Augmentation Techniques