{"id":851,"date":"2020-08-31T06:33:28","date_gmt":"2020-08-31T06:33:28","guid":{"rendered":"https:\/\/data-science.gotoauthority.com\/2020\/08\/31\/five-popular-data-augmentation-techniques-in-deep-learning\/"},"modified":"2020-08-31T06:33:28","modified_gmt":"2020-08-31T06:33:28","slug":"five-popular-data-augmentation-techniques-in-deep-learning","status":"publish","type":"post","link":"https:\/\/wealthrevelation.com\/data-science\/2020\/08\/31\/five-popular-data-augmentation-techniques-in-deep-learning\/","title":{"rendered":"Five Popular Data Augmentation techniques In Deep Learning"},"content":{"rendered":"<div id=\"tve_editor\" data-post-id=\"5298\">\n<div class=\"thrv_wrapper tve_image_caption\" data-css=\"tve-u-17442951eb6\"><span class=\"tve_image_frame\"><img src=\"https:\/\/i2.wp.com\/dataaspirant.com\/wp-content\/plugins\/lazy-load\/images\/1x1.trans.gif?ssl=1\" data-lazy-src=\"https:\/\/i1.wp.com\/dataaspirant.com\/wp-content\/uploads\/2020\/08\/1-Data-Augmentation-techniques-in-deep-learning.png?resize=613%2C368&amp;ssl=1\" class=\"tve_image wp-image-5300\" alt=\"Data Augmentation techniques in deep learning\" data-id=\"5300\" width=\"613\" data-init-width=\"750\" height=\"368\" data-init-height=\"450\" title=\"Data Augmentation techniques in deep learning\" loading=\"lazy\" data-width=\"613\" data-height=\"368\" data-recalc-dims=\"1\"><img class=\"tve_image wp-image-5300\" alt=\"Data Augmentation techniques in deep learning\" data-id=\"5300\" width=\"613\" data-init-width=\"750\" height=\"368\" data-init-height=\"450\" title=\"Data Augmentation techniques in deep learning\" loading=\"lazy\" src=\"https:\/\/i1.wp.com\/dataaspirant.com\/wp-content\/uploads\/2020\/08\/1-Data-Augmentation-techniques-in-deep-learning.png?resize=613%2C368&amp;ssl=1\" data-width=\"613\" data-height=\"368\" data-recalc-dims=\"1\"><\/span><\/div>\n<div class=\"thrv_wrapper thrv_text_element tve-froala fr-box fr-basic\">\n<p>As Alan turing said<\/p>\n<blockquote class=\"\"><p>What we want is a machine that can learn from experience.<\/p><\/blockquote>\n<p dir=\"ltr\">The machine gets more learning experience from feeding more data. In particular for deep learning models more data is the key for building high performance models.<\/p>\n<p dir=\"ltr\">If we are not able to feed the right amount of data the deep learning models we build \u00a0face the underfitting issue, Sometime the data we feed needs to be more diversified, else even if we are feeding high amount data, the model will face the <a href=\"https:\/\/dataaspirant.com\/handle-overfitting-deep-learning-models\/\" target=\"_blank\" class=\"tve-froala\" rel=\"noopener noreferrer\">overfitting issue<\/a>.<\/p>\n<p dir=\"ltr\">So we are clear now, we need large amounts of data to build deep learning models but not all the time we will have enough data,\u00a0<\/p>\n<p dir=\"ltr\">So we will stop building the model in such cases.<\/p>\n<p dir=\"ltr\">No right, We need to find ways to use the available data, to generate more data with more diversity. In machine learning to solve the similar kind of problem handling limited data, we use the <a href=\"https:\/\/dataaspirant.com\/handle-imbalanced-data-machine-learning\/\" target=\"_blank\" rel=\"noopener noreferrer\">oversampling method<\/a>.\u00a0<\/p>\n<p dir=\"ltr\">In the same way for building deep learning models we use different data augmentation methods to create more meaningful data which can be used for building deep learning models.<\/p>\n<p dir=\"ltr\">So let\u2019s drive further.<\/p>\n<p dir=\"ltr\">Below are the concepts you are going to learn in this article.<\/p>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<h2 id=\"t-1598844713768\" class=\"\">What is Data Augmentation?<\/h2>\n<p dir=\"ltr\">Data Augmentation is a process of increasing the available limited data to large meaningful and more diversity amounts. In other terms, we are <strong>artificially increasing the size of the dataset by creating different version<\/strong>s of the existing data from our dataset.\u00a0<\/p>\n<p dir=\"ltr\">The main reason for this, as we all know the real world data may not always be in the correct form.\u00a0<\/p>\n<p dir=\"ltr\">For example, consider a car in an image, the car may not be at the center in all cases, sometimes it can be in the left side of the image or right. The image may be clicked on a bright sunny day or on a cloudy day. The image might be the left view of the car or the right view.\u00a0<\/p>\n<p dir=\"ltr\">All these factors affect the model while evaluating an image. The model should be trained in such a way that it can detect the object accurately irrespective of the above factors.\u00a0\u00a0<\/p>\n<p dir=\"ltr\">We can apply data augmentation to different types of data, but in this article we are focusing on the Image Data Augmentation techniques that are used in common. <\/p>\n<h2 id=\"t-1598844713769\" class=\"\">Why do we need Data Augmentation?<\/h2>\n<\/div>\n<div class=\"thrv_wrapper thrv_tw_qs tve_clearfix\" data-url=\"https:\/\/twitter.com\/intent\/tweet\" data-via=\"\" data-use_custom_url=\"\">\n<div class=\"thrv_tw_qs_container\">\n<div class=\"thrv_tw_quote\">\n<p class=\"\">Popular Data Augmentation techniques In Deep Learning<\/p>\n<\/div>\n<p>\n\t\t\t<span><br \/>\n\t\t\t\t<i><\/i><br \/>\n\t\t\t\t<span class=\"thrv_tw_qs_button_text \">Click to Tweet<\/span><br \/>\n\t\t\t<\/span>\n\t\t<\/p>\n<\/div>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<p dir=\"ltr\">Most of the state-of-the-art models contain lots of parameters in the order of millions.<\/p>\n<p dir=\"ltr\">In order to train a model for accurate results we need to have more number of parameters to learn almost all the features from the data. To accommodate all these parameters we need to have a good amount of data. Deep learning models often require more data which is not always available.<\/p>\n<blockquote class=\"\"><p>\u201cWhat do we do if we have less amount of data or imbalance data?\u201d<\/p><\/blockquote>\n<p dir=\"ltr\">We need not dig in google for new images. We can simply use some techniques and generate images which are ten times of our dataset or even more.\u00a0<\/p>\n<p dir=\"ltr\">In case of <a href=\"https:\/\/dataaspirant.com\/handle-imbalanced-data-machine-learning\/\" target=\"_blank\" rel=\"noopener noreferrer\">imbalanced data<\/a> we can generate more images for the class which has less data.<\/p>\n<h2 id=\"t-1598844713770\" class=\"\">Where do we apply Data Augmentation?<\/h2>\n<p dir=\"ltr\">We can apply this technique at the time of the data generation after preprocessing and before training.\u00a0<\/p>\n<p dir=\"ltr\">We apply this technique only for the training dataset. At test time we use the test image directly without any transformations.<\/p>\n<p dir=\"ltr\">For small datasets we can generate the transformations of the images and train the model with all the data at once. For large datasets we can generate unique transformed images for every batch of an epoch.<\/p>\n<h2 class=\"\" id=\"t-1598844713771\">Data Augmentation Techniques<\/h2>\n<\/div>\n<div class=\"thrv_wrapper tve_image_caption\" data-css=\"tve-u-174429b3417\">\n<span class=\"tve_image_frame\"><img src=\"https:\/\/i2.wp.com\/dataaspirant.com\/wp-content\/plugins\/lazy-load\/images\/1x1.trans.gif?ssl=1\" data-lazy-src=\"https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2020\/08\/2-Five-Popular-Data-Augmentation-techniques.png?resize=613%2C368&amp;ssl=1\" class=\"tve_image wp-image-5309\" alt=\"Five Popular Data Augmentation techniques\" data-id=\"5309\" width=\"613\" data-init-width=\"750\" height=\"368\" data-init-height=\"450\" title=\"Five Popular Data Augmentation techniques\" loading=\"lazy\" data-width=\"613\" data-height=\"368\" data-recalc-dims=\"1\"><img class=\"tve_image wp-image-5309\" alt=\"Five Popular Data Augmentation techniques\" data-id=\"5309\" width=\"613\" data-init-width=\"750\" height=\"368\" data-init-height=\"450\" title=\"Five Popular Data Augmentation techniques\" loading=\"lazy\" src=\"https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2020\/08\/2-Five-Popular-Data-Augmentation-techniques.png?resize=613%2C368&amp;ssl=1\" data-width=\"613\" data-height=\"368\" data-recalc-dims=\"1\"><\/span><\/p>\n<p class=\"thrv-inline-text wp-caption-text\">Five Popular Data Augmentation techniques<\/p>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<p dir=\"ltr\">Below are some of the\u00a0 most popular data augmentation widely used in deep learning.<\/p>\n<ol class=\"\">\n<li>Random Rotation.<\/li>\n<li>Flip (Horizontal and Vertical).<\/li>\n<li>Zoom<\/li>\n<li>Random Shift<\/li>\n<li>Brightness<\/li>\n<\/ol>\n<p dir=\"ltr\">To get a better understanding of these data augmentation techniques we are going to use a cat image.<\/p>\n<p dir=\"ltr\">First step is to read it using the <strong>matplotlib library<\/strong>.\u00a0<\/p>\n<p dir=\"ltr\">Below is the code to read the image:<\/p>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<p dir=\"ltr\">We are going to fit the image on the <strong>ImageDataGenerator<\/strong> class from keras which applies the transformations and returns the data in batches.<\/p>\n<p dir=\"ltr\">The ImageDataGenerator needs the input in the shape of (<strong>batch_size, height, width, channels<\/strong>) but the shape of our image is ( <strong>height, width, channels<\/strong>).<\/p>\n<p dir=\"ltr\">So , let&#8217;s reshape our image into the desired shape.<\/p>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<p>We have to create an instance for the ImageDataGenerator and pass these <strong>transformations<\/strong> as parameters.<\/p>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<p dir=\"ltr\">Replace the above code cell with the respective code cells from the below techniques to apply the transformations.<\/p>\n<p dir=\"ltr\">Now we need to pass the image to the data generator flow method which generates the transformations.<\/p>\n<p dir=\"ltr\">After that Let\u2019s view our image using matplotlib without any augmentations.<\/p>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<p>Below is the loaded cat image.<\/p>\n<\/div>\n<div class=\"thrv_wrapper tve_image_caption\" data-css=\"tve-u-17442acd2ee\"><span class=\"tve_image_frame\"><img src=\"https:\/\/i2.wp.com\/dataaspirant.com\/wp-content\/plugins\/lazy-load\/images\/1x1.trans.gif?ssl=1\" data-lazy-src=\"https:\/\/i1.wp.com\/dataaspirant.com\/wp-content\/uploads\/2020\/08\/3-Cat-image-for-data-augmentation.png?resize=418%2C464&amp;ssl=1\" class=\"tve_image wp-image-5321\" alt=\"Cat image for data augmentation\" data-id=\"5321\" width=\"418\" data-init-width=\"418\" height=\"464\" data-init-height=\"464\" title=\"Cat image for data augmentation\" loading=\"lazy\" data-width=\"418\" data-height=\"464\" data-recalc-dims=\"1\"><img class=\"tve_image wp-image-5321\" alt=\"Cat image for data augmentation\" data-id=\"5321\" width=\"418\" data-init-width=\"418\" height=\"464\" data-init-height=\"464\" title=\"Cat image for data augmentation\" loading=\"lazy\" src=\"https:\/\/i1.wp.com\/dataaspirant.com\/wp-content\/uploads\/2020\/08\/3-Cat-image-for-data-augmentation.png?resize=418%2C464&amp;ssl=1\" data-width=\"418\" data-height=\"464\" data-recalc-dims=\"1\"><\/span><\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<p dir=\"ltr\">Now, let&#8217;s dive into the details of the data augmentation techniques and apply them on our image.<\/p>\n<h3 class=\"\" id=\"t-1598844713772\">Random Rotation<\/h3>\n<p dir=\"ltr\">We can rotate the image by applying some angle. Each rotated image is a unique one to the model. The rotation can be applied up to 360 degrees based on the object in the image.\u00a0<\/p>\n<p dir=\"ltr\">For the above example we are applying rotation_range = <strong>50,<\/strong> which means the ImageGenerator considers it as a range <strong>[-50,50]<\/strong> and applies some random angle from the range to the image.<\/p>\n<\/div>\n<div class=\"thrv_wrapper tve_image_caption\" data-css=\"tve-u-17442b0ce05\">\n<span class=\"tve_image_frame\"><img src=\"https:\/\/i2.wp.com\/dataaspirant.com\/wp-content\/plugins\/lazy-load\/images\/1x1.trans.gif?ssl=1\" data-lazy-src=\"https:\/\/i2.wp.com\/dataaspirant.com\/wp-content\/uploads\/2020\/08\/4-rotation-technique.png?resize=613%2C213&amp;ssl=1\" class=\"tve_image wp-image-5326\" alt=\"rotation technique\" data-id=\"5326\" width=\"613\" data-init-width=\"1258\" height=\"213\" data-init-height=\"438\" title=\"rotation technique\" loading=\"lazy\" data-width=\"613\" data-height=\"213\" data-recalc-dims=\"1\"><img class=\"tve_image wp-image-5326\" alt=\"rotation technique\" data-id=\"5326\" width=\"613\" data-init-width=\"1258\" height=\"213\" data-init-height=\"438\" title=\"rotation technique\" loading=\"lazy\" src=\"https:\/\/i2.wp.com\/dataaspirant.com\/wp-content\/uploads\/2020\/08\/4-rotation-technique.png?resize=613%2C213&amp;ssl=1\" data-width=\"613\" data-height=\"213\" data-recalc-dims=\"1\"><\/span><\/p>\n<p class=\"thrv-inline-text wp-caption-text\">Rotation technique<\/p>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<h3 class=\"\" id=\"t-1598844713773\">Flip<\/h3>\n<p dir=\"ltr\">The image can be flipped either horizontally or vertically based on the object in the image.\u00a0<\/p>\n<p dir=\"ltr\">For example, the image of a car cannot be flipped vertically as it results in the upside down car. However, It can be flipped horizontally generating left view and right view of a car.<\/p>\n<p dir=\"ltr\">For some objects we should not flip it vertically as the image may change entirely. The below flip transformation is just for understanding the concept.<\/p>\n<h4 class=\"\">Horizontal Flip<\/h4>\n<\/div>\n<div class=\"thrv_wrapper tve_image_caption\" data-css=\"tve-u-17442b53ec0\">\n<span class=\"tve_image_frame\"><img src=\"https:\/\/i2.wp.com\/dataaspirant.com\/wp-content\/plugins\/lazy-load\/images\/1x1.trans.gif?ssl=1\" data-lazy-src=\"https:\/\/i2.wp.com\/dataaspirant.com\/wp-content\/uploads\/2020\/08\/5-horizontal-flip-technique.png?resize=613%2C326&amp;ssl=1\" class=\"tve_image wp-image-5329\" alt=\"horizontal flip technique\" data-id=\"5329\" width=\"613\" data-init-width=\"1276\" height=\"326\" data-init-height=\"678\" title=\"horizontal flip technique\" loading=\"lazy\" data-width=\"613\" data-height=\"326\" data-recalc-dims=\"1\"><img class=\"tve_image wp-image-5329\" alt=\"horizontal flip technique\" data-id=\"5329\" width=\"613\" data-init-width=\"1276\" height=\"326\" data-init-height=\"678\" title=\"horizontal flip technique\" loading=\"lazy\" src=\"https:\/\/i2.wp.com\/dataaspirant.com\/wp-content\/uploads\/2020\/08\/5-horizontal-flip-technique.png?resize=613%2C326&amp;ssl=1\" data-width=\"613\" data-height=\"326\" data-recalc-dims=\"1\"><\/span><\/p>\n<p class=\"thrv-inline-text wp-caption-text\">Horizontal flip technique<\/p>\n<\/div>\n<div class=\"thrv_wrapper tve_image_caption\" data-css=\"tve-u-17442b6f4b7\">\n<span class=\"tve_image_frame\"><img src=\"https:\/\/i2.wp.com\/dataaspirant.com\/wp-content\/plugins\/lazy-load\/images\/1x1.trans.gif?ssl=1\" data-lazy-src=\"https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2020\/08\/6-vertical-flip-technique.png?resize=613%2C325&amp;ssl=1\" class=\"tve_image wp-image-5331\" alt=\"vertical flip technique\" data-id=\"5331\" width=\"613\" data-init-width=\"1264\" height=\"325\" data-init-height=\"670\" title=\"vertical flip technique\" loading=\"lazy\" data-width=\"613\" data-height=\"325\" data-recalc-dims=\"1\"><img class=\"tve_image wp-image-5331\" alt=\"vertical flip technique\" data-id=\"5331\" width=\"613\" data-init-width=\"1264\" height=\"325\" data-init-height=\"670\" title=\"vertical flip technique\" loading=\"lazy\" src=\"https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2020\/08\/6-vertical-flip-technique.png?resize=613%2C325&amp;ssl=1\" data-width=\"613\" data-height=\"325\" data-recalc-dims=\"1\"><\/span><\/p>\n<p class=\"thrv-inline-text wp-caption-text\">Vertical flip technique<\/p>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<h3 id=\"t-1598844713774\" class=\"\">Zoom<\/h3>\n<p dir=\"ltr\">The image can be zoomed in or out with the zoom Augmentation.<\/p>\n<p dir=\"ltr\">ImageDataGenerator class accepts a single float value or a list of 2 values:<\/p>\n<ul class=\"\">\n<li>If a single value is given then the zoom range is <strong>[1-value, 1+value]<\/strong>.\u00a0<\/li>\n<li>If a list is given then one value is taken as lower limit and the other as upper limit.<\/li>\n<\/ul>\n<p dir=\"ltr\">The image is <strong>randomly zoomed<\/strong> in or out within the given range.<\/p>\n<\/div>\n<div class=\"thrv_wrapper tve_image_caption\" data-css=\"tve-u-17442b9a336\">\n<span class=\"tve_image_frame\"><img src=\"https:\/\/i2.wp.com\/dataaspirant.com\/wp-content\/plugins\/lazy-load\/images\/1x1.trans.gif?ssl=1\" data-lazy-src=\"https:\/\/i2.wp.com\/dataaspirant.com\/wp-content\/uploads\/2020\/08\/7-zoom-technique.png?resize=613%2C216&amp;ssl=1\" class=\"tve_image wp-image-5335\" alt=\"zoom technique\" data-id=\"5335\" width=\"613\" data-init-width=\"1258\" height=\"216\" data-init-height=\"444\" title=\"zoom technique\" loading=\"lazy\" data-width=\"613\" data-height=\"216\" data-recalc-dims=\"1\"><img class=\"tve_image wp-image-5335\" alt=\"zoom technique\" data-id=\"5335\" width=\"613\" data-init-width=\"1258\" height=\"216\" data-init-height=\"444\" title=\"zoom technique\" loading=\"lazy\" src=\"https:\/\/i2.wp.com\/dataaspirant.com\/wp-content\/uploads\/2020\/08\/7-zoom-technique.png?resize=613%2C216&amp;ssl=1\" data-width=\"613\" data-height=\"216\" data-recalc-dims=\"1\"><\/span><\/p>\n<p class=\"thrv-inline-text wp-caption-text\">Zoom technique<\/p>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<h3 id=\"t-1598844713775\" class=\"\">Random Shift<\/h3>\n<p dir=\"ltr\">The pixels of the image can be shifted horizontally or vertically.<\/p>\n<p dir=\"ltr\">ImageDataGenerator class accepts two types of values(float and int):<\/p>\n<ul class=\"\">\n<li>If float value is given then it considers the value as percentage of width or height to shift the image.\u00a0<\/li>\n<li>If int value is given then it shifts the pixels of the height or width by that value.<\/li>\n<\/ul>\n<h4 class=\"\">Width Shift<\/h4>\n<p dir=\"ltr\">The width_shift_range shifts the pixels horizontally either to the left or to the right randomly.<\/p>\n<\/div>\n<div class=\"thrv_wrapper tve_image_caption\" data-css=\"tve-u-17442bc5a5c\">\n<span class=\"tve_image_frame\"><img src=\"https:\/\/i2.wp.com\/dataaspirant.com\/wp-content\/plugins\/lazy-load\/images\/1x1.trans.gif?ssl=1\" data-lazy-src=\"https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2020\/08\/8-Width-shift-technique.png?resize=613%2C211&amp;ssl=1\" class=\"tve_image wp-image-5339\" alt=\"Width shift technique\" data-id=\"5339\" width=\"613\" data-init-width=\"1256\" height=\"211\" data-init-height=\"432\" title=\"Width shift technique\" loading=\"lazy\" data-width=\"613\" data-height=\"211\" data-recalc-dims=\"1\"><img class=\"tve_image wp-image-5339\" alt=\"Width shift technique\" data-id=\"5339\" width=\"613\" data-init-width=\"1256\" height=\"211\" data-init-height=\"432\" title=\"Width shift technique\" loading=\"lazy\" src=\"https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2020\/08\/8-Width-shift-technique.png?resize=613%2C211&amp;ssl=1\" data-width=\"613\" data-height=\"211\" data-recalc-dims=\"1\"><\/span><\/p>\n<p class=\"thrv-inline-text wp-caption-text\">Width shift technique<\/p>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<h4 class=\"\">Height Shift<\/h4>\n<p dir=\"ltr\">The height_shift_range shifts the pixels vertically either to the top or to the bottom randomly.<\/p>\n<\/div>\n<div class=\"thrv_wrapper tve_image_caption\" data-css=\"tve-u-17442bef7fa\">\n<span class=\"tve_image_frame\"><img src=\"https:\/\/i2.wp.com\/dataaspirant.com\/wp-content\/plugins\/lazy-load\/images\/1x1.trans.gif?ssl=1\" data-lazy-src=\"https:\/\/i1.wp.com\/dataaspirant.com\/wp-content\/uploads\/2020\/08\/9-hight-shift-technique.png?resize=613%2C216&amp;ssl=1\" class=\"tve_image wp-image-5342\" alt=\"hight shift technique\" data-id=\"5342\" width=\"613\" data-init-width=\"1282\" height=\"216\" data-init-height=\"452\" title=\"hight shift technique\" loading=\"lazy\" data-width=\"613\" data-height=\"216\" data-recalc-dims=\"1\"><img class=\"tve_image wp-image-5342\" alt=\"hight shift technique\" data-id=\"5342\" width=\"613\" data-init-width=\"1282\" height=\"216\" data-init-height=\"452\" title=\"hight shift technique\" loading=\"lazy\" src=\"https:\/\/i1.wp.com\/dataaspirant.com\/wp-content\/uploads\/2020\/08\/9-hight-shift-technique.png?resize=613%2C216&amp;ssl=1\" data-width=\"613\" data-height=\"216\" data-recalc-dims=\"1\"><\/span><\/p>\n<p class=\"thrv-inline-text wp-caption-text\">Hight shift technique<\/p>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<h3 class=\"\" id=\"t-1598844713776\">Brightness<\/h3>\n<p dir=\"ltr\">Brightness is an important factor when training the model. We are not sure that the images are always taken in better lighting. So, our model needs to identify the object even with the least resolution.\u00a0<\/p>\n<p dir=\"ltr\">ImageDataGenerator class accepts a range of values and sets the <strong>brightness<\/strong> of an image randomly from that range.<\/p>\n<\/div>\n<div class=\"thrv_wrapper tve_image_caption\" data-css=\"tve-u-17442c11334\">\n<span class=\"tve_image_frame\"><img src=\"https:\/\/i2.wp.com\/dataaspirant.com\/wp-content\/plugins\/lazy-load\/images\/1x1.trans.gif?ssl=1\" data-lazy-src=\"https:\/\/i1.wp.com\/dataaspirant.com\/wp-content\/uploads\/2020\/08\/10-brightness-technique.png?resize=613%2C216&amp;ssl=1\" class=\"tve_image wp-image-5344\" alt=\"Brightness technique\" data-id=\"5344\" width=\"613\" data-init-width=\"1278\" height=\"216\" data-init-height=\"450\" title=\"brightness technique\" loading=\"lazy\" data-width=\"613\" data-height=\"216\" data-recalc-dims=\"1\"><img class=\"tve_image wp-image-5344\" alt=\"Brightness technique\" data-id=\"5344\" width=\"613\" data-init-width=\"1278\" height=\"216\" data-init-height=\"450\" title=\"brightness technique\" loading=\"lazy\" src=\"https:\/\/i1.wp.com\/dataaspirant.com\/wp-content\/uploads\/2020\/08\/10-brightness-technique.png?resize=613%2C216&amp;ssl=1\" data-width=\"613\" data-height=\"216\" data-recalc-dims=\"1\"><\/span><\/p>\n<p class=\"thrv-inline-text wp-caption-text\">Brightness technique<\/p>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<p dir=\"ltr\">We can apply all these transformations at a time based on the context of our dataset.<\/p>\n<p dir=\"ltr\">Below is the complete code for the Data Augmentation.<\/p>\n<h2 class=\"\" id=\"t-1598844713777\">Complete Code<\/h2>\n<\/div>\n<div class=\"thrv_wrapper thrv_text_element\">\n<h2 class=\"\" id=\"t-1598844713778\">Conclusion<\/h2>\n<p dir=\"ltr\">More models are being trained everyday with some accuracy. But only the models which give accurate results are rewarded the best. The above Augmentation techniques help in generalizing the model by preventing the overfitting and in turn increases the accuracy of the model.<\/p>\n<p dir=\"ltr\">These techniques can be applicable only for the Computer Vision problems with image datasets. There are also techniques to generate synthetic data for other types of datasets also. <\/p>\n<p dir=\"ltr\">Try the one which better suits your problem and obtain state of the art accuracy for your models.<\/p>\n<h4>Recommended Deep Learning courses<\/h4>\n<\/div>\n<div class=\"thrv_wrapper thrv-page-section thrv-lp-block\" data-inherit-lp-settings=\"1\" data-css=\"tve-u-17442ef3549\" data-keep-css_id=\"1\">\n<div class=\"tve-page-section-in tve_empty_dropzone  \" data-css=\"tve-u-17442ef385c\">\n<div class=\"thrv_wrapper thrv-columns dynamic-group-kbt3q0q7\" data-css=\"tve-u-17442ef354b\">\n<div class=\"tcb-flex-row v-2 tcb--cols--3 tcb-medium-no-wrap tcb-mobile-wrap m-edit\" data-css=\"tve-u-17442ef354c\">\n<div class=\"tcb-flex-col\">\n<div class=\"tcb-col dynamic-group-kbt3pyfd\" data-css=\"tve-u-17442ef354d\">\n<div class=\"thrv_wrapper thrv_contentbox_shortcode thrv-content-box tve-elem-default-pad dynamic-group-kbt3pwhk\" data-css=\"tve-u-17442ef354e\">\n<div class=\"tve-cb\">\n<div class=\"thrv_wrapper tve_image_caption dynamic-group-kbt3pu4z\" data-css=\"tve-u-17442ef3559\"><span class=\"tve_image_frame\"><a href=\"https:\/\/dataaspirant.com\/recommends\/ds-courses\/coursera-deep-learning-specialisation\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img src=\"https:\/\/i2.wp.com\/dataaspirant.com\/wp-content\/plugins\/lazy-load\/images\/1x1.trans.gif?ssl=1\" data-lazy-src=\"https:\/\/i1.wp.com\/dataaspirant.com\/wp-content\/uploads\/2020\/08\/deeplearning-coursera.jpeg?resize=172%2C172&amp;ssl=1\" class=\"tve_image wp-image-5165\" alt=\"Deep Learning Coursera\" data-id=\"5165\" width=\"172\" data-init-width=\"1200\" height=\"172\" data-init-height=\"1200\" title=\"deeplearning coursera\" loading=\"lazy\" data-width=\"172\" data-height=\"172\" data-css=\"tve-u-17442ef355a\" data-link-wrap=\"true\" data-recalc-dims=\"1\"><img class=\"tve_image wp-image-5165\" alt=\"Deep Learning Coursera\" data-id=\"5165\" width=\"172\" data-init-width=\"1200\" height=\"172\" data-init-height=\"1200\" title=\"deeplearning coursera\" loading=\"lazy\" src=\"https:\/\/i1.wp.com\/dataaspirant.com\/wp-content\/uploads\/2020\/08\/deeplearning-coursera.jpeg?resize=172%2C172&amp;ssl=1\" data-width=\"172\" data-height=\"172\" data-css=\"tve-u-17442ef355a\" data-link-wrap=\"true\" data-recalc-dims=\"1\"><\/a><span class=\"tve-image-overlay\"><\/span><\/span><\/div>\n<h4 class=\"\" data-css=\"tve-u-17442ef355c\">Deep Learning Specializations<\/h4>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"tcb-flex-col\">\n<div class=\"tcb-col dynamic-group-kbt3pyfd\" data-css=\"tve-u-17442ef354d\">\n<div class=\"thrv_wrapper thrv_contentbox_shortcode thrv-content-box tve-elem-default-pad dynamic-group-kbt3pwhk\" data-css=\"tve-u-17442ef3568\">\n<div class=\"tve-cb\">\n<div class=\"thrv_wrapper tve_image_caption dynamic-group-kbt3pu4z\" data-css=\"tve-u-17442ef3569\"><span class=\"tve_image_frame\"><a href=\"https:\/\/dataaspirant.com\/recommends\/ds-courses\/udemy-deeplearning-tensorflow\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img src=\"https:\/\/i2.wp.com\/dataaspirant.com\/wp-content\/plugins\/lazy-load\/images\/1x1.trans.gif?ssl=1\" data-lazy-src=\"https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2020\/08\/tensorflow-course.png?resize=172%2C172&amp;ssl=1\" class=\"tve_image wp-image-5175\" alt=\"Tensorflow Course\" data-id=\"5175\" width=\"172\" data-init-width=\"150\" height=\"172\" data-init-height=\"150\" title=\"tensorflow course\" loading=\"lazy\" data-width=\"172\" data-height=\"172\" data-css=\"tve-u-17442ef356b\" data-link-wrap=\"true\" data-recalc-dims=\"1\"><img class=\"tve_image wp-image-5175\" alt=\"Tensorflow Course\" data-id=\"5175\" width=\"172\" data-init-width=\"150\" height=\"172\" data-init-height=\"150\" title=\"tensorflow course\" loading=\"lazy\" src=\"https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2020\/08\/tensorflow-course.png?resize=172%2C172&amp;ssl=1\" data-width=\"172\" data-height=\"172\" data-css=\"tve-u-17442ef356b\" data-link-wrap=\"true\" data-recalc-dims=\"1\"><\/a><span class=\"tve-image-overlay\"><\/span><\/span><\/div>\n<h4 class=\"\" data-css=\"tve-u-17442ef356d\">Deep Learning With TensorFlow<\/h4>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"tcb-flex-col\">\n<div class=\"tcb-col dynamic-group-kbt3pyfd\" data-css=\"tve-u-17442ef354d\">\n<div class=\"thrv_wrapper thrv_contentbox_shortcode thrv-content-box tve-elem-default-pad dynamic-group-kbt3pwhk\" data-css=\"tve-u-17442ef3578\">\n<div class=\"tve-cb\">\n<div class=\"thrv_wrapper tve_image_caption dynamic-group-kbt3pu4z\" data-css=\"tve-u-17442ef3579\"><span class=\"tve_image_frame\"><a href=\"https:\/\/dataaspirant.com\/recommends\/ds-courses\/udemy-deep-learning-course\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><img src=\"https:\/\/i2.wp.com\/dataaspirant.com\/wp-content\/plugins\/lazy-load\/images\/1x1.trans.gif?ssl=1\" data-lazy-src=\"https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2020\/08\/deeplearning-course.jpg?resize=172%2C172&amp;ssl=1\" class=\"tve_image wp-image-5170\" alt=\"Deep Learning python\" data-id=\"5170\" width=\"172\" data-init-width=\"150\" height=\"172\" data-init-height=\"150\" title=\"deeplearning-course\" loading=\"lazy\" data-width=\"172\" data-height=\"172\" data-css=\"tve-u-17442ef357a\" data-link-wrap=\"true\" data-recalc-dims=\"1\"><img class=\"tve_image wp-image-5170\" alt=\"Deep Learning python\" data-id=\"5170\" width=\"172\" data-init-width=\"150\" height=\"172\" data-init-height=\"150\" title=\"deeplearning-course\" loading=\"lazy\" src=\"https:\/\/i0.wp.com\/dataaspirant.com\/wp-content\/uploads\/2020\/08\/deeplearning-course.jpg?resize=172%2C172&amp;ssl=1\" data-width=\"172\" data-height=\"172\" data-css=\"tve-u-17442ef357a\" data-link-wrap=\"true\" data-recalc-dims=\"1\"><\/a><span class=\"tve-image-overlay\"><\/span><\/span><\/div>\n<h4 class=\"\" data-css=\"tve-u-17442ef357c\">Deep Learning A to Z Python Course<\/h4>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/dataaspirant.com\/data-augmentation-techniques-deep-learning\/<\/p>\n","protected":false},"author":0,"featured_media":852,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/wealthrevelation.com\/data-science\/wp-json\/wp\/v2\/posts\/851"}],"collection":[{"href":"https:\/\/wealthrevelation.com\/data-science\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wealthrevelation.com\/data-science\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/wealthrevelation.com\/data-science\/wp-json\/wp\/v2\/comments?post=851"}],"version-history":[{"count":0,"href":"https:\/\/wealthrevelation.com\/data-science\/wp-json\/wp\/v2\/posts\/851\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wealthrevelation.com\/data-science\/wp-json\/wp\/v2\/media\/852"}],"wp:attachment":[{"href":"https:\/\/wealthrevelation.com\/data-science\/wp-json\/wp\/v2\/media?parent=851"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wealthrevelation.com\/data-science\/wp-json\/wp\/v2\/categories?post=851"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wealthrevelation.com\/data-science\/wp-json\/wp\/v2\/tags?post=851"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}