pugh_torch.models package

Submodules

pugh_torch.models.io module

pugh_torch.models.io.load_state_dict_from_url(url, local=None, map_location=None, progress=True, force=False, **kwargs)[source]
Parameters
  • url (str)

  • local (str-like) – Local path of where to save or check for cached file. If relative, is relative to the torch.hub directory.

  • force (bool) – Force the redownload, even if the local file exists.

pugh_torch.models.resnet module

class pugh_torch.models.resnet.ResNet(block, layers, num_classes=1000, zero_init_residual=False, groups=1, width_per_group=64, replace_stride_with_dilation=None, norm_layer=None)[source]

Bases: pugh_torch.modules.load_state_dict_mixin.LoadStateDictMixin, torchvision.models.resnet.ResNet

Just mixes in our load_state_dict method that allows easier fine-tuning/transfer learning.

Initializes internal Module state, shared by both nn.Module and ScriptModule.

training = None
pugh_torch.models.resnet.resnet101(pretrained=False, progress=True, strict=True, **kwargs)[source]

ResNet-101 model from “Deep Residual Learning for Image Recognition” Args:

pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr

pugh_torch.models.resnet.resnet152(pretrained=False, progress=True, strict=True, **kwargs)[source]

ResNet-152 model from “Deep Residual Learning for Image Recognition” Args:

pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr

pugh_torch.models.resnet.resnet18(pretrained=False, progress=True, strict=True, **kwargs)[source]

ResNet-18 model from “Deep Residual Learning for Image Recognition” Args:

pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr

pugh_torch.models.resnet.resnet34(pretrained=False, progress=True, strict=True, **kwargs)[source]

ResNet-34 model from “Deep Residual Learning for Image Recognition” Args:

pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr

pugh_torch.models.resnet.resnet50(pretrained=False, progress=True, strict=True, **kwargs)[source]

ResNet-50 model from “Deep Residual Learning for Image Recognition” Args:

pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr

pugh_torch.models.resnet.resnext101_32x8d(pretrained=False, progress=True, strict=True, **kwargs)[source]

ResNeXt-101 32x8d model from “Aggregated Residual Transformation for Deep Neural Networks” Args:

pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr

pugh_torch.models.resnet.resnext50_32x4d(pretrained=False, progress=True, strict=True, **kwargs)[source]

ResNeXt-50 32x4d model from “Aggregated Residual Transformation for Deep Neural Networks” Args:

pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr

pugh_torch.models.resnet.wide_resnet101_2(pretrained=False, progress=True, strict=True, **kwargs)[source]

Wide ResNet-101-2 model from “Wide Residual Networks” The model is the same as ResNet except for the bottleneck number of channels which is twice larger in every block. The number of channels in outer 1x1 convolutions is the same, e.g. last block in ResNet-50 has 2048-512-2048 channels, and in Wide ResNet-50-2 has 2048-1024-2048. Args:

pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr

pugh_torch.models.resnet.wide_resnet50_2(pretrained=False, progress=True, strict=True, **kwargs)[source]

Wide ResNet-50-2 model from “Wide Residual Networks” The model is the same as ResNet except for the bottleneck number of channels which is twice larger in every block. The number of channels in outer 1x1 convolutions is the same, e.g. last block in ResNet-50 has 2048-512-2048 channels, and in Wide ResNet-50-2 has 2048-1024-2048. Args:

pretrained (bool): If True, returns a model pre-trained on ImageNet progress (bool): If True, displays a progress bar of the download to stderr

Module contents

pugh_torch.models.__init__

The root dataset path can be set via the environmental variable PUGH_TORCH_MODELS_PATH.

I don’t expose this in code because I think it just clutters the code.