2 import chainer.functions
as F
3 import chainer.links
as L
10 conv1_1=L.Convolution2D(3, 64, 3, stride=1, pad=1),
11 bn1_1=L.BatchNormalization(64),
12 conv1_2=L.Convolution2D(64, 64, 3, stride=1, pad=1),
13 bn1_2=L.BatchNormalization(64),
15 conv2_1=L.Convolution2D(64, 128, 3, stride=1, pad=1),
16 bn2_1=L.BatchNormalization(128),
17 conv2_2=L.Convolution2D(128, 128, 3, stride=1, pad=1),
18 bn2_2=L.BatchNormalization(128),
20 conv3_1=L.Convolution2D(128, 256, 3, stride=1, pad=1),
21 bn3_1=L.BatchNormalization(256),
22 conv3_2=L.Convolution2D(256, 256, 3, stride=1, pad=1),
23 bn3_2=L.BatchNormalization(256),
24 conv3_3=L.Convolution2D(256, 256, 3, stride=1, pad=1),
25 bn3_3=L.BatchNormalization(256),
27 conv4_1=L.Convolution2D(256, 512, 3, stride=1, pad=1),
28 bn4_1=L.BatchNormalization(512),
29 conv4_2=L.Convolution2D(512, 512, 3, stride=1, pad=1),
30 bn4_2=L.BatchNormalization(512),
31 conv4_3=L.Convolution2D(512, 512, 3, stride=1, pad=1),
32 bn4_3=L.BatchNormalization(512),
34 conv5_1=L.Convolution2D(512, 512, 3, stride=1, pad=1),
35 bn5_1=L.BatchNormalization(512),
36 conv5_2=L.Convolution2D(512, 512, 3, stride=1, pad=1),
37 bn5_2=L.BatchNormalization(512),
38 conv5_3=L.Convolution2D(512, 512, 3, stride=1, pad=1),
39 bn5_3=L.BatchNormalization(512),
41 fc6=L.Linear(25088, 4096),
42 fc7=L.Linear(4096, 4096),
43 fc8=L.Linear(4096, n_class)
47 h = F.relu(self.bn1_1(self.conv1_1(x)))
48 h = F.relu(self.bn1_2(self.conv1_2(h)))
49 h = F.max_pooling_2d(h, 2, stride=2)
51 h = F.relu(self.bn2_1(self.conv2_1(h)))
52 h = F.relu(self.bn2_2(self.conv2_2(h)))
53 h = F.max_pooling_2d(h, 2, stride=2)
55 h = F.relu(self.bn3_1(self.conv3_1(h)))
56 h = F.relu(self.bn3_2(self.conv3_2(h)))
57 h = F.relu(self.bn3_3(self.conv3_3(h)))
58 h = F.max_pooling_2d(h, 2, stride=2)
60 h = F.relu(self.bn4_1(self.conv4_1(h)))
61 h = F.relu(self.bn4_2(self.conv4_2(h)))
62 h = F.relu(self.bn4_3(self.conv4_3(h)))
63 h = F.max_pooling_2d(h, 2, stride=2)
65 h = F.relu(self.bn5_1(self.conv5_1(h)))
66 h = F.relu(self.bn5_2(self.conv5_2(h)))
67 h = F.relu(self.bn5_3(self.conv5_3(h)))
68 h = F.max_pooling_2d(h, 2, stride=2)
70 h = F.dropout(F.relu(self.fc6(h)), ratio=0.5)
71 h = F.dropout(F.relu(self.fc7(h)), ratio=0.5)
78 assert not chainer.config.train
81 self.
loss = F.softmax_cross_entropy(fc8, t)