Skip to content

ResNet

PyTorch implementation of ResNet1 as defined in Torchvision.

Pre-trained models

mozuma.models.resnet.pretrained.torch_resnet_imagenet

TorchResNetModule model pre-trained on ImageNet

Parameters:

Name Type Description Default
resnet_arch ResNetArchs

Identifier for the ResNet architecture to load. Must be one of:

  • resnet18
  • resnet34
  • resnet50
  • resnet101
  • resnet152
  • resnext50_32x4d
  • resnext101_32x8d
  • wide_resnet50_2
  • wide_resnet101_2
required
device torch.device

Torch device to initialise the model weights

device(type='cpu')
training_mode TorchResNetTrainingMode | None

Whether to return features or labels in the forward function. Used for training when computing the loss.

None

Returns:

Type Description
TorchResNetModule

A PyTorch ResNet module pre-trained on ImageNet

Base model

The ResNet model is an implementation of a TorchModel.

mozuma.models.resnet.modules.TorchResNetModule

PyTorch ResNet architecture.

See PyTorch's documentation.

Attributes:

Name Type Description
resnet_arch ResNetArchs

Identifier for the ResNet architecture to load. Must be one of:

  • resnet18
  • resnet34
  • resnet50
  • resnet101
  • resnet152
  • resnext50_32x4d
  • resnext101_32x8d
  • wide_resnet50_2
  • wide_resnet101_2
label_set LabelSet

The output labels. Defaults to ImageNet 1000 labels.

device torch.device

Torch device to initialise the model weights

training_mode TorchResNetTrainingMode | None

Whether to return features or labels in the forward function. Used for training when computing the loss.

Pre-trained state origins

See the stores documentation for usage.

mozuma.models.resnet.stores.ResNetTorchVisionStore

Model store to load ResNet weights pretrained on ImageNet from TorchVision


  1. Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), volume, 770–778. 2016. doi:10.1109/CVPR.2016.90