Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

ConvNet

Our implementation of ConvNet is based on DC.

By default, we use width 128, average pooling, and ReLU activation. We provide the following interface to initialize a ConvNet model:

dd_ranking.utils.get_convnet(model_name: str, im_size: tuple, channel: int, num_classes: int, net_depth: int, net_norm: str, pretrained: bool, model_path: str) [SOURCE]

Parameters

  • model_name(str): Name of the model. Please navigate to models for the model naming convention in DD-Ranking.
  • im_size(tuple): Image size.
  • channel(int): Number of channels of the input image.
  • num_classes(int): Number of classes.
  • net_depth(int): Depth of the network.
  • net_norm(str): Normalization method. In ConvNet, we support instance, batch, and group normalization.
  • pretrained(bool): Whether to load pretrained weights.
  • model_path(str): Path to the pretrained model weights.

To load a ConvNet model with different width or activation function or pooling method, you can use the following interface:

dd_ranking.utils.networks.ConvNet(channel, num_classes, net_width, net_depth, net_act, net_norm, net_pooling, im_size) [SOURCE]

Parameters

We only list the parameters that are not present in get_convnet.

  • net_width(int): Width of the network.
  • net_act(str): Activation function. We support relu, leakyrelu, and sigmoid.
  • net_pooling(str): Pooling method. We support avgpooling, maxpooling, and none.