Table Of Contents
Table Of Contents

mxnet.image.ImageDetIter

class mxnet.image.ImageDetIter(batch_size, data_shape, path_imgrec=None, path_imglist=None, path_root=None, path_imgidx=None, shuffle=False, part_index=0, num_parts=1, aug_list=None, imglist=None, data_name='data', label_name='label', last_batch_handle='pad', **kwargs)[source]

Image iterator with a large number of augmentation choices for detection.

Parameters
  • aug_list (list or None) – Augmenter list for generating distorted images

  • batch_size (int) – Number of examples per batch.

  • data_shape (tuple) – Data shape in (channels, height, width) format. For now, only RGB image with 3 channels is supported.

  • path_imgrec (str) – Path to image record file (.rec). Created with tools/im2rec.py or bin/im2rec.

  • path_imglist (str) – Path to image list (.lst). Created with tools/im2rec.py or with custom script. Format: Tab separated record of index, one or more labels and relative_path_from_root.

  • imglist (list) – A list of images with the label(s). Each item is a list [imagelabel: float or list of float, imgpath].

  • path_root (str) – Root folder of image files.

  • path_imgidx (str) – Path to image index file. Needed for partition and shuffling when using .rec source.

  • shuffle (bool) – Whether to shuffle all images at the start of each iteration or not. Can be slow for HDD.

  • part_index (int) – Partition index.

  • num_parts (int) – Total number of partitions.

  • data_name (str) – Data name for provided symbols.

  • label_name (str) – Name for detection labels

  • last_batch_handle (str, optional) – How to handle the last batch. This parameter can be ‘pad’(default), ‘discard’ or ‘roll_over’. If ‘pad’, the last batch will be padded with data starting from the begining If ‘discard’, the last batch will be discarded If ‘roll_over’, the remaining elements will be rolled over to the next iteration

  • kwargs – More arguments for creating augmenter. See mx.image.CreateDetAugmenter.

__init__(batch_size, data_shape, path_imgrec=None, path_imglist=None, path_root=None, path_imgidx=None, shuffle=False, part_index=0, num_parts=1, aug_list=None, imglist=None, data_name='data', label_name='label', last_batch_handle='pad', **kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(batch_size, data_shape[, …])

Initialize self.

augmentation_transform(data, label)

Override Transforms input data with specified augmentations.

check_data_shape(data_shape)

Checks if the input data shape is valid

check_label_shape(label_shape)

Checks if the new label shape is valid

check_valid_image(data)

Checks if the input data is valid

draw_next([color, thickness, mean, std, …])

Display next image with bounding boxes drawn.

getdata()

Get data of current batch.

getindex()

Get index of the current batch.

getlabel()

Get label of the current batch.

getpad()

Get the number of padding examples in the current batch.

hard_reset()

Resets the iterator and ignore roll over data

imdecode(s)

Decodes a string or byte string to an NDArray.

iter_next()

Move to the next batch.

next()

Override the function for returning next batch.

next_sample()

Helper function for reading in next sample.

postprocess_data(datum)

Final postprocessing step before image is loaded into the batch.

read_image(fname)

Reads an input image fname and returns the decoded raw bytes.

reset()

Resets the iterator to the beginning of the data.

reshape([data_shape, label_shape])

Reshape iterator for data_shape or label_shape.

sync_label_shape(it[, verbose])

Synchronize label shape with the input iterator.