9 def __init__(self, inplanes, squeeze_planes,
10 expand1x1_planes, expand3x3_planes):
11 super(Fire, self).__init__()
13 self.
squeeze = nn.Conv2d(inplanes, squeeze_planes, kernel_size=1)
15 self.
expand1x1 = nn.Conv2d(squeeze_planes, expand1x1_planes,
18 self.
expand3x3 = nn.Conv2d(squeeze_planes, expand3x3_planes,
19 kernel_size=3, padding=1)
32 def __init__(self, version=1.0, num_classes=1000, ceil_mode=False):
33 super(SqueezeNet, self).__init__()
34 if version
not in [1.0, 1.1]:
35 raise ValueError(
"Unsupported SqueezeNet version {version}:" 36 "1.0 or 1.1 expected".format(version=version))
40 nn.Conv2d(3, 96, kernel_size=7, stride=2),
41 nn.ReLU(inplace=
True),
42 nn.MaxPool2d(kernel_size=3, stride=2, ceil_mode=ceil_mode),
44 Fire(128, 16, 64, 64),
45 Fire(128, 32, 128, 128),
46 nn.MaxPool2d(kernel_size=3, stride=2, ceil_mode=ceil_mode),
47 Fire(256, 32, 128, 128),
48 Fire(256, 48, 192, 192),
49 Fire(384, 48, 192, 192),
50 Fire(384, 64, 256, 256),
51 nn.MaxPool2d(kernel_size=3, stride=2, ceil_mode=ceil_mode),
52 Fire(512, 64, 256, 256),
56 nn.Conv2d(3, 64, kernel_size=3, stride=2),
57 nn.ReLU(inplace=
True),
58 nn.MaxPool2d(kernel_size=3, stride=2, ceil_mode=ceil_mode),
60 Fire(128, 16, 64, 64),
61 nn.MaxPool2d(kernel_size=3, stride=2, ceil_mode=ceil_mode),
62 Fire(128, 32, 128, 128),
63 Fire(256, 32, 128, 128),
64 nn.MaxPool2d(kernel_size=3, stride=2, ceil_mode=ceil_mode),
65 Fire(256, 48, 192, 192),
66 Fire(384, 48, 192, 192),
67 Fire(384, 64, 256, 256),
68 Fire(512, 64, 256, 256),
71 final_conv = nn.Conv2d(512, self.
num_classes, kernel_size=1)
75 nn.ReLU(inplace=
True),
79 for m
in self.modules():
80 if isinstance(m, nn.Conv2d):
82 init.normal_(m.weight.data, mean=0.0, std=0.01)
84 init.kaiming_uniform_(m.weight.data)
85 if m.bias
is not None: