AMD rocAL - Meta Data API#

rocAL: API: AMD rocAL - Meta Data API
API: AMD rocAL - Meta Data API

The AMD rocAL meta data functions. More...

Functions

RocalMetaData ROCAL_API_CALL rocalCreateLabelReader (RocalContext rocal_context, const char *source_path)
 creates label reader More...
 
RocalMetaData ROCAL_API_CALL rocalCreateVideoLabelReader (RocalContext rocal_context, const char *source_path, unsigned sequence_length, unsigned frame_step, unsigned frame_stride, bool file_list_frame_num=true)
 creates video label reader More...
 
RocalMetaData ROCAL_API_CALL rocalCreateTFReader (RocalContext rocal_context, const char *source_path, bool is_output, const char *user_key_for_label, const char *user_key_for_filename)
 create tf reader More...
 
RocalMetaData ROCAL_API_CALL rocalCreateTFReaderDetection (RocalContext rocal_context, const char *source_path, bool is_output, const char *user_key_for_label, const char *user_key_for_text, const char *user_key_for_xmin, const char *user_key_for_ymin, const char *user_key_for_xmax, const char *user_key_for_ymax, const char *user_key_for_filename)
 create tf reader detection More...
 
RocalMetaData ROCAL_API_CALL rocalCreateCOCOReader (RocalContext rocal_context, const char *source_path, bool is_output, bool mask=false, bool ltrb=true, bool is_box_encoder=false, bool avoid_class_remapping=false, bool aspect_ratio_grouping=false, bool is_box_iou_matcher=false)
 create coco reader More...
 
RocalMetaData ROCAL_API_CALL rocalCreateCOCOReaderKeyPoints (RocalContext rocal_context, const char *source_path, bool is_output, float sigma=0.0, unsigned pose_output_width=0, unsigned pose_output_height=0)
 create coco reader key points More...
 
RocalMetaData ROCAL_API_CALL rocalCreateTextFileBasedLabelReader (RocalContext rocal_context, const char *source_path)
 create text file based label reader More...
 
RocalMetaData ROCAL_API_CALL rocalCreateCaffeLMDBLabelReader (RocalContext rocal_context, const char *source_path)
 create caffe LMDB label reader More...
 
RocalMetaData ROCAL_API_CALL rocalCreateCaffeLMDBReaderDetection (RocalContext rocal_context, const char *source_path)
 create caffe LMDB label reader for object detection More...
 
RocalMetaData ROCAL_API_CALL rocalCreateCaffe2LMDBLabelReader (RocalContext rocal_context, const char *source_path, bool is_output)
 create caffe2 LMDB label reader More...
 
RocalMetaData ROCAL_API_CALL rocalCreateCaffe2LMDBReaderDetection (RocalContext rocal_context, const char *source_path, bool is_output)
 create caffe2 LMDB label reader for object detection More...
 
RocalMetaData ROCAL_API_CALL rocalCreateMXNetReader (RocalContext rocal_context, const char *source_path, bool is_output)
 create MXNet reader More...
 
void ROCAL_API_CALL rocalGetImageName (RocalContext rocal_context, char *buf)
 get image name More...
 
unsigned ROCAL_API_CALL rocalGetImageNameLen (RocalContext rocal_context, int *buf)
 get image name lengths More...
 
RocalTensorList ROCAL_API_CALL rocalGetImageLabels (RocalContext rocal_context)
 get image labels More...
 
unsigned ROCAL_API_CALL rocalGetBoundingBoxCount (RocalContext rocal_context)
 get bounding box count More...
 
unsigned ROCAL_API_CALL rocalGetMaskCount (RocalContext p_context, int *buf)
 get mask count More...
 
RocalTensorList ROCAL_API_CALL rocalGetMaskCoordinates (RocalContext p_context, int *bufcount)
 get mask coordinates More...
 
RocalTensorList ROCAL_API_CALL rocalGetBoundingBoxLabel (RocalContext rocal_context)
 get bounding box label More...
 
RocalTensorList ROCAL_API_CALL rocalGetBoundingBoxCords (RocalContext rocal_context)
 get bounding box coordinates More...
 
void ROCAL_API_CALL rocalGetImageSizes (RocalContext rocal_context, int *buf)
 get image sizes More...
 
void ROCAL_API_CALL rocalGetROIImageSizes (RocalContext rocal_context, int *buf)
 get ROI image sizes More...
 
RocalMetaData ROCAL_API_CALL rocalCreateTextCifar10LabelReader (RocalContext rocal_context, const char *source_path, const char *file_prefix)
 create text cifar10 label reader More...
 
void ROCAL_API_CALL rocalGetOneHotImageLabels (RocalContext rocal_context, void *buf, int numOfClasses, int dest)
 get one hot image labels More...
 
void ROCAL_API_CALL rocalGetSequenceStartFrameNumber (RocalContext rocal_context, unsigned int *buf)
 get sequence starting frame number More...
 
void ROCAL_API_CALL rocalGetSequenceFrameTimestamps (RocalContext rocal_context, float *buf)
 get sequence time stamps More...
 
void ROCAL_API_CALL rocalBoxEncoder (RocalContext p_context, std::vector< float > &anchors, float criteria, std::vector< float > &means, std::vector< float > &stds, bool offset=false, float scale=1.0)
 rocal box encoder More...
 
void ROCAL_API_CALL rocalCopyEncodedBoxesAndLables (RocalContext p_context, float *boxes_buf, int *labels_buf)
 copy encoded boxes and labels More...
 
RocalMetaData ROCAL_API_CALL rocalGetEncodedBoxesAndLables (RocalContext p_context, int num_encoded_boxes)
 
void ROCAL_API_CALL rocalGetImageId (RocalContext p_context, int *buf)
 get image id More...
 
void ROCAL_API_CALL rocalGetJointsDataPtr (RocalContext p_context, RocalJointsData **joints_data)
 get joints data pointer More...
 
void ROCAL_API_CALL rocalBoxIouMatcher (RocalContext p_context, std::vector< float > &anchors, float high_threshold, float low_threshold, bool allow_low_quality_matches=true)
 API to enable box IOU matcher and pass required params to pipeline. More...
 
RocalTensorList ROCAL_API_CALL rocalGetMatchedIndices (RocalContext p_context)
 API to return the matched indices for the bounding box and anchors. More...
 

Detailed Description

The AMD rocAL meta data functions.

Function Documentation

◆ rocalBoxEncoder()

void ROCAL_API_CALL rocalBoxEncoder ( RocalContext  p_context,
std::vector< float > &  anchors,
float  criteria,
std::vector< float > &  means,
std::vector< float > &  stds,
bool  offset = false,
float  scale = 1.0 
)

rocal box encoder

Parameters
[in]anchorsAnchors to be used for encoding, as the array of floats is in the ltrb format.
[in]criteriaThreshold IoU for matching bounding boxes with anchors. The value needs to be between 0 and 1.
[in]offsetReturns normalized offsets ((encoded_bboxes*scale - anchors*scale) - mean) / stds in EncodedBBoxes that use std and the mean and scale arguments
[in]means[x y w h] mean values for normalization.
[in]stds[x y w h] standard deviations for offset normalization.
[in]scaleRescales the box and anchor values before the offset is calculated (for example, to return to the absolute values).

◆ rocalBoxIouMatcher()

void ROCAL_API_CALL rocalBoxIouMatcher ( RocalContext  p_context,
std::vector< float > &  anchors,
float  high_threshold,
float  low_threshold,
bool  allow_low_quality_matches = true 
)

API to enable box IOU matcher and pass required params to pipeline.

Parameters
[in]p_contextrocAL context
[in]anchorsThe anchors / ground truth bounding box coordinates
[in]high_thresholdThe max threshold for IOU
[in]low_thresholdThe min threshold for IOU
[in]allow_low_quality_matchesbool value when set to true allows low quality matches

◆ rocalCopyEncodedBoxesAndLables()

void ROCAL_API_CALL rocalCopyEncodedBoxesAndLables ( RocalContext  p_context,
float *  boxes_buf,
int *  labels_buf 
)

copy encoded boxes and labels

Parameters
[in]p_contextrocal context
[out]boxes_bufuser's buffer that will be filled with encoded bounding boxes . Its needs to be at least of size batch_size.
[out]labels_bufuser's buffer that will be filled with encoded labels . Its needs to be at least of size batch_size.

◆ rocalCreateCaffe2LMDBLabelReader()

RocalMetaData ROCAL_API_CALL rocalCreateCaffe2LMDBLabelReader ( RocalContext  rocal_context,
const char *  source_path,
bool  is_output 
)

create caffe2 LMDB label reader

Parameters
[in]rocal_contextrocal context
[in]source_pathpath to the Caffe2LMDB records for Classification
Returns
RocalMetaData object, can be used to inquire about the rocal's output (processed) tensors

◆ rocalCreateCaffe2LMDBReaderDetection()

RocalMetaData ROCAL_API_CALL rocalCreateCaffe2LMDBReaderDetection ( RocalContext  rocal_context,
const char *  source_path,
bool  is_output 
)

create caffe2 LMDB label reader for object detection

Parameters
[in]rocal_contextrocal context
[in]source_pathpath to the Caffe2LMDB records for Object Detection
Returns
RocalMetaData object - can be used to inquire about the rocal's output (processed) tensors

◆ rocalCreateCaffeLMDBLabelReader()

RocalMetaData ROCAL_API_CALL rocalCreateCaffeLMDBLabelReader ( RocalContext  rocal_context,
const char *  source_path 
)

create caffe LMDB label reader

Parameters
[in]rocal_context
[in]source_pathpath to the Caffe LMDB records for Classification
Returns
RocalMetaData object, can be used to inquire about the rocal's output (processed) tensors

◆ rocalCreateCaffeLMDBReaderDetection()

RocalMetaData ROCAL_API_CALL rocalCreateCaffeLMDBReaderDetection ( RocalContext  rocal_context,
const char *  source_path 
)

create caffe LMDB label reader for object detection

Parameters
[in]rocal_contextrocal context
[in]source_pathpath to the Caffe LMDB records for Object Detection
Returns
RocalMetaData object, can be used to inquire about the rocal's output (processed) tensors

◆ rocalCreateCOCOReader()

RocalMetaData ROCAL_API_CALL rocalCreateCOCOReader ( RocalContext  rocal_context,
const char *  source_path,
bool  is_output,
bool  mask = false,
bool  ltrb = true,
bool  is_box_encoder = false,
bool  avoid_class_remapping = false,
bool  aspect_ratio_grouping = false,
bool  is_box_iou_matcher = false 
)

create coco reader

Parameters
[in]rocal_contextrocal context
[in]source_pathpath to the coco json file
[in]maskenable polygon masks
[in]ltrbIf set to True, bboxes are returned as [left, top, right, bottom]. If set to False, the bboxes are returned as [x, y, width, height]
[in]is_box_encoderIf set to True, bboxes are returned as encoded bboxes using the anchors
[in]avoid_class_remappingIf set to True, classes are returned directly. Otherwise, classes are mapped to consecutive values
[in]aspect_ratio_groupingIf set to True, images are sorted by their aspect ratio and returned
[in]is_box_iou_matcherIf set to True, box iou matcher which returns matched indices is enabled in the pipeline
Returns
RocalMetaData object, can be used to inquire about the rocal's output (processed) tensors

◆ rocalCreateCOCOReaderKeyPoints()

RocalMetaData ROCAL_API_CALL rocalCreateCOCOReaderKeyPoints ( RocalContext  rocal_context,
const char *  source_path,
bool  is_output,
float  sigma = 0.0,
unsigned  pose_output_width = 0,
unsigned  pose_output_height = 0 
)

create coco reader key points

Parameters
[in]rocal_contextrocal context
[in]source_pathpath to the coco json file
[in]sigmasigma used for gaussian distribution (needed for HRNet Pose estimation)
[in]pose_output_widthoutput image width (needed for HRNet Pose estimation)
[in]pose_output_widthoutput image height (needed for HRNet Pose estimation)
Returns
RocalMetaData object, can be used to inquire about the rocal's output (processed) tensors

◆ rocalCreateLabelReader()

RocalMetaData ROCAL_API_CALL rocalCreateLabelReader ( RocalContext  rocal_context,
const char *  source_path 
)

creates label reader

Parameters
[in]rocal_contextrocal context
[in]source_pathpath to the folder that contains the dataset or metadata file
Returns
RocalMetaData object, can be used to inquire about the rocal's output (processed) tensors

◆ rocalCreateMXNetReader()

RocalMetaData ROCAL_API_CALL rocalCreateMXNetReader ( RocalContext  rocal_context,
const char *  source_path,
bool  is_output 
)

create MXNet reader

Parameters
[in]rocal_contextrocal context
[in]source_pathpath to the MXNet recordio files for Classification
Returns
RocalMetaData object - can be used to inquire about the rocal's output (processed) tensors

◆ rocalCreateTextCifar10LabelReader()

RocalMetaData ROCAL_API_CALL rocalCreateTextCifar10LabelReader ( RocalContext  rocal_context,
const char *  source_path,
const char *  file_prefix 
)

create text cifar10 label reader

Parameters
[in]rocal_contextrocal context
[in]source_pathpath to the file that contains the metadata file
[in]filename_prefixlook only files with prefix ( needed for cifar10)
Returns
RocalMetaData object, can be used to inquire about the rocal's output (processed) tensors

◆ rocalCreateTextFileBasedLabelReader()

RocalMetaData ROCAL_API_CALL rocalCreateTextFileBasedLabelReader ( RocalContext  rocal_context,
const char *  source_path 
)

create text file based label reader

Parameters
[in]rocal_context
[in]source_pathpath to the file that contains the metadata file
Returns
RocalMetaData object, can be used to inquire about the rocal's output (processed) tensors

◆ rocalCreateTFReader()

RocalMetaData ROCAL_API_CALL rocalCreateTFReader ( RocalContext  rocal_context,
const char *  source_path,
bool  is_output,
const char *  user_key_for_label,
const char *  user_key_for_filename 
)

create tf reader

Parameters
[in]rocal_contextrocal context
[in]source_pathpath to the coco json file
Returns
RocalMetaData object, can be used to inquire about the rocal's output (processed) tensors

◆ rocalCreateTFReaderDetection()

RocalMetaData ROCAL_API_CALL rocalCreateTFReaderDetection ( RocalContext  rocal_context,
const char *  source_path,
bool  is_output,
const char *  user_key_for_label,
const char *  user_key_for_text,
const char *  user_key_for_xmin,
const char *  user_key_for_ymin,
const char *  user_key_for_xmax,
const char *  user_key_for_ymax,
const char *  user_key_for_filename 
)

create tf reader detection

Parameters
[in]rocal_context
[in]source_pathpath to the coco json file
Returns
RocalMetaData object, can be used to inquire about the rocal's output (processed) tensors

◆ rocalCreateVideoLabelReader()

RocalMetaData ROCAL_API_CALL rocalCreateVideoLabelReader ( RocalContext  rocal_context,
const char *  source_path,
unsigned  sequence_length,
unsigned  frame_step,
unsigned  frame_stride,
bool  file_list_frame_num = true 
)

creates video label reader

Parameters
[in]rocal_contextrocal context
[in]source_pathpath to the folder that contains the dataset or metadata file
[in]sequence_lengthThe number of frames in a sequence.
[in]frame_stepFrame interval between each sequence.
[in]frame_strideFrame interval between frames in a sequence.
[in]file_list_frame_numTrue : when the inputs from text file is to be considered as frame numbers. False : when the inputs from text file is to considered as timestamps.
Returns
RocalMetaData object, can be used to inquire about the rocal's output (processed) tensors

◆ rocalGetBoundingBoxCords()

RocalTensorList ROCAL_API_CALL rocalGetBoundingBoxCords ( RocalContext  rocal_context)

get bounding box coordinates

Parameters
[in]rocal_contextrocal context
[out]bufThe user's buffer that will be filled with bounding box coords info for the images in the output batch. It needs to be of size returned by a call to the rocalGetBoundingBoxCords
Returns
RocalTensorList of bounding box co-ordinates

◆ rocalGetBoundingBoxCount()

unsigned ROCAL_API_CALL rocalGetBoundingBoxCount ( RocalContext  rocal_context)

get bounding box count

Parameters
[in]rocal_contextrocal context
[out]bufThe user's buffer that will be filled with number of object in the images.
Returns
The size of the buffer needs to be provided by user to get bounding box info for all images in the output batch.

◆ rocalGetBoundingBoxLabel()

RocalTensorList ROCAL_API_CALL rocalGetBoundingBoxLabel ( RocalContext  rocal_context)

get bounding box label

Parameters
[in]rocal_contextrocal context
[out]bufThe user's buffer that will be filled with bounding box label info for the images in the output batch. It needs to be of size returned by a call to the rocalGetBoundingBoxCount
Returns
RocalTensorList of labels associated with bounding box coordinates

◆ rocalGetEncodedBoxesAndLables()

RocalMetaData ROCAL_API_CALL rocalGetEncodedBoxesAndLables ( RocalContext  p_context,
int  num_encoded_boxes 
)
Parameters
boxes_bufptr to user's buffer that will be filled with encoded bounding boxes . Its needs to be at least of size batch_size.
labels_bufuser's buffer that will be filled with encoded labels . Its needs to be at least of size batch_size.

◆ rocalGetImageId()

void ROCAL_API_CALL rocalGetImageId ( RocalContext  p_context,
int *  buf 
)

get image id

Parameters
rocal_contextrocal context
bufThe user's buffer that will be filled with image id info for the images in the output batch.

◆ rocalGetImageLabels()

RocalTensorList ROCAL_API_CALL rocalGetImageLabels ( RocalContext  rocal_context)

get image labels

Parameters
[in]meta_dataRocalMetaData object that contains info about the images and labels
[out]bufuser's buffer that will be filled with labels. Its needs to be at least of size batch_size.
Returns
RocalTensorList of labels associated with image

◆ rocalGetImageName()

void ROCAL_API_CALL rocalGetImageName ( RocalContext  rocal_context,
char *  buf 
)

get image name

Parameters
[in]rocal_contextrocal context
[out]bufuser buffer provided to be filled with output image names for images in the output batch.

◆ rocalGetImageNameLen()

unsigned ROCAL_API_CALL rocalGetImageNameLen ( RocalContext  rocal_context,
int *  buf 
)

get image name lengths

Parameters
[in]rocal_contextrocal context
[out]bufuserbuffer provided to be filled with the length of the image names in the output batch
Returns
The size of the buffer needs to be provided by user to get the image names of the output batch

◆ rocalGetImageSizes()

void ROCAL_API_CALL rocalGetImageSizes ( RocalContext  rocal_context,
int *  buf 
)

get image sizes

Parameters
[in]rocal_contextrocal context
[out]bufThe user's buffer that will be filled with images sizes info for the images in the output batch

◆ rocalGetJointsDataPtr()

void ROCAL_API_CALL rocalGetJointsDataPtr ( RocalContext  p_context,
RocalJointsData **  joints_data 
)

get joints data pointer

Parameters
[in]rocal_contextrocal context
[out]joints_dataThe user's RocalJointsData pointer that will be pointed to JointsDataBatch pointer

◆ rocalGetMaskCoordinates()

RocalTensorList ROCAL_API_CALL rocalGetMaskCoordinates ( RocalContext  p_context,
int *  bufcount 
)

get mask coordinates

Parameters
[in]rocal_contextrocal context
[out]bufcountThe user's buffer that will be filled with polygon size for the mask info
Returns
The tensorlist with the mask coordinates

◆ rocalGetMaskCount()

unsigned ROCAL_API_CALL rocalGetMaskCount ( RocalContext  p_context,
int *  buf 
)

get mask count

Parameters
[in]rocal_contextrocal context
[out]bufthe imageIdx in the output batch
Returns
The size of the buffer needs to be provided by user to get mask box info associated with image_idx in the output batch.

◆ rocalGetMatchedIndices()

RocalTensorList ROCAL_API_CALL rocalGetMatchedIndices ( RocalContext  p_context)

API to return the matched indices for the bounding box and anchors.

Parameters
[in]p_contextrocAL context
Returns
RocalTensorList of matched indices

◆ rocalGetOneHotImageLabels()

void ROCAL_API_CALL rocalGetOneHotImageLabels ( RocalContext  rocal_context,
void *  buf,
int  numOfClasses,
int  dest 
)

get one hot image labels

Parameters
[in]meta_dataRocalMetaData object that contains info about the images and labels
[in]numOfClassesthe number of classes for a image dataset
[out]bufuser's buffer that will be filled with labels. Its needs to be at least of size batch_size.
[in]destdestination can be host=0 / device=1

◆ rocalGetROIImageSizes()

void ROCAL_API_CALL rocalGetROIImageSizes ( RocalContext  rocal_context,
int *  buf 
)

get ROI image sizes

Parameters
[in]rocal_contextrocal context
[out]bufThe user's buffer that will be filled with ROI image size info for the images in the output batch

◆ rocalGetSequenceFrameTimestamps()

void ROCAL_API_CALL rocalGetSequenceFrameTimestamps ( RocalContext  rocal_context,
float *  buf 
)

get sequence time stamps

Parameters
[in]rocal_contextrocal context
[out]bufThe user's buffer that will be filled with frame timestamps of each of the frames in output batch sequences.

◆ rocalGetSequenceStartFrameNumber()

void ROCAL_API_CALL rocalGetSequenceStartFrameNumber ( RocalContext  rocal_context,
unsigned int *  buf 
)

get sequence starting frame number

Parameters
[in]rocal_contextrocal context
[out]bufThe user's buffer that will be filled with starting frame numbers of the output batch sequences.