prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Missing '**kwargs' parameters passing to imshow_bboxes() in show_result() of rpn.py
  https://github.com/open-mmlab/mmdetection/blob/bde7b4b7eea9dd6ee91a486c6996b2d68662366d/mmdet/models/detectors/rpn.py#L155
  
  '**kwargs' parameters haven't passed to mmcv.imshow_bboxes() in show_result() of mmdetection/mmdet/models/detectors/rpn.py
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `mmdet/models/detectors/rpn.py`
  Content:
  ```
  1 # Copyright (c) OpenMMLab. All rights reserved.
  2 import warnings
  3 
  4 import mmcv
  5 import torch
  6 from mmcv.image import tensor2imgs
  7 
  8 from mmdet.core import bbox_mapping
  9 from ..builder import DETECTORS, build_backbone, build_head, build_neck
  10 from .base import BaseDetector
  11 
  12 
  13 @DETECTORS.register_module()
  14 class RPN(BaseDetector):
  15     """Implementation of Region Proposal Network."""
  16 
  17     def __init__(self,
  18                  backbone,
  19                  neck,
  20                  rpn_head,
  21                  train_cfg,
  22                  test_cfg,
  23                  pretrained=None,
  24                  init_cfg=None):
  25         super(RPN, self).__init__(init_cfg)
  26         if pretrained:
  27             warnings.warn('DeprecationWarning: pretrained is deprecated, '
  28                           'please use "init_cfg" instead')
  29             backbone.pretrained = pretrained
  30         self.backbone = build_backbone(backbone)
  31         self.neck = build_neck(neck) if neck is not None else None
  32         rpn_train_cfg = train_cfg.rpn if train_cfg is not None else None
  33         rpn_head.update(train_cfg=rpn_train_cfg)
  34         rpn_head.update(test_cfg=test_cfg.rpn)
  35         self.rpn_head = build_head(rpn_head)
  36         self.train_cfg = train_cfg
  37         self.test_cfg = test_cfg
  38 
  39     def extract_feat(self, img):
  40         """Extract features.
  41 
  42         Args:
  43             img (torch.Tensor): Image tensor with shape (n, c, h ,w).
  44 
  45         Returns:
  46             list[torch.Tensor]: Multi-level features that may have
  47                 different resolutions.
  48         """
  49         x = self.backbone(img)
  50         if self.with_neck:
  51             x = self.neck(x)
  52         return x
  53 
  54     def forward_dummy(self, img):
  55         """Dummy forward function."""
  56         x = self.extract_feat(img)
  57         rpn_outs = self.rpn_head(x)
  58         return rpn_outs
  59 
  60     def forward_train(self,
  61                       img,
  62                       img_metas,
  63                       gt_bboxes=None,
  64                       gt_bboxes_ignore=None):
  65         """
  66         Args:
  67             img (Tensor): Input images of shape (N, C, H, W).
  68                 Typically these should be mean centered and std scaled.
  69             img_metas (list[dict]): A List of image info dict where each dict
  70                 has: 'img_shape', 'scale_factor', 'flip', and may also contain
  71                 'filename', 'ori_shape', 'pad_shape', and 'img_norm_cfg'.
  72                 For details on the values of these keys see
  73                 :class:`mmdet.datasets.pipelines.Collect`.
  74             gt_bboxes (list[Tensor]): Each item are the truth boxes for each
  75                 image in [tl_x, tl_y, br_x, br_y] format.
  76             gt_bboxes_ignore (None | list[Tensor]): Specify which bounding
  77                 boxes can be ignored when computing the loss.
  78 
  79         Returns:
  80             dict[str, Tensor]: A dictionary of loss components.
  81         """
  82         if (isinstance(self.train_cfg.rpn, dict)
  83                 and self.train_cfg.rpn.get('debug', False)):
  84             self.rpn_head.debug_imgs = tensor2imgs(img)
  85 
  86         x = self.extract_feat(img)
  87         losses = self.rpn_head.forward_train(x, img_metas, gt_bboxes, None,
  88                                              gt_bboxes_ignore)
  89         return losses
  90 
  91     def simple_test(self, img, img_metas, rescale=False):
  92         """Test function without test time augmentation.
  93 
  94         Args:
  95             imgs (list[torch.Tensor]): List of multiple images
  96             img_metas (list[dict]): List of image information.
  97             rescale (bool, optional): Whether to rescale the results.
  98                 Defaults to False.
  99 
  100         Returns:
  101             list[np.ndarray]: proposals
  102         """
  103         x = self.extract_feat(img)
  104         # get origin input shape to onnx dynamic input shape
  105         if torch.onnx.is_in_onnx_export():
  106             img_shape = torch._shape_as_tensor(img)[2:]
  107             img_metas[0]['img_shape_for_onnx'] = img_shape
  108         proposal_list = self.rpn_head.simple_test_rpn(x, img_metas)
  109         if rescale:
  110             for proposals, meta in zip(proposal_list, img_metas):
  111                 proposals[:, :4] /= proposals.new_tensor(meta['scale_factor'])
  112         if torch.onnx.is_in_onnx_export():
  113             return proposal_list
  114 
  115         return [proposal.cpu().numpy() for proposal in proposal_list]
  116 
  117     def aug_test(self, imgs, img_metas, rescale=False):
  118         """Test function with test time augmentation.
  119 
  120         Args:
  121             imgs (list[torch.Tensor]): List of multiple images
  122             img_metas (list[dict]): List of image information.
  123             rescale (bool, optional): Whether to rescale the results.
  124                 Defaults to False.
  125 
  126         Returns:
  127             list[np.ndarray]: proposals
  128         """
  129         proposal_list = self.rpn_head.aug_test_rpn(
  130             self.extract_feats(imgs), img_metas)
  131         if not rescale:
  132             for proposals, img_meta in zip(proposal_list, img_metas[0]):
  133                 img_shape = img_meta['img_shape']
  134                 scale_factor = img_meta['scale_factor']
  135                 flip = img_meta['flip']
  136                 flip_direction = img_meta['flip_direction']
  137                 proposals[:, :4] = bbox_mapping(proposals[:, :4], img_shape,
  138                                                 scale_factor, flip,
  139                                                 flip_direction)
  140         return [proposal.cpu().numpy() for proposal in proposal_list]
  141 
  142     def show_result(self, data, result, top_k=20, **kwargs):
  143         """Show RPN proposals on the image.
  144 
  145         Args:
  146             data (str or np.ndarray): Image filename or loaded image.
  147             result (Tensor or tuple): The results to draw over `img`
  148                 bbox_result or (bbox_result, segm_result).
  149             top_k (int): Plot the first k bboxes only
  150                if set positive. Default: 20
  151 
  152         Returns:
  153             np.ndarray: The image with bboxes drawn on it.
  154         """
  155         mmcv.imshow_bboxes(data, result, top_k=top_k)
  156
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/mmdet/models/detectors/rpn.py b/mmdet/models/detectors/rpn.py
  --- a/mmdet/models/detectors/rpn.py
  +++ b/mmdet/models/detectors/rpn.py
  @@ -152,4 +152,4 @@
           Returns:
               np.ndarray: The image with bboxes drawn on it.
           """
  -        mmcv.imshow_bboxes(data, result, top_k=top_k)
  +        mmcv.imshow_bboxes(data, result, top_k=top_k, **kwargs)
  
verification_info: {"golden_diff": "diff --git a/mmdet/models/detectors/rpn.py b/mmdet/models/detectors/rpn.py\n--- a/mmdet/models/detectors/rpn.py\n+++ b/mmdet/models/detectors/rpn.py\n@@ -152,4 +152,4 @@\n         Returns:\n             np.ndarray: The image with bboxes drawn on it.\n         \"\"\"\n-        mmcv.imshow_bboxes(data, result, top_k=top_k)\n+        mmcv.imshow_bboxes(data, result, top_k=top_k, **kwargs)\n", "issue": "Missing '**kwargs' parameters passing to imshow_bboxes() in show_result() of rpn.py\nhttps://github.com/open-mmlab/mmdetection/blob/bde7b4b7eea9dd6ee91a486c6996b2d68662366d/mmdet/models/detectors/rpn.py#L155\r\n\r\n'**kwargs' parameters haven't passed to mmcv.imshow_bboxes() in show_result() of mmdetection/mmdet/models/detectors/rpn.py\r\n\n", "before_files": [{"content": "# Copyright (c) OpenMMLab. All rights reserved.\nimport warnings\n\nimport mmcv\nimport torch\nfrom mmcv.image import tensor2imgs\n\nfrom mmdet.core import bbox_mapping\nfrom ..builder import DETECTORS, build_backbone, build_head, build_neck\nfrom .base import BaseDetector\n\n\n@DETECTORS.register_module()\nclass RPN(BaseDetector):\n    \"\"\"Implementation of Region Proposal Network.\"\"\"\n\n    def __init__(self,\n                 backbone,\n                 neck,\n                 rpn_head,\n                 train_cfg,\n                 test_cfg,\n                 pretrained=None,\n                 init_cfg=None):\n        super(RPN, self).__init__(init_cfg)\n        if pretrained:\n            warnings.warn('DeprecationWarning: pretrained is deprecated, '\n                          'please use \"init_cfg\" instead')\n            backbone.pretrained = pretrained\n        self.backbone = build_backbone(backbone)\n        self.neck = build_neck(neck) if neck is not None else None\n        rpn_train_cfg = train_cfg.rpn if train_cfg is not None else None\n        rpn_head.update(train_cfg=rpn_train_cfg)\n        rpn_head.update(test_cfg=test_cfg.rpn)\n        self.rpn_head = build_head(rpn_head)\n        self.train_cfg = train_cfg\n        self.test_cfg = test_cfg\n\n    def extract_feat(self, img):\n        \"\"\"Extract features.\n\n        Args:\n            img (torch.Tensor): Image tensor with shape (n, c, h ,w).\n\n        Returns:\n            list[torch.Tensor]: Multi-level features that may have\n                different resolutions.\n        \"\"\"\n        x = self.backbone(img)\n        if self.with_neck:\n            x = self.neck(x)\n        return x\n\n    def forward_dummy(self, img):\n        \"\"\"Dummy forward function.\"\"\"\n        x = self.extract_feat(img)\n        rpn_outs = self.rpn_head(x)\n        return rpn_outs\n\n    def forward_train(self,\n                      img,\n                      img_metas,\n                      gt_bboxes=None,\n                      gt_bboxes_ignore=None):\n        \"\"\"\n        Args:\n            img (Tensor): Input images of shape (N, C, H, W).\n                Typically these should be mean centered and std scaled.\n            img_metas (list[dict]): A List of image info dict where each dict\n                has: 'img_shape', 'scale_factor', 'flip', and may also contain\n                'filename', 'ori_shape', 'pad_shape', and 'img_norm_cfg'.\n                For details on the values of these keys see\n                :class:`mmdet.datasets.pipelines.Collect`.\n            gt_bboxes (list[Tensor]): Each item are the truth boxes for each\n                image in [tl_x, tl_y, br_x, br_y] format.\n            gt_bboxes_ignore (None | list[Tensor]): Specify which bounding\n                boxes can be ignored when computing the loss.\n\n        Returns:\n            dict[str, Tensor]: A dictionary of loss components.\n        \"\"\"\n        if (isinstance(self.train_cfg.rpn, dict)\n                and self.train_cfg.rpn.get('debug', False)):\n            self.rpn_head.debug_imgs = tensor2imgs(img)\n\n        x = self.extract_feat(img)\n        losses = self.rpn_head.forward_train(x, img_metas, gt_bboxes, None,\n                                             gt_bboxes_ignore)\n        return losses\n\n    def simple_test(self, img, img_metas, rescale=False):\n        \"\"\"Test function without test time augmentation.\n\n        Args:\n            imgs (list[torch.Tensor]): List of multiple images\n            img_metas (list[dict]): List of image information.\n            rescale (bool, optional): Whether to rescale the results.\n                Defaults to False.\n\n        Returns:\n            list[np.ndarray]: proposals\n        \"\"\"\n        x = self.extract_feat(img)\n        # get origin input shape to onnx dynamic input shape\n        if torch.onnx.is_in_onnx_export():\n            img_shape = torch._shape_as_tensor(img)[2:]\n            img_metas[0]['img_shape_for_onnx'] = img_shape\n        proposal_list = self.rpn_head.simple_test_rpn(x, img_metas)\n        if rescale:\n            for proposals, meta in zip(proposal_list, img_metas):\n                proposals[:, :4] /= proposals.new_tensor(meta['scale_factor'])\n        if torch.onnx.is_in_onnx_export():\n            return proposal_list\n\n        return [proposal.cpu().numpy() for proposal in proposal_list]\n\n    def aug_test(self, imgs, img_metas, rescale=False):\n        \"\"\"Test function with test time augmentation.\n\n        Args:\n            imgs (list[torch.Tensor]): List of multiple images\n            img_metas (list[dict]): List of image information.\n            rescale (bool, optional): Whether to rescale the results.\n                Defaults to False.\n\n        Returns:\n            list[np.ndarray]: proposals\n        \"\"\"\n        proposal_list = self.rpn_head.aug_test_rpn(\n            self.extract_feats(imgs), img_metas)\n        if not rescale:\n            for proposals, img_meta in zip(proposal_list, img_metas[0]):\n                img_shape = img_meta['img_shape']\n                scale_factor = img_meta['scale_factor']\n                flip = img_meta['flip']\n                flip_direction = img_meta['flip_direction']\n                proposals[:, :4] = bbox_mapping(proposals[:, :4], img_shape,\n                                                scale_factor, flip,\n                                                flip_direction)\n        return [proposal.cpu().numpy() for proposal in proposal_list]\n\n    def show_result(self, data, result, top_k=20, **kwargs):\n        \"\"\"Show RPN proposals on the image.\n\n        Args:\n            data (str or np.ndarray): Image filename or loaded image.\n            result (Tensor or tuple): The results to draw over `img`\n                bbox_result or (bbox_result, segm_result).\n            top_k (int): Plot the first k bboxes only\n               if set positive. Default: 20\n\n        Returns:\n            np.ndarray: The image with bboxes drawn on it.\n        \"\"\"\n        mmcv.imshow_bboxes(data, result, top_k=top_k)\n", "path": "mmdet/models/detectors/rpn.py"}], "after_files": [{"content": "# Copyright (c) OpenMMLab. All rights reserved.\nimport warnings\n\nimport mmcv\nimport torch\nfrom mmcv.image import tensor2imgs\n\nfrom mmdet.core import bbox_mapping\nfrom ..builder import DETECTORS, build_backbone, build_head, build_neck\nfrom .base import BaseDetector\n\n\n@DETECTORS.register_module()\nclass RPN(BaseDetector):\n    \"\"\"Implementation of Region Proposal Network.\"\"\"\n\n    def __init__(self,\n                 backbone,\n                 neck,\n                 rpn_head,\n                 train_cfg,\n                 test_cfg,\n                 pretrained=None,\n                 init_cfg=None):\n        super(RPN, self).__init__(init_cfg)\n        if pretrained:\n            warnings.warn('DeprecationWarning: pretrained is deprecated, '\n                          'please use \"init_cfg\" instead')\n            backbone.pretrained = pretrained\n        self.backbone = build_backbone(backbone)\n        self.neck = build_neck(neck) if neck is not None else None\n        rpn_train_cfg = train_cfg.rpn if train_cfg is not None else None\n        rpn_head.update(train_cfg=rpn_train_cfg)\n        rpn_head.update(test_cfg=test_cfg.rpn)\n        self.rpn_head = build_head(rpn_head)\n        self.train_cfg = train_cfg\n        self.test_cfg = test_cfg\n\n    def extract_feat(self, img):\n        \"\"\"Extract features.\n\n        Args:\n            img (torch.Tensor): Image tensor with shape (n, c, h ,w).\n\n        Returns:\n            list[torch.Tensor]: Multi-level features that may have\n                different resolutions.\n        \"\"\"\n        x = self.backbone(img)\n        if self.with_neck:\n            x = self.neck(x)\n        return x\n\n    def forward_dummy(self, img):\n        \"\"\"Dummy forward function.\"\"\"\n        x = self.extract_feat(img)\n        rpn_outs = self.rpn_head(x)\n        return rpn_outs\n\n    def forward_train(self,\n                      img,\n                      img_metas,\n                      gt_bboxes=None,\n                      gt_bboxes_ignore=None):\n        \"\"\"\n        Args:\n            img (Tensor): Input images of shape (N, C, H, W).\n                Typically these should be mean centered and std scaled.\n            img_metas (list[dict]): A List of image info dict where each dict\n                has: 'img_shape', 'scale_factor', 'flip', and may also contain\n                'filename', 'ori_shape', 'pad_shape', and 'img_norm_cfg'.\n                For details on the values of these keys see\n                :class:`mmdet.datasets.pipelines.Collect`.\n            gt_bboxes (list[Tensor]): Each item are the truth boxes for each\n                image in [tl_x, tl_y, br_x, br_y] format.\n            gt_bboxes_ignore (None | list[Tensor]): Specify which bounding\n                boxes can be ignored when computing the loss.\n\n        Returns:\n            dict[str, Tensor]: A dictionary of loss components.\n        \"\"\"\n        if (isinstance(self.train_cfg.rpn, dict)\n                and self.train_cfg.rpn.get('debug', False)):\n            self.rpn_head.debug_imgs = tensor2imgs(img)\n\n        x = self.extract_feat(img)\n        losses = self.rpn_head.forward_train(x, img_metas, gt_bboxes, None,\n                                             gt_bboxes_ignore)\n        return losses\n\n    def simple_test(self, img, img_metas, rescale=False):\n        \"\"\"Test function without test time augmentation.\n\n        Args:\n            imgs (list[torch.Tensor]): List of multiple images\n            img_metas (list[dict]): List of image information.\n            rescale (bool, optional): Whether to rescale the results.\n                Defaults to False.\n\n        Returns:\n            list[np.ndarray]: proposals\n        \"\"\"\n        x = self.extract_feat(img)\n        # get origin input shape to onnx dynamic input shape\n        if torch.onnx.is_in_onnx_export():\n            img_shape = torch._shape_as_tensor(img)[2:]\n            img_metas[0]['img_shape_for_onnx'] = img_shape\n        proposal_list = self.rpn_head.simple_test_rpn(x, img_metas)\n        if rescale:\n            for proposals, meta in zip(proposal_list, img_metas):\n                proposals[:, :4] /= proposals.new_tensor(meta['scale_factor'])\n        if torch.onnx.is_in_onnx_export():\n            return proposal_list\n\n        return [proposal.cpu().numpy() for proposal in proposal_list]\n\n    def aug_test(self, imgs, img_metas, rescale=False):\n        \"\"\"Test function with test time augmentation.\n\n        Args:\n            imgs (list[torch.Tensor]): List of multiple images\n            img_metas (list[dict]): List of image information.\n            rescale (bool, optional): Whether to rescale the results.\n                Defaults to False.\n\n        Returns:\n            list[np.ndarray]: proposals\n        \"\"\"\n        proposal_list = self.rpn_head.aug_test_rpn(\n            self.extract_feats(imgs), img_metas)\n        if not rescale:\n            for proposals, img_meta in zip(proposal_list, img_metas[0]):\n                img_shape = img_meta['img_shape']\n                scale_factor = img_meta['scale_factor']\n                flip = img_meta['flip']\n                flip_direction = img_meta['flip_direction']\n                proposals[:, :4] = bbox_mapping(proposals[:, :4], img_shape,\n                                                scale_factor, flip,\n                                                flip_direction)\n        return [proposal.cpu().numpy() for proposal in proposal_list]\n\n    def show_result(self, data, result, top_k=20, **kwargs):\n        \"\"\"Show RPN proposals on the image.\n\n        Args:\n            data (str or np.ndarray): Image filename or loaded image.\n            result (Tensor or tuple): The results to draw over `img`\n                bbox_result or (bbox_result, segm_result).\n            top_k (int): Plot the first k bboxes only\n               if set positive. Default: 20\n\n        Returns:\n            np.ndarray: The image with bboxes drawn on it.\n        \"\"\"\n        mmcv.imshow_bboxes(data, result, top_k=top_k, **kwargs)\n", "path": "mmdet/models/detectors/rpn.py"}]}