
本文共 3005 字,大约阅读时间需要 10 分钟。
���������������CBM������������������
���������������CBMconv+batchnorm+mish���������������������������������������������������������������������������������������������������������������������������������������������������������������������Batch Normalization���BN���������Mish���������������
������������Conv���
������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
Batch Normalization���BN���
Batch Normalization���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������BN���������������������������������������������������������������������������������������������BN������������������������������������������������������������������������������������
Mish������������
Mish���������������������������������������������������������ReLU���Sigmoid���������������������������������������������������������Mish��������������������������� [ \text{Mish}(x) = x \cdot \tanh(\text{softplus}(x)) ] ���������softplus���������������������_cosh������������������x���������������������������1������������������������������������������������������������������Mish������������������������������������������������
CBM������������
CBM������������������������������������������Mish������������������������������������������������������������������ [ CBM(x) = \text{Conv}(x) \rightarrow \text{BN}(x) \rightarrow \text{Mish}(x) ] ���������������������CBM������������������������������������������������������������������������������������
������������
������������CBM���������������������������������Python���PyTorch���������������������������������������������������������
������������������������������������RGB���������������������������������32x32���������������3���
import torchrgb = torch.randn(1, 3, 32, 32)print(rgb)print(rgb.shape) # (1, 3, 32, 32)
���������������������������������������������������������������������������������3x3������������2���
class BasicConv(nn.Module): def __init__(self, in_channels, out_channels, kernel_size=3, stride=1): super(BasicConv, self).__init__() self.conv = nn.Conv2d(in_channels, out_channels, kernel_size, stride, kernel_size//2, bias=False)test_downsample_conv = BasicConv(3, 1, 3, stride=2)x = test_downsample_conv(rgb)print(x)print(x.shape) # (1, 1, 16, 16)
���������������������������������������������������������������������������������������������CBM���������������������������
������
���������������CBM������������������������������������������Mish���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
发表评论
最新留言
关于作者
