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

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

rocAL: /home/docs/checkouts/readthedocs.org/user_builds/advanced-micro-devices-rocal/checkouts/docs-6.1.1/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)
 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)
 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)
 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)
 Slices images randomly using different readers and decoders. More...
 
def rocAL_pybind.amd.rocal.decoders.audio (*inputs, file_root='', file_list_path='', shard_id=0, num_shards=1, random_shuffle=False, downmix=False, stick_to_shard=False, shard_size=-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 = '',
  shard_id = 0,
  num_shards = 1,
  random_shuffle = False,
  downmix = False,
  stick_to_shard = False,
  shard_size = -1 
)

Decodes wav audio files.

    @param inputs                           List of input audio.
    @param file_root                        Folder Path to the audio data.
    @param file_list_path (for future use)  Path to the 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 audio samples randomly.
    @param downmix                          Converts the audio data to single channel when enabled 
    @param stick_to_shard                   The reader sticks to the data for it's corresponding shard when enabled
    @param shard_size                       Provides the number of files in an epoch of a particular shard.
    @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 
)

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 
)

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 
)

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 
)

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.