data augmentation

Created
TagsData prepare

34) What is data augmentation? Can you give some examples? [src]

Data augmentation is a technique for synthesizing new data by modifying existing data in such a way that the target is not changed, or it is changed in a known way.

Computer vision is one of fields where data augmentation is very useful. There are many modifications that we can do to images:

Each problem needs a customized data augmentation pipeline. For example, on OCR, doing flips will change the text and won’t be beneficial; however, resizes and small rotations may help.

Random oversampling: duplicating the sample for the class with less data
Under sampling: select the sample from the class with more data


Smote: oversampling by x = x+ rand(x-xn)
Bagging: under sampling by random select multiple groups for the same amount of class with less data and combine the performances of multiple models
Sample weight: calculate the sample weight and add to loss

Data augmentation is a technique used to increase the diversity of your dataset by applying various transformations to your existing data. This method helps improve the performance and generalizability of machine learning models, especially in domains where collecting more data is challenging or expensive. Data augmentation is particularly popular in image processing, natural language processing (NLP), and audio analysis but can be applied to any data type. Here are some examples across different domains:

Image Data Augmentation

  1. Rotation: Rotating the image by a certain angle to simulate the effect of viewing the object from different perspectives.
  1. Translation: Shifting the image horizontally or vertically to mimic the object's position changes in the frame.
  1. Rescaling: Adjusting the size of the image to simulate the object being closer or further away.
  1. Flipping: Mirroring the image either horizontally or vertically to increase variability.
  1. Cropping: Cutting out parts of the image and using the crops as new images to focus on different parts of the scene.
  1. Color Jittering: Modifying the colors of the image (e.g., adjusting brightness, contrast, saturation) to simulate different lighting conditions.
  1. Noise Injection: Adding random noise to images to mimic imperfections in the data acquisition process.

Text Data Augmentation

  1. Synonym Replacement: Replacing words with their synonyms to change the text slightly without altering the meaning.
  1. Back Translation: Translating the text into another language and then back to the original language to introduce variability in phrasing.
  1. Sentence Shuffling: Rearranging the sentences in a paragraph to change the structure without affecting the overall narrative.
  1. Word or Character Dropout: Randomly removing words or characters from the text to simulate missing or incomplete data.

Audio Data Augmentation

  1. Time Stretching: Slowing down or speeding up the audio to simulate different speaking rates or musical tempos.
  1. Pitch Shifting: Changing the pitch of the audio without altering the tempo to simulate different voice characteristics or musical keys.
  1. Background Noise Injection: Adding different background sounds (e.g., street noise, cafe ambiance) to simulate various recording environments.
  1. Volume Adjustment: Varying the audio's volume to simulate changes in the speaker's distance or recording levels.

General Techniques

Data augmentation can significantly improve model robustness and generalization by presenting it with a wider variety of examples during training. This helps prevent overfitting, especially in situations where the amount of available training data is limited.