Data Readers Reference#

This page documents the data readers available in DALI Dynamic.

Once you create an instance of a reader, you can use it to iterate over the data multiple times. To start a new iteration over the data, you can call the next_epoch method, which will return an iterator that yields data.

If next_epoch is called without batch_size argument specified, the reader will return individual samples. Otherwise, it will return batches of the specified size. The batch size can differ from epoch to epoch.

import nvidia.dali.experimental.dynamic as ndd
reader = ndd.readers.File(file_root=images_dir)
for batch in reader.next_epoch(batch_size=16):
    images_batch, labels_batch = batch
    # process the batch

for batch in reader.next_epoch():
    image, label = batch
    # process the single sample

The table below lists the available readers.

Function

Device support

Short description

experimental.readers.Fits

CPU, GPU

Reads Fits image HDUs from a directory.

experimental.readers.Video

CPU, GPU

Loads and decodes video files from disk.

readers.Caffe

CPU

Reads (Image, label) pairs from a Caffe LMDB.

readers.Caffe2

CPU

Reads sample data from a Caffe2 Lightning Memory-Mapped Database (LMDB).

readers.COCO

CPU

Reads data from a COCO dataset that is composed of a directory with images and annotation JSON files.

readers.File

CPU

Reads file contents and returns file-label pairs.

readers.MXNet

CPU

Reads the data from an MXNet RecordIO.

readers.NemoAsr

CPU

Reads automatic speech recognition (ASR) data (audio, text) from an NVIDIA NeMo compatible manifest.

readers.Numpy

CPU, GPU

Reads Numpy arrays from a directory.

readers.Sequence

CPU

Reads [Frame] sequences from a directory representing a collection of streams.

readers.TFRecord

CPU

Reads samples from a TensorFlow TFRecord file.

readers.Video

GPU

Loads and decodes video files using FFmpeg and NVDECODE, which is the hardware-accelerated video decoding feature in the NVIDIA(R) GPU.

readers.VideoResize

GPU

Loads, decodes and resizes video files with FFmpeg and NVDECODE, which is NVIDIA GPU’s hardware-accelerated video decoding.

readers.Webdataset

CPU

A reader for the webdataset format.