Skip to content

Commit fa1554f

Browse files
authored
[Enhancement] Refine the docstring of ResNet (open-mmlab#723)
* refine docstring of resnet * refine docstring
1 parent f800669 commit fa1554f

File tree

1 file changed

+28
-14
lines changed

1 file changed

+28
-14
lines changed

mmseg/models/backbones/resnet.py

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -312,25 +312,38 @@ class ResNet(BaseModule):
312312
313313
Args:
314314
depth (int): Depth of resnet, from {18, 34, 50, 101, 152}.
315-
in_channels (int): Number of input image channels. Default" 3.
315+
in_channels (int): Number of input image channels. Default: 3.
316316
stem_channels (int): Number of stem channels. Default: 64.
317317
base_channels (int): Number of base channels of res layer. Default: 64.
318-
num_stages (int): Resnet stages, normally 4.
318+
num_stages (int): Resnet stages, normally 4. Default: 4.
319319
strides (Sequence[int]): Strides of the first block of each stage.
320+
Default: (1, 2, 2, 2).
320321
dilations (Sequence[int]): Dilation of each stage.
322+
Default: (1, 1, 1, 1).
321323
out_indices (Sequence[int]): Output from which stages.
324+
Default: (0, 1, 2, 3).
322325
style (str): `pytorch` or `caffe`. If set to "pytorch", the stride-two
323326
layer is the 3x3 conv layer, otherwise the stride-two layer is
324-
the first 1x1 conv layer.
325-
deep_stem (bool): Replace 7x7 conv in input stem with 3 3x3 conv
327+
the first 1x1 conv layer. Default: 'pytorch'.
328+
deep_stem (bool): Replace 7x7 conv in input stem with 3 3x3 conv.
329+
Default: False.
326330
avg_down (bool): Use AvgPool instead of stride conv when
327-
downsampling in the bottleneck.
331+
downsampling in the bottleneck. Default: False.
328332
frozen_stages (int): Stages to be frozen (stop grad and set eval mode).
329-
-1 means not freezing any parameters.
333+
-1 means not freezing any parameters. Default: -1.
334+
conv_cfg (dict | None): Dictionary to construct and config conv layer.
335+
When conv_cfg is None, cfg will be set to dict(type='Conv2d').
336+
Default: None.
330337
norm_cfg (dict): Dictionary to construct and config norm layer.
338+
Default: dict(type='BN', requires_grad=True).
331339
norm_eval (bool): Whether to set norm layers to eval mode, namely,
332340
freeze running stats (mean and var). Note: Effect on Batch Norm
333-
and its variants only.
341+
and its variants only. Default: False.
342+
dcn (dict | None): Dictionary to construct and config DCN conv layer.
343+
When dcn is not None, conv_cfg must be None. Default: None.
344+
stage_with_dcn (Sequence[bool]): Whether to set DCN conv for each
345+
stage. The length of stage_with_dcn is equal to num_stages.
346+
Default: (False, False, False, False).
334347
plugins (list[dict]): List of plugins for stages, each dict contains:
335348
336349
- cfg (dict, required): Cfg dict to build plugin.
@@ -339,18 +352,19 @@ class ResNet(BaseModule):
339352
options: 'after_conv1', 'after_conv2', 'after_conv3'.
340353
341354
- stages (tuple[bool], optional): Stages to apply plugin, length
342-
should be same as 'num_stages'
355+
should be same as 'num_stages'.
356+
Default: None.
343357
multi_grid (Sequence[int]|None): Multi grid dilation rates of last
344-
stage. Default: None
358+
stage. Default: None.
345359
contract_dilation (bool): Whether contract first dilation of each layer
346-
Default: False
360+
Default: False.
347361
with_cp (bool): Use checkpoint or not. Using checkpoint will save some
348-
memory while slowing down the training speed.
362+
memory while slowing down the training speed. Default: False.
349363
zero_init_residual (bool): Whether to use zero init for last norm layer
350-
in resblocks to let them behave as identity.
351-
pretrained (str, optional): model pretrained path. Default: None
364+
in resblocks to let them behave as identity. Default: True.
365+
pretrained (str, optional): model pretrained path. Default: None.
352366
init_cfg (dict or list[dict], optional): Initialization config dict.
353-
Default: None
367+
Default: None.
354368
355369
Example:
356370
>>> from mmseg.models import ResNet

0 commit comments

Comments
 (0)