nntoolbox.vision.transforms.transforms module

class nntoolbox.vision.transforms.transforms.Cutout(n_holes, length)[source]

Bases: object

https://arxiv.org/pdf/1708.04552.pdf

class nntoolbox.vision.transforms.transforms.ElasticDeformation(alpha, sigma)[source]

Bases: object

Apply elastic deformation on a PIL image (H x W x C) Adapt from https://gist.github.com/oeway/2e3b989e0343f0884388ed7ed82eb3b0 Paper: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.10.5032&rep=rep1&type=pdf

static elastic_deform(image: <module 'PIL.Image' from '/Users/nhat/Documents/Projects/nn-toolbox/venv/lib/python3.8/site-packages/PIL/Image.py'>, alpha=1000, sigma=30, spline_order=1, mode='nearest') → <module ‘PIL.Image’ from ‘/Users/nhat/Documents/Projects/nn-toolbox/venv/lib/python3.8/site-packages/PIL/Image.py’>[source]

Elastic deformation of image as described in [Simard2003]. .. [Simard2003] Simard, Steinkraus and Platt, “Best Practices for

Convolutional Neural Networks applied to Visual Document Analysis”, in Proc. of the International Conference on Document Analysis and Recognition, 2003. :param image: The image to be deformed :param alpha: scaling factor that controls the intensity of the deformation :param sigma: the std of gaussian filters. Smaller sigma implies more random deformation field :param spline_order :param mode: interpolation mode