/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-rocal/checkouts/develop/rocAL_pybind/amd/rocal/decoders.py File Reference

/home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-rocal/checkouts/develop/rocAL_pybind/amd/rocal/decoders.py File Reference#

rocAL: /home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-rocal/checkouts/develop/rocAL_pybind/amd/rocal/decoders.py File Reference
decoders.py File Reference

File containing various decoder implementations for various readers. More...

Functions

def rocAL_pybind.amd.rocal.decoders.image (*inputs, user_feature_key_map=None, path='', file_root='', annotations_file='', shard_id=0, num_shards=1, random_shuffle=False, output_type=types.RGB, decoder_type=types.DECODER_TJPEG, device=None, decode_size_policy=types.USER_GIVEN_SIZE_ORIG, max_decoded_width=1000, max_decoded_height=1000, last_batch_policy=types.LAST_BATCH_FILL, pad_last_batch=True, stick_to_shard=True, shard_size=-1)
 Decodes images using different readers and decoders. More...
 
def rocAL_pybind.amd.rocal.decoders.image_raw (*inputs, user_feature_key_map=None, path='', random_shuffle=False, output_type=types.RGB, max_decoded_width=1000, max_decoded_height=1000, last_batch_policy=types.LAST_BATCH_FILL, pad_last_batch=True, stick_to_shard=True, shard_size=-1)
 Decodes raw images for TF reader and decoder. More...
 
def rocAL_pybind.amd.rocal.decoders.image_random_crop (*inputs, user_feature_key_map=None, path='', file_root='', annotations_file='', num_shards=1, shard_id=0, random_shuffle=False, num_attempts=10, output_type=types.RGB, random_area=[0.08, 1.0], random_aspect_ratio=[0.8, 1.25], decode_size_policy=types.USER_GIVEN_SIZE_ORIG, max_decoded_width=1000, max_decoded_height=1000, decoder_type=types.DECODER_TJPEG, last_batch_policy=types.LAST_BATCH_FILL, pad_last_batch=True, stick_to_shard=True, shard_size=-1)
 Applies random cropping to images using different readers and decoders. More...
 
def rocAL_pybind.amd.rocal.decoders.image_slice (*inputs, file_root='', path='', annotations_file='', shard_id=0, num_shards=1, random_shuffle=False, random_aspect_ratio=[0.75, 1.33333], random_area=[0.08, 1.0], num_attempts=100, output_type=types.RGB, decode_size_policy=types.USER_GIVEN_SIZE_ORIG, max_decoded_width=1000, max_decoded_height=1000, last_batch_policy=types.LAST_BATCH_FILL, pad_last_batch=True, stick_to_shard=True, shard_size=-1)
 Slices images randomly using different readers and decoders. More...
 
def rocAL_pybind.amd.rocal.decoders.audio (*inputs, file_root='', file_list_path='', bytes_per_sample_hint=[0], shard_id=0, num_shards=1, random_shuffle=False, downmix=False, dtype=types.FLOAT, quality=50.0, sample_rate=0.0, seed=1, stick_to_shard=True, shard_size=-1, last_batch_policy=types.LAST_BATCH_FILL, pad_last_batch_repeated=False, decode_size_policy=types.MAX_SIZE, max_decoded_samples=522320, max_decoded_channels=1)
 Decodes wav audio files. More...
 

Detailed Description

File containing various decoder implementations for various readers.

Function Documentation

◆ audio()

def rocAL_pybind.amd.rocal.decoders.audio ( inputs,
  file_root = '',
  file_list_path = '',
  bytes_per_sample_hint = [0],
  shard_id = 0,
  num_shards = 1,
  random_shuffle = False,
  downmix = False,
  dtype = types.FLOAT,
  quality = 50.0,
  sample_rate = 0.0,
  seed = 1,
  stick_to_shard = True,
  shard_size = -1,
  last_batch_policy = types.LAST_BATCH_FILL,
  pad_last_batch_repeated = False,
  decode_size_policy = types.MAX_SIZE,
  max_decoded_samples = 522320,
  max_decoded_channels = 1 
)

Decodes wav audio files.

    @param inputs                   list of input audio.
    @param file_root                Folder Path to the audio data.
    @param file_list_path           Text file containing list of files and the labels
    @param shard_id                 Shard ID for parallel processing.
    @param num_shards               Total number of shards for parallel processing.
    @param random_shuffle           Whether to shuffle images randomly.
    @param downmix                  Converts the audio data to single channel when enabled 
    @param dtype                    Data type of the decoded audio
    @param quality                  Resampling quality
    @param sample_rate              Sample rate for the decoded audio.
    @param seed                     Random seed.
    @param stick_to_shard           The reader sticks to the data for it's corresponding shard when enabled
    @param shard_size               Number of files in an epoch
    @param last_batch_policy        Determines the handling of the last batch when the shard size is not divisible by the batch size. Check types.py enum for possible values.
    @param pad_last_batch_repeated  If set to True, pads the shards last batch by repeating the last sample's data (dummy data).
    @param decode_size_policy       Size policy for decoding images.
    @param max_decoded_samples      Maximum samples for decoded images.
    @param max_decoded_channels     Maximum channels for decoded images.
    @return                         Decoded audio.

◆ image()

def rocAL_pybind.amd.rocal.decoders.image ( inputs,
  user_feature_key_map = None,
  path = '',
  file_root = '',
  annotations_file = '',
  shard_id = 0,
  num_shards = 1,
  random_shuffle = False,
  output_type = types.RGB,
  decoder_type = types.DECODER_TJPEG,
  device = None,
  decode_size_policy = types.USER_GIVEN_SIZE_ORIG,
  max_decoded_width = 1000,
  max_decoded_height = 1000,
  last_batch_policy = types.LAST_BATCH_FILL,
  pad_last_batch = True,
  stick_to_shard = True,
  shard_size = -1 
)

Decodes images using different readers and decoders.

    @param inputs                   list of input images.
    @param user_feature_key_map     User-provided feature key mapping.
    @param path                     Path to image source.
    @param file_root                Root path for image files.
    @param annotations_file         Path to annotations file.
    @param shard_id                 Shard ID for parallel processing.
    @param num_shards               Total number of shards for parallel processing.
    @param random_shuffle           Whether to shuffle images randomly.
    @param output_type              Color format of the output image.
    @param decoder_type             Type of image decoder to use.
    @param device                   Device to use for decoding ("gpu" or "cpu").
    @param decode_size_policy       Size policy for decoding images.
    @param max_decoded_width        Maximum width for decoded images.
    @param max_decoded_height       Maximum height for decoded images.

    @return    Decoded and preprocessed image.

◆ image_random_crop()

def rocAL_pybind.amd.rocal.decoders.image_random_crop ( inputs,
  user_feature_key_map = None,
  path = '',
  file_root = '',
  annotations_file = '',
  num_shards = 1,
  shard_id = 0,
  random_shuffle = False,
  num_attempts = 10,
  output_type = types.RGB,
  random_area = [0.08, 1.0],
  random_aspect_ratio = [0.8, 1.25],
  decode_size_policy = types.USER_GIVEN_SIZE_ORIG,
  max_decoded_width = 1000,
  max_decoded_height = 1000,
  decoder_type = types.DECODER_TJPEG,
  last_batch_policy = types.LAST_BATCH_FILL,
  pad_last_batch = True,
  stick_to_shard = True,
  shard_size = -1 
)

Applies random cropping to images using different readers and decoders.

    @param inputs                  list of input images.
    @param user_feature_key_map    User-provided feature key mapping.
    @param path                    Path to image source.
    @param file_root               Root path for image files.
    @param annotations_file        Path to annotations file.
    @param num_shards              Total number of shards for parallel processing.
    @param shard_id                Shard ID for parallel processing.
    @param random_shuffle          Whether to shuffle images randomly.
    @param num_attempts            Maximum number of attempts to find a valid crop.
    @param output_type             Color format of the output image.
    @param random_area             Random areas for cropping.
    @param random_aspect_ratio     Random aspect ratios for cropping.
    @param decode_size_policy      Size policy for decoding images.
    @param max_decoded_width       Maximum width for decoded images.
    @param max_decoded_height      Maximum height for decoded images.
    @param decoder_type            Type of image decoder to use.

    @return    Randomly cropped and preprocessed image.

◆ image_raw()

def rocAL_pybind.amd.rocal.decoders.image_raw ( inputs,
  user_feature_key_map = None,
  path = '',
  random_shuffle = False,
  output_type = types.RGB,
  max_decoded_width = 1000,
  max_decoded_height = 1000,
  last_batch_policy = types.LAST_BATCH_FILL,
  pad_last_batch = True,
  stick_to_shard = True,
  shard_size = -1 
)

Decodes raw images for TF reader and decoder.

    @param inputs                  list of input images.
    @param user_feature_key_map    User-provided feature key mapping.
    @param path                    Path to image source.
    @param random_shuffle          Whether to shuffle images randomly.
    @param output_type             Color format of the output image.
    @param max_decoded_width       Maximum width for decoded images.
    @param max_decoded_height      Maximum height for decoded images.

    @return    Decoded raw image.

◆ image_slice()

def rocAL_pybind.amd.rocal.decoders.image_slice ( inputs,
  file_root = '',
  path = '',
  annotations_file = '',
  shard_id = 0,
  num_shards = 1,
  random_shuffle = False,
  random_aspect_ratio = [0.75, 1.33333],
  random_area = [0.08, 1.0],
  num_attempts = 100,
  output_type = types.RGB,
  decode_size_policy = types.USER_GIVEN_SIZE_ORIG,
  max_decoded_width = 1000,
  max_decoded_height = 1000,
  last_batch_policy = types.LAST_BATCH_FILL,
  pad_last_batch = True,
  stick_to_shard = True,
  shard_size = -1 
)

Slices images randomly using different readers and decoders.

    @param inputs                 list of input images.
    @param file_root              Root path for image files.
    @param path                   Path to image source.
    @param annotations_file       Path to annotations file.
    @param shard_id               Shard ID for parallel processing.
    @param num_shards             Total number of shards for parallel processing.
    @param random_shuffle         Whether to shuffle images randomly.
    @param random_aspect_ratio    Random aspect ratios for cropping.
    @param random_area            Random areas for cropping.
    @param num_attempts           Maximum number of attempts to find a valid crop.
    @param output_type            Color format of the output image.
    @param decode_size_policy     Size policy for decoding images.
    @param max_decoded_width      Maximum width for decoded images.
    @param max_decoded_height     Maximum height for decoded images.

    @return    Sliced image.