Deep Learning Fundamentals - Classic Edition

A newer version of this course is available! Check here for details!

Data Augmentation explained


expand_more chevron_left


expand_more chevron_left

Data augmentation for machine learning

In this post, we'll be discussing data augmentation and under what circumstances we may want to use it.


Data augmentation occurs when we create new data based on modifications of our existing data. Essentially, we're creating new, augmented data by making reasonable modifications to data in our training set.

Data augmentation occurs when we create new data based on modifications of our existing data.

For example, we could augment image data by flipping the images, either horizontally or vertically. We could rotate the images, zoom in or out, crop, or even vary the color of the images. All of these are common data augmentation techniques.

  • Horizontal flip
  • Vertical flip
  • Rotation
  • Zoom in
  • Zoom out
  • Cropping
  • Color variations

Why would we want to do this, though? Why use data augmentation?

Why use data augmentation?

Well, we may just want or need to add more data to our training set. For example, say we have a relatively small amount of samples to include in our training set, and it's difficult to get more. Then we could create new data from our existing data set using data augmentation to create more samples.

Reducing overfitting

Additionally, we may want to use data augmentation to reduce overfitting. Recall, we mentioned this point in our post that covered overfitting.

If our model is overfitting, one technique to reduce it to add more data to the training set. Given the first point we just made a moment ago, we can easily create more data using data augmentation if we don't have access to additional data.

Also, in regards to overfitting, think about if we had a data set full of images of dogs, but most of the dogs were facing to the right.

If a model was trained on these images, it's reasonable to think that the model would believe that only these right-facing dogs were actually dogs. It may very well not classify left-facing dogs as actually being dogs when we deploy this model in the field or use it to predict on test images.

With this, producing new right-facing images of dogs by augmenting the original images of left-facing dogs would be a reasonable modification. We would do this by horizontally flipping the original images to produce new ones.

front facing dog

Now, some data augmentation techniques may not be appropriate to use on our given data set. Sticking with the dog example, we stated that horizontally flipping our dog images makes sense, however, it wouldn't necessarily be reasonable to modify our dog images by vertically flipping them.

In real world images of dogs, it's not really as likely that we'll be seeing many images of dogs flipped upside down on their heads or backs.

Wrapping up

Hopefully now you have an understanding for what data augmentation is and why it would make sense to use it. If you're interested in seeing how to do implement data augmentation in code using Keras, be sure to check out the Keras series where we implement data augmentation.

In that series, we show how to make 10 augmented images from a single original image of a dog by rotating the image, shifting the width and height, zooming, varying the color, and horizontally flipping the image.

This is actually pretty simple to implement when we use Keras' ImageDataGenerator class. You can find out all the necessary technical details for how this is done in this post. I'll see ya in the next one!


expand_more chevron_left
deeplizard logo DEEPLIZARD Message notifications

Quiz Results


expand_more chevron_left
In this video, we explain the concept of data augmentation, as it pertains to machine learning and deep learning. We also point to another resource to show how to implement data augmentation on images in code with Keras. πŸ•’πŸ¦Ž VIDEO SECTIONS πŸ¦ŽπŸ•’ 00:00 Welcome to DEEPLIZARD - Go to for learning resources 00:30 Help deeplizard add video timestamps - See example in the description 02:50 Collective Intelligence and the DEEPLIZARD HIVEMIND πŸ’₯🦎 DEEPLIZARD COMMUNITY RESOURCES 🦎πŸ’₯ πŸ‘‹ Hey, we're Chris and Mandy, the creators of deeplizard! πŸ‘€ CHECK OUT OUR VLOG: πŸ”— πŸ’ͺ CHECK OUT OUR FITNESS CHANNEL: πŸ”— 🧠 Use code DEEPLIZARD at checkout to receive 15% off your first Neurohacker order: πŸ”— ❀️🦎 Special thanks to the following polymaths of the deeplizard hivemind: Mano Prime πŸ‘€ Follow deeplizard: Our vlog: Fitness: Facebook: Instagram: Twitter: Patreon: YouTube: πŸŽ“ Deep Learning with deeplizard: AI Art for Beginners - Deep Learning Dictionary - Deep Learning Fundamentals - Learn TensorFlow - Learn PyTorch - Natural Language Processing - Reinforcement Learning - Generative Adversarial Networks - Stable Diffusion Masterclass - πŸŽ“ Other Courses: DL Fundamentals Classic - Deep Learning Deployment - Data Science - Trading - πŸ›’ Check out products deeplizard recommends on Amazon: πŸ”— πŸ“• Get a FREE 30-day Audible trial and 2 FREE audio books using deeplizard's link: πŸ”— 🎡 deeplizard uses music by Kevin MacLeod πŸ”— ❀️ Please use the knowledge gained from deeplizard content for good, not evil.


expand_more chevron_left
deeplizard logo DEEPLIZARD Message notifications

Update history for this page

Did you know you that deeplizard content is regularly updated and maintained?

  • Updated
  • Maintained

Spot something that needs to be updated? Don't hesitate to let us know. We'll fix it!

All relevant updates for the content on this page are listed below.