We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Invalid link in readme of cityscape
Hi, Thank you very much for the amazing project! 

I would like to report that the [model](http://download.openmmlab.com/mmdetection/v2.0/cityscapes/mask_rcnn_r50_fpn_1x_cityscapes_20200502-6ea77f0e.pth) in the [readme](https://github.com/open-mmlab/mmdetection/blob/master/configs/cityscapes/README.md) in the cityscape is invalid. 

Meanwhile, may I ask whether there are more pre-trained models on Cityscape? I would like to evaluate the models elaborately. 

Thank you!

--- 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/core/bbox/assigners/hungarian_assigner.py`
Content:
```
1 import torch
2 from scipy.optimize import linear_sum_assignment
3 
4 from ..builder import BBOX_ASSIGNERS
5 from ..iou_calculators import build_iou_calculator
6 from ..transforms import bbox_cxcywh_to_xyxy, bbox_xyxy_to_cxcywh
7 from .assign_result import AssignResult
8 from .base_assigner import BaseAssigner
9 
10 
11 @BBOX_ASSIGNERS.register_module()
12 class HungarianAssigner(BaseAssigner):
13     """Computes one-to-one matching between predictions and ground truth.
14 
15     This class computes an assignment between the targets and the predictions
16     based on the costs. The costs are weighted sum of three components:
17     classfication cost, regression L1 cost and regression iou cost. The
18     targets don't include the no_object, so generally there are more
19     predictions than targets. After the one-to-one matching, the un-matched
20     are treated as backgrounds. Thus each query prediction will be assigned
21     with `0` or a positive integer indicating the ground truth index:
22 
23     - 0: negative sample, no assigned gt
24     - positive integer: positive sample, index (1-based) of assigned gt
25 
26     Args:
27         cls_weight (int | float, optional): The scale factor for classification
28             cost. Default 1.0.
29         bbox_weight (int | float, optional): The scale factor for regression
30             L1 cost. Default 1.0.
31         iou_weight (int | float, optional): The scale factor for regression
32             iou cost. Default 1.0.
33         iou_calculator (dict | optional): The config for the iou calculation.
34             Default type `BboxOverlaps2D`.
35         iou_mode (str | optional): "iou" (intersection over union), "iof"
36                 (intersection over foreground), or "giou" (generalized
37                 intersection over union). Default "giou".
38     """
39 
40     def __init__(self,
41                  cls_weight=1.,
42                  bbox_weight=1.,
43                  iou_weight=1.,
44                  iou_calculator=dict(type='BboxOverlaps2D'),
45                  iou_mode='giou'):
46         # defaultly giou cost is used in the official DETR repo.
47         self.iou_mode = iou_mode
48         self.cls_weight = cls_weight
49         self.bbox_weight = bbox_weight
50         self.iou_weight = iou_weight
51         self.iou_calculator = build_iou_calculator(iou_calculator)
52 
53     def assign(self,
54                bbox_pred,
55                cls_pred,
56                gt_bboxes,
57                gt_labels,
58                img_meta,
59                gt_bboxes_ignore=None,
60                eps=1e-7):
61         """Computes one-to-one matching based on the weighted costs.
62 
63         This method assign each query prediction to a ground truth or
64         background. The `assigned_gt_inds` with -1 means don't care,
65         0 means negative sample, and positive number is the index (1-based)
66         of assigned gt.
67         The assignment is done in the following steps, the order matters.
68 
69         1. assign every prediction to -1
70         2. compute the weighted costs
71         3. do Hungarian matching on CPU based on the costs
72         4. assign all to 0 (background) first, then for each matched pair
73            between predictions and gts, treat this prediction as foreground
74            and assign the corresponding gt index (plus 1) to it.
75 
76         Args:
77             bbox_pred (Tensor): Predicted boxes with normalized coordinates
78                 (cx, cy, w, h), which are all in range [0, 1]. Shape
79                 [num_query, 4].
80             cls_pred (Tensor): Predicted classification logits, shape
81                 [num_query, num_class].
82             gt_bboxes (Tensor): Ground truth boxes with unnormalized
83                 coordinates (x1, y1, x2, y2). Shape [num_gt, 4].
84             gt_labels (Tensor): Label of `gt_bboxes`, shape (num_gt,).
85             img_meta (dict): Meta information for current image.
86             gt_bboxes_ignore (Tensor, optional): Ground truth bboxes that are
87                 labelled as `ignored`. Default None.
88             eps (int | float, optional): A value added to the denominator for
89                 numerical stability. Default 1e-7.
90 
91         Returns:
92             :obj:`AssignResult`: The assigned result.
93         """
94         assert gt_bboxes_ignore is None, \
95             'Only case when gt_bboxes_ignore is None is supported.'
96         num_gts, num_bboxes = gt_bboxes.size(0), bbox_pred.size(0)
97 
98         # 1. assign -1 by default
99         assigned_gt_inds = bbox_pred.new_full((num_bboxes, ),
100                                               -1,
101                                               dtype=torch.long)
102         assigned_labels = bbox_pred.new_full((num_bboxes, ),
103                                              -1,
104                                              dtype=torch.long)
105         if num_gts == 0 or num_bboxes == 0:
106             # No ground truth or boxes, return empty assignment
107             if num_gts == 0:
108                 # No ground truth, assign all to background
109                 assigned_gt_inds[:] = 0
110             return AssignResult(
111                 num_gts, assigned_gt_inds, None, labels=assigned_labels)
112 
113         # 2. compute the weighted costs
114         # classification cost.
115         # Following the official DETR repo, contrary to the loss that
116         # NLL is used, we approximate it in 1 - cls_score[gt_label].
117         # The 1 is a constant that doesn't change the matching,
118         # so it can be ommitted.
119         cls_score = cls_pred.softmax(-1)
120         cls_cost = -cls_score[:, gt_labels]  # [num_bboxes, num_gt]
121 
122         # regression L1 cost
123         img_h, img_w, _ = img_meta['img_shape']
124         factor = torch.Tensor([img_w, img_h, img_w,
125                                img_h]).unsqueeze(0).to(gt_bboxes.device)
126         gt_bboxes_normalized = gt_bboxes / factor
127         bbox_cost = torch.cdist(
128             bbox_pred, bbox_xyxy_to_cxcywh(gt_bboxes_normalized),
129             p=1)  # [num_bboxes, num_gt]
130 
131         # regression iou cost, defaultly giou is used in official DETR.
132         bboxes = bbox_cxcywh_to_xyxy(bbox_pred) * factor
133         # overlaps: [num_bboxes, num_gt]
134         overlaps = self.iou_calculator(
135             bboxes, gt_bboxes, mode=self.iou_mode, is_aligned=False)
136         # The 1 is a constant that doesn't change the matching, so ommitted.
137         iou_cost = -overlaps
138 
139         # weighted sum of above three costs
140         cost = self.cls_weight * cls_cost + self.bbox_weight * bbox_cost
141         cost = cost + self.iou_weight * iou_cost
142 
143         # 3. do Hungarian matching on CPU using linear_sum_assignment
144         cost = cost.detach().cpu()
145         matched_row_inds, matched_col_inds = linear_sum_assignment(cost)
146         matched_row_inds = torch.from_numpy(matched_row_inds).to(
147             bbox_pred.device)
148         matched_col_inds = torch.from_numpy(matched_col_inds).to(
149             bbox_pred.device)
150 
151         # 4. assign backgrounds and foregrounds
152         # assign all indices to backgrounds first
153         assigned_gt_inds[:] = 0
154         # assign foregrounds based on matching results
155         assigned_gt_inds[matched_row_inds] = matched_col_inds + 1
156         assigned_labels[matched_row_inds] = gt_labels[matched_col_inds]
157         return AssignResult(
158             num_gts, assigned_gt_inds, None, labels=assigned_labels)
159
```
--- 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()

```

diff --git a/mmdet/core/bbox/assigners/hungarian_assigner.py b/mmdet/core/bbox/assigners/hungarian_assigner.py
--- a/mmdet/core/bbox/assigners/hungarian_assigner.py
+++ b/mmdet/core/bbox/assigners/hungarian_assigner.py
@@ -1,5 +1,9 @@
 import torch
-from scipy.optimize import linear_sum_assignment
+
+try:
+    from scipy.optimize import linear_sum_assignment
+except ImportError:
+    linear_sum_assignment = None
 
 from ..builder import BBOX_ASSIGNERS
 from ..iou_calculators import build_iou_calculator
@@ -142,6 +146,9 @@
 
         # 3. do Hungarian matching on CPU using linear_sum_assignment
         cost = cost.detach().cpu()
+        if linear_sum_assignment is None:
+            raise ImportError('Please run "pip install scipy" '
+                              'to install scipy first.')
         matched_row_inds, matched_col_inds = linear_sum_assignment(cost)
         matched_row_inds = torch.from_numpy(matched_row_inds).to(
             bbox_pred.device)

{"golden_diff": "diff --git a/mmdet/core/bbox/assigners/hungarian_assigner.py b/mmdet/core/bbox/assigners/hungarian_assigner.py\n--- a/mmdet/core/bbox/assigners/hungarian_assigner.py\n+++ b/mmdet/core/bbox/assigners/hungarian_assigner.py\n@@ -1,5 +1,9 @@\n import torch\n-from scipy.optimize import linear_sum_assignment\n+\n+try:\n+    from scipy.optimize import linear_sum_assignment\n+except ImportError:\n+    linear_sum_assignment = None\n \n from ..builder import BBOX_ASSIGNERS\n from ..iou_calculators import build_iou_calculator\n@@ -142,6 +146,9 @@\n \n         # 3. do Hungarian matching on CPU using linear_sum_assignment\n         cost = cost.detach().cpu()\n+        if linear_sum_assignment is None:\n+            raise ImportError('Please run \"pip install scipy\" '\n+                              'to install scipy first.')\n         matched_row_inds, matched_col_inds = linear_sum_assignment(cost)\n         matched_row_inds = torch.from_numpy(matched_row_inds).to(\n             bbox_pred.device)\n", "issue": "Invalid link in readme of cityscape\nHi, Thank you very much for the amazing project! \r\n\r\nI would like to report that the [model](http://download.openmmlab.com/mmdetection/v2.0/cityscapes/mask_rcnn_r50_fpn_1x_cityscapes_20200502-6ea77f0e.pth) in the [readme](https://github.com/open-mmlab/mmdetection/blob/master/configs/cityscapes/README.md) in the cityscape is invalid. \r\n\r\nMeanwhile, may I ask whether there are more pre-trained models on Cityscape? I would like to evaluate the models elaborately. \r\n\r\nThank you!\n", "before_files": [{"content": "import torch\nfrom scipy.optimize import linear_sum_assignment\n\nfrom ..builder import BBOX_ASSIGNERS\nfrom ..iou_calculators import build_iou_calculator\nfrom ..transforms import bbox_cxcywh_to_xyxy, bbox_xyxy_to_cxcywh\nfrom .assign_result import AssignResult\nfrom .base_assigner import BaseAssigner\n\n\n@BBOX_ASSIGNERS.register_module()\nclass HungarianAssigner(BaseAssigner):\n    \"\"\"Computes one-to-one matching between predictions and ground truth.\n\n    This class computes an assignment between the targets and the predictions\n    based on the costs. The costs are weighted sum of three components:\n    classfication cost, regression L1 cost and regression iou cost. The\n    targets don't include the no_object, so generally there are more\n    predictions than targets. After the one-to-one matching, the un-matched\n    are treated as backgrounds. Thus each query prediction will be assigned\n    with `0` or a positive integer indicating the ground truth index:\n\n    - 0: negative sample, no assigned gt\n    - positive integer: positive sample, index (1-based) of assigned gt\n\n    Args:\n        cls_weight (int | float, optional): The scale factor for classification\n            cost. Default 1.0.\n        bbox_weight (int | float, optional): The scale factor for regression\n            L1 cost. Default 1.0.\n        iou_weight (int | float, optional): The scale factor for regression\n            iou cost. Default 1.0.\n        iou_calculator (dict | optional): The config for the iou calculation.\n            Default type `BboxOverlaps2D`.\n        iou_mode (str | optional): \"iou\" (intersection over union), \"iof\"\n                (intersection over foreground), or \"giou\" (generalized\n                intersection over union). Default \"giou\".\n    \"\"\"\n\n    def __init__(self,\n                 cls_weight=1.,\n                 bbox_weight=1.,\n                 iou_weight=1.,\n                 iou_calculator=dict(type='BboxOverlaps2D'),\n                 iou_mode='giou'):\n        # defaultly giou cost is used in the official DETR repo.\n        self.iou_mode = iou_mode\n        self.cls_weight = cls_weight\n        self.bbox_weight = bbox_weight\n        self.iou_weight = iou_weight\n        self.iou_calculator = build_iou_calculator(iou_calculator)\n\n    def assign(self,\n               bbox_pred,\n               cls_pred,\n               gt_bboxes,\n               gt_labels,\n               img_meta,\n               gt_bboxes_ignore=None,\n               eps=1e-7):\n        \"\"\"Computes one-to-one matching based on the weighted costs.\n\n        This method assign each query prediction to a ground truth or\n        background. The `assigned_gt_inds` with -1 means don't care,\n        0 means negative sample, and positive number is the index (1-based)\n        of assigned gt.\n        The assignment is done in the following steps, the order matters.\n\n        1. assign every prediction to -1\n        2. compute the weighted costs\n        3. do Hungarian matching on CPU based on the costs\n        4. assign all to 0 (background) first, then for each matched pair\n           between predictions and gts, treat this prediction as foreground\n           and assign the corresponding gt index (plus 1) to it.\n\n        Args:\n            bbox_pred (Tensor): Predicted boxes with normalized coordinates\n                (cx, cy, w, h), which are all in range [0, 1]. Shape\n                [num_query, 4].\n            cls_pred (Tensor): Predicted classification logits, shape\n                [num_query, num_class].\n            gt_bboxes (Tensor): Ground truth boxes with unnormalized\n                coordinates (x1, y1, x2, y2). Shape [num_gt, 4].\n            gt_labels (Tensor): Label of `gt_bboxes`, shape (num_gt,).\n            img_meta (dict): Meta information for current image.\n            gt_bboxes_ignore (Tensor, optional): Ground truth bboxes that are\n                labelled as `ignored`. Default None.\n            eps (int | float, optional): A value added to the denominator for\n                numerical stability. Default 1e-7.\n\n        Returns:\n            :obj:`AssignResult`: The assigned result.\n        \"\"\"\n        assert gt_bboxes_ignore is None, \\\n            'Only case when gt_bboxes_ignore is None is supported.'\n        num_gts, num_bboxes = gt_bboxes.size(0), bbox_pred.size(0)\n\n        # 1. assign -1 by default\n        assigned_gt_inds = bbox_pred.new_full((num_bboxes, ),\n                                              -1,\n                                              dtype=torch.long)\n        assigned_labels = bbox_pred.new_full((num_bboxes, ),\n                                             -1,\n                                             dtype=torch.long)\n        if num_gts == 0 or num_bboxes == 0:\n            # No ground truth or boxes, return empty assignment\n            if num_gts == 0:\n                # No ground truth, assign all to background\n                assigned_gt_inds[:] = 0\n            return AssignResult(\n                num_gts, assigned_gt_inds, None, labels=assigned_labels)\n\n        # 2. compute the weighted costs\n        # classification cost.\n        # Following the official DETR repo, contrary to the loss that\n        # NLL is used, we approximate it in 1 - cls_score[gt_label].\n        # The 1 is a constant that doesn't change the matching,\n        # so it can be ommitted.\n        cls_score = cls_pred.softmax(-1)\n        cls_cost = -cls_score[:, gt_labels]  # [num_bboxes, num_gt]\n\n        # regression L1 cost\n        img_h, img_w, _ = img_meta['img_shape']\n        factor = torch.Tensor([img_w, img_h, img_w,\n                               img_h]).unsqueeze(0).to(gt_bboxes.device)\n        gt_bboxes_normalized = gt_bboxes / factor\n        bbox_cost = torch.cdist(\n            bbox_pred, bbox_xyxy_to_cxcywh(gt_bboxes_normalized),\n            p=1)  # [num_bboxes, num_gt]\n\n        # regression iou cost, defaultly giou is used in official DETR.\n        bboxes = bbox_cxcywh_to_xyxy(bbox_pred) * factor\n        # overlaps: [num_bboxes, num_gt]\n        overlaps = self.iou_calculator(\n            bboxes, gt_bboxes, mode=self.iou_mode, is_aligned=False)\n        # The 1 is a constant that doesn't change the matching, so ommitted.\n        iou_cost = -overlaps\n\n        # weighted sum of above three costs\n        cost = self.cls_weight * cls_cost + self.bbox_weight * bbox_cost\n        cost = cost + self.iou_weight * iou_cost\n\n        # 3. do Hungarian matching on CPU using linear_sum_assignment\n        cost = cost.detach().cpu()\n        matched_row_inds, matched_col_inds = linear_sum_assignment(cost)\n        matched_row_inds = torch.from_numpy(matched_row_inds).to(\n            bbox_pred.device)\n        matched_col_inds = torch.from_numpy(matched_col_inds).to(\n            bbox_pred.device)\n\n        # 4. assign backgrounds and foregrounds\n        # assign all indices to backgrounds first\n        assigned_gt_inds[:] = 0\n        # assign foregrounds based on matching results\n        assigned_gt_inds[matched_row_inds] = matched_col_inds + 1\n        assigned_labels[matched_row_inds] = gt_labels[matched_col_inds]\n        return AssignResult(\n            num_gts, assigned_gt_inds, None, labels=assigned_labels)\n", "path": "mmdet/core/bbox/assigners/hungarian_assigner.py"}], "after_files": [{"content": "import torch\n\ntry:\n    from scipy.optimize import linear_sum_assignment\nexcept ImportError:\n    linear_sum_assignment = None\n\nfrom ..builder import BBOX_ASSIGNERS\nfrom ..iou_calculators import build_iou_calculator\nfrom ..transforms import bbox_cxcywh_to_xyxy, bbox_xyxy_to_cxcywh\nfrom .assign_result import AssignResult\nfrom .base_assigner import BaseAssigner\n\n\n@BBOX_ASSIGNERS.register_module()\nclass HungarianAssigner(BaseAssigner):\n    \"\"\"Computes one-to-one matching between predictions and ground truth.\n\n    This class computes an assignment between the targets and the predictions\n    based on the costs. The costs are weighted sum of three components:\n    classfication cost, regression L1 cost and regression iou cost. The\n    targets don't include the no_object, so generally there are more\n    predictions than targets. After the one-to-one matching, the un-matched\n    are treated as backgrounds. Thus each query prediction will be assigned\n    with `0` or a positive integer indicating the ground truth index:\n\n    - 0: negative sample, no assigned gt\n    - positive integer: positive sample, index (1-based) of assigned gt\n\n    Args:\n        cls_weight (int | float, optional): The scale factor for classification\n            cost. Default 1.0.\n        bbox_weight (int | float, optional): The scale factor for regression\n            L1 cost. Default 1.0.\n        iou_weight (int | float, optional): The scale factor for regression\n            iou cost. Default 1.0.\n        iou_calculator (dict | optional): The config for the iou calculation.\n            Default type `BboxOverlaps2D`.\n        iou_mode (str | optional): \"iou\" (intersection over union), \"iof\"\n                (intersection over foreground), or \"giou\" (generalized\n                intersection over union). Default \"giou\".\n    \"\"\"\n\n    def __init__(self,\n                 cls_weight=1.,\n                 bbox_weight=1.,\n                 iou_weight=1.,\n                 iou_calculator=dict(type='BboxOverlaps2D'),\n                 iou_mode='giou'):\n        # defaultly giou cost is used in the official DETR repo.\n        self.iou_mode = iou_mode\n        self.cls_weight = cls_weight\n        self.bbox_weight = bbox_weight\n        self.iou_weight = iou_weight\n        self.iou_calculator = build_iou_calculator(iou_calculator)\n\n    def assign(self,\n               bbox_pred,\n               cls_pred,\n               gt_bboxes,\n               gt_labels,\n               img_meta,\n               gt_bboxes_ignore=None,\n               eps=1e-7):\n        \"\"\"Computes one-to-one matching based on the weighted costs.\n\n        This method assign each query prediction to a ground truth or\n        background. The `assigned_gt_inds` with -1 means don't care,\n        0 means negative sample, and positive number is the index (1-based)\n        of assigned gt.\n        The assignment is done in the following steps, the order matters.\n\n        1. assign every prediction to -1\n        2. compute the weighted costs\n        3. do Hungarian matching on CPU based on the costs\n        4. assign all to 0 (background) first, then for each matched pair\n           between predictions and gts, treat this prediction as foreground\n           and assign the corresponding gt index (plus 1) to it.\n\n        Args:\n            bbox_pred (Tensor): Predicted boxes with normalized coordinates\n                (cx, cy, w, h), which are all in range [0, 1]. Shape\n                [num_query, 4].\n            cls_pred (Tensor): Predicted classification logits, shape\n                [num_query, num_class].\n            gt_bboxes (Tensor): Ground truth boxes with unnormalized\n                coordinates (x1, y1, x2, y2). Shape [num_gt, 4].\n            gt_labels (Tensor): Label of `gt_bboxes`, shape (num_gt,).\n            img_meta (dict): Meta information for current image.\n            gt_bboxes_ignore (Tensor, optional): Ground truth bboxes that are\n                labelled as `ignored`. Default None.\n            eps (int | float, optional): A value added to the denominator for\n                numerical stability. Default 1e-7.\n\n        Returns:\n            :obj:`AssignResult`: The assigned result.\n        \"\"\"\n        assert gt_bboxes_ignore is None, \\\n            'Only case when gt_bboxes_ignore is None is supported.'\n        num_gts, num_bboxes = gt_bboxes.size(0), bbox_pred.size(0)\n\n        # 1. assign -1 by default\n        assigned_gt_inds = bbox_pred.new_full((num_bboxes, ),\n                                              -1,\n                                              dtype=torch.long)\n        assigned_labels = bbox_pred.new_full((num_bboxes, ),\n                                             -1,\n                                             dtype=torch.long)\n        if num_gts == 0 or num_bboxes == 0:\n            # No ground truth or boxes, return empty assignment\n            if num_gts == 0:\n                # No ground truth, assign all to background\n                assigned_gt_inds[:] = 0\n            return AssignResult(\n                num_gts, assigned_gt_inds, None, labels=assigned_labels)\n\n        # 2. compute the weighted costs\n        # classification cost.\n        # Following the official DETR repo, contrary to the loss that\n        # NLL is used, we approximate it in 1 - cls_score[gt_label].\n        # The 1 is a constant that doesn't change the matching,\n        # so it can be ommitted.\n        cls_score = cls_pred.softmax(-1)\n        cls_cost = -cls_score[:, gt_labels]  # [num_bboxes, num_gt]\n\n        # regression L1 cost\n        img_h, img_w, _ = img_meta['img_shape']\n        factor = torch.Tensor([img_w, img_h, img_w,\n                               img_h]).unsqueeze(0).to(gt_bboxes.device)\n        gt_bboxes_normalized = gt_bboxes / factor\n        bbox_cost = torch.cdist(\n            bbox_pred, bbox_xyxy_to_cxcywh(gt_bboxes_normalized),\n            p=1)  # [num_bboxes, num_gt]\n\n        # regression iou cost, defaultly giou is used in official DETR.\n        bboxes = bbox_cxcywh_to_xyxy(bbox_pred) * factor\n        # overlaps: [num_bboxes, num_gt]\n        overlaps = self.iou_calculator(\n            bboxes, gt_bboxes, mode=self.iou_mode, is_aligned=False)\n        # The 1 is a constant that doesn't change the matching, so ommitted.\n        iou_cost = -overlaps\n\n        # weighted sum of above three costs\n        cost = self.cls_weight * cls_cost + self.bbox_weight * bbox_cost\n        cost = cost + self.iou_weight * iou_cost\n\n        # 3. do Hungarian matching on CPU using linear_sum_assignment\n        cost = cost.detach().cpu()\n        if linear_sum_assignment is None:\n            raise ImportError('Please run \"pip install scipy\" '\n                              'to install scipy first.')\n        matched_row_inds, matched_col_inds = linear_sum_assignment(cost)\n        matched_row_inds = torch.from_numpy(matched_row_inds).to(\n            bbox_pred.device)\n        matched_col_inds = torch.from_numpy(matched_col_inds).to(\n            bbox_pred.device)\n\n        # 4. assign backgrounds and foregrounds\n        # assign all indices to backgrounds first\n        assigned_gt_inds[:] = 0\n        # assign foregrounds based on matching results\n        assigned_gt_inds[matched_row_inds] = matched_col_inds + 1\n        assigned_labels[matched_row_inds] = gt_labels[matched_col_inds]\n        return AssignResult(\n            num_gts, assigned_gt_inds, None, labels=assigned_labels)\n", "path": "mmdet/core/bbox/assigners/hungarian_assigner.py"}]}