mixmo.augmentations.mixing_blocks

Mixing blocks inspired from several standard mixing sample data augmentations

Functions

_channel_mask(input_size, lam, config_mix)

Compute masks that toggle entire channels on and off

_cow_mask(input_size, lam, config_mix)

Compute masks for CowMix lam is overridden by Cowmask’s parameters https://github.com/google-research/google-research/tree/master/milking_cowmask/masking

_cutmix_mask(input_size, lam[, config_mix])

Compute masks for CutMix

_gaussian_blur_kernel(sigma, sigma_max[, sym])

Compute Gaussian kernel, as per the scipy.signal implementation

_mixup_mask(input_size, lam, config_mix)

Compute masks for MixUp (constant masks)

_n_cutinmix_mask(input_size, lams, config_mix)

Multivariate CutMix generalization (see paper) lam is a tuple here (simplex) that gives the proportion between n inputs CutMix(A, MixUp(B,C,…))

_n_mix(method, lams, input_size, config_mix)

Computes masks for M>2 inputs (requires lam tuples)

_n_mixup_mask(input_size, lams, config_mix)

Multivariate MixUp generalization lam is a tuple here (simplex) that gives the proportion between n inputs

_noise_mask(input_size, lam, config_mix)

Random mask pixels drawn from uniform distribution

_patchup_mask(input_size, lam, config_mix)

Compute masks for PatchUp mixing https://github.com/chandar-lab/PatchUp

_patchuphard2d_mask(input_size, lam, config_mix)

Wrapper function for PatchUp hard masking (2d variant)

_patchupsoft_mask(input_size, lam, config_mix)

Wrapper function for PatchUp soft masking

_rand_bbox_of_area_lam(size, lam[, seed])

Compute the corner coordinates of a random rectangular box such that area_box/area_image=lam

_single_mix(method, lam, input_size, config_mix)

Computes masks for two inputs (traditional MSDA methods)

_stack0_mask(input_size, lam, config_mix)

Wrapper function for channel concat mixing

_stack2_mask(input_size, lam, config_mix)

Wrapper function for vertical concat mixing

_stack_mask(input_size, lam, config_mix)

Compute masks for Channel/Horizontal/Vertical concat (number of images) x channel x (image width) x (image height)

mix(method, lams, input_size[, config_mix])

Front facing function that computes the masks/lams for any number of inputs

mix_manifolds(list_lfeats, metadata)

Main function to mix manifolds in network