torchsat.transforms package¶
Submodules¶
torchsat.transforms.functional module¶
-
torchsat.transforms.functional.adjust_brightness(img, value=0)¶
-
torchsat.transforms.functional.adjust_contrast(img, factor)¶
-
torchsat.transforms.functional.adjust_hue()¶
-
torchsat.transforms.functional.adjust_saturation()¶
-
torchsat.transforms.functional.bbox_crop(bboxes, top, left, height, width)¶ crop bbox
- Arguments:
- img {ndarray} – image to be croped top {int} – top size left {int} – left size height {int} – croped height width {int} – croped width
-
torchsat.transforms.functional.bbox_hflip(bboxes, img_width)¶ - horizontal flip the bboxes
- ^
. . . . . . . . . . . . ………….
^- Args:
- bbox (ndarray): bbox ndarray [box_nums, 4] flip_code (int, optional): [description]. Defaults to 0.
-
torchsat.transforms.functional.bbox_pad(bboxes, padding)¶
-
torchsat.transforms.functional.bbox_resize(bboxes, img_size, target_size)¶ resize the bbox
- Args:
bboxes (ndarray): bbox ndarray [box_nums, 4] img_size (tuple): the image height and width target_size (int, or tuple): the target bbox size.
Int or Tuple, if tuple the shape should be (height, width)
-
torchsat.transforms.functional.bbox_shift(bboxes, top, left)¶ shift the bbox
- Arguments:
- bboxes {ndarray} – input bboxes, should be num x 4 top {int} – shit to top value, positive mean move down, negative mean move up. left {int} – shit to left value, positive mean move right, negative mean move left.
- Returns:
- [ndarray] – shifted bboxes
-
torchsat.transforms.functional.bbox_vflip(bboxes, img_height)¶ - vertical flip the bboxes
- . . . .
- >………..<
. . . . ……….. Args:
bbox (ndarray): bbox ndarray [box_nums, 4] flip_code (int, optional): [description]. Defaults to 0.
-
torchsat.transforms.functional.center_crop(img, output_size)¶ crop image
- Arguments:
- img {ndarray} – input image output_size {number or sequence} – the output image size. if sequence, should be [h, w]
- Raises:
- ValueError – the input image is large than original image.
- Returns:
- ndarray image – return croped ndarray image.
-
torchsat.transforms.functional.crop(img, top, left, height, width)¶ crop image
- Arguments:
- img {ndarray} – image to be croped top {int} – top size left {int} – left size height {int} – croped height width {int} – croped width
-
torchsat.transforms.functional.elastic_transform(image, alpha, sigma, alpha_affine, interpolation=1, border_mode=4, random_state=None, approximate=False)¶ Elastic deformation of images as described in [Simard2003] (with modifications). Based on https://gist.github.com/erniejunior/601cdf56d2b424757de5 .. [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.
-
torchsat.transforms.functional.flip(img, flip_code)¶
-
torchsat.transforms.functional.gaussian_blur(img, kernel_size)¶
-
torchsat.transforms.functional.hflip(img)¶
-
torchsat.transforms.functional.noise(img, mode='gaussain', percent=0.02)¶ TODO: Not good for uint16 data
-
torchsat.transforms.functional.normalize(tensor, mean, std, inplace=False)¶ Normalize a tensor image with mean and standard deviation.
Note
This transform acts out of place by default, i.e., it does not mutates the input tensor.
See
Normalizefor more details.- Args:
- tensor (Tensor): Tensor image of size (C, H, W) to be normalized. mean (sequence): Sequence of means for each channel. std (sequence): Sequence of standard deviations for each channel.
- Returns:
- Tensor: Normalized Tensor image.
-
torchsat.transforms.functional.pad(img, padding, fill=0, padding_mode='constant')¶
-
torchsat.transforms.functional.preserve_channel_dim(func)¶ Preserve dummy channel dim.
-
torchsat.transforms.functional.resize(img, size, interpolation=2)¶ resize the image TODO: opencv resize 之后图像就成了0~1了 Arguments:
img {ndarray} – the input ndarray image size {int, iterable} – the target size, if size is intger, width and height will be resized to same otherwise, the size should be tuple (height, width) or list [height, width]- Keyword Arguments:
- interpolation {Image} – the interpolation method (default: {Image.BILINEAR})
- Raises:
- TypeError – img should be ndarray ValueError – size should be intger or iterable vaiable and length should be 2.
- Returns:
- img – resize ndarray image
-
torchsat.transforms.functional.resized_crop(img, top, left, height, width, size, interpolation=2)¶
-
torchsat.transforms.functional.rotate(img, angle, center=None, scale=1.0)¶
-
torchsat.transforms.functional.rotate_box(bboxes, angle, center_x, center_y)¶ rotate_box rotate the bboxes
- Args:
- bboxes (ndarray): the original bboxes, N(numbers) x 4 angle (float): rotate angle should be degree center_x (int): rotate center x center_y (int): rotate center y
- Returns:
- ndarray: the rotated bboxes
-
torchsat.transforms.functional.shift(img, top, left)¶
-
torchsat.transforms.functional.to_grayscale(img, output_channels=1)¶ convert input ndarray image to gray sacle image.
- Arguments:
- img {ndarray} – the input ndarray image
- Keyword Arguments:
- output_channels {int} – output gray image channel (default: {1})
- Returns:
- ndarray – gray scale ndarray image
-
torchsat.transforms.functional.to_pil_image(tensor)¶
-
torchsat.transforms.functional.to_tensor(img)¶ convert numpy.ndarray to torch tensor.
if the image is uint8 , it will be divided by 255;
if the image is uint16 , it will be divided by 65535;
if the image is float , it will not be divided, we suppose your image range should between [0~1] ;
- Arguments:
- img {numpy.ndarray} – image to be converted to tensor. torch.float32
-
torchsat.transforms.functional.to_tiff_image(tensor)¶
-
torchsat.transforms.functional.vflip(img)¶
torchsat.transforms.transforms_cls module¶
-
class
torchsat.transforms.transforms_cls.Compose(transforms)¶ Bases:
objectComposes serveral classification transform together.
- Args:
- transforms (list of
transformobjects): list of classification transforms to compose. - Example:
>>> transforms_cls.Compose([ >>> transforms_cls.Resize(300), >>> transforms_cls.ToTensor() >>> ])
-
class
torchsat.transforms.transforms_cls.Lambda(lambd)¶ Bases:
objectApply a user-defined lambda as function.
- Args:
- lambd (function): Lambda/function to be used for transform.
-
class
torchsat.transforms.transforms_cls.ToTensor¶ Bases:
objectonvert numpy.ndarray to torch tensor.
if the image is uint8 , it will be divided by 255; if the image is uint16 , it will be divided by 65535; if the image is float , it will not be divided, we suppose your image range should between [0~1] ;- Args:
- img {numpy.ndarray} – image to be converted to tensor.
-
class
torchsat.transforms.transforms_cls.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225], inplace=False)¶ Bases:
objectNormalize a tensor image with mean and standard deviation.
Given mean:
(M1,...,Mn)and std:(S1,..,Sn)fornchannels, this transform will normalize each channel of the inputtorch.*Tensori.e.input[channel] = (input[channel] - mean[channel]) / std[channel].. note:This transform acts out of place, i.e., it does not mutates the input tensor.
- Args:
- tensor (tensor): input torch tensor data. mean (sequence): Sequence of means for each channel. std (sequence): Sequence of standard deviations for each channel. inplace (boolean): inplace apply the transform or not. (default: False)
-
class
torchsat.transforms.transforms_cls.ToGray(output_channels=1)¶ Bases:
objectConvert the image to grayscale
- Args:
- output_channels (int): number of channels desired for output image. (default: 1)
- Returns:
- [ndarray]: the graysacle version of input - If output_channels=1 : returned single channel image (height, width) - If output_channels>1 : returned multi-channels ndarray image (height, width, channels)
-
class
torchsat.transforms.transforms_cls.GaussianBlur(kernel_size=3)¶ Bases:
objectConvert the input ndarray image to blurred image by gaussian method.
- Args:
- kernel_size (int): kernel size of gaussian blur method. (default: 3)
- Returns:
- ndarray: the blurred image.
-
class
torchsat.transforms.transforms_cls.RandomNoise(mode='gaussian', percent=0.02)¶ Bases:
objectAdd noise to the input ndarray image. Args:
mode (str): the noise mode, should be one ofgaussian,salt,pepper,s&p, (default: gaussian). percent (float): noise percent, only work forsalt,pepper,s&pmode. (default: 0.02)- Returns:
- ndarray: noised ndarray image.
-
class
torchsat.transforms.transforms_cls.RandomBrightness(max_value=0)¶ Bases:
object
-
class
torchsat.transforms.transforms_cls.RandomContrast(max_factor=0)¶ Bases:
object
-
class
torchsat.transforms.transforms_cls.RandomShift(max_percent=0.4)¶ Bases:
objectrandom shift the ndarray with value or some percent.
- Args:
- max_percent (float): shift percent of the image.
- Returns:
- ndarray: return the shifted ndarray image.
-
class
torchsat.transforms.transforms_cls.RandomRotation(degrees, center=None)¶ Bases:
objectrandom rotate the ndarray image with the degrees.
- Args:
- degrees (number or sequence): the rotate degree.
- If single number, it must be positive. if squeence, it’s length must 2 and first number should small than the second one.
- Raises:
- ValueError: If degrees is a single number, it must be positive. ValueError: If degrees is a sequence, it must be of len 2.
- Returns:
- ndarray: return rotated ndarray image.
-
class
torchsat.transforms.transforms_cls.Resize(size, interpolation=2)¶ Bases:
objectresize the image Args:
img {ndarray} : the input ndarray image size {int, iterable} : the target size, if size is intger, width and height will be resized to same otherwise, the size should be tuple (height, width) or list [height, width]- Keyword Arguments:
- interpolation {Image} : the interpolation method (default: {Image.BILINEAR})
- Raises:
- TypeError : img should be ndarray ValueError : size should be intger or iterable vaiable and length should be 2.
- Returns:
- img (ndarray) : resize ndarray image
-
class
torchsat.transforms.transforms_cls.Pad(padding, fill=0, padding_mode='constant')¶ Bases:
objectPad the given ndarray image with padding width. Args:
- padding : {int, sequence}, padding width
- If int, each border same. If sequence length is 2, this is the padding for left/right and top/bottom. If sequence length is 4, this is the padding for left, top, right, bottom.
fill: {int, sequence}: Pixel padding_mode: str or function. contain{‘constant’,‘edge’,‘linear_ramp’,‘maximum’,‘mean’
, ‘median’, ‘minimum’, ‘reflect’,‘symmetric’,‘wrap’} (default: constant)- Examples:
>>> transformed_img = Pad(img, 20, mode='reflect') >>> transformed_img = Pad(img, (10,20), mode='edge') >>> transformed_img = Pad(img, (10,20,30,40), mode='reflect')
-
class
torchsat.transforms.transforms_cls.CenterCrop(out_size)¶ Bases:
objectcrop image
- Args:
- img {ndarray}: input image output_size {number or sequence}: the output image size. if sequence, should be [height, width]
- Raises:
- ValueError: the input image is large than original image.
- Returns:
- ndarray: return croped ndarray image.
-
class
torchsat.transforms.transforms_cls.RandomCrop(size)¶ Bases:
objectrandom crop the input ndarray image
- Args:
- size (int, sequence): th output image size, if sequeue size should be [height, width]
- Returns:
- ndarray: return random croped ndarray image.
-
class
torchsat.transforms.transforms_cls.RandomHorizontalFlip(p=0.5)¶ Bases:
objectFlip the input image on central horizon line.
- Args:
- p (float): probability apply the horizon flip.(default: 0.5)
- Returns:
- ndarray: return the flipped image.
-
class
torchsat.transforms.transforms_cls.RandomVerticalFlip(p=0.5)¶ Bases:
objectFlip the input image on central vertical line.
- Args:
- p (float): probability apply the vertical flip. (default: 0.5)
- Returns:
- ndarray: return the flipped image.
-
class
torchsat.transforms.transforms_cls.RandomFlip(p=0.5)¶ Bases:
objectFlip the input image vertical or horizon.
- Args:
- p (float): probability apply flip. (default: 0.5)
- Returns:
- ndarray: return the flipped image.
-
class
torchsat.transforms.transforms_cls.RandomResizedCrop(crop_size, target_size, interpolation=2)¶ Bases:
object[summary]
- Args:
- object ([type]): [description]
- Returns:
- [type]: [description]
-
class
torchsat.transforms.transforms_cls.ElasticTransform(alpha=1, sigma=50, alpha_affine=50, interpolation=1, border_mode=4, random_state=None, approximate=False)¶ Bases:
objectcode modify from https://github.com/albu/albumentations. Elastic deformation of images as described in [Simard2003] (with modifications). Based on https://gist.github.com/erniejunior/601cdf56d2b424757de5 .. [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.- Args:
- approximate (boolean): Whether to smooth displacement map with fixed kernel size.
- Enabling this option gives ~2X speedup on large images.
- Image types:
- uint8, uint16 float32
torchsat.transforms.transforms_det module¶
-
class
torchsat.transforms.transforms_det.Compose(transforms)¶ Bases:
objectComposes serveral classification transform together.
- Args:
- transforms (list of
transformobjects): list of classification transforms to compose. - Example:
>>> transforms_cls.Compose([ >>> transforms_cls.Resize(300), >>> transforms_cls.ToTensor() >>> ])
-
class
torchsat.transforms.transforms_det.Lambda(lambd)¶ Bases:
objectApply a user-defined lambda as function.
- Args:
- lambd (function): Lambda/function to be used for transform.
-
class
torchsat.transforms.transforms_det.ToTensor¶ Bases:
objectonvert numpy.ndarray to torch tensor.
if the image is uint8 , it will be divided by 255; if the image is uint16 , it will be divided by 65535; if the image is float , it will not be divided, we suppose your image range should between [0~1] ;- Args:
- img {numpy.ndarray} – image to be converted to tensor. bboxes {numpy.ndarray} – target bbox to be converted to tensor. the input should be [box_nums, 4] labels {numpy.ndarray} – target labels to be converted to tensor. the input shape shold be [box_nums]
-
class
torchsat.transforms.transforms_det.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225], inplace=False)¶ Bases:
objectNormalize a tensor image with mean and standard deviation.
Given mean:
(M1,...,Mn)and std:(S1,..,Sn)fornchannels, this transform will normalize each channel of the inputtorch.*Tensori.e.input[channel] = (input[channel] - mean[channel]) / std[channel].. note:This transform acts out of place, i.e., it does not mutates the input tensor.
- Args:
- tensor (tensor): input torch tensor data. mean (sequence): Sequence of means for each channel. std (sequence): Sequence of standard deviations for each channel. inplace (boolean): inplace apply the transform or not. (default: False)
-
class
torchsat.transforms.transforms_det.ToGray(output_channels=1)¶ Bases:
objectConvert the image to grayscale
- Args:
- output_channels (int): number of channels desired for output image. (default: 1)
- Returns:
- [ndarray]: the graysacle version of input - If output_channels=1 : returned single channel image (height, width) - If output_channels>1 : returned multi-channels ndarray image (height, width, channels)
-
class
torchsat.transforms.transforms_det.GaussianBlur(kernel_size=3)¶ Bases:
objectConvert the input ndarray image to blurred image by gaussian method.
- Args:
- kernel_size (int): kernel size of gaussian blur method. (default: 3)
- Returns:
- ndarray: the blurred image.
-
class
torchsat.transforms.transforms_det.RandomNoise(mode='gaussian', percent=0.02)¶ Bases:
objectAdd noise to the input ndarray image. Args:
mode (str): the noise mode, should be one ofgaussian,salt,pepper,s&p, (default: gaussian). percent (float): noise percent, only work forsalt,pepper,s&pmode. (default: 0.02)- Returns:
- ndarray: noised ndarray image.
-
class
torchsat.transforms.transforms_det.RandomBrightness(max_value=0)¶ Bases:
object
-
class
torchsat.transforms.transforms_det.RandomContrast(max_factor=0)¶ Bases:
object
-
class
torchsat.transforms.transforms_det.Resize(size, interpolation=2)¶ Bases:
objectresize the image Args:
img {ndarray} : the input ndarray image size {int, iterable} : the target size, if size is intger, width and height will be resized to same otherwise, the size should be tuple (height, width) or list [height, width]- Keyword Arguments:
- interpolation {Image} : the interpolation method (default: {Image.BILINEAR})
- Raises:
- TypeError : img should be ndarray ValueError : size should be intger or iterable vaiable and length should be 2.
- Returns:
- img (ndarray) : resize ndarray image
-
class
torchsat.transforms.transforms_det.Pad(padding, fill=0, padding_mode='constant')¶ Bases:
objectPad the given ndarray image with padding width. Args:
- padding : {int, sequence}, padding width
- If int, each border same. If sequence length is 2, this is the padding for left/right and top/bottom. If sequence length is 4, this is the padding for left, top, right, bottom.
fill: {int, sequence}: Pixel padding_mode: str or function. contain{‘constant’,‘edge’,‘linear_ramp’,‘maximum’,‘mean’
, ‘median’, ‘minimum’, ‘reflect’,‘symmetric’,‘wrap’} (default: constant)- Examples:
>>> transformed_img = Pad(img, 20, mode='reflect') >>> transformed_img = Pad(img, (10,20), mode='edge') >>> transformed_img = Pad(img, (10,20,30,40), mode='reflect')
-
class
torchsat.transforms.transforms_det.CenterCrop(out_size)¶ Bases:
objectcrop image
- Args:
- img {ndarray}: input image output_size {number or sequence}: the output image size. if sequence, should be [height, width]
- Raises:
- ValueError: the input image is large than original image.
- Returns:
- ndarray: return croped ndarray image.
-
class
torchsat.transforms.transforms_det.RandomCrop(size)¶ Bases:
objectrandom crop the input ndarray image
- Args:
- size (int, sequence): th output image size, if sequeue size should be [height, width]
- Returns:
- ndarray: return random croped ndarray image.
-
class
torchsat.transforms.transforms_det.RandomHorizontalFlip(p=0.5)¶ Bases:
objectFlip the input image on central horizon line.
- Args:
- p (float): probability apply the horizon flip.(default: 0.5)
- Returns:
- ndarray: return the flipped image.
-
class
torchsat.transforms.transforms_det.RandomVerticalFlip(p=0.5)¶ Bases:
objectFlip the input image on central vertical line.
- Args:
- p (float): probability apply the vertical flip. (default: 0.5)
- Returns:
- ndarray: return the flipped image.
-
class
torchsat.transforms.transforms_det.RandomFlip(p=0.5)¶ Bases:
objectFlip the input image vertical or horizon.
- Args:
- p (float): probability apply flip. (default: 0.5)
- Returns:
- ndarray: return the flipped image.
-
class
torchsat.transforms.transforms_det.RandomResizedCrop(crop_size, target_size, interpolation=2)¶ Bases:
object[summary]
- Args:
- object ([type]): [description]
- Returns:
- [type]: [description]
torchsat.transforms.transforms_seg module¶
-
class
torchsat.transforms.transforms_seg.Compose(transforms)¶ Bases:
object
-
class
torchsat.transforms.transforms_seg.Lambda(lambd)¶ Bases:
object
-
class
torchsat.transforms.transforms_seg.ToTensor¶ Bases:
object
-
class
torchsat.transforms.transforms_seg.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225], inplace=False)¶ Bases:
object
-
class
torchsat.transforms.transforms_seg.ToGray(output_channels=1)¶ Bases:
objectConvert the image to grayscale
- Args:
- output_channels (int): number of channels desired for output image. (default: 1)
- Returns:
- [ndarray]: the graysacle version of input - If output_channels=1 : returned single channel image (height, width) - If output_channels>1 : returned multi-channels ndarray image (height, width, channels)
-
class
torchsat.transforms.transforms_seg.GaussianBlur(kernel_size=3)¶ Bases:
object
-
class
torchsat.transforms.transforms_seg.RandomNoise(mode='gaussian', percent=0.02)¶ Bases:
objectAdd noise to the input ndarray image. Args:
mode (str): the noise mode, should be one ofgaussian,salt,pepper,s&p, (default: gaussian). percent (float): noise percent, only work forsalt,pepper,s&pmode. (default: 0.02)- Returns:
- ndarray: noised ndarray image.
-
class
torchsat.transforms.transforms_seg.RandomBrightness(max_value=0)¶ Bases:
object
-
class
torchsat.transforms.transforms_seg.RandomContrast(max_factor=0)¶ Bases:
object
-
class
torchsat.transforms.transforms_seg.RandomShift(max_percent=0.4)¶ Bases:
objectrandom shift the ndarray with value or some percent.
- Args:
- max_percent (float): shift percent of the image.
- Returns:
- ndarray: return the shifted ndarray image.
-
class
torchsat.transforms.transforms_seg.RandomRotation(degrees, center=None)¶ Bases:
objectrandom rotate the ndarray image with the degrees.
- Args:
- degrees (number or sequence): the rotate degree.
- If single number, it must be positive. if squeence, it’s length must 2 and first number should small than the second one.
- Raises:
- ValueError: If degrees is a single number, it must be positive. ValueError: If degrees is a sequence, it must be of len 2.
- Returns:
- ndarray: return rotated ndarray image.
-
class
torchsat.transforms.transforms_seg.Resize(size, interpolation=2)¶ Bases:
objectresize the image Args:
img {ndarray} : the input ndarray image size {int, iterable} : the target size, if size is intger, width and height will be resized to same otherwise, the size should be tuple (height, width) or list [height, width]- Keyword Arguments:
- interpolation {Image} : the interpolation method (default: {Image.BILINEAR})
- Raises:
- TypeError : img should be ndarray ValueError : size should be intger or iterable vaiable and length should be 2.
- Returns:
- img (ndarray) : resize ndarray image
-
class
torchsat.transforms.transforms_seg.Pad(padding, fill=0, padding_mode='constant')¶ Bases:
objectPad the given ndarray image with padding width. Args:
- padding : {int, sequence}, padding width
- If int, each border same. If sequence length is 2, this is the padding for left/right and top/bottom. If sequence length is 4, this is the padding for left, top, right, bottom.
fill: {int, sequence}: Pixel padding_mode: str or function. contain{‘constant’,‘edge’,‘linear_ramp’,‘maximum’,‘mean’
, ‘median’, ‘minimum’, ‘reflect’,‘symmetric’,‘wrap’} (default: constant)- Examples:
>>> transformed_img = Pad(img, 20, mode='reflect') >>> transformed_img = Pad(img, (10,20), mode='edge') >>> transformed_img = Pad(img, (10,20,30,40), mode='reflect')
-
class
torchsat.transforms.transforms_seg.CenterCrop(out_size)¶ Bases:
objectcrop image
- Args:
- img {ndarray}: input image output_size {number or sequence}: the output image size. if sequence, should be [height, width]
- Raises:
- ValueError: the input image is large than original image.
- Returns:
- ndarray: return croped ndarray image.
-
class
torchsat.transforms.transforms_seg.RandomCrop(size)¶ Bases:
objectrandom crop the input ndarray image
- Args:
- size (int, sequence): th output image size, if sequeue size should be [height, width]
- Returns:
- ndarray: return random croped ndarray image.
-
class
torchsat.transforms.transforms_seg.RandomHorizontalFlip(p=0.5)¶ Bases:
objectFlip the input image on central horizon line.
- Args:
- p (float): probability apply the horizon flip.(default: 0.5)
- Returns:
- ndarray: return the flipped image.
-
class
torchsat.transforms.transforms_seg.RandomVerticalFlip(p=0.5)¶ Bases:
objectFlip the input image on central vertical line.
- Args:
- p (float): probability apply the vertical flip. (default: 0.5)
- Returns:
- ndarray: return the flipped image.
-
class
torchsat.transforms.transforms_seg.RandomFlip(p=0.5)¶ Bases:
objectFlip the input image vertical or horizon.
- Args:
- p (float): probability apply flip. (default: 0.5)
- Returns:
- ndarray: return the flipped image.
-
class
torchsat.transforms.transforms_seg.RandomResizedCrop(crop_size, target_size, interpolation=2)¶ Bases:
object[summary]
- Args:
- object ([type]): [description]
- Returns:
- [type]: [description]
-
class
torchsat.transforms.transforms_seg.ElasticTransform(alpha=1, sigma=50, alpha_affine=50, interpolation=1, border_mode=4, random_state=None, approximate=False)¶ Bases:
objectcode modify from https://github.com/albu/albumentations. Elastic deformation of images as described in [Simard2003] (with modifications). Based on https://gist.github.com/erniejunior/601cdf56d2b424757de5 .. [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.- Args:
- approximate (boolean): Whether to smooth displacement map with fixed kernel size.
- Enabling this option gives ~2X speedup on large images.
- Image types:
- uint8, uint16 float32