ultralytics 8.3.47 fix softmax and Classify head commonality (#18085)
Signed-off-by: Glenn Jocher <glenn.jocher@ultralytics.com> Co-authored-by: UltralyticsAssistant <web@ultralytics.com> Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
95a9796fee
commit
3d52c4fa10
6 changed files with 17 additions and 4 deletions
|
|
@ -604,6 +604,7 @@ class v8ClassificationLoss:
|
|||
|
||||
def __call__(self, preds, batch):
|
||||
"""Compute the classification loss between predictions and true labels."""
|
||||
preds = preds[1] if isinstance(preds, (list, tuple)) else preds
|
||||
loss = F.cross_entropy(preds, batch["cls"], reduction="mean")
|
||||
loss_items = loss.detach()
|
||||
return loss, loss_items
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue