code: def draw_boxes(
      self,
      boxes: torch.Tensor,
      obj_ids: torch.Tensor = None,
      obj_scores: torch.Tensor = None,
      attr_ids: torch.Tensor = None,
      attr_scores: torch.Tensor = None,
  ):
      if len(boxes.shape) > 2:
          boxes = boxes[0]
      if len(obj_ids.shape) > 1:
          obj_ids = obj_ids[0]
      if len(obj_scores.shape) > 1:
          obj_scores = obj_scores[0]
      if len(attr_ids.shape) > 1:
          attr_ids = attr_ids[0]
      if len(attr_scores.shape) > 1:
          attr_scores = attr_scores[0]
      if isinstance(boxes, torch.Tensor):
          boxes = boxes.numpy()
      if isinstance(boxes, list):
          boxes = np.array(boxes)
      assert isinstance(boxes, np.ndarray)
      areas = np.prod(boxes[:, 2:] - boxes[:, :2], axis=1)
      sorted_idxs = np.argsort(-areas).tolist()
      boxes = boxes[sorted_idxs] if boxes is not None else None
      obj_ids = obj_ids[sorted_idxs] if obj_ids is not None else None
      obj_scores = (
          obj_scores[sorted_idxs] if obj_scores is not None else None
      )
      attr_ids = attr_ids[sorted_idxs] if attr_ids is not None else None
      attr_scores = (
          attr_scores[sorted_idxs] if attr_scores is not None else None
      )
  
      assigned_colors = [
          self._random_color(maximum=1) for _ in range(len(boxes))
      ]
      assigned_colors = [assigned_colors[idx] for idx in sorted_idxs]
      if obj_ids is not None:
          labels = self._create_text_labels_attr(
              obj_ids, obj_scores, attr_ids, attr_scores
          )
          for i in range(len(boxes)):
              color = assigned_colors[i]
              self.add_box(boxes[i], color)
              self.draw_labels(labels[i], boxes[i], color)
  
imports: import colorsys
  import io
  import os
  from typing import Union
  import matplotlib
  import matplotlib.colors
  import matplotlib.figure
  import numpy
  import requests
  import torch
  from matplotlib.backends.backend_agg import FigureCanvasAgg
  from mmf.datasets.processors.frcnn_processor import img_tensorize
  from PIL import Image
label_desc: Use image node_id 3 for calling the SingleImageViz obj's underlying member method code with example usage: obj.draw_boxes(boxes, obj_ids, obj_scores, attr_ids, attr_scores) without return types