FFCV

ffcv.fields.decoders module

class ffcv.fields.decoders.FloatDecoder[source]

Decoder for floating point scalars (float64)

dtype = dtype('float64')
class ffcv.fields.decoders.IntDecoder[source]

Decoder for signed integers scalars (int64)

dtype = dtype('int64')
class ffcv.fields.decoders.NDArrayDecoder[source]

Default decoder for NDArrayField.

declare_state_and_memory(previous_state: State) Tuple[State, AllocationQuery][source]
generate_code() Callable[source]
class ffcv.fields.decoders.RandomResizedCropRGBImageDecoder(output_size, scale=(0.08, 1.0), ratio=(0.75, 1.3333333333333333))[source]

Decoder for RGBImageField that performs a Random crop and and a resize operation.

It supports both variable and constant resolution datasets.

Parameters:
  • output_size (Tuple[int]) – The desired resized resolution of the images

  • scale (Tuple[float]) – The range of possible ratios (in area) than can randomly sampled

  • ratio (Tuple[float]) – The range of potential aspect ratios that can be randomly sampled

property get_crop_generator
class ffcv.fields.decoders.CenterCropRGBImageDecoder(output_size, ratio)[source]

Decoder for RGBImageField that performs a center crop followed by a resize operation.

It supports both variable and constant resolution datasets.

Parameters:
  • output_size (Tuple[int]) – The desired resized resolution of the images

  • ratio (float) – ratio of (crop size) / (min side length)

property get_crop_generator
class ffcv.fields.decoders.SimpleRGBImageDecoder[source]

Most basic decoder for the RGBImageField.

It only supports dataset with constant image resolution and will simply read (potentially decompress) and pass the images as is.

declare_state_and_memory(previous_state: State) Tuple[State, AllocationQuery][source]
generate_code() Callable[source]
class ffcv.fields.decoders.BytesDecoder[source]
declare_state_and_memory(previous_state: State) Tuple[State, AllocationQuery][source]
generate_code() Callable[source]