random_cutout
Random Cutout Layer API
This module provides classes to build random cutout layers.
Classes:
-
RandomCutout1D
–Random cutout 1D
-
RandomCutout2D
–Random cutout 2D
Classes
RandomCutout1D
RandomCutout1D(factor: float | tuple[float, float] = 0.1, cutouts: int = 1, fill_mode='constant', fill_value: float = 0.0, **kwargs)
Apply random cutout to the input. This is similar to its 2D counterpart where a random portion of the input is cutout. We allow providing a range for the factor and cutouts to randomly pick the values.
Parameters:
-
factor
(float | tuple[float, float]
, default:0.1
) –Factor of the duration to cutout. If tuple, factor is randomly picked between the values.
-
cutouts
(int
, default:1
) –Number of cutouts to apply.
-
fill_mode
(str
, default:'constant'
) –Fill mode. "constant" or "normal".
-
fill_value
(float
, default:0.0
) –Fill value for the cutout.
Source code in neuralspot_edge/layers/preprocessing/random_cutout.py
Functions
call
Override the call method to apply multiple cutouts.
Source code in neuralspot_edge/layers/preprocessing/random_cutout.py
get_random_transformations
Generate random cutout locations, sizes, and fill values.
Source code in neuralspot_edge/layers/preprocessing/random_cutout.py
augment_sample
Apply cutout to the input.
Source code in neuralspot_edge/layers/preprocessing/random_cutout.py
get_config
Serialize the configuration of the layer.
Source code in neuralspot_edge/layers/preprocessing/random_cutout.py
RandomCutout2D
RandomCutout2D(factor: float | tuple[float, float] = 0.1, cutouts: int = 1, fill_mode='constant', fill_value: float = 0.0, **kwargs)
Apply random cutout to the input. This is similar to its 1D counterpart where a random portion of the input is cutout. We allow providing a range for the factor and cutouts to randomly pick the values.
Parameters:
-
factor
(float | tuple[float, float]
, default:0.1
) –Factor of the dimensions to cutout. If tuple, factor is randomly picked between the values.
-
cutouts
(int
, default:1
) –Number of cutouts to apply.
-
fill_mode
(str
, default:'constant'
) –Fill mode. "constant" or "normal".
-
fill_value
(float
, default:0.0
) –Fill value for the cutout.
Source code in neuralspot_edge/layers/preprocessing/random_cutout.py
Functions
call
Override the call method to apply multiple cutouts.
Source code in neuralspot_edge/layers/preprocessing/random_cutout.py
get_random_transformations
Generate random cutout locations, sizes, and fill values.
Source code in neuralspot_edge/layers/preprocessing/random_cutout.py
augment_sample
Apply cutout to the input.
Source code in neuralspot_edge/layers/preprocessing/random_cutout.py
get_config
Serialize the configuration of the layer.