<a id="easydeeplearning-data-augmentation"></a>

# Using Data Augmentation

Data augmentation performs random transformations on images given to a [`deep learning tool`](../../../doxygen_cpp/classeVision_1_1EasyDeepLearning_1_1EDeepLearningTool.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepLearning_1_1EDeepLearningTool.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepLearning_1_1EDeepLearningTool.html) during the training.

* Experiment different settings to choose the best parameters for your data augmentation.
* Configure data augmentation according to your problem. However, flips, shifts (20 - 40 px), brightness (5%), contrast (0.95 to 1.05) or salt and pepper noise (2%) can be useful on many datasets.
* Check that the transformations do not change the label of an image (for example a defect that disappears because of a rotation or a contrast change).

#### WARNING
With **EasyLocate**, we do not recommend to use rotation and shear data augmentation as it is not possible to compute the minimal bounding box surrounding the object after these geometric transformations.

<a id="easydeeplearning-data-augmentation-dlstudio"></a>

## Deep Learning Studio

* Create and configure the data augmentation settings in the `Data augmentation` tab.
* Display and review the data augmented images with the minimum settings (`Lower limits augmentation`), the maximum settings (`Upper limits augmentation`) or the random settings (`Random augmentation`).

![](assets/images/easydeeplearning/using_data_augmentation_1.webp)

<a id="easydeeplearning-data-augmentation-api"></a>

## API

Use an [`EDataAugmentation`](../../../doxygen_cpp/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html) object to configure the data augmentation settings. You can give this object to the
to enable or disable these transformations or directly use an object [`EDataAugmentation`](../../../doxygen_cpp/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html) that you give to the `Train` method of your tool.

<a id="easydeeplearning-data-augmentation-transformations"></a>

## Available Transformations

<a id="easydeeplearning-data-augmentation-transformations-geometric"></a>

### Geometric Transformations

![image](assets/images/easydeeplearning/using_data_augmentation_2.webp)
* Horizontal and vertical flips (enabled with [`SetEnableHorizontalFlip`](../../../doxygen_cpp/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#aace175e75b61dcbea173e235b50a5268) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a8fdc6b6a999177fd611ce9254109b794) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#ada23754101b4e2c2447140a0c9b71f3c) and [`SetEnableVerticalFlip`](../../../doxygen_cpp/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a470abc5d126a77d12959bae992740fba) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#af55bbc693e422ea453d121291bbb38a9) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a039a2d80ccf9a86e08debd885fbcac06)).
* Scaling (between a minimum and maximum value defined with [`SetMinScale`](../../../doxygen_cpp/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a27b46745debf76383691a0aecab787b8) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a1b472400f25faec8e365c5b02bffe1c7) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a87c52c75d6ef53865405cae96bda99d5) and [`SetMaxScale`](../../../doxygen_cpp/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a3b9468813d641a4902b82373a2c4c442) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#aecbae54d373487c3ce35433037357733) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a1fabf4b60a62c6d3b7940a3ed1783009)).
* Horizontal and vertical shifts (between `–maxValue` and `maxValue` defined with [`SetMaxHorizontalShift`](../../../doxygen_cpp/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a164ebd0cc07b11e1d427474e60e5d33f) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a1ab784f6c375490c88f0b3c260845beb) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a7ddf038ca320a104a93f9a85064e58b5) and [`SetMaxVerticalShift`](../../../doxygen_cpp/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a4a7a239585b325c6c80b74af432e8b3e) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#ae4fa49f5047a6d4f5b4a0007a7ea9103) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a31f5d2d5e53f5124c37a49683d0ce31e)).
* Rotations (between 0 and a maximum value defined with [`SetMaxRotationAngle`](../../../doxygen_cpp/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a89c0a1457a689b0dc1d0f8a4129958cf) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a5a4af26d3040b8d8b8854fc3e1f61cb3) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a50812573e891c315c8c42af210de2968)).
* Horizontal and vertical shear (between –`maxValue` and `maxValue` defined with [`SetMaxHorizontalShear`](../../../doxygen_cpp/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#aa56213ac3ec6410709dc5d2e81073a15) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a565ae3ff59ad04b28b86980c9d94b3ae) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a1158e3c5ee6b3b0fa960e552e74bbc0a) and [`SetMaxVerticalShear`](../../../doxygen_cpp/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#aaea5313fc3c4ed8f3bcfa4bb1a1d7b2b) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#abf26d6b940a8217117dce0e25397c7e3) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#ab9c58fb13701ccfc00e59c5d32051ce0)).

<a id="easydeeplearning-data-augmentation-transformations-color-luminosity"></a>

### Color and Luminosity Transformations

![image](assets/images/easydeeplearning/using_data_augmentation_3.webp)
* Brightness offset (between –`maxValue` and `maxValue` defined with [`SetMaxBrightnessOffset`](../../../doxygen_cpp/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a8ff45b5201281c47426f4fc1ca053006) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#adb898ddf7f4226a5b614858aa2748cbe) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#aa7af007847b37ccf089131ab4fe146d7)).
* Contrast gain (between a minimum and maximum value defined with [`SetMinContrastGain`](../../../doxygen_cpp/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#aba1f262a59a39f9b1f6bd51fa07a4f20) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a8d09214bf6bcc507b22785dd070bb35d) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a87bf269df56823107256188cd83d8745) and [`SetMaxContrastGain`](../../../doxygen_cpp/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#ae20b5d732b9e48f3516e777fdf52a98e) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#af2e0f786cfd52b790a2e6fa67ac07be4) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a3e1a6a398a50151a3718727a125fbc40)).
* Gamma corrections (between a minimum and maximum value defined with [`SetMinGamma`](../../../doxygen_cpp/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a83b4bc86762d3cc23f430abf2cbe0ce4) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a540473d09e9e7fbc7e7970a504cd0f0e) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a7b32b7a79bf52281fe6b131fd546566c) and [`SetMaxGamma`](../../../doxygen_cpp/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a07a0a46ff70905901758ec35cd969aff) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#ad0452ca1e66b79315665ae21c087b8d0) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a2b2fdc5d08ee41ccd012d5d3703d6f8b)).
* Hue offset (between –`maxValue` and `maxValue` defined with [`SetMaxHueOffset`](../../../doxygen_cpp/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a1495ed5c9f78c31b593028af4f4b7fac) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a37412395a7ae0cead3595716258556de) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#aac613f0cca82ae54f2e83e13e02f8b8b)).
* Saturation gain (between a minimum and maximum value defined with [`SetMinSaturationGain`](../../../doxygen_cpp/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#af3f94f4aef91f823577e23fa7218f0e2) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a4e658a092f7c9178f495fe74a3ff38fc) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#aef5e87c7a90c995835cc14bbf87dba07) and [`SetMaxSaturationGain`](../../../doxygen_cpp/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#aaa5629741a79868dd435363a7ba5a0c6) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a48f124604cbc2f3a3e7c7a806dcc1fdb) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a33793aea7fd5bb4bbf1f84b59a53fa9a)).

<a id="easydeeplearning-data-augmentation-transformations-noise"></a>

### Noise Transformations

![image](assets/images/easydeeplearning/using_data_augmentation_4.webp)
* Gaussian noise, also called additive white noise, generated with a standard deviation (between a minimum and maximum value defined with [`SetGaussianNoiseMinimumStandardDeviation`](../../../doxygen_cpp/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a47830f635752ca765e7abd887f4a5b93) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a30e525d22f46d9a0e53606aba0823ca1) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#aa70f451d35375df94a39585a604f6246) and [`SetGaussianNoiseMaximumStandardDeviation`](../../../doxygen_cpp/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a87eb2ec7e069c8305e532cf36bcc8701) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#af12ca07015484ca88dd262a6a0a0eb75) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#aac3c4c6e682fcfa88ef87ff228e03c70)).
* Speckle noise, a multiplicative noise, generated from a Gamma distribution with a mean of 1 and a standard deviation (between a minimum and a maximum value defined with [`SetSpeckleNoiseMinimumStandardDeviation`](../../../doxygen_cpp/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#af1bb4981cd0552ee54564e5b5b4d7483) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#af6c6b928dd158f9fe9baf8e0561e5aec) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a7ef8cdbf349d0bf8c40922222e3529be) and [`SetSpeckleNoiseMinimumStandardDeviation`](../../../doxygen_cpp/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#af1bb4981cd0552ee54564e5b5b4d7483) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#af6c6b928dd158f9fe9baf8e0561e5aec) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a7ef8cdbf349d0bf8c40922222e3529be)).
* Salt and pepper noise generated from a pixel density (between a minimum and a maximum value defined with [`SetSaltAndPepperNoiseMinimumDensity`](../../../doxygen_cpp/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a6e1d3027c138ad415e02dbc1c4a55465) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a9cad84b57135e852550a72b7ba5d35bc) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#a3f8a829620fc3ce2af5a71a82caac0fc) and [`SetSaltAndPepperNoiseMaximumDensity`](../../../doxygen_cpp/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#ab49936529421db1e556e2790f9c0af96) [<sub>.NET</sub>](../../../doxygen_cs/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#af171eae79806f699ef2fabb5b449f77c) [<sub>Python</sub>](../../../doxygen_python/classeVision_1_1EasyDeepLearning_1_1EDataAugmentation.html#aca88265b4c67cb51334876c0968bc7b7)).

#### NOTE
The standard deviation is expressed as a percentage of the maximum pixel value.
