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

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

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

File containing reader functions for multiple datasets and data formats. More...

Functions

def rocAL_pybind.amd.rocal.readers.coco (annotations_file='', ltrb=True, masks=False, ratio=False, avoid_class_remapping=False, pixelwise_masks=False, is_box_encoder=False, is_box_iou_matcher=False, aspect_ratio_grouping=False, stick_to_shard=False, pad_last_batch=False)
 Creates a COCOReader node. More...
 
def rocAL_pybind.amd.rocal.readers.file (file_root, file_filters=None, file_list='', stick_to_shard=False, pad_last_batch=False)
 Creates a labelReader node for reading files from folder or file_list. More...
 
def rocAL_pybind.amd.rocal.readers.tfrecord (path, user_feature_key_map, features, reader_type=0, stick_to_shard=False, pad_last_batch=False)
 Creates a TFRecordReader node for loading TFRecord dataset. More...
 
def rocAL_pybind.amd.rocal.readers.caffe (path, bbox=False, stick_to_shard=False, pad_last_batch=False)
 Creates a CaffeReader node for loading Caffe dataset. More...
 
def rocAL_pybind.amd.rocal.readers.caffe2 (path, bbox=False, stick_to_shard=False, pad_last_batch=False)
 Creates a Caffe2Reader node for loading Caffe2 dataset. More...
 
def rocAL_pybind.amd.rocal.readers.video (sequence_length, file_list_frame_num=False, file_root="", image_type=types.RGB, num_shards=1, random_shuffle=False, step=1, stride=1, decoder_mode=types.SOFTWARE_DECODE, enable_frame_num=False, enable_timestamps=False, file_list="", stick_to_shard=False, pad_last_batch=False, file_list_include_preceding_frame=False, normalized=False, skip_vfr_check=False)
 Creates a VideoDecoder node for loading video sequences. More...
 
def rocAL_pybind.amd.rocal.readers.video_resize (sequence_length, resize_width, resize_height, file_list_frame_num=False, file_root="", image_type=types.RGB, num_shards=1, random_shuffle=False, step=3, stride=3, decoder_mode=types.SOFTWARE_DECODE, scaling_mode=types.SCALING_MODE_DEFAULT, interpolation_type=types.LINEAR_INTERPOLATION, resize_longer=0, resize_shorter=0, max_size=[], enable_frame_num=False, enable_timestamps=False, file_list="", stick_to_shard=False, pad_last_batch=False, file_list_include_preceding_frame=False, normalized=False, skip_vfr_check=False)
 Creates a VideoDecoderResize node in the pipeline for loading and resizing video sequences. More...
 
def rocAL_pybind.amd.rocal.readers.sequence_reader (file_root, sequence_length, image_type=types.RGB, num_shards=1, random_shuffle=False, step=3, stride=1, stick_to_shard=False, pad_last_batch=False)
 Creates a SequenceReader node for loading image sequences. More...
 
def rocAL_pybind.amd.rocal.readers.mxnet (path, stick_to_shard=False, pad_last_batch=False)
 Creates an MXNETReader node for reading data from MXNet record files. More...
 

Detailed Description

File containing reader functions for multiple datasets and data formats.

Function Documentation

◆ caffe()

def rocAL_pybind.amd.rocal.readers.caffe (   path,
  bbox = False,
  stick_to_shard = False,
  pad_last_batch = False 
)

Creates a CaffeReader node for loading Caffe dataset.

    @param path              Path to the Caffe dataset.
    @param bbox              Type of reader (False for classification, True for detection).
    @param stick_to_shard    Determines whether the reader should stick to a data shard instead of going through the entire dataset
    @param pad_last_batch    If set to True, pads the shard by repeating the last sample.

    @return    caffe reader meta data, bboxes, and labels.

◆ caffe2()

def rocAL_pybind.amd.rocal.readers.caffe2 (   path,
  bbox = False,
  stick_to_shard = False,
  pad_last_batch = False 
)

Creates a Caffe2Reader node for loading Caffe2 dataset.

    @param path              Path to the Caffe2 dataset.
    @param bbox              Type of reader (False for classification, True for detection).
    @param stick_to_shard    Determines whether the reader should stick to a data shard instead of going through the entire dataset.
    @param pad_last_batch    If set to True, pads the shard by repeating the last sample.

    @return    caffe2 reader meta data, bboxes, and labels.

◆ coco()

def rocAL_pybind.amd.rocal.readers.coco (   annotations_file = '',
  ltrb = True,
  masks = False,
  ratio = False,
  avoid_class_remapping = False,
  pixelwise_masks = False,
  is_box_encoder = False,
  is_box_iou_matcher = False,
  aspect_ratio_grouping = False,
  stick_to_shard = False,
  pad_last_batch = False 
)

Creates a COCOReader node.

    @param annotations_file         Path to the COCO annotations file.
    @param ltrb                     Whether bounding box coordinates are provided in (left, top, right, bottom) format.
    @param masks                    Whether to read polygon masks from COCO annotations.
    @param ratio                    Whether bounding box coordinates are provided in normalized format.
    @param avoid_class_remapping    Specifies if class remapping should be avoided.
    @param pixelwise_masks          Whether to read mask data and generate pixel-wise masks.
    @param is_box_encoder           Whether to enable box encoder in the pipeline.
    @param is_box_iou_matcher       Whether to enable box IOU matcher in the pipeline.
    @param aspect_ratio_grouping    Whether to enable aspect ratio grouping in the pipeline.
    @param stick_to_shard           Determines whether the reader should stick to a data shard instead of going through the entire dataset.
    @param pad_last_batch           If set to True, pads the shard by repeating the last sample.

    @return    meta data, labels, and bounding boxes.

◆ file()

def rocAL_pybind.amd.rocal.readers.file (   file_root,
  file_filters = None,
  file_list = '',
  stick_to_shard = False,
  pad_last_batch = False 
)

Creates a labelReader node for reading files from folder or file_list.

    @param file_root         Path to a directory that contains the data files.
    @param file_filters      A list of glob strings to filter the list of files in the sub-directories of the file_root.
    @param file_list         Path to a text file that contains one whitespace-separated filename label pair per line. The filenames are relative to the location of that file or to file_root, if specified.
    @param stick_to_shard    Determines whether the reader should stick to a data shard instead of going through the entire dataset.
    @param pad_last_batch    If set to True, pads the shard by repeating the last sample.

    @return    label reader meta data and labels.

◆ mxnet()

def rocAL_pybind.amd.rocal.readers.mxnet (   path,
  stick_to_shard = False,
  pad_last_batch = False 
)

Creates an MXNETReader node for reading data from MXNet record files.

    @param path              Path to the MXNet record files.
    @param stick_to_shard    Determines whether the reader should stick to a data shard instead of going through the entire dataset.
    @param pad_last_batch    If set to True, pads the shard by repeating the last sample.

    @return    Metadata and loaded data from the MXNet record file.

◆ sequence_reader()

def rocAL_pybind.amd.rocal.readers.sequence_reader (   file_root,
  sequence_length,
  image_type = types.RGB,
  num_shards = 1,
  random_shuffle = False,
  step = 3,
  stride = 1,
  stick_to_shard = False,
  pad_last_batch = False 
)

Creates a SequenceReader node for loading image sequences.

    @param file_root            Root directory containing image sequences.
    @param sequence_length      Number of frames in each sequence.
    @param image_type           Color format of the frames.
    @param num_shards           Number of shards for data parallelism.
    @param random_shuffle       Specifies if frames should be randomly shuffled.
    @param step                 Distance between first frames of consecutive sequences.
    @param stride               Distance between consecutive frames in a sequence.
    @param stick_to_shard       Determines whether the reader should stick to a data shard instead of going through the entire dataset.
    @param pad_last_batch       If set to True, pads the shard by repeating the last sample.

    @return    list of loaded image sequences.

◆ tfrecord()

def rocAL_pybind.amd.rocal.readers.tfrecord (   path,
  user_feature_key_map,
  features,
  reader_type = 0,
  stick_to_shard = False,
  pad_last_batch = False 
)

Creates a TFRecordReader node for loading TFRecord dataset.

    @param path                    Path to the TFRecord dataset.
    @param user_feature_key_map    User-provided feature key mapping.
    @param features                Features to load from TFRecords.
    @param reader_type             Type of reader (0 for classification, 1 for detection).
    @param stick_to_shard          Determines whether the reader should stick to a data shard instead of going through the entire dataset.
    @param pad_last_batch          If set to True, pads the shard by repeating the last sample.

    @return    Features loaded from TFRecords.

◆ video()

def rocAL_pybind.amd.rocal.readers.video (   sequence_length,
  file_list_frame_num = False,
  file_root = "",
  image_type = types.RGB,
  num_shards = 1,
  random_shuffle = False,
  step = 1,
  stride = 1,
  decoder_mode = types.SOFTWARE_DECODE,
  enable_frame_num = False,
  enable_timestamps = False,
  file_list = "",
  stick_to_shard = False,
  pad_last_batch = False,
  file_list_include_preceding_frame = False,
  normalized = False,
  skip_vfr_check = False 
)

Creates a VideoDecoder node for loading video sequences.

    @param sequence_length                      Number of frames in video sequence.
    @param file_list_frame_num                  Specifies whether file list includes frame numbers.
    @param file_root                            Root directory containing video files.
    @param image_type                           Color format of the frames.
    @param num_shards                           Number of shards for data parallelism.
    @param random_shuffle                       Specifies if frames should be randomly shuffled.
    @param step                                 Distance between first frames of consecutive sequences.
    @param stride                               Distance between consecutive frames in a sequence.
    @param decoder_mode                         Device used for video decoding.
    @param enable_frame_num                     Specifies whether frame numbers are enabled.
    @param enable_timestamps                    Specifies whether timestamps are enabled.
    @param file_list                            List of video files.
    @param stick_to_shard                       Determines whether the reader should stick to a data shard instead of going through the entire dataset.
    @param pad_last_batch                       If set to True, pads the shard by repeating the last sample.
    @param file_list_include_preceding_frame    Changes the behavior how file_list start and end frame timestamps are translated to a frame number.
    @param normalized                           Gets the output as normalized data.
    @param skip_vfr_check                       Skips the check for the variable frame rate (VFR) videos.

    @return   list of loaded video sequences.

◆ video_resize()

def rocAL_pybind.amd.rocal.readers.video_resize (   sequence_length,
  resize_width,
  resize_height,
  file_list_frame_num = False,
  file_root = "",
  image_type = types.RGB,
  num_shards = 1,
  random_shuffle = False,
  step = 3,
  stride = 3,
  decoder_mode = types.SOFTWARE_DECODE,
  scaling_mode = types.SCALING_MODE_DEFAULT,
  interpolation_type = types.LINEAR_INTERPOLATION,
  resize_longer = 0,
  resize_shorter = 0,
  max_size = [],
  enable_frame_num = False,
  enable_timestamps = False,
  file_list = "",
  stick_to_shard = False,
  pad_last_batch = False,
  file_list_include_preceding_frame = False,
  normalized = False,
  skip_vfr_check = False 
)

Creates a VideoDecoderResize node in the pipeline for loading and resizing video sequences.

    @param sequence_length                      Number of frames in video sequence.
    @param resize_width                         output width for resizing.
    @param resize_height                        output height for resizing.
    @param file_list_frame_num                  Specifies whether file list includes frame numbers.
    @param file_root                            Root directory containing video files.
    @param image_type                           Color format of the frames.
    @param num_shards                           Number of shards for data parallelism.
    @param random_shuffle                       Specifies if frames should be randomly shuffled.
    @param step                                 Distance between first frames of consecutive sequences.
    @param stride                               Distance between consecutive frames in a sequence.
    @param decoder_mode                         Device used for video decoding.
    @param scaling_mode                         Scaling mode for resizing.
    @param interpolation_type                   Interpolation type for resizing.
    @param resize_longer                        Target size for the longer dimension during resizing.
    @param resize_shorter                       Target size for the shorter dimension during resizing.
    @param max_size                             Maximum size for resizing.
    @param enable_frame_num                     Specifies whether frame numbers are enabled.
    @param enable_timestamps                    Specifies whether timestamps are enabled.
    @param file_list                            List of video files.
    @param stick_to_shard                       Determines whether the reader should stick to a data shard instead of going through the entire dataset.
    @param pad_last_batch                       If set to True, pads the shard by repeating the last sample.
    @param file_list_include_preceding_frame    Specifies if file list includes preceding frames.
    @param normalized                           Gets the output as normalized data.
    @param skip_vfr_check                       Skips the check for the variable frame rate (VFR) videos.

    @returns   loaded and resized video sequences and meta data.