neural_compressor.data.transforms.imagenet_transform
¶
Neural Compressor built-in imagenet transforms.
Module Contents¶
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. |
|
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. |
- class neural_compressor.data.transforms.imagenet_transform.QuantizedInput(dtype, scale=None)¶
Bases:
neural_compressor.data.transforms.transform.BaseTransform
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)¶
Bases:
neural_compressor.data.transforms.transform.BaseTransform
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¶
Parse features in Example proto.
- Returns:
tuple of parsed image and label
- class neural_compressor.data.transforms.imagenet_transform.ParseDecodeImagenetTransform¶
Bases:
neural_compressor.data.transforms.transform.BaseTransform
Imagenet decoding will be performed automatically from Neural Compressor v1.4.
- Returns:
sample
- 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')¶
Bases:
neural_compressor.data.transforms.transform.BaseTransform
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)¶
Bases:
neural_compressor.data.transforms.transform.BaseTransform
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)¶
Bases:
neural_compressor.data.transforms.transform.BaseTransform
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')¶
Bases:
neural_compressor.data.transforms.transform.BaseTransform
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.ResizeWithAspectRatio(height, width, scale=87.5, inter_pol=cv2.INTER_AREA)¶
Bases:
neural_compressor.data.transforms.transform.BaseTransform
Resize the image with aspect ratio.
- Returns:
image and label