From fd94d312da626f9557e43adb7b339afa459e497f Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 30 May 2023 20:23:30 +0200 Subject: [PATCH] `ultralytics 8.0.111` refactored `model.loss()` method (#2911) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Snyk bot --- docs/reference/nn/tasks.md | 5 +++++ .../yolo/data/dataloaders/stream_loaders.md | 5 +++++ docs/reference/yolo/utils/loss.md | 20 +++++++++++++++++++ docs/reference/yolo/v8/detect/train.md | 5 ----- docs/reference/yolo/v8/pose/train.md | 5 ----- docs/reference/yolo/v8/segment/train.md | 5 ----- ultralytics/__init__.py | 2 +- ultralytics/nn/modules/__init__.py | 13 ++++++------ ultralytics/nn/modules/block.py | 5 ++--- ultralytics/nn/modules/conv.py | 5 ++--- ultralytics/nn/modules/head.py | 2 +- ultralytics/nn/modules/transformer.py | 5 ++--- ultralytics/nn/modules/utils.py | 2 +- ultralytics/vit/rtdetr/val.py | 2 +- 14 files changed, 46 insertions(+), 35 deletions(-) diff --git a/docs/reference/nn/tasks.md b/docs/reference/nn/tasks.md index bf1fa05..502b82d 100644 --- a/docs/reference/nn/tasks.md +++ b/docs/reference/nn/tasks.md @@ -27,6 +27,11 @@ description: Learn how to work with Ultralytics YOLO Detection, Segmentation & C :::ultralytics.nn.tasks.ClassificationModel

+# RTDETRDetectionModel +--- +:::ultralytics.nn.tasks.RTDETRDetectionModel +

+ # Ensemble --- :::ultralytics.nn.tasks.Ensemble diff --git a/docs/reference/yolo/data/dataloaders/stream_loaders.md b/docs/reference/yolo/data/dataloaders/stream_loaders.md index 50ed8aa..afecea7 100644 --- a/docs/reference/yolo/data/dataloaders/stream_loaders.md +++ b/docs/reference/yolo/data/dataloaders/stream_loaders.md @@ -36,3 +36,8 @@ description: 'Ultralytics YOLO Docs: Learn about stream loaders for image and te --- :::ultralytics.yolo.data.dataloaders.stream_loaders.autocast_list

+ +# get_best_youtube_url +--- +:::ultralytics.yolo.data.dataloaders.stream_loaders.get_best_youtube_url +

diff --git a/docs/reference/yolo/utils/loss.md b/docs/reference/yolo/utils/loss.md index 10e23c5..b01e3ef 100644 --- a/docs/reference/yolo/utils/loss.md +++ b/docs/reference/yolo/utils/loss.md @@ -16,3 +16,23 @@ description: Learn about Varifocal Loss and Keypoint Loss in Ultralytics YOLO fo --- :::ultralytics.yolo.utils.loss.KeypointLoss

+ +# v8DetectionLoss +--- +:::ultralytics.yolo.utils.loss.v8DetectionLoss +

+ +# v8SegmentationLoss +--- +:::ultralytics.yolo.utils.loss.v8SegmentationLoss +

+ +# v8PoseLoss +--- +:::ultralytics.yolo.utils.loss.v8PoseLoss +

+ +# v8ClassificationLoss +--- +:::ultralytics.yolo.utils.loss.v8ClassificationLoss +

diff --git a/docs/reference/yolo/v8/detect/train.md b/docs/reference/yolo/v8/detect/train.md index 03da3ae..84e4794 100644 --- a/docs/reference/yolo/v8/detect/train.md +++ b/docs/reference/yolo/v8/detect/train.md @@ -7,11 +7,6 @@ description: Train and optimize custom object detection models with Ultralytics :::ultralytics.yolo.v8.detect.train.DetectionTrainer

-# Loss ---- -:::ultralytics.yolo.v8.detect.train.Loss -

- # train --- :::ultralytics.yolo.v8.detect.train.train diff --git a/docs/reference/yolo/v8/pose/train.md b/docs/reference/yolo/v8/pose/train.md index 61cce26..7d3f586 100644 --- a/docs/reference/yolo/v8/pose/train.md +++ b/docs/reference/yolo/v8/pose/train.md @@ -7,11 +7,6 @@ description: Boost posture detection using PoseTrainer and train models using tr :::ultralytics.yolo.v8.pose.train.PoseTrainer

-# PoseLoss ---- -:::ultralytics.yolo.v8.pose.train.PoseLoss -

- # train --- :::ultralytics.yolo.v8.pose.train.train diff --git a/docs/reference/yolo/v8/segment/train.md b/docs/reference/yolo/v8/segment/train.md index 746312d..ee25fe2 100644 --- a/docs/reference/yolo/v8/segment/train.md +++ b/docs/reference/yolo/v8/segment/train.md @@ -7,11 +7,6 @@ description: Learn about SegmentationTrainer and Train in Ultralytics YOLO v8 fo :::ultralytics.yolo.v8.segment.train.SegmentationTrainer

-# SegLoss ---- -:::ultralytics.yolo.v8.segment.train.SegLoss -

- # train --- :::ultralytics.yolo.v8.segment.train.train diff --git a/ultralytics/__init__.py b/ultralytics/__init__.py index ebca26d..22911e1 100644 --- a/ultralytics/__init__.py +++ b/ultralytics/__init__.py @@ -1,6 +1,6 @@ # Ultralytics YOLO 🚀, AGPL-3.0 license -__version__ = '8.0.110' +__version__ = '8.0.111' from ultralytics.hub import start from ultralytics.vit.rtdetr import RTDETR diff --git a/ultralytics/nn/modules/__init__.py b/ultralytics/nn/modules/__init__.py index 8746303..b6dc6c4 100644 --- a/ultralytics/nn/modules/__init__.py +++ b/ultralytics/nn/modules/__init__.py @@ -21,10 +21,9 @@ from .head import Classify, Detect, Pose, RTDETRDecoder, Segment from .transformer import (AIFI, MLP, DeformableTransformerDecoder, DeformableTransformerDecoderLayer, LayerNorm2d, MLPBlock, MSDeformAttn, TransformerBlock, TransformerEncoderLayer, TransformerLayer) -__all__ = [ - 'Conv', 'Conv2', 'LightConv', 'RepConv', 'DWConv', 'DWConvTranspose2d', 'ConvTranspose', 'Focus', 'GhostConv', - 'ChannelAttention', 'SpatialAttention', 'CBAM', 'Concat', 'TransformerLayer', 'TransformerBlock', 'MLPBlock', - 'LayerNorm2d', 'DFL', 'HGBlock', 'HGStem', 'SPP', 'SPPF', 'C1', 'C2', 'C3', 'C2f', 'C3x', 'C3TR', 'C3Ghost', - 'GhostBottleneck', 'Bottleneck', 'BottleneckCSP', 'Proto', 'Detect', 'Segment', 'Pose', 'Classify', - 'TransformerEncoderLayer', 'RepC3', 'RTDETRDecoder', 'AIFI', 'DeformableTransformerDecoder', - 'DeformableTransformerDecoderLayer', 'MSDeformAttn', 'MLP'] +__all__ = ('Conv', 'Conv2', 'LightConv', 'RepConv', 'DWConv', 'DWConvTranspose2d', 'ConvTranspose', 'Focus', + 'GhostConv', 'ChannelAttention', 'SpatialAttention', 'CBAM', 'Concat', 'TransformerLayer', + 'TransformerBlock', 'MLPBlock', 'LayerNorm2d', 'DFL', 'HGBlock', 'HGStem', 'SPP', 'SPPF', 'C1', 'C2', 'C3', + 'C2f', 'C3x', 'C3TR', 'C3Ghost', 'GhostBottleneck', 'Bottleneck', 'BottleneckCSP', 'Proto', 'Detect', + 'Segment', 'Pose', 'Classify', 'TransformerEncoderLayer', 'RepC3', 'RTDETRDecoder', 'AIFI', + 'DeformableTransformerDecoder', 'DeformableTransformerDecoderLayer', 'MSDeformAttn', 'MLP') diff --git a/ultralytics/nn/modules/block.py b/ultralytics/nn/modules/block.py index ff76db3..508ddb3 100644 --- a/ultralytics/nn/modules/block.py +++ b/ultralytics/nn/modules/block.py @@ -10,9 +10,8 @@ import torch.nn.functional as F from .conv import Conv, DWConv, GhostConv, LightConv, RepConv from .transformer import TransformerBlock -__all__ = [ - 'DFL', 'HGBlock', 'HGStem', 'SPP', 'SPPF', 'C1', 'C2', 'C3', 'C2f', 'C3x', 'C3TR', 'C3Ghost', 'GhostBottleneck', - 'Bottleneck', 'BottleneckCSP', 'Proto', 'RepC3'] +__all__ = ('DFL', 'HGBlock', 'HGStem', 'SPP', 'SPPF', 'C1', 'C2', 'C3', 'C2f', 'C3x', 'C3TR', 'C3Ghost', + 'GhostBottleneck', 'Bottleneck', 'BottleneckCSP', 'Proto', 'RepC3') class DFL(nn.Module): diff --git a/ultralytics/nn/modules/conv.py b/ultralytics/nn/modules/conv.py index 13e970f..38ee3f5 100644 --- a/ultralytics/nn/modules/conv.py +++ b/ultralytics/nn/modules/conv.py @@ -9,9 +9,8 @@ import numpy as np import torch import torch.nn as nn -__all__ = [ - 'Conv', 'LightConv', 'DWConv', 'DWConvTranspose2d', 'ConvTranspose', 'Focus', 'GhostConv', 'ChannelAttention', - 'SpatialAttention', 'CBAM', 'Concat', 'RepConv'] +__all__ = ('Conv', 'LightConv', 'DWConv', 'DWConvTranspose2d', 'ConvTranspose', 'Focus', 'GhostConv', + 'ChannelAttention', 'SpatialAttention', 'CBAM', 'Concat', 'RepConv') def autopad(k, p=None, d=1): # kernel, padding, dilation diff --git a/ultralytics/nn/modules/head.py b/ultralytics/nn/modules/head.py index f9145f0..f7105bf 100644 --- a/ultralytics/nn/modules/head.py +++ b/ultralytics/nn/modules/head.py @@ -16,7 +16,7 @@ from .conv import Conv from .transformer import MLP, DeformableTransformerDecoder, DeformableTransformerDecoderLayer from .utils import bias_init_with_prob, linear_init_ -__all__ = ['Detect', 'Segment', 'Pose', 'Classify', 'RTDETRDecoder'] +__all__ = 'Detect', 'Segment', 'Pose', 'Classify', 'RTDETRDecoder' class Detect(nn.Module): diff --git a/ultralytics/nn/modules/transformer.py b/ultralytics/nn/modules/transformer.py index 4ae946a..4745905 100644 --- a/ultralytics/nn/modules/transformer.py +++ b/ultralytics/nn/modules/transformer.py @@ -13,9 +13,8 @@ from torch.nn.init import constant_, xavier_uniform_ from .conv import Conv from .utils import _get_clones, inverse_sigmoid, multi_scale_deformable_attn_pytorch -__all__ = [ - 'TransformerEncoderLayer', 'TransformerLayer', 'TransformerBlock', 'MLPBlock', 'LayerNorm2d', 'AIFI', - 'DeformableTransformerDecoder', 'DeformableTransformerDecoderLayer', 'MSDeformAttn', 'MLP'] +__all__ = ('TransformerEncoderLayer', 'TransformerLayer', 'TransformerBlock', 'MLPBlock', 'LayerNorm2d', 'AIFI', + 'DeformableTransformerDecoder', 'DeformableTransformerDecoderLayer', 'MSDeformAttn', 'MLP') class TransformerEncoderLayer(nn.Module): diff --git a/ultralytics/nn/modules/utils.py b/ultralytics/nn/modules/utils.py index 35cf30c..f8636dc 100644 --- a/ultralytics/nn/modules/utils.py +++ b/ultralytics/nn/modules/utils.py @@ -12,7 +12,7 @@ import torch.nn as nn import torch.nn.functional as F from torch.nn.init import uniform_ -__all__ = ['multi_scale_deformable_attn_pytorch', 'inverse_sigmoid'] +__all__ = 'multi_scale_deformable_attn_pytorch', 'inverse_sigmoid' def _get_clones(module, n): diff --git a/ultralytics/vit/rtdetr/val.py b/ultralytics/vit/rtdetr/val.py index 41d4000..e1619a6 100644 --- a/ultralytics/vit/rtdetr/val.py +++ b/ultralytics/vit/rtdetr/val.py @@ -9,7 +9,7 @@ from ultralytics.yolo.data.augment import Compose, Format, LetterBox from ultralytics.yolo.utils import colorstr, ops from ultralytics.yolo.v8.detect import DetectionValidator -__all__ = ['RTDETRValidator'] +__all__ = 'RTDETRValidator', # tuple or list # TODO: Temporarily, RT-DETR does not need padding.