frarch.models.classification.cnn.vgg module#

VGG definition. Slightly modified pytorch implementation.

Description

VGG

Authors

victor badenas (victor.badenas@gmail.com), pytorch.org

Version

0.1.0

Created on

21/07/2021 19:00

class frarch.models.classification.cnn.vgg.VGG(layers_cfg: List[Union[str, int]], batch_norm: bool = True, init_weights: bool = True, pretrained: bool = False)[source]#

Bases: torch.nn.modules.module.Module

VGG network definition.

From “Very Deep Convolutional Networks for Large-Scale Image Recognition”.

Parameters
  • layers_cfg (List[Union[str, int]]) – vgg layer configuration.

  • batch_norm (bool, optional) – Boolean flag for doing batch normalization. Defaults to True.

  • init_weights (bool, optional) – Force weight initialization. Defaults to True.

  • pretrained (bool, optional) – Get pretrained model. Defaults to False.

forward(x: torch.Tensor) torch.Tensor[source]#

Define the computation performed at every call.

forward computation for VGG.

Parameters

x (torch.Tensor) – input to the model.

Returns

output of the model.

Return type

torch.Tensor

training: bool#
frarch.models.classification.cnn.vgg.vgg11(pretrained: bool = False, **kwargs: Any) frarch.models.classification.cnn.vgg.VGG[source]#

Create VGG 11-layer model.

VGG 11-layer model from “Very Deep Convolutional Networks for Large-Scale Image Recognition”. The required minimum input size of the model is 32x32.

Parameters

pretrained (bool) – If True, returns a model pre-trained on ImageNet

frarch.models.classification.cnn.vgg.vgg11_bn(pretrained: bool = False, **kwargs: Any) frarch.models.classification.cnn.vgg.VGG[source]#

Create VGG 11-layer with batch normalization model.

VGG 11-layer model with batch normalization from “Very Deep Convolutional Networks for Large-Scale Image Recognition”. The required minimum input size of the model is 32x32.

Parameters

pretrained (bool) – If True, returns a model pre-trained on ImageNet

frarch.models.classification.cnn.vgg.vgg13(pretrained: bool = False, **kwargs: Any) frarch.models.classification.cnn.vgg.VGG[source]#

Create VGG 13-layer model.

VGG 13-layer model from “Very Deep Convolutional Networks for Large-Scale Image Recognition”. The required minimum input size of the model is 32x32.

Parameters

pretrained (bool) – If True, returns a model pre-trained on ImageNet

frarch.models.classification.cnn.vgg.vgg13_bn(pretrained: bool = False, **kwargs: Any) frarch.models.classification.cnn.vgg.VGG[source]#

Create VGG 13-layer with batch normalization model.

VGG 13-layer model with batch normalization from “Very Deep Convolutional Networks for Large-Scale Image Recognition”. The required minimum input size of the model is 32x32.

Parameters

pretrained (bool) – If True, returns a model pre-trained on ImageNet

frarch.models.classification.cnn.vgg.vgg16(pretrained: bool = False, **kwargs: Any) frarch.models.classification.cnn.vgg.VGG[source]#

Create VGG 16-layer model.

VGG 16-layer model from “Very Deep Convolutional Networks for Large-Scale Image Recognition”. The required minimum input size of the model is 32x32.

Parameters

pretrained (bool) – If True, returns a model pre-trained on ImageNet

frarch.models.classification.cnn.vgg.vgg16_bn(pretrained: bool = False, **kwargs: Any) frarch.models.classification.cnn.vgg.VGG[source]#

Create VGG 16-layer with batch normalization model.

VGG 16-layer model with batch normalization from “Very Deep Convolutional Networks for Large-Scale Image Recognition”. The required minimum input size of the model is 32x32.

Parameters

pretrained (bool) – If True, returns a model pre-trained on ImageNet

frarch.models.classification.cnn.vgg.vgg19(pretrained: bool = False, **kwargs: Any) frarch.models.classification.cnn.vgg.VGG[source]#

Create VGG 19-layer model.

VGG 19-layer model from “Very Deep Convolutional Networks for Large-Scale Image Recognition”. The required minimum input size of the model is 32x32.

Parameters

pretrained (bool) – If True, returns a model pre-trained on ImageNet

frarch.models.classification.cnn.vgg.vgg19_bn(pretrained: bool = False, **kwargs: Any) frarch.models.classification.cnn.vgg.VGG[source]#

Create VGG 19-layer with batch normalization model.

VGG 19-layer model with batch normalization from “Very Deep Convolutional Networks for Large-Scale Image Recognition”. The required minimum input size of the model is 32x32.

Parameters

pretrained (bool) – If True, returns a model pre-trained on ImageNet