neodroidvision.utilities.torch_utilities.transforms.interpolate.RandomResizedCropAndInterpolationWithTwoPic

class neodroidvision.utilities.torch_utilities.transforms.interpolate.RandomResizedCropAndInterpolationWithTwoPic(size, second_size=None, scale=(0.08, 1.0), ratio=(0.75, 1.3333333333333333), interpolation='bilinear', second_interpolation='lanczos')[source]

Bases: object

Crop the given PIL Image to random size and aspect ratio with random interpolation.

A crop of random size (default: of 0.08 to 1.0) of the original size and a random aspect ratio (default: of 3/4 to 4/3) of the original aspect ratio is made. This crop is finally resized to given size. This is popularly used to train the Inception networks.

Parameters
  • size – expected output size of each edge

  • scale – range of size of the origin size cropped

  • ratio – range of aspect ratio of the origin aspect ratio cropped

  • interpolation – Default: PIL.Image.BILINEAR

__init__(size, second_size=None, scale=(0.08, 1.0), ratio=(0.75, 1.3333333333333333), interpolation='bilinear', second_interpolation='lanczos')[source]

Methods

__init__(size[, second_size, scale, ratio, ...])

get_params(img, scale, ratio)

Get parameters for crop for a random sized crop.

static get_params(img, scale, ratio)[source]

Get parameters for crop for a random sized crop.

Parameters
  • img (PIL Image) – Image to be cropped.

  • scale (tuple) – range of size of the origin size cropped

  • ratio (tuple) – range of aspect ratio of the origin aspect ratio cropped

Returns

params (i, j, h, w) to be passed to crop for a random

sized crop.

Return type

tuple