Skip to content
This repository has been archived by the owner on Jul 2, 2021. It is now read-only.

Commit

Permalink
BuildingBlock -> ResBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
yuyu2172 committed Dec 19, 2017
1 parent a6c3012 commit 4be7565
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions chainercv/links/model/resnet/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from chainercv.links.model.resnet.building_block import Bottleneck # NOQA
from chainercv.links.model.resnet.building_block import BuildingBlock # NOQA
from chainercv.links.model.resnet.resblock import Bottleneck # NOQA
from chainercv.links.model.resnet.resblock import ResBlock # NOQA
from chainercv.links.model.resnet.resnet import ResNet # NOQA
from chainercv.links.model.resnet.resnet import ResNet101 # NOQA
from chainercv.links.model.resnet.resnet import ResNet152 # NOQA
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from chainercv.links import Conv2DBNActiv


class BuildingBlock(chainer.Chain):
class ResBlock(chainer.Chain):

"""A building block that consists of several Bottleneck layers.
"""A building block for ResNets that consists of several Bottleneck layers.
in --> Bottleneck with shortcut --> Bottleneck * (n_layer - 1) --> out
Expand All @@ -27,7 +27,7 @@ class BuildingBlock(chainer.Chain):

def __init__(self, n_layer, in_channels, mid_channels,
out_channels, stride, initialW=None, stride_first=False):
super(BuildingBlock, self).__init__()
super(ResBlock, self).__init__()
with self.init_scope():
self.a = Bottleneck(
in_channels, mid_channels, out_channels, stride,
Expand Down
10 changes: 5 additions & 5 deletions chainercv/links/model/resnet/resnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import chainer.links as L

from chainercv.links import Conv2DBNActiv
from chainercv.links.model.resnet.building_block import BuildingBlock
from chainercv.links.model.resnet.resblock import ResBlock
from chainercv.links import PickableSequentialChain
from chainercv.utils import download_model

Expand Down Expand Up @@ -181,10 +181,10 @@ def __init__(self, model_name,
self.conv1 = Conv2DBNActiv(None, 64, 7, 2, 3, nobias=conv1_no_bias,
initialW=conv_initialW)
self.pool1 = lambda x: F.max_pooling_2d(x, ksize=3, stride=2)
self.res2 = BuildingBlock(blocks[0], None, 64, 256, 1, **kwargs)
self.res3 = BuildingBlock(blocks[1], None, 128, 512, 2, **kwargs)
self.res4 = BuildingBlock(blocks[2], None, 256, 1024, 2, **kwargs)
self.res5 = BuildingBlock(blocks[3], None, 512, 2048, 2, **kwargs)
self.res2 = ResBlock(blocks[0], None, 64, 256, 1, **kwargs)
self.res3 = ResBlock(blocks[1], None, 128, 512, 2, **kwargs)
self.res4 = ResBlock(blocks[2], None, 256, 1024, 2, **kwargs)
self.res5 = ResBlock(blocks[3], None, 512, 2048, 2, **kwargs)
self.pool5 = _global_average_pooling_2d
self.fc6 = L.Linear(None, n_class, initialW=fc_initialW)
self.prob = F.softmax
Expand Down
6 changes: 3 additions & 3 deletions docs/source/reference/links/resnet.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Bottleneck
.. autoclass:: Bottleneck
:members:

BuildingBlock
~~~~~~~~~~~~~
.. autoclass:: BuildingBlock
ResBlock
~~~~~~~~
.. autoclass:: ResBlock
:members:

0 comments on commit 4be7565

Please sign in to comment.