# 探索未来的视觉革命：卷积神经网络的崭新时代（二）

## 🍋1×1 convolution

• 通道降维（channel dimension reduction）：通过应用 1×1 卷积，可以减小特征图的通道数量，从而降低模型的计算负担。这对于减小模型的参数数量和计算复杂度很有帮助。通道降维有时也称为特征压缩。
• 通道混合（channel mixing）：1×1 卷积可以将不同通道之间的信息进行混合。它通过学习权重来组合输入通道的信息，以产生更丰富的特征表示。这有助于模型更好地捕获特征之间的关联。
• 非线性变换：虽然 1×1 卷积核的大小为 1x1，但通常会包括非线性激活函数，如ReLU（Rectified Linear Unit）。这使得 1×1 卷积可以执行非线性变换，有助于模型更好地捕获复杂的模式。

branch3×3 = self.branch3×3_3(branch3×3)

outputs = [branch1x1, branch5x5, branch3x3, branch_pool]
return torch.cat(outputs, dim=1)

class InceptionA(nn.Module):
def __init__(self, in_channels):
super(InceptionA, self).__init__()
self.branch1x1 = nn.Conv2d(in_channels, 16, kernel_size=1)
self.branch5x5_1 = nn.Conv2d(in_channels,16, kernel_size=1)
self.branch5x5_2 = nn.Conv2d(16, 24, kernel_size=5, padding=2)
self.branch3x3_1 = nn.Conv2d(in_channels, 16, kernel_size=1)
self.branch3x3_2 = nn.Conv2d(16, 24, kernel_size=3, padding=1)
self.branch3x3_3 = nn.Conv2d(24, 24, kernel_size=3, padding=1)
self.branch_pool = nn.Conv2d(in_channels, 24, kernel_size=1)
def forward(self, x):
branch1x1 = self.branch1x1(x)
branch5x5 = self.branch5x5_1(x)
branch5x5 = self.branch5x5_2(branch5x5)
branch3x3 = self.branch3x3_1(x)
branch3x3 = self.branch3x3_2(branch3x3)
branch3x3 = self.branch3x3_3(branch3x3)
branch_pool = F.avg_pool2d(x, kernel_size=3, stride=1, padding=1)
branch_pool = self.branch_pool(branch_pool)
outputs = [branch1x1, branch5x5, branch3x3, branch_pool]
return torch.cat(outputs, dim=1)

class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(1, 10, kernel_size=5)
self.conv2 = nn.Conv2d(88, 20, kernel_size=5)
self.incep1 = InceptionA(in_channels=10)
self.incep2 = InceptionA(in_channels=20)
self.mp = nn.MaxPool2d(2)
self.fc = nn.Linear(1408, 10)
def forward(self, x):
in_size = x.size(0)
x = F.relu(self.mp(self.conv1(x)))
x = self.incep1(x)
x = F.relu(self.mp(self.conv2(x)))
x = self.incep2(x)
x = x.view(in_size, -1)
x = self.fc(x)
return x

## 🍋总结

• 理论《深度学习》
• 阅读pytorch文档（通读一遍）
• 复现经典论文（代码下载，读代码，写代码）
• 扩充视野

|
6天前
|

YOLOv5改进 | 主干网络 | 用EfficientNet卷积替换backbone【教程+代码 】

34 3
|
8天前
|

YOLOv5改进 | 卷积模块 | 用ShuffleNetV2卷积替换Conv【轻量化网络】

32 7
|
5天前
|

YOLOv8改进 | 融合模块 | 用Resblock+CBAM卷积替换Conv【轻量化网络】

23 1
|
8天前
|

27 3
|
13天前
|

39 0
|
13天前
|

24 1
|
13天前
|

23 1
|
13天前
|

47 1
|
13天前
|

26 2
|
13天前
|

41 2