neural_compressor.data.transforms.imagenet_transform
Neural Compressor built-in imagenet transforms.
Classes
Convert the dtype of input to quantize it. |
|
Convert label to label - label_shift. |
|
Parse features in Example proto. |
|
Imagenet decoding will be performed automatically from Neural Compressor v1.4. |
|
Transpose NHWC to NCHW. |
|
Label shift by 1 and rescale. |
|
Combination of a series of transforms which is applicable to images in Imagenet. |
|
Combination of a series of transforms which is applicable to images in Imagenet. |
|
Combination of a series of transforms which is applicable to images in Imagenet. |
|
Combination of a series of transforms which is applicable to images in Imagenet. |
|
Resize the image with aspect ratio. |
Module Contents
- class neural_compressor.data.transforms.imagenet_transform.QuantizedInput(dtype, scale=None)[source]
Convert the dtype of input to quantize it.
- Parameters:
dtype (str) – desired image dtype, support ‘uint8’, ‘int8’
scale (float, default=None) – scaling ratio of each point in image
- Returns:
tuple of processed image and label
- class neural_compressor.data.transforms.imagenet_transform.LabelShift(label_shift=0)[source]
Convert label to label - label_shift.
- Parameters:
label_shift (int, default=0) – number of label shift
- Returns:
tuple of processed image and label
- class neural_compressor.data.transforms.imagenet_transform.ParseDecodeImagenet[source]
Parse features in Example proto.
- Returns:
tuple of parsed image and label
- class neural_compressor.data.transforms.imagenet_transform.ParseDecodeImagenetTransform[source]
Imagenet decoding will be performed automatically from Neural Compressor v1.4.
- Returns:
sample
- class neural_compressor.data.transforms.imagenet_transform.TensorflowTransposeLastChannel[source]
Transpose NHWC to NCHW.
- Returns:
tuple of processed image and label
- class neural_compressor.data.transforms.imagenet_transform.TensorflowShiftRescale[source]
Label shift by 1 and rescale.
- Returns:
tuple of processed image and label
- class neural_compressor.data.transforms.imagenet_transform.TensorflowResizeCropImagenetTransform(height, width, random_crop=False, resize_side=256, resize_method='bilinear', random_flip_left_right=False, mean_value=[0.0, 0.0, 0.0], scale=1.0, data_format='channels_last', subpixels='RGB')[source]
Combination of a series of transforms which is applicable to images in Imagenet.
- Parameters:
height (int) – Height of the result
width (int) – Width of the result
random_crop (bool, default=False) – whether to random crop
resize_side (int, default=256) – desired shape after resize operation
random_flip_left_right (bool, default=False) – whether to random flip left and right
mean_value (list, default=[0.0,0.0,0.0]) – means for each channel
scale (float, default=1.0) – std value
- Returns:
tuple of processed image and label
- class neural_compressor.data.transforms.imagenet_transform.BilinearImagenetTransform(height, width, central_fraction=0.875, mean_value=[0.0, 0.0, 0.0], scale=1.0)[source]
Combination of a series of transforms which is applicable to images in Imagenet.
- Parameters:
height – Height of the result
width – Width of the result
central_fraction (float, default=0.875) – fraction of size to crop
mean_value (list, default=[0.0,0.0,0.0]) – means for each channel
scale (float, default=1.0) – std value
- Returns:
tuple of processed image and label
- class neural_compressor.data.transforms.imagenet_transform.OnnxBilinearImagenetTransform(height, width, central_fraction=0.875, mean_value=[0.0, 0.0, 0.0], scale=1.0)[source]
Combination of a series of transforms which is applicable to images in Imagenet.
- Parameters:
height – Height of the result
width – Width of the result
central_fraction (float, default=0.875) – fraction of size to crop
mean_value (list, default=[0.0,0.0,0.0]) – means for each channel
scale (float, default=1.0) – std value
- Returns:
tuple of processed image and label
- class neural_compressor.data.transforms.imagenet_transform.ONNXResizeCropImagenetTransform(height, width, random_crop=False, resize_side=256, mean_value=[0.0, 0.0, 0.0], std_value=[0.229, 0.224, 0.225], resize_method='bilinear', data_format='channels_last', subpixels='RGB')[source]
Combination of a series of transforms which is applicable to images in Imagenet.
- Parameters:
height – Height of the result
width – Width of the result
central_fraction (float, default=0.875) – fraction of size to crop
mean_value (list, default=[0.0,0.0,0.0]) – means for each channel
scale (float, default=1.0) – std value
- Returns:
tuple of processed image and label