MCPcopy Create free account
hub / github.com/Sirwenhao/Deep-Learning-Notes / Inception

Class Inception

CV/Pytorch_classification/GoogleNet/model.py:102–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

100 nn.init.constant_(m.bias, 0)
101
102class Inception(nn.Module):
103 def __init__(self, in_channels, ch1x1, ch3x3red, ch3x3, ch5x5red, ch5x5, pool_proj):
104 super(Inception, self).__init__()
105 self.branch1 = BasicConv2d(in_channels, ch1x1, kernel_size=1)
106
107 self.branch2 = nn.Sequential(
108 BasicConv2d(in_channels, ch3x3red, kernel_size=1),
109 BasicConv2d(ch3x3red, ch3x3, kernel_size=3, padding=1)
110 )
111
112 self.branch3 = nn.Sequential(
113 BasicConv2d(in_channels, ch5x5red, kernel_size=1),
114 BasicConv2d(ch5x5red, ch5x5, kernel_size=5, padding=5)
115 )
116
117 self.branch4 = nn.Sequential(
118 nn.MaxPool2d(kernel_size=3, stride=1, padding=1),
119 BasicConv2d(in_channels, pool_proj, kernel_size=1)
120 )
121
122 def forward(self, x):
123 branch1 = self.branch1(x)
124 branch2 = self.branch2(x)
125 branch3 = self.branch3(x)
126 branch4 = self.branch4(x)
127
128 outputs = [branch1, branch2, branch3, branch4]
129 return torch.cat(outputs, 1)
130
131# 定义辅助分类器结构
132class InceptionAux(nn.Module):

Callers 1

__init__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected