Replace inline comments with docstrings (#12764)
* Add docstrings * Add docstrings * Add docstrings * Add docstrings * Add docstrings * Add docstrings * Add docstrings * Add docstrings * Add docstrings * Add docstrings * Auto-format by https://ultralytics.com/actions * Add docstrings * Add docstrings * Add docstrings * Add docstrings * Auto-format by https://ultralytics.com/actions * Update plots.py Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> --------- Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
This commit is contained in:
1 parent
41603da162
commit
574331f984
14 files changed
+225
-66
No files matched your search
+3
-2
@@ -8,8 +8,8 @@ from utils.metrics import bbox_iou
|
||||
from utils.torch_utils import de_parallel
|
||||
|
||||
|
||||
def smooth_BCE(eps=0.1): # https://github.com/ultralytics/yolov3/issues/238#issuecomment-598028441
|
||||
# return positive, negative label smoothing BCE targets
|
||||
def smooth_BCE(eps=0.1):
|
||||
"""Returns label smoothing BCE targets for reducing overfitting; pos: `1.0 - 0.5*eps`, neg: `0.5*eps`. For details see ttps://github.com/ultralytics/yolov3/issues/238#issuecomment-598028441"""
|
||||
return 1.0 - 0.5 * eps, 0.5 * eps
|
||||
|
||||
|
||||
@@ -132,6 +132,7 @@ class ComputeLoss:
|
||||
self.device = device
|
||||
|
||||
def __call__(self, p, targets): # predictions, targets
|
||||
"""Performs forward pass, calculating class, box, and object loss for given predictions and targets."""
|
||||
lcls = torch.zeros(1, device=self.device) # class loss
|
||||
lbox = torch.zeros(1, device=self.device) # box loss
|
||||
lobj = torch.zeros(1, device=self.device) # object loss
|
||||
|
||||
Reference in new issue
Block a user