code: def __init__(self, args, device_id, file_root, annotations_file):
      super(DetectionPipeline, self).__init__(
          batch_size=args.batch_size,
          num_threads=args.num_workers,
          device_id=device_id,
          prefetch_queue_depth=args.prefetch,
          seed=args.seed,
      )
  
      # Reading COCO dataset
      self.input = ops.readers.COCO(
          file_root=file_root,
          annotations_file=annotations_file,
          shard_id=device_id,
          num_shards=args.num_gpus,
          ratio=True,
          ltrb=True,
          random_shuffle=True,
      )
  
      self.decode_cpu = ops.decoders.Image(
          device="cpu", output_type=types.RGB
      )
      self.decode_crop = ops.decoders.ImageSlice(
          device="cpu", output_type=types.RGB
      )
  
      self.decode_gpu = ops.decoders.Image(
          device="mixed", output_type=types.RGB, hw_decoder_load=0
      )
      self.decode_gpu_crop = ops.decoders.ImageSlice(
          device="mixed", output_type=types.RGB, hw_decoder_load=0
      )
  
      self.ssd_crop = ops.SSDRandomCrop(
          device="cpu", num_attempts=1, seed=args.seed
      )
      self.random_bbox_crop = ops.RandomBBoxCrop(
          device="cpu",
          aspect_ratio=[0.5, 2.0],
          thresholds=[0, 0.1, 0.3, 0.5, 0.7, 0.9],
          scaling=[0.3, 1.0],
          bbox_layout="xyXY",
          seed=args.seed,
      )
  
      self.slice_cpu = ops.Slice(device="cpu")
      self.slice_gpu = ops.Slice(device="gpu")
  
      self.resize_cpu = ops.Resize(
          device="cpu",
          resize_x=300,
          resize_y=300,
          min_filter=types.DALIInterpType.INTERP_TRIANGULAR,
      )
      self.resize_gpu = ops.Resize(
          device="gpu",
          resize_x=300,
          resize_y=300,
          min_filter=types.DALIInterpType.INTERP_TRIANGULAR,
      )
  
      mean = [0.485 * 255, 0.456 * 255, 0.406 * 255]
      std = [0.229 * 255, 0.224 * 255, 0.225 * 255]
      crop_size = (300, 300)
      self.normalize_cpu = ops.CropMirrorNormalize(
          device="cpu",
          crop=crop_size,
          mean=mean,
          std=std,
          mirror=0,
          dtype=types.FLOAT,
      )
      self.normalize_gpu = ops.CropMirrorNormalize(
          device="gpu",
          crop=crop_size,
          mean=mean,
          std=std,
          mirror=0,
          dtype=types.FLOAT,
      )
  
      self.twist_cpu = ops.ColorTwist(device="cpu")
      self.twist_gpu = ops.ColorTwist(device="gpu")
  
      self.hsv_cpu = ops.Hsv(device="cpu", dtype=types.FLOAT)
      self.hsv_gpu = ops.Hsv(device="gpu", dtype=types.FLOAT)
  
      self.bc_cpu = ops.BrightnessContrast(
          device="cpu", dtype=types.UINT8, contrast_center=128
      )
      self.bc_gpu = ops.BrightnessContrast(
          device="gpu", dtype=types.UINT8, contrast_center=128
      )
  
      self.flip_cpu = ops.Flip(device="cpu")
      self.bbox_flip_cpu = ops.BbFlip(device="cpu", ltrb=True)
  
      self.flip_gpu = ops.Flip(device="gpu")
      self.bbox_flip_gpu = ops.BbFlip(device="gpu", ltrb=True)
  
      default_boxes = coco_anchors()
      self.box_encoder_cpu = ops.BoxEncoder(
          device="cpu", criteria=0.5, anchors=default_boxes
      )
      self.box_encoder_gpu = ops.BoxEncoder(
          device="gpu", criteria=0.5, anchors=default_boxes
      )
      self.box_encoder_cpu_offsets = ops.BoxEncoder(
          device="cpu",
          criteria=0.5,
          offset=True,
          scale=2,
          stds=[0.1, 0.1, 0.2, 0.2],
          anchors=default_boxes,
      )
      self.box_encoder_gpu_offsets = ops.BoxEncoder(
          device="gpu",
          criteria=0.5,
          offset=True,
          scale=2,
          stds=[0.1, 0.1, 0.2, 0.2],
          anchors=default_boxes,
      )
  
      # Random variables
      self.saturation_rng = ops.random.Uniform(range=[0.8, 1.2])
      self.contrast_rng = ops.random.Uniform(range=[0.5, 1.5])
      self.brighness_rng = ops.random.Uniform(range=[0.875, 1.125])
      self.hue_rng = ops.random.Uniform(range=[-45, 45])
  
imports: import argparse
  import os
  from math import ceil, sqrt
  import numpy
  import nvidia.dali.ops
  import nvidia.dali.types
  from nvidia.dali.pipeline import Pipeline
  from test_utils import get_dali_extra_path
  from test_utils import to_array
label_desc: Use image node_id 1 to create a new DetectionPipeline object from inherited base classes: Pipeline with example: obj = DetectionPipeline(args, device_id, file_root, annotations_file)