ultralytics 8.3.39 fix classification validation loss scaling (#17851)

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Mohammed Yasin 2024-11-29 06:08:28 +08:00 committed by GitHub
parent 29826241a0
commit e60992214c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 3 deletions

View file

@ -1,6 +1,6 @@
# Ultralytics YOLO 🚀, AGPL-3.0 license # Ultralytics YOLO 🚀, AGPL-3.0 license
__version__ = "8.3.38" __version__ = "8.3.39"
import os import os

View file

@ -54,6 +54,6 @@ class ClassificationPredictor(BasePredictor):
orig_imgs = ops.convert_torch2numpy_batch(orig_imgs) orig_imgs = ops.convert_torch2numpy_batch(orig_imgs)
return [ return [
Results(orig_img, path=img_path, names=self.model.names, probs=pred) Results(orig_img, path=img_path, names=self.model.names, probs=pred.softmax(0))
for pred, orig_img, img_path in zip(preds, orig_imgs, self.batch[0]) for pred, orig_img, img_path in zip(preds, orig_imgs, self.batch[0])
] ]

View file

@ -296,7 +296,7 @@ class Classify(nn.Module):
if isinstance(x, list): if isinstance(x, list):
x = torch.cat(x, 1) x = torch.cat(x, 1)
x = self.linear(self.drop(self.pool(self.conv(x)).flatten(1))) x = self.linear(self.drop(self.pool(self.conv(x)).flatten(1)))
return x if self.training else x.softmax(1) return x
class WorldDetect(Detect): class WorldDetect(Detect):