code: def test_image_detiter(self):
      im_list = [_generate_objects() + [x] for x in self.IMAGES]
      det_iter = mx.image.ImageDetIter(
          2, (3, 300, 300), imglist=im_list, path_root=self.IMAGES_DIR
      )
      for _ in range(3):
          for _ in det_iter:
              pass
      det_iter.reset()
      val_iter = mx.image.ImageDetIter(
          2, (3, 300, 300), imglist=im_list, path_root=self.IMAGES_DIR
      )
      det_iter = val_iter.sync_label_shape(det_iter)
      assert det_iter.data_shape == val_iter.data_shape
      assert det_iter.label_shape == val_iter.label_shape
  
      # test batch_size is not divisible by number of images
      det_iter = mx.image.ImageDetIter(
          4, (3, 300, 300), imglist=im_list, path_root=self.IMAGES_DIR
      )
      for _ in det_iter:
          pass
  
      # test file list with last batch handle
      fname = os.path.join(self.IMAGES_DIR, "test_imagedetiter.lst")
      im_list = [
          [k] + _generate_objects() + [x]
          for k, x in enumerate(self.IMAGES)
      ]
      with open(fname, "w") as f:
          for line in im_list:
              line = "\t".join([str(k) for k in line])
              f.write(line + "\n")
  
      imageiter_list = [
          mx.image.ImageDetIter(
              2,
              (3, 400, 400),
              path_imglist=fname,
              path_root=self.IMAGES_DIR,
          ),
          mx.image.ImageDetIter(
              3,
              (3, 400, 400),
              path_imglist=fname,
              path_root=self.IMAGES_DIR,
              last_batch_handle="discard",
          ),
          mx.image.ImageDetIter(
              3,
              (3, 400, 400),
              path_imglist=fname,
              path_root=self.IMAGES_DIR,
              last_batch_handle="pad",
          ),
          mx.image.ImageDetIter(
              3,
              (3, 400, 400),
              path_imglist=fname,
              path_root=self.IMAGES_DIR,
              last_batch_handle="roll_over",
          ),
          mx.image.ImageDetIter(
              3,
              (3, 400, 400),
              shuffle=True,
              path_imglist=fname,
              path_root=self.IMAGES_DIR,
              last_batch_handle="pad",
          ),
      ]
      _test_imageiter_last_batch(imageiter_list, (2, 3, 400, 400))
  
imports: import os
  import mxnet
  import numpy
  import scipy.ndimage
  from mxnet.test_utils import *
  from common import xfail_when_nonstandard_decimal_separator
  import shutil
  import tempfile
  import unittest
  import pytest
label_desc: Use image node_id 16 for calling the TestImage obj's underlying member method code with example usage: obj.test_image_detiter() without return types