code: def test_coco_include_crowd(include_iscrowd):
      @pipeline_def(batch_size=1, device_id=0, num_threads=4)
      def coco_pipe(include_iscrowd):
          _, boxes, _, image_ids = fn.readers.coco(
              file_root=file_root,
              annotations_file=train_annotations,
              image_ids=True,
              include_iscrowd=include_iscrowd,
          )
          return boxes, image_ids
  
      annotations = None
      with open(train_annotations) as file:
          annotations = json.load(file)
  
      pipe = coco_pipe(include_iscrowd=include_iscrowd)
      pipe.build()
      number_of_samples = pipe.epoch_size()
      for k in number_of_samples:
          # there is only one reader
          number_of_samples = number_of_samples[k]
          break
  
      anno_mapping = {}
      for elm in annotations["annotations"]:
          image_id = elm["image_id"]
          if not anno_mapping.get(image_id):
              anno_mapping[image_id] = {"bbox": [], "iscrowd": []}
          anno_mapping[image_id]["bbox"].append(elm["bbox"])
          anno_mapping[image_id]["iscrowd"].append(elm["iscrowd"])
  
      all_iscrowd = []
      for _ in range(number_of_samples):
          boxes, image_ids = pipe.run()
          image_ids = int(image_ids.as_array())
          boxes = boxes.as_array()[0]
          anno = anno_mapping[image_ids]
          idx = 0
          # it assumes that the coco reader reads annotations at the order of appearance inside JSON
          all_iscrowd += anno["iscrowd"]
          for j, iscrowd in enumerate(anno["iscrowd"]):
              if include_iscrowd or iscrowd == 0:
                  assert np.all(boxes[idx] == np.array(anno["bbox"][j]))
                  idx += 1
      assert any(
          all_iscrowd
      ), "At least one annotation should include `iscrowd=1`"
  
imports: import numpy
  import nvidia.dali.fn
  import os
  import tempfile
  import json
  from nvidia.dali import Pipeline, pipeline_def
  from nose_utils import raises
  from nose2.tools import params
  from test_utils import compare_pipelines, get_dali_extra_path
label_desc: Use image node_id 8 for calling a global function with example usage: test_coco_include_crowd(include_iscrowd) and returns: boxes,  image_ids