CSPResNeXt¶
- class mmpretrain.models.backbones.CSPResNeXt(*args, **kwargs)[源代码]¶
CSP-ResNeXt backbone.
- 参数:
depth (int) – Depth of CSP-ResNeXt. Default: 50.
out_indices (Sequence[int]) – Output from which stages. Default: (4, ).
frozen_stages (int) – Stages to be frozen (stop grad and set eval mode). -1 means not freezing any parameters. Default: -1.
conv_cfg (dict) – Config dict for convolution layer. Default: None.
norm_cfg (dict) – Dictionary to construct and config norm layer. Default: dict(type=’BN’, requires_grad=True).
act_cfg (dict) – Config dict for activation layer. Default: dict(type=’LeakyReLU’, negative_slope=0.1).
norm_eval (bool) – Whether to set norm layers to eval mode, namely, freeze running stats (mean and var). Note: Effect on Batch Norm and its variants only.
init_cfg (dict or list[dict], optional) – Initialization config dict. Default: None.
示例
>>> from mmpretrain.models import CSPResNeXt >>> import torch >>> model = CSPResNeXt(depth=50, out_indices=(0, 1, 2, 3)) >>> model.eval() >>> inputs = torch.rand(1, 3, 224, 224) >>> level_outputs = model(inputs) >>> for level_out in level_outputs: ... print(tuple(level_out.shape)) ... (1, 256, 56, 56) (1, 512, 28, 28) (1, 1024, 14, 14) (1, 2048, 7, 7)