Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RandAugment and TrivialAugment to auto_aug module #4704

Merged
merged 2 commits into from
Mar 14, 2023

Conversation

stiepan
Copy link
Member

@stiepan stiepan commented Mar 10, 2023

Category:

New feature (non-breaking change which adds functionality)

Description:

Add RandAugment (https://arxiv.org/abs/1909.13719) and TrivialAugment (https://arxiv.org/abs/2103.10158).
The first selects, for each sample, uniformy at random, N operations out of the set of augmentations and applies them. Each augmentation uses magnitude (intuitevely strength) M that is fixed throught execution and common for all samples and ops. (The magnitude may still be randomly negated though, based on the augmentation specifcation).

TrivialAugment uses N=1 but the magnitudes are randomly sampled per sample (per iteration).

Additional information:

For context: augmentations used by RA, TA (and AA) are DALI-based python functions that take sample and a parameter. They are decorated with @agumentation which takes care of providing the parameter based only on the magnitude_bin, i.e. an int from [0, num_magnitude_bins-1] range, so that the RA/TA/AA schemes can in abstract way control parameters of different operations.
The necessary augmentations are defined here: https://github.com/NVIDIA/DALI/blob/main/dali/python/nvidia/dali/auto_aug/augmentations.py

The trivial_augment_wide and rand_augment run the suites with default set of augmentations based on the papers, the apply_trivial_augment and apply_rand_augment accept the custom list of augmentations to apply.

Affected modules and functionalities:

Key points relevant for the review:

Tests:

  • Existing tests apply
  • New tests added
    • Python tests
    • GTests
    • Benchmark
    • Other
  • N/A

Checklist

Documentation

  • Existing documentation applies
  • Documentation updated
    • Docstring
    • Doxygen
    • RST
    • Jupyter
    • Other
  • N/A

DALI team only

Requirements

  • Implements new requirements
  • Affects existing requirements
  • N/A

REQ IDs: N/A

JIRA TASK: DALI-3230

@awolant awolant self-assigned this Mar 10, 2023
@stiepan stiepan added conditional execution Questions related to conditional execution and using `if` statements in DALI automatic augmentations Automatic augmentations (AutoAugment, RandAugment, TrivialAugment and more) support in DALI. labels Mar 10, 2023
Copy link
Contributor

@awolant awolant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as before :)

@stiepan
Copy link
Member Author

stiepan commented Mar 13, 2023

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [7573522]: BUILD STARTED

param = [shape[0] * offset_fraction, 0]
elif extent == 'width':
param = [0, shape[1] * offset_fraction]
params[param_name] = param

Check failure

Code scanning / CodeQL

Potentially uninitialized local variable

Local variable 'param' may be used before it is initialized.
@dali-automaton
Copy link
Collaborator

CI MESSAGE: [7573522]: BUILD PASSED

@stiepan stiepan merged commit 77c3a3e into NVIDIA:main Mar 14, 2023
@stiepan stiepan mentioned this pull request Mar 14, 2023
18 tasks
stiepan added a commit that referenced this pull request Mar 14, 2023
* Add RandAugment and TrivialAugment to auto_aug module
* Fix type annotations

---------

Signed-off-by: Kamil Tokarski <[email protected]>
aderylo pushed a commit to zpp-dali-2022/DALI that referenced this pull request Mar 17, 2023
* Add RandAugment and TrivialAugment to auto_aug module
* Fix type annotations

---------

Signed-off-by: Kamil Tokarski <[email protected]>
@JanuszL JanuszL mentioned this pull request Sep 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automatic augmentations Automatic augmentations (AutoAugment, RandAugment, TrivialAugment and more) support in DALI. conditional execution Questions related to conditional execution and using `if` statements in DALI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants