Skip to content

Commit d7734dd

Browse files
authored
Parameters of DilatedEncoder (#7812)
* Parameters of DilatedEncoder Add the original fixed parameter block_dilations as an incoming parameter * [Fix] Add default value to block_dilations parameter of DilatedEncoder and fully function annotation * [Fix] The incoming parameter of calling DilatedEncoder in the test_dilated_encoder function is missing block_dilations * Update test_necks.py [fix] tests/test_models/test_necks.py:237:80: E501 line too long (84 > 79 characters)
1 parent 541222d commit d7734dd

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

configs/yolof/yolof_r50_c5_8x8_1x_coco.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
in_channels=2048,
2222
out_channels=512,
2323
block_mid_channels=128,
24-
num_residual_blocks=4),
24+
num_residual_blocks=4,
25+
block_dilations=[2, 4, 6, 8]),
2526
bbox_head=dict(
2627
type='YOLOFHead',
2728
num_classes=80,

mmdet/models/necks/dilated_encoder.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,17 @@ class DilatedEncoder(nn.Module):
6262
out_channels (int): The number of output channels.
6363
block_mid_channels (int): The number of middle block output channels
6464
num_residual_blocks (int): The number of residual blocks.
65+
block_dilations (list): The list of residual blocks dilation.
6566
"""
6667

6768
def __init__(self, in_channels, out_channels, block_mid_channels,
68-
num_residual_blocks):
69+
num_residual_blocks, block_dilations):
6970
super(DilatedEncoder, self).__init__()
7071
self.in_channels = in_channels
7172
self.out_channels = out_channels
7273
self.block_mid_channels = block_mid_channels
7374
self.num_residual_blocks = num_residual_blocks
74-
self.block_dilations = [2, 4, 6, 8]
75+
self.block_dilations = block_dilations
7576
self._init_layers()
7677

7778
def _init_layers(self):

tests/test_models/test_necks.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@ def test_dilated_encoder():
234234
in_channels = 16
235235
out_channels = 32
236236
out_shape = 34
237-
dilated_encoder = DilatedEncoder(in_channels, out_channels, 16, 2)
237+
dilated_encoder = DilatedEncoder(in_channels, out_channels, 16, 2,
238+
[2, 4, 6, 8])
238239
feat = [torch.rand(1, in_channels, 34, 34)]
239240
out_feat = dilated_encoder(feat)[0]
240241
assert out_feat.shape == (1, out_channels, out_shape, out_shape)

0 commit comments

Comments
 (0)