class_docstr: A dataset wrapping over a RecordIO file containing images.
  
  Each sample is an image and its corresponding label.
  
  Parameters
  ----------
  filename : str
      Path to rec file.
  flag : {0, 1}, default 1
      If 0, always convert images to greyscale.         If 1, always convert images to colored (RGB).
  transform : function, default None
      DEPRECATED FUNCTION ARGUMENTS.
      A user defined callback that transforms each sample. For example::
  
          transform=lambda data, label: (data.astype(np.float32)/255, label)
class_docstr_tok: ["A","dataset","wrapping","over","a","RecordIO","file","containing","images",".","Each","sample","is","an","image","and","its","corresponding","label",".","Parameters","--","--","--","--","--","filename",":","str","Path","to","rec","file",".","flag",":","{","0",",","1","}",",","default","1","If","0",",","always","convert","images","to","greyscale",".","If","1",",","always","convert","images","to","colored","(","RGB",")",".","transform",":","function",",","default","None","DEPRECATED","FUNCTION","ARGUMENTS",".","A","user","defined","callback","that","transforms","each","sample",".","For","example",":",":","transform=lambda","data",",","label",":","(","data.astype","(","np.float32",")","\/255",",","label",")"]
code: def __getitem__(self, idx):
      record = super(ImageRecordDataset, self).__getitem__(idx)
      header, img = recordio.unpack(record)
      if self._transform is not None:
          return self._transform(
              image.imdecode(img, self._flag), header.label
          )
      return image.imdecode(img, self._flag), header.label
  
imports: import os
  import gzip
  import tarfile
  import struct
  import warnings
  import numpy
  from ..None import dataset
  from ...utils import download, check_sha1, _get_repo_file_url
  from ....None import ndarray, image, recordio, base
  from ....None import numpy
  from ....util import is_np_array, default_array
  from ....base import numeric_types
label_desc: Use image node_id 2 for calling the ImageRecordDataset obj's underlying member method code with example usage: obj.__getitem__(idx) and returns: image,  header, self