"tests/vscode:/vscode.git/clone" did not exist on "2619aa9c8e6946d8a1213603fec2c7ac09e51fc8"
Commit cd12b9a9 authored by ekka's avatar ekka Committed by Francisco Massa
Browse files

Modifying the comments of inceptionV3 dimensions (#748)

* Modifying the comments of inceptionV3 dimensions

Modifying the comments of inceptionV3 dimensions to match the pytorch convention. Relevant (https://github.com/pytorch/vision/pull/719#pullrequestreview-203194302)

* Added Batch size in comment

* Update inception.py
parent 813576b4
......@@ -19,7 +19,7 @@ def inception_v3(pretrained=False, **kwargs):
.. note::
**Important**: In contrast to the other models the inception_v3 expects tensors with a size of
299x299x3, so ensure your images are sized accordingly.
N x 3 x 299 x 299, so ensure your images are sized accordingly.
Args:
pretrained (bool): If True, returns a model pre-trained on ImageNet
......@@ -78,55 +78,55 @@ class Inception3(nn.Module):
x_ch1 = torch.unsqueeze(x[:, 1], 1) * (0.224 / 0.5) + (0.456 - 0.5) / 0.5
x_ch2 = torch.unsqueeze(x[:, 2], 1) * (0.225 / 0.5) + (0.406 - 0.5) / 0.5
x = torch.cat((x_ch0, x_ch1, x_ch2), 1)
# 299 x 299 x 3
# N x 3 x 299 x 299
x = self.Conv2d_1a_3x3(x)
# 149 x 149 x 32
# N x 32 x 149 x 149
x = self.Conv2d_2a_3x3(x)
# 147 x 147 x 32
# N x 32 x 147 x 147
x = self.Conv2d_2b_3x3(x)
# 147 x 147 x 64
# N x 64 x 147 x 147
x = F.max_pool2d(x, kernel_size=3, stride=2)
# 73 x 73 x 64
# N x 64 x 73 x 73
x = self.Conv2d_3b_1x1(x)
# 73 x 73 x 80
# N x 80 x 73 x 73
x = self.Conv2d_4a_3x3(x)
# 71 x 71 x 192
# N x 192 x 71 x 71
x = F.max_pool2d(x, kernel_size=3, stride=2)
# 35 x 35 x 192
# N x 192 x 35 x 35
x = self.Mixed_5b(x)
# 35 x 35 x 256
# N x 256 x 35 x 35
x = self.Mixed_5c(x)
# 35 x 35 x 288
# N x 288 x 35 x 35
x = self.Mixed_5d(x)
# 35 x 35 x 288
# N x 288 x 35 x 35
x = self.Mixed_6a(x)
# 17 x 17 x 768
# N x 768 x 17 x 17
x = self.Mixed_6b(x)
# 17 x 17 x 768
# N x 768 x 17 x 17
x = self.Mixed_6c(x)
# 17 x 17 x 768
# N x 768 x 17 x 17
x = self.Mixed_6d(x)
# 17 x 17 x 768
# N x 768 x 17 x 17
x = self.Mixed_6e(x)
# 17 x 17 x 768
# N x 768 x 17 x 17
if self.training and self.aux_logits:
aux = self.AuxLogits(x)
# 17 x 17 x 768
# N x 768 x 17 x 17
x = self.Mixed_7a(x)
# 8 x 8 x 1280
# N x 1280 x 8 x 8
x = self.Mixed_7b(x)
# 8 x 8 x 2048
# N x 2048 x 8 x 8
x = self.Mixed_7c(x)
# 8 x 8 x 2048
# N x 2048 x 8 x 8
# Adaptive average pooling
x = F.adaptive_avg_pool2d(x, (1, 1))
# 1 x 1 x 2048
# N x 2048 x 1 x 1
x = F.dropout(x, training=self.training)
# 1 x 1 x 2048
# N x 2048 x 1 x 1
x = x.view(x.size(0), -1)
# 2048
# N x 2048
x = self.fc(x)
# 1000 (num_classes)
# N x 1000 (num_classes)
if self.training and self.aux_logits:
return x, aux
return x
......@@ -305,20 +305,20 @@ class InceptionAux(nn.Module):
self.fc.stddev = 0.001
def forward(self, x):
# 17 x 17 x 768
# N x 768 x 17 x 17
x = F.avg_pool2d(x, kernel_size=5, stride=3)
# 5 x 5 x 768
# N x 768 x 5 x 5
x = self.conv0(x)
# 5 x 5 x 128
# N x 128 x 5 x 5
x = self.conv1(x)
# 1 x 1 x 768
# N x 768 x 1 x 1
# Adaptive average pooling
x = F.adaptive_avg_pool2d(x, (1, 1))
# 1 x 1 x 768
# N x 768 x 1 x 1
x = x.view(x.size(0), -1)
# 768
# N x 768
x = self.fc(x)
# 1000
# N x 1000
return x
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment