abstract_dataloader.ext.augment
¶
Abstract specifications for data augmentations.
Programming Model
- Data augmentations consist of a set of properties which correspond to
common properties of the data, such as
azimuth_flip
orrange_scale
. - The user is responsible for defining and keeping track of each augmentation property and its meaning.
- Multiple data augmentation specifications can be combined into a single
set of
Augmentations
, which generates a dictionary of values.
In addition to the general framework, we include wrappers for a few common distributions:
Bernoulli
:Bernoulli(p)
Normal
:Normal(0, std) * Bernoulli(p)
TruncatedLogNormal
:exp(clamp(Normal(0, std), -clip, clip)) * Bernoulli(p))
Uniform
:Unif(lower, upper) * Bernoulli(p)
abstract_dataloader.ext.augment.Augmentation
¶
A generic augmentation random generation policy.
Source code in src/abstract_dataloader/ext/augment.py
abstract_dataloader.ext.augment.Augmentations
¶
A collection of data augmentations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
kwargs
|
Augmentation
|
augmentations to apply, where each key is the
name of a physical property (e.g., |
{}
|
Source code in src/abstract_dataloader/ext/augment.py
__call__
¶
Generate a dictionary of augmentations.
If a train=False
flag is passed in meta
, no augmentations are
generated.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
meta
|
dict[str, Any]
|
data processing configuration inputs. |
{}
|
Returns:
Type | Description |
---|---|
dict[str, Any]
|
Augmentation specifications. |
Source code in src/abstract_dataloader/ext/augment.py
abstract_dataloader.ext.augment.Bernoulli
¶
Bases: Augmentation[bool]
Enable augmentation with certain probability.
Type: bool
(True
if enabled).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
p
|
float
|
probability of enabling. |
0.5
|
Source code in src/abstract_dataloader/ext/augment.py
abstract_dataloader.ext.augment.Normal
¶
Bases: Augmentation[float]
Normal distribution.
Type: float
; returns 0.0
if not enabled. Always zero-centered.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
p
|
float
|
probability of enabling this augmentation ( |
1.0
|
std
|
float
|
standard deviation of the normal distribution. |
1.0
|
Source code in src/abstract_dataloader/ext/augment.py
abstract_dataloader.ext.augment.TruncatedLogNormal
¶
Bases: Augmentation[float]
Truncated log-normal distribution.
The underlying normal is always centered around zero.
Type: float
; returns 1.0
if not enabled.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
p
|
float
|
probability of enabling this augmentation ( |
1.0
|
std
|
float
|
standard deviation of the underlying normal distribution. |
0.2
|
clip
|
float
|
clip to this many standard deviations; don't clip if 0. |
2.0
|
Source code in src/abstract_dataloader/ext/augment.py
abstract_dataloader.ext.augment.Uniform
¶
Bases: Augmentation[float]
Uniform distribution.
Type: float
; returns 0.0
if not enabled.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
p
|
float
|
probability of enabling this augmentation. |
1.0
|
lower
|
float
|
lower bound. |
-pi
|
upper
|
float
|
upper bound. |
pi
|