Shortcuts

Note

You are reading the documentation for MMClassification 0.x, which will soon be deprecated at the end of 2022. We recommend you upgrade to MMClassification 1.0 to enjoy fruitful new features and better performance brought by OpenMMLab 2.0. Check the installation tutorial, migration tutorial and changelog for more details.

DenseNet

class mmcls.models.DenseNet(arch='121', in_channels=3, bn_size=4, drop_rate=0, compression_factor=0.5, memory_efficient=False, norm_cfg={'type': 'BN'}, act_cfg={'type': 'ReLU'}, out_indices=- 1, frozen_stages=0, init_cfg=None)[source]

DenseNet.

A PyTorch implementation of : Densely Connected Convolutional Networks

Modified from the official repo and pytorch.

Parameters
  • arch (str | dict) –

    The model’s architecture. If string, it should be one of architecture in DenseNet.arch_settings. And if dict, it should include the following two keys:

    • growth_rate (int): Each layer of DenseBlock produce k feature maps. Here refers k as the growth rate of the network.

    • depths (list[int]): Number of repeated layers in each DenseBlock.

    • init_channels (int): The output channels of stem layers.

    Defaults to ‘121’.

  • in_channels (int) – Number of input image channels. Defaults to 3.

  • bn_size (int) – Refers to channel expansion parameter of 1x1 convolution layer. Defaults to 4.

  • drop_rate (float) – Drop rate of Dropout Layer. Defaults to 0.

  • compression_factor (float) – The reduction rate of transition layers. Defaults to 0.5.

  • memory_efficient (bool) – If True, uses checkpointing. Much more memory efficient, but slower. Defaults to False. See “paper”.

  • norm_cfg (dict) – The config dict for norm layers. Defaults to dict(type='BN').

  • act_cfg (dict) – The config dict for activation after each convolution. Defaults to dict(type='ReLU').

  • out_indices (Sequence | int) – Output from which stages. Defaults to -1, means the last stage.

  • frozen_stages (int) – Stages to be frozen (all param fixed). Defaults to 0, which means not freezing any parameters.

  • init_cfg (dict, optional) – Initialization config dict.

forward(x)[source]

Forward computation.

Parameters

x (tensor | tuple[tensor]) – x could be a Torch.tensor or a tuple of Torch.tensor, containing input data for forward computation.

train(mode=True)[source]

Set module status before forward computation.

Parameters

mode (bool) – Whether it is train_mode or test_mode

Read the Docs v: master
Versions
master
latest
1.x
dev-1.x
Downloads
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.