rocAL User Guide#

Today’s deep learning applications require loading and pre-processing data efficiently to achieve high processing throughput. This requires creating efficient processing pipelines fully utilizing the underlying hardware capabilities. Some examples are load and decode data, do a variety of augmentations, color-format conversions, etc. Deep learning frameworks require supporting multiple data formats and augmentations to adapt to a variety of data-sets and models.

AMD ROCm Augmentation Library (rocAL) is designed to efficiently do such processing pipelines from both images and video as well as from a variety of storage formats. These pipelines are programmable by the user using both C++ and Python APIs.

User Guide Chapters#

Key Components of rocAL#

  • Full processing pipeline support for data_loading, meta-data loading, augmentations, and data-format conversions for training and inference.

  • Being able to do processing on CPU or Radeon GPU (with OpenCL or HIP backend)

  • Ease of integration with framework plugins in Python

  • Support variety of augmentation operations through AMD’s Radeon Performance Primitives (RPP).

  • All available public and open-sourced under ROCm.

Prerequisites#

Refer rocAL Prerequisites

Build instructions#

Refer rocAL build instructions

rocAL Python#

  • rocAL Python package has been created using Pybind11 which enables data transfer between rocAL C++ API and Python API.

  • rocal Python Bindings has both PyTorch and TensorFlow framework support.

  • Various reader format support including FileReader, COCOReader, and TFRecordReader.

  • examples folder has sample implementations for PyTorch and Tensorflow training and inference pipeline.

rocAL Python API#

amd.rocal.fn#

  • Contains the image augmentations & file read and decode operations which are linked to rocAL C++ API

  • All ops (listed below) are supported for the single input image and batched inputs.

Image Augmentation

Reader and Decoder

Geometric Ops

Color Twist

Image File Reader

Crop Mirror Normalize

Color Temperature

Caffe Reader

Crop Resize

Brightness

Caffe2 Reader

Resize

Gamma Correction

CIFAR10 Reader

Random Crop

Snow

COCO Reader

Warp Affine

Rain

TF Record Reader

Fish Eye

Blur

MXNet Record Reader

Lens Correction

Jitter

Video File Reader

Rotate

Hue

Image Decoder

Crop

Saturation

Image Decoder Random Crop

Flip

Fog

Video Decoder

Resize Crop Mirror

Contrast

Resize Crop Mirror Normalize

Vignette

SNP Noise

Pixelate

Blend

Exposure

amd.rocal.pipeline#

  • Contains Pipeline class which has all the data needed to build and run the rocAL graph.

  • Contains support for context/graph creation, verify and run the graph.

  • Has data transfer functions to exchange data between frameworks and rocAL

  • define_graph functionality has been implemented to add nodes to build a pipeline graph.

amd.rocal.types#

amd.rocal.types are enums exported from C++ API to python. Some examples include CPU, GPU, FLOAT, FLOAT16, RGB, GRAY, etc.

amd.rocal.plugin.pytorch#

  • Contains ROCALGenericIterator for Pytorch.

  • ROCALClassificationIterator class implements iterator for image classification and return images with corresponding labels.

  • From the above classes, any hybrid iterator pipeline can be created by adding augmentations.

  • See example PyTorch Simple Example. Requires PyTorch.

amd.rocal.plugin.tf#

  • Contains ROCALIterator for TensorFlow.

  • Any hybrid iterator pipeline can be created by adding augmentations.

  • See example Tensorflow Simple Example. Requires TensorFlow.

installing rocAL python plugin (Python 3.9+)#

  • Build and install RPP

  • Build and install MIVisionX

  • Build and install rocAL