/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-rocal/checkouts/develop/rocAL_pybind/amd/rocal/fn.py File Reference#
File containing augmentation functions used in multiple trainings. More...
Functions | |
def | rocAL_pybind.amd.rocal.fn.blend (*inputs, ratio=None, device=None, output_layout=types.NHWC, output_dtype=types.UINT8) |
Blends two input images given the ratio: output = input1*ratio + input2*(1-ratio) More... | |
def | rocAL_pybind.amd.rocal.fn.snow (*inputs, snow=0.5, device=None, output_layout=types.NHWC, output_dtype=types.UINT8) |
Applies snow effect on images. More... | |
def | rocAL_pybind.amd.rocal.fn.exposure (*inputs, exposure=0.5, device=None, output_layout=types.NHWC, output_dtype=types.UINT8) |
Adjusts the exposure in images. More... | |
def | rocAL_pybind.amd.rocal.fn.fish_eye (*inputs, device=None, fill_value=0.0, output_layout=types.NHWC, output_dtype=types.UINT8) |
Applies fish eye effect on images. More... | |
def | rocAL_pybind.amd.rocal.fn.fog (*inputs, fog=0.5, device=None, output_layout=types.NHWC, output_dtype=types.UINT8) |
Applies fog effect on images. More... | |
def | rocAL_pybind.amd.rocal.fn.brightness (*inputs, brightness=None, brightness_shift=None, device=None, output_layout=types.NHWC, output_dtype=types.UINT8) |
Adjusts brightness of the image. More... | |
def | rocAL_pybind.amd.rocal.fn.brightness_fixed (*inputs, brightness=1.0, brightness_shift=0.0, device=None, output_layout=types.NHWC, output_dtype=types.UINT8) |
Adjusts brightness of the image with fixed parameters. More... | |
def | rocAL_pybind.amd.rocal.fn.lens_correction (*inputs, strength=None, zoom=None, device=None, output_layout=types.NHWC, output_dtype=types.UINT8) |
Applies lens correction effect on images. More... | |
def | rocAL_pybind.amd.rocal.fn.blur (*inputs, window_size=None, sigma=0.0, device=None, output_layout=types.NHWC, output_dtype=types.UINT8) |
Applies blur effect to images. More... | |
def | rocAL_pybind.amd.rocal.fn.contrast (*inputs, contrast=None, contrast_center=None, device=None, output_layout=types.NHWC, output_dtype=types.UINT8) |
Adjusts contrast of the image. More... | |
def | rocAL_pybind.amd.rocal.fn.flip (*inputs, horizontal=0, vertical=0, device=None, output_layout=types.NHWC, output_dtype=types.UINT8) |
Flip images horizontally and/or vertically based on inputs. More... | |
def | rocAL_pybind.amd.rocal.fn.gamma_correction (*inputs, gamma=0.5, device=None, output_layout=types.NHWC, output_dtype=types.UINT8) |
Applies gamma correction on image. More... | |
def | rocAL_pybind.amd.rocal.fn.hue (*inputs, hue=None, device=None, seed=0, output_layout=types.NHWC, output_dtype=types.UINT8) |
Adjust the hue in the images. More... | |
def | rocAL_pybind.amd.rocal.fn.jitter (*inputs, kernel_size=None, seed=0, fill_value=0.0, device=None, output_layout=types.NHWC, output_dtype=types.UINT8) |
Applies Jitter effect on images. More... | |
def | rocAL_pybind.amd.rocal.fn.pixelate (*inputs, device=None, output_layout=types.NHWC, output_dtype=types.UINT8) |
Applies pixelate effect on images. More... | |
def | rocAL_pybind.amd.rocal.fn.rain (*inputs, rain=None, rain_width=None, rain_height=None, rain_transparency=None, device=None, output_layout=types.NHWC, output_dtype=types.UINT8) |
Applies Rain effect on images. More... | |
def | rocAL_pybind.amd.rocal.fn.resize (*inputs, max_size=[], resize_longer=0, resize_shorter=0, resize_width=0, resize_height=0, scaling_mode=types.SCALING_MODE_DEFAULT, interpolation_type=types.LINEAR_INTERPOLATION, antialias=True, device=None, output_layout=types.NHWC, output_dtype=types.UINT8) |
Resizes the images. More... | |
def | rocAL_pybind.amd.rocal.fn.resize_crop_mirror (*inputs, resize_width=0, resize_height=0, crop_w=0, crop_h=0, mirror=1, device=None, max_size=[], resize_longer=0, resize_shorter=0, scaling_mode=types.SCALING_MODE_DEFAULT, interpolation_type=types.LINEAR_INTERPOLATION, output_layout=types.NHWC, output_dtype=types.UINT8) |
Fused function which performs resize, crop and flip on images. More... | |
def | rocAL_pybind.amd.rocal.fn.resize_crop (*inputs, resize_width=0, resize_height=0, crop_area_factor=None, crop_aspect_ratio=None, x_drift=None, y_drift=None, device=None, max_size=[], resize_longer=0, resize_shorter=0, scaling_mode=types.SCALING_MODE_DEFAULT, interpolation_type=types.LINEAR_INTERPOLATION, output_layout=types.NHWC, output_dtype=types.UINT8) |
Fused function which performs resize, crop on images. More... | |
def | rocAL_pybind.amd.rocal.fn.resize_mirror_normalize (*inputs, max_size=[], resize_longer=0, resize_shorter=0, resize_width=0, resize_height=0, scaling_mode=types.SCALING_MODE_DEFAULT, interpolation_type=types.LINEAR_INTERPOLATION, mean=[0.0], std=[1.0], mirror=1, device=None, output_layout=types.NHWC, output_dtype=types.UINT8) |
Fused function which performs resize, Normalize and flip on images. More... | |
def | rocAL_pybind.amd.rocal.fn.random_crop (*inputs, crop_area_factor=[0.08, 1], crop_aspect_ratio=[0.75, 1.333333], crop_pox_x=0, crop_pox_y=0, num_attempts=20, device=None, all_boxes_above_threshold=True, allow_no_crop=True, ltrb=True, output_layout=types.NHWC, output_dtype=types.UINT8) |
Crops images randomly. More... | |
def | rocAL_pybind.amd.rocal.fn.rotate (*inputs, angle=None, dest_width=0, dest_height=0, interpolation_type=types.LINEAR_INTERPOLATION, device=None, fill_value=None, output_layout=types.NHWC, output_dtype=types.UINT8) |
Rotates images. More... | |
def | rocAL_pybind.amd.rocal.fn.saturation (*inputs, saturation=1.0, device=None, output_layout=types.NHWC, output_dtype=types.UINT8) |
Adjusts the saturation in images. More... | |
def | rocAL_pybind.amd.rocal.fn.ssd_random_crop (*inputs, p_threshold=None, crop_area_factor=None, crop_aspect_ratio=None, crop_pos_x=None, crop_pos_y=None, num_attempts=20, device=None, all_boxes_above_threshold=True, allow_no_crop=True, ltrb=True, output_layout=types.NHWC, output_dtype=types.UINT8) |
Crops images randomly used for SSD training. More... | |
def | rocAL_pybind.amd.rocal.fn.warp_affine (*inputs, dest_width=0, dest_height=0, matrix=[0, 0, 0, 0, 0, 0], interpolation_type=types.LINEAR_INTERPOLATION, device=None, output_layout=types.NHWC, output_dtype=types.UINT8) |
Applies affine transformation to images. More... | |
def | rocAL_pybind.amd.rocal.fn.vignette (*inputs, vignette=0.5, device=None, output_layout=types.NHWC, output_dtype=types.UINT8) |
Applies Vignette effect. More... | |
def | rocAL_pybind.amd.rocal.fn.crop_mirror_normalize (*inputs, crop=[0, 0], crop_pos_x=0.5, crop_pos_y=0.5, crop_w=0, crop_h=0, mean=[0.0], std=[1.0], mirror=1, device=None, output_layout=types.NHWC, output_dtype=types.UINT8) |
Fused function which performs crop, normalize and flip on images. More... | |
def | rocAL_pybind.amd.rocal.fn.center_crop (*inputs, crop=[0, 0], crop_h=0, crop_w=0, crop_d=1, device=None, output_layout=types.NHWC, output_dtype=types.UINT8) |
Crops images at the center. More... | |
def | rocAL_pybind.amd.rocal.fn.crop (*inputs, crop=[0, 0], crop_pos_x=0.5, crop_pos_y=0.5, crop_pos_z=0.5, crop_w=0, crop_h=0, crop_d=1, device=None, output_layout=types.NHWC, output_dtype=types.UINT8) |
crops images More... | |
def | rocAL_pybind.amd.rocal.fn.color_twist (*inputs, brightness=1.0, contrast=1.0, hue=0.0, saturation=1.0, device=None, output_layout=types.NHWC, output_dtype=types.UINT8) |
Adjusts the brightness, hue and saturation of the images. More... | |
def | rocAL_pybind.amd.rocal.fn.uniform (*inputs, range=[-1, 1], device=None) |
Applies uniform random number generation to the input images. More... | |
def | rocAL_pybind.amd.rocal.fn.random_bbox_crop (*inputs, all_boxes_above_threshold=True, allow_no_crop=True, aspect_ratio=None, bbox_layout="", threshold_type="iou", thresholds=None, crop_shape=None, num_attempts=1, scaling=None, seed=1, shape_layout="", input_shape=None, total_num_attempts=0, device=None, ltrb=True, labels=None) |
Applies random bounding box cropping to the input images. More... | |
def | rocAL_pybind.amd.rocal.fn.one_hot (*inputs, num_classes=0, device=None) |
Applies one-hot encoding to the input images. More... | |
def | rocAL_pybind.amd.rocal.fn.box_encoder (*inputs, anchors, criteria=0.5, means=None, offset=False, scale=1.0, stds=None, device=None) |
Applies box encoding to the input bounding boxes. More... | |
def | rocAL_pybind.amd.rocal.fn.color_temp (*inputs, adjustment_value=50, device=None, output_layout=types.NHWC, output_dtype=types.UINT8) |
Adjusts the color temperature in images. More... | |
def | rocAL_pybind.amd.rocal.fn.nop (*inputs, device=None) |
Performs no operation. More... | |
def | rocAL_pybind.amd.rocal.fn.copy (*inputs, device=None) |
Copies input tensor to output tensor. More... | |
def | rocAL_pybind.amd.rocal.fn.snp_noise (*inputs, p_noise=0.0, p_salt=0.0, noise_val=0.0, salt_val=0.0, seed=0, device=None, output_layout=types.NHWC, output_dtype=types.UINT8) |
Applies salt-and-pepper noise to the input image. More... | |
def | rocAL_pybind.amd.rocal.fn.box_iou_matcher (*inputs, anchors, high_threshold=0.5, low_threshold=0.4, allow_low_quality_matches=True, device=None) |
Applies box IoU matching to the input image. More... | |
def | rocAL_pybind.amd.rocal.fn.external_source (source, device=None, color_format=types.RGB, random_shuffle=False, mode=types.EXTSOURCE_FNAME, max_width=2000, max_height=2000, last_batch_policy=types.LAST_BATCH_FILL, pad_last_batch_repeated=False, stick_to_shard=True, shard_size=-1) |
def | rocAL_pybind.amd.rocal.fn.preemphasis_filter (*inputs, border=types.CLAMP, preemph_coeff=0.97, output_dtype=types.FLOAT) |
def | rocAL_pybind.amd.rocal.fn.spectrogram (*inputs, bytes_per_sample_hint=[0], center_windows=True, layout=types.NFT, nfft=None, power=2, reflect_padding=True, seed=-1, window_fn=[], window_length=512, window_step=256, output_dtype=types.FLOAT) |
def | rocAL_pybind.amd.rocal.fn.to_decibels (*inputs, bytes_per_sample_hint=[0], cutoff_db=-200.0, multiplier=10.0, reference=0.0, seed=-1, output_dtype=types.FLOAT) |
def | rocAL_pybind.amd.rocal.fn.resample (*inputs, resample_rate=None, output_datatype=types.FLOAT, resample_hint=-1, quality=50.0) |
def | rocAL_pybind.amd.rocal.fn.tensor_add_tensor_float (*inputs, output_datatype=types.FLOAT) |
def | rocAL_pybind.amd.rocal.fn.tensor_mul_scalar_float (*inputs, scalar=1.0, output_datatype=types.FLOAT) |
def | rocAL_pybind.amd.rocal.fn.nonsilent_region (*inputs, cutoff_db=-60, reference_power=0.0, reset_interval=8192, window_length=2048) |
def | rocAL_pybind.amd.rocal.fn.slice (*inputs, anchor=[], shape=[], fill_values=[0.0], out_of_bounds_policy=types.ERROR, rocal_tensor_output_type=types.FLOAT) |
def | rocAL_pybind.amd.rocal.fn.normalize (*inputs, axes=[], mean=[], stddev=[], scale=1.0, shift=0.0, output_datatype=types.FLOAT) |
def | rocAL_pybind.amd.rocal.fn.mel_filter_bank (*inputs, bytes_per_sample_hint=[0], freq_high=0.0, freq_low=0.0, mel_formula=types.MELSCALE_SLANEY, nfilter=128, normalize=True, sample_rate=44100.0, seed=-1, output_datatype=types.FLOAT) |
Detailed Description
File containing augmentation functions used in multiple trainings.
Function Documentation
◆ blend()
def rocAL_pybind.amd.rocal.fn.blend | ( | * | inputs, |
ratio = None , |
|||
device = None , |
|||
output_layout = types.NHWC , |
|||
output_dtype = types.UINT8 |
|||
) |
Blends two input images given the ratio: output = input1*ratio + input2*(1-ratio)
@param inputs list containing the input images @param ratio (float, optional, default = None) ratio used for blending one image with another @param device (string, optional, default = None) Parameter unused for augmentation @param output_layout (int, optional, default = types.NHWC) tensor layout for the augmentation output @param output_dtype (int, optional, default = types.UINT8) tensor dtype for the augmentation output @return blended image
◆ blur()
def rocAL_pybind.amd.rocal.fn.blur | ( | * | inputs, |
window_size = None , |
|||
sigma = 0.0 , |
|||
device = None , |
|||
output_layout = types.NHWC , |
|||
output_dtype = types.UINT8 |
|||
) |
Applies blur effect to images.
@param inputs the input image passed to the augmentation @param window_size (int, default = None) kernel size used for the filter @param sigma (float, default = 0.0) sigma value for blur effect @param device (string, optional, default = None) Parameter unused for augmentation @param output_layout (int, optional, default = types.NHWC) tensor layout for the augmentation output @param output_dtype (int, optional, default = types.UINT8) tensor dtype for the augmentation output @return Image with Blur effect
◆ box_encoder()
def rocAL_pybind.amd.rocal.fn.box_encoder | ( | * | inputs, |
anchors, | |||
criteria = 0.5 , |
|||
means = None , |
|||
offset = False , |
|||
scale = 1.0 , |
|||
stds = None , |
|||
device = None |
|||
) |
Applies box encoding to the input bounding boxes.
@param inputs (list) The input bounding boxes to which box encoding is applied. @param anchors (list of floats) Anchors to be used for encoding, as a list of floats in the ltrb format. @param criteria (float, optional, default = 0.5) Threshold IoU for matching bounding boxes with anchors. The value needs to be between 0 and 1. Default is 0.5. @param means (list of floats, optional, default = None) [x y w h] mean values for normalization. Default is [0.0, 0.0, 0.0, 0.0]. @param offset (bool, optional, default = False) Returns normalized offsets ((encoded_bboxes * scale - anchors * scale) - mean) / stds in Encoded bboxes that use std and the mean and scale arguments. Default is False. @param scale (float, optional, default = 1.0) Rescales the box and anchor values before the offset is calculated (for example, to return to the absolute values). Default is 1.0. @param stds (list of float, optional, default = None) Parameter unused for augmentation @param device (string, optional, default = None) Parameter unused for augmentation @return encoded bounding boxes.
◆ box_iou_matcher()
def rocAL_pybind.amd.rocal.fn.box_iou_matcher | ( | * | inputs, |
anchors, | |||
high_threshold = 0.5 , |
|||
low_threshold = 0.4 , |
|||
allow_low_quality_matches = True , |
|||
device = None |
|||
) |
Applies box IoU matching to the input image.
@param inputs (list) The input image to which box IoU matching is applied. @param anchors (list of floats) Anchors to be used for encoding, in the ltrb format. @param high_threshold (float, optional, default = 0.5) Upper threshold used for matching indices. Default is 0.5. @param low_threshold (float, optional, default = 0.4) Lower threshold used for matching indices. Default is 0.4. @param allow_low_quality_matches (bool, optional, default = True) Whether to allow low quality matches as output. Default is True. @param device (string, optional, default = None) Parameter unused for augmentation @return matched boxes and the list of matched indices.
◆ brightness()
def rocAL_pybind.amd.rocal.fn.brightness | ( | * | inputs, |
brightness = None , |
|||
brightness_shift = None , |
|||
device = None , |
|||
output_layout = types.NHWC , |
|||
output_dtype = types.UINT8 |
|||
) |
Adjusts brightness of the image.
@param inputs the input image passed to the augmentation @param brightness (float, optional, default = None): brightness multiplier. Values >= 0 are accepted. For example: 0 - black image, 1 - no change, 2 - increase brightness twice @param brightness_shift (float, optional, default = None) brightness shift @param device (string, optional, default = None) Parameter unused for augmentation @param output_layout (int, optional, default = types.NHWC) tensor layout for the augmentation output @param output_dtype (int, optional, default = types.UINT8) tensor dtype for the augmentation output @return Image with Adjusted Brightness
◆ brightness_fixed()
def rocAL_pybind.amd.rocal.fn.brightness_fixed | ( | * | inputs, |
brightness = 1.0 , |
|||
brightness_shift = 0.0 , |
|||
device = None , |
|||
output_layout = types.NHWC , |
|||
output_dtype = types.UINT8 |
|||
) |
Adjusts brightness of the image with fixed parameters.
@param inputs the input image passed to the augmentation @param brightness (float, optional, default = 1.0) brightness multiplier. Values >= 0 are accepted. For example: 0 - black image, 1 - no change, 2 - increase brightness twice @param brightness_shift (float, optional, default = 0.0) brightness shift @param device (string, optional, default = None) Parameter unused for augmentation @param output_layout (int, optional, default = types.NHWC) tensor layout for the augmentation output @param output_dtype (int, optional, default = types.UINT8) tensor dtype for the augmentation output @return Image with adjusted brightness
◆ center_crop()
def rocAL_pybind.amd.rocal.fn.center_crop | ( | * | inputs, |
crop = [0, 0] , |
|||
crop_h = 0 , |
|||
crop_w = 0 , |
|||
crop_d = 1 , |
|||
device = None , |
|||
output_layout = types.NHWC , |
|||
output_dtype = types.UINT8 |
|||
) |
Crops images at the center.
@param inputs the input image passed to the augmentation @param crop (list of ints, optional, default = [0, 0]) list containing the crop dimensions of the cropped image @param crop_h (int, optional, default = 0) crop height @param crop_w (int, optional, default = 0) crop width @param crop_d (int, optional, default = 0) crop depth @param device (string, optional, default = None) Parameter unused for augmentation @param output_layout (int, optional, default = types.NHWC) tensor layout for the augmentation output @param output_dtype (int, optional, default = types.UINT8) tensor dtype for the augmentation output @return Center cropped Images
◆ color_temp()
def rocAL_pybind.amd.rocal.fn.color_temp | ( | * | inputs, |
adjustment_value = 50 , |
|||
device = None , |
|||
output_layout = types.NHWC , |
|||
output_dtype = types.UINT8 |
|||
) |
Adjusts the color temperature in images.
@param inputs the input image passed to the augmentation @param adjustment_value (int, default = 50) value for adjusting the color temperature @param device (string, optional, default = None) Parameter unused for augmentation @param output_layout (int, optional, default = types.NHWC) tensor layout for the augmentation output @param output_dtype (int, optional, default = types.UINT8) tensor dtype for the augmentation output @return Images with Adjusted Color temperature
◆ color_twist()
def rocAL_pybind.amd.rocal.fn.color_twist | ( | * | inputs, |
brightness = 1.0 , |
|||
contrast = 1.0 , |
|||
hue = 0.0 , |
|||
saturation = 1.0 , |
|||
device = None , |
|||
output_layout = types.NHWC , |
|||
output_dtype = types.UINT8 |
|||
) |
Adjusts the brightness, hue and saturation of the images.
@param inputs the input image passed to the augmentation @param brightness (float, optional, default = 1.0) brightness multiplier. Values >= 0 are accepted. For example: 0 - black image, 1 - no change, 2 - increase brightness twice @param contrast (float, optional, default = 1.0) contrast multiplier used for the augmentation. Values >= 0 are accepted. For example: 0 - gray image, 1 - no change, 2 - increase contrast twice @param hue (float, optional, default = 0.0) hue change in degrees @param saturation (float, optional, default = 1.0) The saturation change factor. Values must be non-negative. Example values: 0 - Completely desaturated image, 1 - No change to image's saturation. @param device (string, optional, default = None) Parameter unused for augmentation @param output_layout (int, optional, default = types.NHWC) tensor layout for the augmentation output @param output_dtype (int, optional, default = types.UINT8): tensor dtype for the augmentation output @return Images with Adjusted Brightness, Hue and Saturation
◆ contrast()
def rocAL_pybind.amd.rocal.fn.contrast | ( | * | inputs, |
contrast = None , |
|||
contrast_center = None , |
|||
device = None , |
|||
output_layout = types.NHWC , |
|||
output_dtype = types.UINT8 |
|||
) |
Adjusts contrast of the image.
@param inputs: the input image passed to the augmentation @param contrast (float, optional, default = None) contrast multiplier used for the augmentation. Values >= 0 are accepted. For example: 0 - gray image, 1 - no change, 2 - increase contrast twice @param contrast_center (float, optional, default = None) intensity value unaffected by the augmentation @param device (string, optional, default = None) Parameter unused for augmentation @param output_layout (int, optional, default = types.NHWC) tensor layout for the augmentation output @param output_dtype (int, optional, default = types.UINT8) tensor dtype for the augmentation output @return Image with adjusted contrast
◆ copy()
def rocAL_pybind.amd.rocal.fn.copy | ( | * | inputs, |
device = None |
|||
) |
Copies input tensor to output tensor.
@param inputs the input image passed to the augmentation @param device (string, optional, default = None) Parameter unused for augmentation @return Copied Image
◆ crop()
def rocAL_pybind.amd.rocal.fn.crop | ( | * | inputs, |
crop = [0, 0] , |
|||
crop_pos_x = 0.5 , |
|||
crop_pos_y = 0.5 , |
|||
crop_pos_z = 0.5 , |
|||
crop_w = 0 , |
|||
crop_h = 0 , |
|||
crop_d = 1 , |
|||
device = None , |
|||
output_layout = types.NHWC , |
|||
output_dtype = types.UINT8 |
|||
) |
crops images
@param inputs the input image passed to the augmentation @param crop (list of ints, optional, default = [0, 0]) list containing the crop dimensions of the cropped image @param crop_pox_x (float, optional, default = 0.5) crop_x position used for crop generation @param crop_pox_y (float, optional, default = 0.5) crop_y position used for crop generation @param crop_pox_z (float, optional, default = 0.5) crop_z position used for crop generation @param crop_w (int, optional, default = 0) crop width @param crop_h (int, optional, default = 0) crop height @param crop_d (int, optional, default = 1) crop depth @param device (string, optional, default = None) Parameter unused for augmentation @param output_layout (int, optional, default = types.NHWC) tensor layout for the augmentation output @param output_dtype (int, optional, default = types.UINT8) tensor dtype for the augmentation output @return Cropped Images
◆ crop_mirror_normalize()
def rocAL_pybind.amd.rocal.fn.crop_mirror_normalize | ( | * | inputs, |
crop = [0, 0] , |
|||
crop_pos_x = 0.5 , |
|||
crop_pos_y = 0.5 , |
|||
crop_w = 0 , |
|||
crop_h = 0 , |
|||
mean = [0.0] , |
|||
std = [1.0] , |
|||
mirror = 1 , |
|||
device = None , |
|||
output_layout = types.NHWC , |
|||
output_dtype = types.UINT8 |
|||
) |
Fused function which performs crop, normalize and flip on images.
@param inputs the input image passed to the augmentation @param crop (list of ints, optional, default = [0, 0]) list containing the crop dimensions of the cropped image @param crop_pox_x (float, optional, default = 0.5) crop_x position used for crop generation @param crop_pox_y (float, optional, default = 0.5) crop_y position used for crop generation @param crop_w (int, optional, default = 0) crop width @param crop_h (int, optional, default = 0) crop height @param mean (list of floats, optional, default = [0.0]) mean used for normalization @param std (list of floats, optional, default = [1.0]) standard deviation used for normalization @param mirror (int, optional, default = 1) flag for the horizontal flip. @param device (string, optional, default = None) Parameter unused for augmentation @param output_layout (int, optional, default = types.NHWC) tensor layout for the augmentation output @param output_dtype (int, optional, default = types.UINT8) tensor dtype for the augmentation output @return Transformed Images after perform crop , normalize and flip operations
◆ exposure()
def rocAL_pybind.amd.rocal.fn.exposure | ( | * | inputs, |
exposure = 0.5 , |
|||
device = None , |
|||
output_layout = types.NHWC , |
|||
output_dtype = types.UINT8 |
|||
) |
Adjusts the exposure in images.
@param inputs the input image passed to the augmentation @param exposure (float, default = 0.5) exposure fill value used for the augmentation @param device (string, optional, default = None) Parameter unused for augmentation @param output_layout (int, optional, default = types.NHWC) tensor layout for the augmentation output @param output_dtype (int, optional, default = types.UINT8) tensor dtype for the augmentation output @return Image with adjusted exposure
◆ external_source()
def rocAL_pybind.amd.rocal.fn.external_source | ( | source, | |
device = None , |
|||
color_format = types.RGB , |
|||
random_shuffle = False , |
|||
mode = types.EXTSOURCE_FNAME , |
|||
max_width = 2000 , |
|||
max_height = 2000 , |
|||
last_batch_policy = types.LAST_BATCH_FILL , |
|||
pad_last_batch_repeated = False , |
|||
stick_to_shard = True , |
|||
shard_size = -1 |
|||
) |
External Source Reader - User can pass a iterator or callable source. @param source (iterator or callable) The source iterator or callable object. @param device (string, optional, default = None) Parameter unused for augmentation @color_format (type, optional, default = RGB) Tensor color format for the reader. Default is RGB format. @random_shuffle (bool, optional, default= False) Data would be randomly shuffled if set to True. @mode (type, optional, default = EXTSOURCE_FNAME) The Default mode would be External Source File Name. The External Source Mode can be FileName, Raw Compressed, Raw Uncompressed. @max_width (int, optional, default = 2000) The Max Width to which the source images would be decoded to. @max_height (int, optional, default = 2000) The Max Height to which the source images would be decoded to.
◆ fish_eye()
def rocAL_pybind.amd.rocal.fn.fish_eye | ( | * | inputs, |
device = None , |
|||
fill_value = 0.0 , |
|||
output_layout = types.NHWC , |
|||
output_dtype = types.UINT8 |
|||
) |
Applies fish eye effect on images.
@param inputs the input image passed to the augmentation @param fill_value (float, optional, default = 0.0) Parameter unused for augmentation @param device (string, optional, default = None) Parameter unused for augmentation @param output_layout (int, optional, default = types.NHWC) tensor layout for the augmentation output @param output_dtype (int, optional, default = types.UINT8) tensor dtype for the augmentation output @return Image with fish eye effect
◆ flip()
def rocAL_pybind.amd.rocal.fn.flip | ( | * | inputs, |
horizontal = 0 , |
|||
vertical = 0 , |
|||
device = None , |
|||
output_layout = types.NHWC , |
|||
output_dtype = types.UINT8 |
|||
) |
Flip images horizontally and/or vertically based on inputs.
@param inputs the input image passed to the augmentation @param horizontal (int, optional, default = 0) flip the horizontal dimension @param vertical (int, optional, default = 0) flip the vertical dimension @param device (string, optional, default = None) Parameter unused for augmentation @param output_layout (int, optional, default = types.NHWC) tensor layout for the augmentation output @param output_dtype (int, optional, default = types.UINT8) tensor dtype for the augmentation output @return Flipped Image
◆ fog()
def rocAL_pybind.amd.rocal.fn.fog | ( | * | inputs, |
fog = 0.5 , |
|||
device = None , |
|||
output_layout = types.NHWC , |
|||
output_dtype = types.UINT8 |
|||
) |
Applies fog effect on images.
@param inputs the input image passed to the augmentation @param fog (float, default = 0.5) fog fill value used for the augmentation @param device (string, optional, default = None) Parameter unused for augmentation @param output_layout (int, optional, default = types.NHWC) tensor layout for the augmentation output @param output_dtype (int, optional, default = types.UINT8) tensor dtype for the augmentation output @return Image with fog effect
◆ gamma_correction()
def rocAL_pybind.amd.rocal.fn.gamma_correction | ( | * | inputs, |
gamma = 0.5 , |
|||
device = None , |
|||
output_layout = types.NHWC , |
|||
output_dtype = types.UINT8 |
|||
) |
Applies gamma correction on image.
@param inputs the input image passed to the augmentation @param gamma (float, default = 0.5) gamma correction value used for the augmentation @param device (string, optional, default = None) Parameter unused for augmentation @param output_layout (int, optional, default = types.NHWC) tensor layout for the augmentation output @param output_dtype (int, optional, default = types.UINT8) tensor dtype for the augmentation output @return Image with Gamma Correction
◆ hue()
def rocAL_pybind.amd.rocal.fn.hue | ( | * | inputs, |
hue = None , |
|||
device = None , |
|||
seed = 0 , |
|||
output_layout = types.NHWC , |
|||
output_dtype = types.UINT8 |
|||
) |
Adjust the hue in the images.
@param inputs the input image passed to the augmentation @param hue (float, default = None) hue change in degrees @param seed (int, optional, default = 0) seed used for randomization in the augmentation @param device (string, optional, default = None) Parameter unused for augmentation @param output_layout (int, optional, default = types.NHWC) tensor layout for the augmentation output @param output_dtype (int, optional, default = types.UINT8) tensor dtype for the augmentation output @return Image with Hue effect
◆ jitter()
def rocAL_pybind.amd.rocal.fn.jitter | ( | * | inputs, |
kernel_size = None , |
|||
seed = 0 , |
|||
fill_value = 0.0 , |
|||
device = None , |
|||
output_layout = types.NHWC , |
|||
output_dtype = types.UINT8 |
|||
) |
Applies Jitter effect on images.
@param inputs the input image passed to the augmentation @param kernel_size (int, optional, default = None) kernel size used for the augmentation @param seed (int, optional, default = 0) seed used for randomization in the augmentation @param fill_value (float, optional, default = 0.0) Value to fill areas outside image. @param device (string, optional, default = None) Parameter unused for augmentation @param output_layout (int, optional, default = types.NHWC) tensor layout for the augmentation output @param output_dtype (int, optional, default = types.UINT8) tensor dtype for the augmentation output @return Image with Jitter effect
◆ lens_correction()
def rocAL_pybind.amd.rocal.fn.lens_correction | ( | * | inputs, |
strength = None , |
|||
zoom = None , |
|||
device = None , |
|||
output_layout = types.NHWC , |
|||
output_dtype = types.UINT8 |
|||
) |
Applies lens correction effect on images.
@param inputs the input image passed to the augmentation @param strength (float, optional, default = None) strength value used for the augmentation @param zoom (float, optional, default = None) zoom value used for the augmentation @param device (string, optional, default = None) Parameter unused for augmentation @param output_layout (int, optional, default = types.NHWC) tensor layout for the augmentation output @param output_dtype (int, optional, default = types.UINT8) tensor dtype for the augmentation output @return Image with lens correction effect
◆ mel_filter_bank()
def rocAL_pybind.amd.rocal.fn.mel_filter_bank | ( | * | inputs, |
bytes_per_sample_hint = [0] , |
|||
freq_high = 0.0 , |
|||
freq_low = 0.0 , |
|||
mel_formula = types.MELSCALE_SLANEY , |
|||
nfilter = 128 , |
|||
normalize = True , |
|||
sample_rate = 44100.0 , |
|||
seed = -1 , |
|||
output_datatype = types.FLOAT |
|||
) |
Converts a spectrogram to a mel spectrogram by applying a bank of triangular filters. The frequency ('f') dimension is selected from the input layout. In case of no layout, “f”, “ft”, or “*ft” is assumed, depending on the number of dimensions.
◆ nonsilent_region()
def rocAL_pybind.amd.rocal.fn.nonsilent_region | ( | * | inputs, |
cutoff_db = -60 , |
|||
reference_power = 0.0 , |
|||
reset_interval = 8192 , |
|||
window_length = 2048 |
|||
) |
Performs leading and trailing silence detection in an audio buffer. @param cutoff_db (float) The threshold, in dB, below which the signal is considered silent. @param reference_power (float) The reference power that is utilized to convert the signal to dB. @param reset_interval (int) The number of samples after which the moving mean average is recalculated aiming to avoid loss of precision. @param window_length (int) Size of the sliding window used in calculating the short-term power of the signal.
◆ nop()
def rocAL_pybind.amd.rocal.fn.nop | ( | * | inputs, |
device = None |
|||
) |
Performs no operation.
@param inputs the input image passed to the augmentation @param device (string, optional, default = None) Parameter unused for augmentation @return Nop Output
◆ normalize()
def rocAL_pybind.amd.rocal.fn.normalize | ( | * | inputs, |
axes = [] , |
|||
mean = [] , |
|||
stddev = [] , |
|||
scale = 1.0 , |
|||
shift = 0.0 , |
|||
output_datatype = types.FLOAT |
|||
) |
Normalizes the input by removing the mean and dividing by the standard deviation. The mean and standard deviation can be calculated internally for the specified subset of axes or can be externally provided as the mean and stddev arguments. The normalization is done following the formula: out = scale * (in - mean) / stddev + shift The formula assumes that out and in are equally shaped tensors, but mean and stddev might be either tensors of same shape, scalars, or a mix of these.
◆ one_hot()
def rocAL_pybind.amd.rocal.fn.one_hot | ( | * | inputs, |
num_classes = 0 , |
|||
device = None |
|||
) |
Applies one-hot encoding to the input images.
@param inputs (list) The input images to which one-hot encoding is applied. @param num_classes (int, optional, default = 0) Number of classes used for one-hot encoding. Default is 0. @param device (string, optional, default = None) Parameter unused for augmentation @return an empty list
◆ pixelate()
def rocAL_pybind.amd.rocal.fn.pixelate | ( | * | inputs, |
device = None , |
|||
output_layout = types.NHWC , |
|||
output_dtype = types.UINT8 |
|||
) |
Applies pixelate effect on images.
@param inputs the input image passed to the augmentation @param device (string, optional, default = None) Parameter unused for augmentation @param output_layout (int, optional, default = types.NHWC) tensor layout for the augmentation output @param output_dtype (int, optional, default = types.UINT8) tensor dtype for the augmentation output @return Images with pixelate effect
◆ preemphasis_filter()
def rocAL_pybind.amd.rocal.fn.preemphasis_filter | ( | * | inputs, |
border = types.CLAMP , |
|||
preemph_coeff = 0.97 , |
|||
output_dtype = types.FLOAT |
|||
) |
Applies preemphasis filter to the input data. This filter, in simple form, can be expressed by the formula: Y[t] = X[t] - coeff * X[t-1] if t > 1 Y[t] = X[t] - coeff * X_border if t == 0 with X and Y being the input and output signal, respectively. The value of X_border depends on the border argument: X_border = 0 if border_type == 'zero' X_border = X[0] if border_type == 'clamp' X_border = X[1] if border_type == 'reflect' @param inputs (list) The input sample to which preEmphasisFilter is applied. @param border The border value policy. The possible values are "CLAMP", "ZERO", "REFLECT" @param preemph_coeff (float , optional, default = 0.97) The preEmphasisFilter co-efficient. @output_dtype (type, optional, default = types.FLOAT) Tensor dtype for the augmentation output. Default is types.FLOAT.
◆ rain()
def rocAL_pybind.amd.rocal.fn.rain | ( | * | inputs, |
rain = None , |
|||
rain_width = None , |
|||
rain_height = None , |
|||
rain_transparency = None , |
|||
device = None , |
|||
output_layout = types.NHWC , |
|||
output_dtype = types.UINT8 |
|||
) |
Applies Rain effect on images.
@param inputs the input image passed to the augmentation @param rain (float, optional, default = None) rain fill value used for the augmentation @param rain_width (int, optional, default = None) width of the rain pixels for the augmentation @param rain_height (int, optional, default = None) height of the rain pixels for the augmentation @param rain_transparency (float, optional, default = None) transparency value used for the augmentation @param device (string, optional, default = None) Parameter unused for augmentation @param output_layout (int, optional, default = types.NHWC): tensor layout for the augmentation output @param output_dtype (int, optional, default = types.UINT8) tensor dtype for the augmentation output @return Images with Rain effect
◆ random_bbox_crop()
def rocAL_pybind.amd.rocal.fn.random_bbox_crop | ( | * | inputs, |
all_boxes_above_threshold = True , |
|||
allow_no_crop = True , |
|||
aspect_ratio = None , |
|||
bbox_layout = "" , |
|||
threshold_type = "iou" , |
|||
thresholds = None , |
|||
crop_shape = None , |
|||
num_attempts = 1 , |
|||
scaling = None , |
|||
seed = 1 , |
|||
shape_layout = "" , |
|||
input_shape = None , |
|||
total_num_attempts = 0 , |
|||
device = None , |
|||
ltrb = True , |
|||
labels = None |
|||
) |
Applies random bounding box cropping to the input images.
@param inputs (list) The input images to which random cropping is applied. @param all_boxes_above_threshold (bool, optional, default = True) If set to True, all bounding boxes in a sample should overlap with the cropping window. Default is True. @param allow_no_crop (bool, optional, default = True) If set to True, one of the possible outcomes of the random process will be to not crop. Default is True. @param aspect_ratio (list of floats, optional, default = None) Aspect ratio range [min, max] used for crop generation. Default is None. @param crop_shape (list of ints, optional, default = None) Crop shape [width, height] used for crop generation. Default is None. @param num_attempts (int, optional, default = 1) Number of attempts to get a crop window that matches the aspect_ratio and threshold. Default is 1. @param scaling (list of int, optional, default = None) Scaling range [min, max] for the crop size with respect to the original image dimensions. Default is None. @param seed (int, optional, default = 1) Random seed. Default is 1. @param total_num_attempts (int, optional, default = 0) If provided, it indicates the total maximum number of attempts to get a crop window that matches the aspect_ratio and the threshold. After total_num_attempts attempts, the best candidate will be selected. If this value is not specified, the crop search will continue indefinitely until a valid crop is found. Default is 0. @param device (string, optional, default = None) Parameter unused for augmentation @param ltrb (bool, optional, default = True) Parameter unused for augmentation @return cropped images
◆ random_crop()
def rocAL_pybind.amd.rocal.fn.random_crop | ( | * | inputs, |
crop_area_factor = [0.08, 1] , |
|||
crop_aspect_ratio = [0.75, 1.333333] , |
|||
crop_pox_x = 0 , |
|||
crop_pox_y = 0 , |
|||
num_attempts = 20 , |
|||
device = None , |
|||
all_boxes_above_threshold = True , |
|||
allow_no_crop = True , |
|||
ltrb = True , |
|||
output_layout = types.NHWC , |
|||
output_dtype = types.UINT8 |
|||
) |
Crops images randomly.
@param inputs: the input image passed to the augmentation @param crop_area_factor (list of floats, optional, default = [0.08, 1]) area factor used for crop generation @param crop_aspect_ratio (list of floats, optional, default = [0.75, 1.333333]) valid range of aspect ratio of the cropping windows @param crop_pox_x (int, optional, default = 0) crop_x position used for crop generation @param crop_pox_y (int, optional, default = 0) crop_y position used for crop generation @param num_attempts (int, optional, default = 20) number of attempts to get a crop window that matches the area factor and aspect ratio conditions @param device (string, optional, default = None) Parameter unused for augmentation @param all_boxes_above_threshold (bool, optional, default = True) Parameter unused for augmentation @param allow_no_crop (bool, optional, default = True) Parameter unused for augmentation @param ltrb (bool, optional, default = True) Parameter unused for augmentation @param output_layout (int, optional, default = types.NHWC) tensor layout for the augmentation output @param output_dtype (int, optional, default = types.UINT8) tensor dtype for the augmentation output @return cropped Image
◆ resample()
def rocAL_pybind.amd.rocal.fn.resample | ( | * | inputs, |
resample_rate = None , |
|||
output_datatype = types.FLOAT , |
|||
resample_hint = -1 , |
|||
quality = 50.0 |
|||
) |
Resamples an audio signal. The resampling is achieved by applying a sinc filter with Hann window with an extent controlled by the quality argument.
◆ resize()
def rocAL_pybind.amd.rocal.fn.resize | ( | * | inputs, |
max_size = [] , |
|||
resize_longer = 0 , |
|||
resize_shorter = 0 , |
|||
resize_width = 0 , |
|||
resize_height = 0 , |
|||
scaling_mode = types.SCALING_MODE_DEFAULT , |
|||
interpolation_type = types.LINEAR_INTERPOLATION , |
|||
antialias = True , |
|||
device = None , |
|||
output_layout = types.NHWC , |
|||
output_dtype = types.UINT8 |
|||
) |
Resizes the images.
@param inputs the input image passed to the augmentation @param max_size (int or list of int, optional, default = []) Maximum size of the longer dimension when resizing with resize_shorter. When set with resize_shorter, the shortest dimension will be resized to resize_shorter if the longest dimension is smaller or equal to max_size. If not, the shortest dimension is resized to satisfy the constraint longest_dim == max_size. Can be also an array of size 2, where the two elements are maximum size per dimension (H, W). Example: Original image = 400x1200. Resized with: resize_shorter = 200 (max_size not set) => 200x600 resize_shorter = 200, max_size = 400 => 132x400 resize_shorter = 200, max_size = 1000 => 200x600 @param resize_longer (int, optional, default = 0) The length of the longer dimension of the resized image. This option is mutually exclusive with resize_shorter,`resize_x` and resize_y. The op will keep the aspect ratio of the original image. @param resize_shorter (int, optional, default = 0) The length of the shorter dimension of the resized image. This option is mutually exclusive with resize_longer, resize_x and resize_y. The op will keep the aspect ratio of the original image. The longer dimension can be bounded by setting the max_size argument. See max_size argument doc for more info. @param resize_width (int, optional, default = 0) The length of the X dimension of the resized image. This option is mutually exclusive with resize_shorter. If the resize_y is left at 0, then the op will keep the aspect ratio of the original image. @param resize_height (int, optional, default = 0) The length of the Y dimension of the resized image. This option is mutually exclusive with resize_shorter. If the resize_x is left at 0, then the op will keep the aspect ratio of the original image. @param scaling_mode (int, optional, default = types.SCALING_MODE_DEFAULT) resize scaling mode. @param interpolation_type (int, optional, default = types.LINEAR_INTERPOLATION) Type of interpolation to be used. @param antialias (bool, optional, default = True) Parameter unused for augmentation @param device (string, optional, default = None) Parameter unused for augmentation @param output_layout (int, optional, default = types.NHWC) tensor layout for the augmentation output @param output_dtype (int, optional, default = types.UINT8) tensor dtype for the augmentation output @return Resized Image
◆ resize_crop()
def rocAL_pybind.amd.rocal.fn.resize_crop | ( | * | inputs, |
resize_width = 0 , |
|||
resize_height = 0 , |
|||
crop_area_factor = None , |
|||
crop_aspect_ratio = None , |
|||
x_drift = None , |
|||
y_drift = None , |
|||
device = None , |
|||
max_size = [] , |
|||
resize_longer = 0 , |
|||
resize_shorter = 0 , |
|||
scaling_mode = types.SCALING_MODE_DEFAULT , |
|||
interpolation_type = types.LINEAR_INTERPOLATION , |
|||
output_layout = types.NHWC , |
|||
output_dtype = types.UINT8 |
|||
) |
Fused function which performs resize, crop on images.
@param inputs: the input image passed to the augmentation @param resize_width (int, optional, default = 0) The length of the X dimension of the resized image @param resize_height (int, optional, default = 0) The length of the Y dimension of the resized image @param crop_area_factor (float, optional, default = None) area factor used for crop generation @param crop_aspect_ratio (float, optional, default = None) aspect ratio used for crop generation @param device (string, optional, default = None) Parameter unused for augmentation @param x_drift (float, optional, default = None) x_drift used for crop generation @param y_drift (float, optional, default = None) y_drift used for crop generation @param max_size (int or list of int, optional, default = []) Maximum size of the longer dimension when resizing with resize_shorter. When set with resize_shorter, the shortest dimension will be resized to resize_shorter if the longest dimension is smaller or equal to max_size. If not, the shortest dimension is resized to satisfy the constraint longest_dim == max_size. Can be also an array of size 2, where the two elements are maximum size per dimension (H, W). Example: Original image = 400x1200. Resized with: resize_shorter = 200 (max_size not set) => 200x600 resize_shorter = 200, max_size = 400 => 132x400 resize_shorter = 200, max_size = 1000 => 200x600 @param resize_longer (int, optional, default = 0) The length of the longer dimension of the resized image. This option is mutually exclusive with resize_shorter,`resize_x` and resize_y. The op will keep the aspect ratio of the original image. @param resize_shorter (int, optional, default = 0) The length of the shorter dimension of the resized image. This option is mutually exclusive with resize_longer, resize_x and resize_y. The op will keep the aspect ratio of the original image. The longer dimension can be bounded by setting the max_size argument. See max_size argument doc for more info. @param scaling_mode (int, optional, default = types.SCALING_MODE_DEFAULT) resize scaling mode. @param interpolation_type (int, optional, default = types.LINEAR_INTERPOLATION) Type of interpolation to be used. @param output_layout (int, optional, default = types.NHWC) tensor layout for the augmentation output @param output_dtype (int, optional, default = types.UINT8) tensor dtype for the augmentation output @return Resized and cropped Image
◆ resize_crop_mirror()
def rocAL_pybind.amd.rocal.fn.resize_crop_mirror | ( | * | inputs, |
resize_width = 0 , |
|||
resize_height = 0 , |
|||
crop_w = 0 , |
|||
crop_h = 0 , |
|||
mirror = 1 , |
|||
device = None , |
|||
max_size = [] , |
|||
resize_longer = 0 , |
|||
resize_shorter = 0 , |
|||
scaling_mode = types.SCALING_MODE_DEFAULT , |
|||
interpolation_type = types.LINEAR_INTERPOLATION , |
|||
output_layout = types.NHWC , |
|||
output_dtype = types.UINT8 |
|||
) |
Fused function which performs resize, crop and flip on images.
@param inputs the input image passed to the augmentation @param resize_width (int, optional, default = 0) The length of the X dimension of the resized image @param resize_height (int, optional, default = 0) The length of the Y dimension of the resized image @param crop_w (int, optional, default = 0) Cropping window width (in pixels). @param crop_h (int, optional, default = 0) Cropping window height (in pixels). @param mirror (int, optional, default = 1) flag for the horizontal flip. @param device (string, optional, default = None) Parameter unused for augmentation @param max_size (int or list of int, optional, default = []) Parameter unused for augmentation @param resize_longer (int, optional, default = 0) Parameter unused for augmentation @param resize_shorter (int, optional, default = 0) Parameter unused for augmentation @param scaling_mode (int, optional, default = types.SCALING_MODE_DEFAULT) Parameter unused for augmentation @param interpolation_type (int, optional, default = types.LINEAR_INTERPOLATION) Parameter unused for augmentation @param output_layout (int, optional, default = types.NHWC) tensor layout for the augmentation output @param output_dtype (int, optional, default = types.UINT8) tensor dtype for the augmentation output @return Resized crop mirror Image
◆ resize_mirror_normalize()
def rocAL_pybind.amd.rocal.fn.resize_mirror_normalize | ( | * | inputs, |
max_size = [] , |
|||
resize_longer = 0 , |
|||
resize_shorter = 0 , |
|||
resize_width = 0 , |
|||
resize_height = 0 , |
|||
scaling_mode = types.SCALING_MODE_DEFAULT , |
|||
interpolation_type = types.LINEAR_INTERPOLATION , |
|||
mean = [0.0] , |
|||
std = [1.0] , |
|||
mirror = 1 , |
|||
device = None , |
|||
output_layout = types.NHWC , |
|||
output_dtype = types.UINT8 |
|||
) |
Fused function which performs resize, Normalize and flip on images.
@param inputs the input image passed to the augmentation @param max_size (int or list of int, optional, default = []) Maximum size of the longer dimension when resizing with resize_shorter. When set with resize_shorter, the shortest dimension will be resized to resize_shorter if the longest dimension is smaller or equal to max_size. If not, the shortest dimension is resized to satisfy the constraint longest_dim == max_size. Can be also an array of size 2, where the two elements are maximum size per dimension (H, W). Example: Original image = 400x1200. Resized with: resize_shorter = 200 (max_size not set) => 200x600 resize_shorter = 200, max_size = 400 => 132x400 resize_shorter = 200, max_size = 1000 => 200x600 @param resize_longer (int, optional, default = 0) The length of the longer dimension of the resized image. This option is mutually exclusive with resize_shorter,`resize_x` and resize_y. The op will keep the aspect ratio of the original image. @param resize_shorter (int, optional, default = 0) The length of the shorter dimension of the resized image. This option is mutually exclusive with resize_longer, resize_x and resize_y. The op will keep the aspect ratio of the original image. The longer dimension can be bounded by setting the max_size argument. See max_size argument doc for more info. @param resize_width (int, optional, default = 0) The length of the X dimension of the resized image. This option is mutually exclusive with resize_shorter. If the resize_y is left at 0, then the op will keep the aspect ratio of the original image. @param resize_height (int, optional, default = 0) The length of the Y dimension of the resized image. This option is mutually exclusive with resize_shorter. If the resize_x is left at 0, then the op will keep the aspect ratio of the original image. @param scaling_mode (int, optional, default = types.SCALING_MODE_DEFAULT) resize scaling mode. @param interpolation_type (int, optional, default = types.LINEAR_INTERPOLATION) Type of interpolation to be used. @param mean (list of floats, optional, default = [0.0]) mean used for normalization @param std (list of floats, optional, default = [1.0]) standard deviation used for normalization @param mirror (int, optional, default = 1) flag for the horizontal flip. @param device (string, optional, default = None) Parameter unused for augmentation @param output_layout (int, optional, default = types.NHWC) tensor layout for the augmentation output @param output_dtype (int, optional, default = types.UINT8) tensor dtype for the augmentation output @return Transformed Image
◆ rotate()
def rocAL_pybind.amd.rocal.fn.rotate | ( | * | inputs, |
angle = None , |
|||
dest_width = 0 , |
|||
dest_height = 0 , |
|||
interpolation_type = types.LINEAR_INTERPOLATION , |
|||
device = None , |
|||
fill_value = None , |
|||
output_layout = types.NHWC , |
|||
output_dtype = types.UINT8 |
|||
) |
Rotates images.
@param inputs the input image passed to the augmentation @param angle (float, optional, default = None) angle used for rotating the image @param dest_width (int, optional, default = 0) The length of the X dimension of the rotated image @param dest_height (int, optional, default = 0) The length of the Y dimension of the rotated image @param interpolation_type (int, optional, default = types.LINEAR_INTERPOLATION) Type of interpolation to be used. @param device (string, optional, default = None) Parameter unused for augmentation @param fill_value (float, optional, default = 0.0) Parameter unused for augmentation @param output_layout (int, optional, default = types.NHWC) tensor layout for the augmentation output @param output_dtype (int, optional, default = types.UINT8) tensor dtype for the augmentation output @return Roatated Image
◆ saturation()
def rocAL_pybind.amd.rocal.fn.saturation | ( | * | inputs, |
saturation = 1.0 , |
|||
device = None , |
|||
output_layout = types.NHWC , |
|||
output_dtype = types.UINT8 |
|||
) |
Adjusts the saturation in images.
@param inputs the input image passed to the augmentation @param saturation (float, default = 1.0) The saturation change factor. Values must be non-negative. Example values: 0 - Completely desaturated image, 1 - No change to image's saturation. @param device (string, optional, default = None) Parameter unused for augmentation @param output_layout (int, optional, default = types.NHWC) tensor layout for the augmentation output @param output_dtype (int, optional, default = types.UINT8) tensor dtype for the augmentation output @return Image with Saturation effect
◆ slice()
def rocAL_pybind.amd.rocal.fn.slice | ( | * | inputs, |
anchor = [] , |
|||
shape = [] , |
|||
fill_values = [0.0] , |
|||
out_of_bounds_policy = types.ERROR , |
|||
rocal_tensor_output_type = types.FLOAT |
|||
) |
The slice can be specified by proving the start and end coordinates, or start coordinates and shape of the slice. Both coordinates and shapes can be provided in absolute or relative terms. @param anchor (int or 1D RocalTensor of ints) The absolute starting co-ordinate points of the slice. @param shape (int or 1D RocalTensor of ints) The absolute co-ordinate for the dimensions of the slice. @param fill_values (float or list of float) Determines the padding values and is only relevant if out_of_bounds_policy is “pad” policy. @param out_of_bounds_policy ("error", "pad", "trim_to_shape") Determines the policy when slicing the out of bounds area of the input. @param rocal_tensor_output_type (float) Output DataType of the Tensor
◆ snow()
def rocAL_pybind.amd.rocal.fn.snow | ( | * | inputs, |
snow = 0.5 , |
|||
device = None , |
|||
output_layout = types.NHWC , |
|||
output_dtype = types.UINT8 |
|||
) |
Applies snow effect on images.
@param inputs the input image passed to the augmentation @param snow (float, default = 0.5) snow fill value used for the augmentation @param device (string, optional, default = None) Parameter unused for augmentation @param output_layout (int, optional, default = types.NHWC) tensor layout for the augmentation output @param output_dtype (int, optional, default = types.UINT8) tensor dtype for the augmentation output @return Image with snow effect
◆ snp_noise()
def rocAL_pybind.amd.rocal.fn.snp_noise | ( | * | inputs, |
p_noise = 0.0 , |
|||
p_salt = 0.0 , |
|||
noise_val = 0.0 , |
|||
salt_val = 0.0 , |
|||
seed = 0 , |
|||
device = None , |
|||
output_layout = types.NHWC , |
|||
output_dtype = types.UINT8 |
|||
) |
Applies salt-and-pepper noise to the input image.
@param inputs (list) The input image to which salt-and-pepper noise is applied. @param p_noise (float, optional, default = 0.0) Noise probability. Default is 0.0. @param p_salt (float, optional, default = 0.0) Salt probability. Default is 0.0. @param noise_val (float, optional, default = 0.0) Noise value to be added to the image. Default is 0.0. @param salt_val (float, optional, default = 0.0) Salt value to be added to the image. Default is 0.0. @param seed (int, optional, default = 0) Random seed. Default is 0. @param device (string, optional, default = None) Parameter unused for augmentation @param output_layout (int, optional, default = types.NHWC) Tensor layout for the augmentation output. Default is types.NHWC. @param output_dtype (int, optional, default = types.UINT*) Tensor dtype for the augmentation output. Default is types.UINT8. @return images with salt-and-pepper noise added.
◆ spectrogram()
def rocAL_pybind.amd.rocal.fn.spectrogram | ( | * | inputs, |
bytes_per_sample_hint = [0] , |
|||
center_windows = True , |
|||
layout = types.NFT , |
|||
nfft = None , |
|||
power = 2 , |
|||
reflect_padding = True , |
|||
seed = -1 , |
|||
window_fn = [] , |
|||
window_length = 512 , |
|||
window_step = 256 , |
|||
output_dtype = types.FLOAT |
|||
) |
Produces a spectrogram from a 1D signal. Input data is expected to be one channel - The shape of the input can be (srcLength, 1) of the data type float32.
◆ ssd_random_crop()
def rocAL_pybind.amd.rocal.fn.ssd_random_crop | ( | * | inputs, |
p_threshold = None , |
|||
crop_area_factor = None , |
|||
crop_aspect_ratio = None , |
|||
crop_pos_x = None , |
|||
crop_pos_y = None , |
|||
num_attempts = 20 , |
|||
device = None , |
|||
all_boxes_above_threshold = True , |
|||
allow_no_crop = True , |
|||
ltrb = True , |
|||
output_layout = types.NHWC , |
|||
output_dtype = types.UINT8 |
|||
) |
Crops images randomly used for SSD training.
@param inputs the input image passed to the augmentation @param p_threshold (float, optional, default = None) threshold value used for selecting bboxes during crop generation @param crop_area_factor (float, optional, default = None) area factor used for crop generation @param crop_aspect_ratio (float, optional, default = None) aspect ratio of the cropping windows @param crop_pox_x (float, optional, default = None) crop_x position used for crop generation @param crop_pox_y (float, optional, default = None) crop_y position used for crop generation @param num_attempts (int, optional, default = 20) number of attempts to get a crop window that matches the area factor and aspect ratio conditions @param device (string, optional, default = None) Parameter unused for augmentation @param all_boxes_above_threshold (bool, optional, default = True) Parameter unused for augmentation @param allow_no_crop (bool, optional, default = True) Parameter unused for augmentation @param ltrb (bool, optional, default = True) Parameter unused for augmentation @param output_layout (int, optional, default = types.NHWC) tensor layout for the augmentation output @param output_dtype (int, optional, default = types.UINT8) tensor dtype for the augmentation output @return Randomly Cropped images for SSD training
◆ tensor_add_tensor_float()
def rocAL_pybind.amd.rocal.fn.tensor_add_tensor_float | ( | * | inputs, |
output_datatype = types.FLOAT |
|||
) |
Adds a rocalTensor with another rocalTensor.
◆ tensor_mul_scalar_float()
def rocAL_pybind.amd.rocal.fn.tensor_mul_scalar_float | ( | * | inputs, |
scalar = 1.0 , |
|||
output_datatype = types.FLOAT |
|||
) |
Multiplies a rocalTensor with a scalar float value.
◆ to_decibels()
def rocAL_pybind.amd.rocal.fn.to_decibels | ( | * | inputs, |
bytes_per_sample_hint = [0] , |
|||
cutoff_db = -200.0 , |
|||
multiplier = 10.0 , |
|||
reference = 0.0 , |
|||
seed = -1 , |
|||
output_dtype = types.FLOAT |
|||
) |
Converts a magnitude (real, positive) to the decibel scale. Conversion is done according to the following formula: min_ratio = pow(10, cutoff_db / multiplier) out[i] = multiplier * log10( max(min_ratio, input[i] / reference) )
◆ uniform()
def rocAL_pybind.amd.rocal.fn.uniform | ( | * | inputs, |
range = [-1, 1] , |
|||
device = None |
|||
) |
Applies uniform random number generation to the input images.
@param inputs the input image passed to the augmentation @param range (list of ints, optional, default = [-1, 1]) uniform distribution used for random number generation @param device (string, optional, default = None) Parameter unused for augmentation @return uniform random numbers
◆ vignette()
def rocAL_pybind.amd.rocal.fn.vignette | ( | * | inputs, |
vignette = 0.5 , |
|||
device = None , |
|||
output_layout = types.NHWC , |
|||
output_dtype = types.UINT8 |
|||
) |
Applies Vignette effect.
@param inputs the input image passed to the augmentation @param vignette (float, default = 0.5) vignette value used for the augmentation output @param device (string, optional, default = None) Parameter unused for augmentation @param output_layout (int, optional, default = types.NHWC) tensor layout for the augmentation output @param output_dtype (int, optional, default = types.UINT8) tensor dtype for the augmentation output @return Images with Vignette effect
◆ warp_affine()
def rocAL_pybind.amd.rocal.fn.warp_affine | ( | * | inputs, |
dest_width = 0 , |
|||
dest_height = 0 , |
|||
matrix = [0, 0, 0, 0, 0, 0] , |
|||
interpolation_type = types.LINEAR_INTERPOLATION , |
|||
device = None , |
|||
output_layout = types.NHWC , |
|||
output_dtype = types.UINT8 |
|||
) |
Applies affine transformation to images.
@param inputs the input image passed to the augmentation @param dest_width (int, optional, default = 0) The length of the X dimension of the transformed image @param matrix (list of ints, optional, default = [0, 0, 0, 0, 0, 0]) Transformation matrix used to produce a new image @param dest_height (int, optional, default = 0) The length of the Y dimension of the transformed image @param interpolation_type (int, optional, default = types.LINEAR_INTERPOLATION) Type of interpolation to be used. @param device (string, optional, default = None) Parameter unused for augmentation @param output_layout (int, optional, default = types.NHWC) tensor layout for the augmentation output @param output_dtype (int, optional, default = types.UINT8) tensor dtype for the augmentation output @return Affine Transformed Images