code: def _test_random_object_bbox_ignore_class(
      max_batch_size,
      ndim,
      dtype,
      format=None,
      background=None,
      threshold=None,
      k_largest=None,
  ):
      pipe = dali.Pipeline(max_batch_size, 4, device_id=None, seed=4321)
      background_out = 0 if background is None else background
      threshold_out = np.int32([]) if threshold is None else threshold
  
      with pipe:
          inp = fn.external_source(
              batch_generator(max_batch_size, ndim, dtype)
          )
          outs = fn.segmentation.random_object_bbox(
              inp,
              format=format,
              ignore_class=True,
              background=background,
              seed=1234,
              threshold=threshold,
              k_largest=k_largest,
          )
          if not isinstance(outs, list):
              outs = [outs]
          pipe.set_outputs(inp, background_out, threshold_out, *outs)
      pipe.build()
  
      format = format or "anchor_shape"
  
      for _ in range(50):
          inp, background_out, threshold_out, *outs = pipe.run()
  
          # Iterate over indices instead of elements, because normal iteration
          # causes an exception to be thrown in native code, making debugging near impossible.
          outs = tuple(
              [np.array(out[i]) for i in range(len(out))]
              for out in outs
          )
  
          boxes = convert_boxes(outs, format)
  
          for i in range(len(inp)):
              in_tensor = inp.at(i)
              background_label = background_out.at(i)
  
              ref_boxes = all_boxes(in_tensor, None, background_label)
              if threshold is not None:
                  thr = threshold_out.at(i)
                  ref_boxes = list(
                      filter(
                          lambda box: np.all(box_extent(box) >= thr),
                          ref_boxes,
                      )
                  )
                  if len(ref_boxes) == 0:
                      ref_boxes = np.int32(
                          [
                              [0] * len(in_tensor.shape)
                              + list(in_tensor.shape)
                          ]
                      )
              if k_largest is not None:
                  assert box_in_k_largest(
                      ref_boxes, boxes[i], k_largest
                  )
              else:
                  assert contains_box(ref_boxes, boxes[i])
  
imports: from nose_utils import assert_raises
  import nvidia.dali
  import nvidia.dali.fn
  import nvidia.dali.ops
  import numpy
  import scipy.ndimage
  import scipy.ndimage.measurements
  import random
  from test_utils import check_batch, np_type_to_dali
  from nose.tools import nottest
  from nose.plugins.attrib import attr
label_desc: Use image node_id 25 for calling a global function with example usage: _test_random_object_bbox_ignore_class(max_batch_size, ndim, dtype, format, background, threshold, k_largest) without return types