beatmup.nnets.ImageSampler

class beatmup.nnets.ImageSampler
Image preprocessing operation.

Samples an image of a fixed size from an arbitrary size texture. Has three key missions. * If enabled, performs a center crop keeping the output aspect ratio (otherwise the input is stretched to fit the output). * If enabled, uses linear interpolation when possible to reduce aliasing (otherwise nearest neighbor sampling is used). * Brings support of OES textures. This allows for example to read data directly from camera in Android.

__init__(self: beatmup.nnets.ImageSampler, name: str, size: tuple, center_crop: bool = True, linear_interp: bool = True) None

Creates an instance of image preprocessing operation.

Parameters:
  • name – operation name

  • size – a tuple containing output image size in pixels

  • center_crop – if True, the center crop is enabled

  • linear_interp – if True, the linear interpolation is enabled

Methods

__init__(self, name, size[, center_crop, ...])

Creates an instance of image preprocessing operation.

Attributes

input_count

Number of operation inputs

name

Operation name

output_count

Number of operation outputs

rotation

Number of times a clockwise rotation by 90 degree is applied to the input image