Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
rectify the 'padding' for 'DFConv2d' (#717)
Browse files Browse the repository at this point in the history
* make pixel indexes 0-based for bounding box in pascal voc dataset

* replacing all instances of torch.distributed.deprecated with torch.distributed

* replacing all instances of torch.distributed.deprecated with torch.distributed

* add GroupNorm

* add GroupNorm -- sort out yaml files

* use torch.nn.GroupNorm instead, replace 'use_gn' with 'conv_block' and use 'BaseStem'&'Bottleneck' to simply codes

* modification on 'group_norm' and 'conv_with_kaiming_uniform' function

* modification on yaml files in configs/gn_baselines/ and reduce the amount of indentation and code duplication

* use 'kaiming_uniform' to initialize resnet, disable gn after fc layer, and add dilation into ResNetHead

* agnostic-regression for bbox

* please set 'STRIDE_IN_1X1' to be 'False' when backbone use GN

* add README.md for GN

* add dcn from mmdetection

* add documentation for finetuning cityscapes

* add documentation for finetuning cityscapes

* add documentation for finetuning cityscapes

* add 'once_differentiable' for dcn and modify 'configs/cityscapes/README.md'

* rectify the 'padding' for 'DFConv2d'
  • Loading branch information
zimenglan-sysu-512 authored and fmassa committed Apr 25, 2019
1 parent d44c3fd commit eb4d335
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions maskrcnn_benchmark/layers/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,18 @@ def __init__(
):
super(DFConv2d, self).__init__()
if isinstance(kernel_size, (list, tuple)):
assert isinstance(stride, (list, tuple))
assert isinstance(dilation, (list, tuple))
assert len(kernel_size) == 2
assert len(stride) == 2
assert len(dilation) == 2
padding = (
dilation[0] * (kernel_size[0] - 1) // 2,
dilation[1] * (kernel_size[1] - 1) // 2
)
offset_base_channels = kernel_size[0] * kernel_size[1]
else:
padding = dilation * (kernel_size - 1) // 2
offset_base_channels = kernel_size * kernel_size
if with_modulated_dcn:
from maskrcnn_benchmark.layers import ModulatedDeformConv
Expand All @@ -143,8 +152,8 @@ def __init__(
in_channels,
deformable_groups * offset_channels,
kernel_size=kernel_size,
stride= stride,
padding= dilation,
stride=stride,
padding=padding,
groups=1,
dilation=dilation
)
Expand All @@ -155,8 +164,8 @@ def __init__(
in_channels,
out_channels,
kernel_size=kernel_size,
stride= stride,
padding=dilation,
stride=stride,
padding=padding,
dilation=dilation,
groups=groups,
deformable_groups=deformable_groups,
Expand All @@ -165,7 +174,7 @@ def __init__(
self.with_modulated_dcn = with_modulated_dcn
self.kernel_size = kernel_size
self.stride = stride
self.padding = dilation
self.padding = padding
self.dilation = dilation

def forward(self, x):
Expand Down

0 comments on commit eb4d335

Please sign in to comment.