Skip to content

Commit

Permalink
update resnext
Browse files Browse the repository at this point in the history
  • Loading branch information
OceanPang committed Dec 18, 2018
1 parent b77b98a commit 2bc86fd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mmdet/models/backbones/resnet.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def __init__(self,
downsample=None,
style='pytorch',
with_cp=False):
"""Bottleneck block.
"""Bottleneck block for ResNet.
If style is "pytorch", the stride-two layer is the 3x3 conv layer,
if it is "caffe", the stride-two layer is the first 1x1 conv layer.
"""
Expand Down
9 changes: 6 additions & 3 deletions mmdet/models/backbones/resnext.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,25 @@ def __init__(self,
base_width=4,
style='pytorch',
with_cp=False):
"""Bottleneck block.
"""Bottleneck block for ResNeXt.
If style is "pytorch", the stride-two layer is the 3x3 conv layer,
if it is "caffe", the stride-two layer is the first 1x1 conv layer.
"""
super(Bottleneck, self).__init__()
assert style in ['pytorch', 'caffe']

width = planes if groups == 1 else math.floor(
planes * (base_width / 64)) * groups
if groups == 1:
width = planes
else:
width = math.floor(planes * (base_width / 64)) * groups

if style == 'pytorch':
conv1_stride = 1
conv2_stride = stride
else:
conv1_stride = stride
conv2_stride = 1

self.conv1 = nn.Conv2d(
inplanes, width, kernel_size=1, stride=conv1_stride, bias=False)
self.bn1 = nn.BatchNorm2d(width)
Expand Down

0 comments on commit 2bc86fd

Please sign in to comment.