code: def _load_coco_annotations(
      self, image, target, load_attributes=False
  ):
      w, h = image.size
      image_id = target["image_id"]
      image_id = torch.tensor([image_id])
      anno = target["annotations"]
      anno = [
          obj
          for obj in anno
          if "iscrowd" not in obj or obj["iscrowd"] == 0
      ]
  
      boxes = [obj["bbox"] for obj in anno]
      boxes = torch.as_tensor(boxes, dtype=torch.float32).reshape(-1, 4)
      boxes[:, 2:] += boxes[:, :2]
      boxes[:, 0::2].clamp_(min=0, max=w)
      boxes[:, 1::2].clamp_(min=0, max=h)
      classes = [obj["category_id"] for obj in anno]
      classes = torch.tensor(classes, dtype=torch.int64)
      attributes = None
      if load_attributes:
          # load the attribute annotations in the Visual Genome dataset
          # following vqa-maskrcnn-benchmark, -1 will be used as ignore label
          # (https://gitlab.com/meetshah1995/vqa-maskrcnn-benchmark)
          MAX_ATTR_NUM = 16
          attributes = -torch.ones(
              len(classes), MAX_ATTR_NUM, dtype=torch.int64
          )
          for n_obj, obj in enumerate(anno):
              attributes[n_obj] = torch.as_tensor(
                  obj["attribute_ids_max16"], dtype=torch.int64
              )
  
      keep = (boxes[:, 3] > boxes[:, 1]) & (boxes[:, 2] > boxes[:, 0])
      boxes = boxes[keep]
      classes = classes[keep]
      if attributes is not None:
          attributes = attributes[keep]
  
      target = {}
      target["boxes"] = boxes
      target["orig_boxes"] = boxes
      target["labels"] = classes
      if attributes is not None:
          target["attributes"] = attributes
      target["image_id"] = image_id
      # for conversion to coco api
      area = torch.tensor([obj["area"] for obj in anno])
      target["area"] = area[keep]
      target["orig_area"] = target["area"]
      iscrowd = torch.tensor([obj.get("iscrowd", 0) for obj in anno])
      target["iscrowd"] = iscrowd[keep]
      target["orig_size"] = torch.as_tensor([int(h), int(w)])
      target["size"] = torch.as_tensor([int(h), int(w)])
  
      return image, target
  
file_path: mmf/mmf/datasets/builders/coco/detection_dataset.py
imports: import os
  from typing import Dict
  import torch
  import torch.nn.functional
  import torchvision
  from mmf.common.sample import Sample
  from mmf.datasets.base_dataset import BaseDataset
  from mmf.utils.distributed import gather_tensor_along_batch, object_to_byte_tensor
  from torch import nn, Tensor
label_desc: Use image node_id 6 for calling the DetectionCOCODataset obj's underlying member method code with example usage: obj._load_coco_annotations(image, target, load_attributes) and returns: image,  target