class_docstr: Load proposal pipeline.
  
  Required Keys:
  
  - proposals
  
  Modified Keys:
  
  - proposals
  
  Args:
      num_max_proposals (int, optional): Maximum number of proposals to load.
          If not specified, all proposals will be loaded.
class_docstr_tok: ["Load","proposal","pipeline",".","Required","Keys",":","-","proposals","Modified","Keys",":","-","proposals","Args",":","num_max_proposals","(","int",",","optional",")",":","Maximum","number","of","proposals","to","load",".","If","not","specified",",","all","proposals","will","be","loaded","."]
docstr: Transform function to load proposals from file.
  
  Args:
      results (dict): Result dict from :obj:`mmdet.CustomDataset`.
  
  Returns:
      dict: The dict contains loaded proposal annotations.
docstr_tok: ["Transform","function","to","load","proposals","from","file",".","Args",":","results","(","dict",")",":","Result","dict","from",":","obj",":","`","mmdet.CustomDataset","`",".","Returns",":","dict",":","The","dict","contains","loaded","proposal","annotations","."]
code: def transform(self, results: dict) -> dict:
      """Transform function to load proposals from file.
  
      Args:
          results (dict): Result dict from :obj:`mmdet.CustomDataset`.
  
      Returns:
          dict: The dict contains loaded proposal annotations.
      """
  
      proposals = results["proposals"]
      # the type of proposals should be `dict` or `InstanceData`
      assert isinstance(proposals, dict) or isinstance(
          proposals, BaseDataElement
      )
      bboxes = proposals["bboxes"].astype(np.float32)
      assert (
          bboxes.shape[1] == 4
      ), f"Proposals should have shapes (n, 4), but found {bboxes.shape}"
  
      if "scores" in proposals:
          scores = proposals["scores"].astype(np.float32)
          assert bboxes.shape[0] == scores.shape[0]
      else:
          scores = np.zeros(bboxes.shape[0], dtype=np.float32)
  
      if self.num_max_proposals is not None:
          # proposals should sort by scores during dumping the proposals
          bboxes = bboxes[: self.num_max_proposals]
          scores = scores[: self.num_max_proposals]
  
      if len(bboxes) == 0:
          bboxes = np.zeros((0, 4), dtype=np.float32)
          scores = np.zeros(0, dtype=np.float32)
  
      results["proposals"] = bboxes
      results["proposals_scores"] = scores
      return results
  
imports: from typing import Optional, Tuple, Union
  import mmcv
  import numpy
  import pycocotools.mask
  import torch
  from mmcv.transforms import BaseTransform
  from mmcv.transforms import LoadAnnotations
  from mmcv.transforms import LoadImageFromFile
  from mmengine.fileio import get
  from mmengine.structures import BaseDataElement
  from mmdet.registry import TRANSFORMS
  from mmdet.structures.bbox import get_box_type
  from mmdet.structures.bbox.box_type import autocast_box_type
  from mmdet.structures.mask import BitmapMasks, PolygonMasks
label_desc: Use image node_id 2 for calling the LoadProposals obj's underlying member method code with example usage: obj.transform(results) and returns: results