In one of the previous posts I’ve described how to create RecordIO data set for MXNet.
Now I wanted to share an example how to iterate over the RecordIO data set. This example in many ways similar to the how to tutorial that are available on the mxnet github page. But nonetheless, I’ve decided it could be a logical continuation of a previous post and could probably help someone.
When we have a RecordIO set of images, we can use mx.io.ImageRecordIter to load and decode the data.
import mxnet as mx
import numpy as np
import matplotlib.pyplot as plt
data_iter = mx.io.ImageRecordIter(
data_shape=(3, 436, 710),
# Backend Parameter
# Prefetch buffer size
# Backend Parameter,
# Whether round batch,
batch = data_iter.next()
data = batch.data
for i in range(4):
If you have prepared your image training set using im2rec.py correctly, you will see 4 little pictures plotted on the graph.