Skip to content
Snippets Groups Projects
Unverified Commit 03e1325c authored by Anurag Paul's avatar Anurag Paul Committed by GitHub
Browse files

Fix loss_bbox in fovea_head.py when num_pos=0 (#2548)

* fix bbox_loss in fovea_head.py when num_pos=0

* Remove PIL from .isort.cfg

* Make loss_bbox scalar in fovea_head.py when num_pos==0

* Sum based reduction for loss_bbox in fovea_head

* reverting to scalar implementation
parent 7dbee18d
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,6 @@ line_length = 79
multi_line_output = 0
known_standard_library = setuptools
known_first_party = mmdet
known_third_party = asynctest,cityscapesscripts,cv2,matplotlib,mmcv,numpy,onnx,pycocotools,robustness_eval,roi_align,roi_pool,seaborn,six,terminaltables,torch,torchvision
known_third_party = PIL,asynctest,cityscapesscripts,cv2,matplotlib,mmcv,numpy,onnx,pycocotools,robustness_eval,roi_align,roi_pool,seaborn,six,terminaltables,torch,torchvision
no_lines_before = STDLIB,LOCALFOLDER
default_section = THIRDPARTY
......@@ -224,9 +224,10 @@ class FoveaHead(nn.Module):
pos_weights,
avg_factor=num_pos)
else:
loss_bbox = torch.tensor([0],
dtype=flatten_bbox_preds.dtype,
device=flatten_bbox_preds.device)
loss_bbox = torch.tensor(
0,
dtype=flatten_bbox_preds.dtype,
device=flatten_bbox_preds.device)
return dict(loss_cls=loss_cls, loss_bbox=loss_bbox)
def fovea_target(self, gt_bbox_list, gt_label_list, featmap_sizes, points):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment