Skip to content

ResNet#

eqxvision.models.ResNet #

A simple port of torchvision.models.resnet

__init__(self, block: Type[Union[_ResNetBasicBlock, _ResNetBottleneck]], layers: List[int], num_classes: int = 1000, groups: int = 1, width_per_group: int = 64, replace_stride_with_dilation: List[bool] = None, norm_layer: Any = None, *, key: Optional[jax.random.PRNGKey] = None) #

Arguments:

  • block: Bottleneck or BasicBlock for constructing the network
  • layers: A list containing number of blocks at different levels
  • num_classes: Number of classes in the classification task. Also controls the final output shape (num_classes,). Defaults to 1000
  • groups: Number of groups to form along the feature depth. Defaults to 1
  • width_per_group: Increases width of block by a factor of width_per_group/64. Defaults to 64
  • replace_stride_with_dilation: Replacing 2x2 strides with dilated convolution. Defaults to None
  • norm_layer: Normalisation to be applied on the inputs. Defaults to BatchNorm
  • key: A jax.random.PRNGKey used to provide randomness for parameter initialisation. (Keyword only argument.)
Exceptions:
  • NotImplementedError: If a norm_layer other than equinox.experimental.BatchNorm is used
  • ValueError: If replace_stride_with_convolution is not None or a 3-tuple
__call__(self, x: Array, *, key: jax.random.PRNGKey) -> Array #

Arguments:

  • x: The input. Should be a JAX array with 3 channels
  • key: Required parameter. Utilised by few layers such as Dropout or DropPath

eqxvision.models.resnet18(torch_weights = None, **kwargs) -> ResNet #

ResNet-18 model from "Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>_

Arguments:

  • torch_weights: A Path or URL for the PyTorch weights. Defaults to None

eqxvision.models.resnet34(torch_weights = None, **kwargs) -> ResNet #

ResNet-34 model from "Deep Residual Learning for Image Recognition" <https://arxiv.org/pdf/1512.03385.pdf>_

Arguments:

  • torch_weights: A Path or URL for the PyTorch weights. Defaults to None

eqxvision.models.resnet50(torch_weights = None, **kwargs) -> ResNet #

ResNet-50 model from Deep Residual Learning for Image Recognition

Arguments:

  • torch_weights: A Path or URL for the PyTorch weights. Defaults to None

eqxvision.models.resnet101(torch_weights = None, **kwargs) -> ResNet #

ResNet-101 model from Deep Residual Learning for Image Recognition

Arguments:

  • torch_weights: A Path or URL for the PyTorch weights. Defaults to None

eqxvision.models.resnet152(torch_weights = None, **kwargs) -> ResNet #

ResNet-152 model from Deep Residual Learning for Image Recognition

Arguments:

  • torch_weights: A Path or URL for the PyTorch weights. Defaults to None

eqxvision.models.resnext50_32x4d(torch_weights = None, **kwargs) -> ResNet #

ResNeXt-50 32x4d model from Aggregated Residual Transformation for Deep Neural Networks

Arguments:

  • torch_weights: A Path or URL for the PyTorch weights. Defaults to None

eqxvision.models.resnext101_32x8d(torch_weights = None, **kwargs) -> ResNet #

ResNeXt-101 32x8d model from Aggregated Residual Transformation for Deep Neural Networks

Arguments:

  • torch_weights: A Path or URL for the PyTorch weights. Defaults to None

eqxvision.models.wide_resnet50_2(torch_weights = None, **kwargs) -> ResNet #

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.

Arguments:

  • torch_weights: A Path or URL for the PyTorch weights. Defaults to None

eqxvision.models.wide_resnet101_2(torch_weights = None, **kwargs) -> ResNet #

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.

Arguments:

  • torch_weights: A Path or URL for the PyTorch weights. Defaults to None