init commit
This commit is contained in:
182
ultralytics/nn/modules/__init__.py
Normal file
182
ultralytics/nn/modules/__init__.py
Normal file
@@ -0,0 +1,182 @@
|
||||
# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
|
||||
"""
|
||||
Ultralytics neural network modules.
|
||||
|
||||
This module provides access to various neural network components used in Ultralytics models, including convolution
|
||||
blocks, attention mechanisms, transformer components, and detection/segmentation heads.
|
||||
|
||||
Examples:
|
||||
Visualize a module with Netron
|
||||
>>> from ultralytics.nn.modules import Conv
|
||||
>>> import torch
|
||||
>>> import subprocess
|
||||
>>> x = torch.ones(1, 128, 40, 40)
|
||||
>>> m = Conv(128, 128)
|
||||
>>> f = f"{m._get_name()}.onnx"
|
||||
>>> torch.onnx.export(m, x, f)
|
||||
>>> subprocess.run(f"onnxslim {f} {f} && open {f}", shell=True, check=True) # pip install onnxslim
|
||||
"""
|
||||
|
||||
from .block import (
|
||||
C1,
|
||||
C2,
|
||||
C2PSA,
|
||||
C3,
|
||||
C3TR,
|
||||
CIB,
|
||||
DFL,
|
||||
ELAN1,
|
||||
PSA,
|
||||
SPP,
|
||||
SPPELAN,
|
||||
SPPF,
|
||||
A2C2f,
|
||||
AConv,
|
||||
ADown,
|
||||
Attention,
|
||||
BNContrastiveHead,
|
||||
Bottleneck,
|
||||
BottleneckCSP,
|
||||
C2f,
|
||||
C2fAttn,
|
||||
C2fCIB,
|
||||
C2fPSA,
|
||||
C3Ghost,
|
||||
C3k2,
|
||||
C3x,
|
||||
CBFuse,
|
||||
CBLinear,
|
||||
ContrastiveHead,
|
||||
GhostBottleneck,
|
||||
HGBlock,
|
||||
HGStem,
|
||||
ImagePoolingAttn,
|
||||
MaxSigmoidAttnBlock,
|
||||
Proto,
|
||||
RepC3,
|
||||
RepNCSPELAN4,
|
||||
RepVGGDW,
|
||||
ResNetLayer,
|
||||
SCDown,
|
||||
TorchVision,
|
||||
)
|
||||
from .conv import (
|
||||
CBAM,
|
||||
ChannelAttention,
|
||||
Concat,
|
||||
Conv,
|
||||
Conv2,
|
||||
ConvTranspose,
|
||||
DWConv,
|
||||
DWConvTranspose2d,
|
||||
Focus,
|
||||
GhostConv,
|
||||
Index,
|
||||
LightConv,
|
||||
RepConv,
|
||||
SpatialAttention,
|
||||
)
|
||||
from .head import (
|
||||
OBB,
|
||||
Classify,
|
||||
Detect,
|
||||
LRPCHead,
|
||||
Pose,
|
||||
RTDETRDecoder,
|
||||
Segment,
|
||||
WorldDetect,
|
||||
YOLOEDetect,
|
||||
YOLOESegment,
|
||||
v10Detect,
|
||||
)
|
||||
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",
|
||||
"C3k2",
|
||||
"SCDown",
|
||||
"C2fPSA",
|
||||
"C2PSA",
|
||||
"C2fAttn",
|
||||
"C3x",
|
||||
"C3TR",
|
||||
"C3Ghost",
|
||||
"GhostBottleneck",
|
||||
"Bottleneck",
|
||||
"BottleneckCSP",
|
||||
"Proto",
|
||||
"Detect",
|
||||
"Segment",
|
||||
"Pose",
|
||||
"Classify",
|
||||
"TransformerEncoderLayer",
|
||||
"RepC3",
|
||||
"RTDETRDecoder",
|
||||
"AIFI",
|
||||
"DeformableTransformerDecoder",
|
||||
"DeformableTransformerDecoderLayer",
|
||||
"MSDeformAttn",
|
||||
"MLP",
|
||||
"ResNetLayer",
|
||||
"OBB",
|
||||
"WorldDetect",
|
||||
"YOLOEDetect",
|
||||
"YOLOESegment",
|
||||
"v10Detect",
|
||||
"LRPCHead",
|
||||
"ImagePoolingAttn",
|
||||
"MaxSigmoidAttnBlock",
|
||||
"ContrastiveHead",
|
||||
"BNContrastiveHead",
|
||||
"RepNCSPELAN4",
|
||||
"ADown",
|
||||
"SPPELAN",
|
||||
"CBFuse",
|
||||
"CBLinear",
|
||||
"AConv",
|
||||
"ELAN1",
|
||||
"RepVGGDW",
|
||||
"CIB",
|
||||
"C2fCIB",
|
||||
"Attention",
|
||||
"PSA",
|
||||
"TorchVision",
|
||||
"Index",
|
||||
"A2C2f",
|
||||
)
|
||||
Reference in New Issue
Block a user