Reference for ultralytics/nn/modules/conv.py
Note
This file is available at https://github.com/ultralytics/ultralytics/blob/main/ultralytics/nn/modules/conv.py. If you spot a problem please help fix it by contributing a Pull Request 🛠️. Thank you 🙏!
ultralytics.nn.modules.conv.Conv
Bases: Module
Standard convolution with args(ch_in, ch_out, kernel, stride, padding, groups, dilation, activation).
Source code in ultralytics/nn/modules/conv.py
forward
ultralytics.nn.modules.conv.Conv2
Bases: Conv
Simplified RepConv module with Conv fusing.
Source code in ultralytics/nn/modules/conv.py
forward
forward_fuse
fuse_convs
Fuse parallel convolutions.
Source code in ultralytics/nn/modules/conv.py
ultralytics.nn.modules.conv.LightConv
Bases: Module
Light convolution with args(ch_in, ch_out, kernel).
https://github.com/PaddlePaddle/PaddleDetection/blob/develop/ppdet/modeling/backbones/hgnet_v2.py
Source code in ultralytics/nn/modules/conv.py
ultralytics.nn.modules.conv.DWConv
ultralytics.nn.modules.conv.DWConvTranspose2d
Bases: ConvTranspose2d
Depth-wise transpose convolution.
Source code in ultralytics/nn/modules/conv.py
ultralytics.nn.modules.conv.ConvTranspose
Bases: Module
Convolution transpose 2d layer.
Source code in ultralytics/nn/modules/conv.py
forward
ultralytics.nn.modules.conv.Focus
Bases: Module
Focus wh information into c-space.
Source code in ultralytics/nn/modules/conv.py
forward
Applies convolution to concatenated tensor and returns the output.
Input shape is (b,c,w,h) and output shape is (b,4c,w/2,h/2).
Source code in ultralytics/nn/modules/conv.py
ultralytics.nn.modules.conv.GhostConv
Bases: Module
Ghost Convolution https://github.com/huawei-noah/ghostnet.
Source code in ultralytics/nn/modules/conv.py
forward
ultralytics.nn.modules.conv.RepConv
Bases: Module
RepConv is a basic rep-style block, including training and deploy status.
This module is used in RT-DETR. Based on https://github.com/DingXiaoH/RepVGG/blob/main/repvgg.py
Source code in ultralytics/nn/modules/conv.py
forward
forward_fuse
fuse_convs
Combines two convolution layers into a single layer and removes unused attributes from the class.
Source code in ultralytics/nn/modules/conv.py
get_equivalent_kernel_bias
Returns equivalent kernel and bias by adding 3x3 kernel, 1x1 kernel and identity kernel with their biases.
Source code in ultralytics/nn/modules/conv.py
ultralytics.nn.modules.conv.ChannelAttention
Bases: Module
Channel-attention module https://github.com/open-mmlab/mmdetection/tree/v3.0.0rc1/configs/rtmdet.
Source code in ultralytics/nn/modules/conv.py
forward
Applies forward pass using activation on convolutions of the input, optionally using batch normalization.
ultralytics.nn.modules.conv.SpatialAttention
Bases: Module
Spatial-attention module.
Source code in ultralytics/nn/modules/conv.py
forward
Apply channel and spatial attention on input for feature recalibration.
ultralytics.nn.modules.conv.CBAM
Bases: Module
Convolutional Block Attention Module.
Source code in ultralytics/nn/modules/conv.py
ultralytics.nn.modules.conv.Concat
Bases: Module
Concatenate a list of tensors along dimension.
Source code in ultralytics/nn/modules/conv.py
ultralytics.nn.modules.conv.autopad
Pad to 'same' shape outputs.