Skip to content

Commit b125f66

Browse files
authored
Merge pull request pytorch#15 from zhiqwang/fix-lint
Fixing docs format in GIoU Loss
2 parents 9b25135 + d8ed195 commit b125f66

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

torchvision/ops/giou_loss.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ def giou_loss(
1111
Original implementation from
1212
https://github.com/facebookresearch/fvcore/blob/bfff2ef/fvcore/nn/giou_loss.py
1313
14-
Generalized Intersection over Union Loss (Hamid Rezatofighi et. al)
15-
https://arxiv.org/abs/1902.09630
1614
Gradient-friendly IoU loss with an additional penalty that is non-zero when the
1715
boxes do not overlap and scales with the size of their smallest enclosing box.
1816
This loss is symmetric, so the boxes1 and boxes2 arguments are interchangeable.
@@ -24,11 +22,16 @@ def giou_loss(
2422
Args:
2523
boxes1 (Tensor[N, 4] or Tensor[4]): first set of boxes
2624
boxes2 (Tensor[N, 4] or Tensor[4]): second set of boxes
27-
reduction (str): 'none' | 'mean' | 'sum'
28-
'none': No reduction will be applied to the output.
29-
'mean': The output will be averaged.
30-
'sum': The output will be summed.
31-
eps (float): small number to prevent division by zero
25+
reduction (string, optional): Specifies the reduction to apply to the output:
26+
``'none'`` | ``'mean'`` | ``'sum'``. ``'none'``: No reduction will be
27+
applied to the output. ``'mean'``: The output will be averaged.
28+
``'sum'``: The output will be summed. Default: ``'none'``
29+
eps (float, optional): small number to prevent division by zero. Default: 1e-7
30+
31+
Reference:
32+
Hamid Rezatofighi et. al: Generalized Intersection over Union:
33+
A Metric and A Loss for Bounding Box Regression:
34+
https://arxiv.org/abs/1902.09630
3235
"""
3336

3437
x1, y1, x2, y2 = boxes1.unbind(dim=-1)

0 commit comments

Comments
 (0)