torchsat.models.classification package¶
Submodules¶
torchsat.models.classification.densenet module¶
-
class
torchsat.models.classification.densenet.
DenseNet
(growth_rate=32, block_config=(6, 12, 24, 16), num_init_features=64, bn_size=4, drop_rate=0, num_classes=1000, in_channels=3, memory_efficient=False)¶ Bases:
torch.nn.modules.module.Module
Densenet-BC model class, based on “Densely Connected Convolutional Networks” Args:
growth_rate (int) - how many filters to add each layer (k in paper) block_config (list of 4 ints) - how many layers in each pooling block num_init_features (int) - the number of filters to learn in the first convolution layer bn_size (int) - multiplicative factor for number of bottle neck layers
(i.e. bn_size * k features in the bottleneck layer)drop_rate (float) - dropout rate after each dense layer num_classes (int) - number of classification classes memory_efficient (bool) - If True, uses checkpointing. Much more memory efficient,
but slower. Default: False. See “paper”-
forward
(x)¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
-
torchsat.models.classification.densenet.
densenet121
(num_classes, in_channels=3, pretrained=False, progress=True, **kwargs)¶ Densenet-121 model from “Densely Connected Convolutional 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 memory_efficient (bool) - If True, uses checkpointing. Much more memory efficient,
but slower. Default: False. See “paper”
-
torchsat.models.classification.densenet.
densenet169
(num_classes, in_channels=3, pretrained=False, progress=True, **kwargs)¶ Densenet-169 model from “Densely Connected Convolutional 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 memory_efficient (bool) - If True, uses checkpointing. Much more memory efficient,
but slower. Default: False. See “paper”
-
torchsat.models.classification.densenet.
densenet201
(num_classes, in_channels=3, pretrained=False, progress=True, **kwargs)¶ Densenet-201 model from “Densely Connected Convolutional 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 memory_efficient (bool) - If True, uses checkpointing. Much more memory efficient,
but slower. Default: False. See “paper”
-
torchsat.models.classification.densenet.
densenet161
(num_classes, in_channels=3, pretrained=False, progress=True, **kwargs)¶ Densenet-161 model from “Densely Connected Convolutional 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 memory_efficient (bool) - If True, uses checkpointing. Much more memory efficient,
but slower. Default: False. See “paper”
torchsat.models.classification.inception module¶
-
class
torchsat.models.classification.inception.
Inception3
(num_classes=1000, in_channels=3, aux_logits=True, transform_input=False)¶ Bases:
torch.nn.modules.module.Module
-
forward
(x)¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
-
torchsat.models.classification.inception.
inception_v3
(num_classes, in_channels=3, pretrained=False, progress=True, **kwargs)¶ Inception v3 model architecture from “Rethinking the Inception Architecture for Computer Vision”. .. note:
**Important**: In contrast to the other models the inception_v3 expects tensors with a size of N x 3 x 299 x 299, so ensure your images are sized accordingly.
- 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 aux_logits (bool): If True, add an auxiliary branch that can improve training.
Default: True- transform_input (bool): If True, preprocesses the input according to the method with which it
- was trained on ImageNet. Default: False
torchsat.models.classification.mobilenet module¶
-
class
torchsat.models.classification.mobilenet.
MobileNetV2
(num_classes=1000, in_channels=3, width_mult=1.0, inverted_residual_setting=None, round_nearest=8)¶ Bases:
torch.nn.modules.module.Module
-
forward
(x)¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
-
torchsat.models.classification.mobilenet.
mobilenet_v2
(num_classes, in_channels=3, pretrained=False, progress=True, **kwargs)¶ Constructs a MobileNetV2 architecture from “MobileNetV2: Inverted Residuals and Linear Bottlenecks”. 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
torchsat.models.classification.resnet module¶
-
class
torchsat.models.classification.resnet.
ResNet
(block, layers, num_classes=1000, in_channels=3, zero_init_residual=False, groups=1, width_per_group=64, replace_stride_with_dilation=None, norm_layer=None)¶ Bases:
torch.nn.modules.module.Module
-
forward
(x)¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
-
torchsat.models.classification.resnet.
resnet18
(num_classes, in_channels=3, pretrained=False, progress=True, **kwargs)¶ ResNet-18 model from `”Deep Residual Learning for Image Recognition” <https://arxiv.org/pdf/1512.03385.pdf>’_ Args:
- pretrained (bool): If True, returns a model pre-trained on ImageNet.
- If in_channels is greater than 3, it will copy the parameters of imagenet to fill in order.
progress (bool): If True, displays a progress bar of the download to stderr
-
torchsat.models.classification.resnet.
resnet34
(num_classes, in_channels=3, pretrained=False, progress=True, **kwargs)¶ ResNet-34 model from `”Deep Residual Learning for Image Recognition” <https://arxiv.org/pdf/1512.03385.pdf>’_ 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
-
torchsat.models.classification.resnet.
resnet50
(num_classes, in_channels=3, pretrained=False, progress=True, **kwargs)¶ ResNet-50 model from `”Deep Residual Learning for Image Recognition” <https://arxiv.org/pdf/1512.03385.pdf>’_ 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
-
torchsat.models.classification.resnet.
resnet101
(num_classes, in_channels=3, pretrained=False, progress=True, **kwargs)¶ ResNet-101 model from `”Deep Residual Learning for Image Recognition” <https://arxiv.org/pdf/1512.03385.pdf>’_ 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
-
torchsat.models.classification.resnet.
resnet152
(num_classes, in_channels=3, pretrained=False, progress=True, **kwargs)¶ ResNet-152 model from `”Deep Residual Learning for Image Recognition” <https://arxiv.org/pdf/1512.03385.pdf>’_ 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
-
torchsat.models.classification.resnet.
resnext50_32x4d
(num_classes, in_channels=3, pretrained=False, progress=True, **kwargs)¶ 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
-
torchsat.models.classification.resnet.
resnext101_32x8d
(num_classes, in_channels=3, pretrained=False, progress=True, **kwargs)¶ 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
-
torchsat.models.classification.resnet.
wide_resnet50_2
(num_classes, in_channels=3, pretrained=False, progress=True, **kwargs)¶ 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
-
torchsat.models.classification.resnet.
wide_resnet101_2
(num_classes, in_channels=3, pretrained=False, progress=True, **kwargs)¶ 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
torchsat.models.classification.vgg module¶
-
class
torchsat.models.classification.vgg.
VGG
(features, num_classes=1000, init_weights=True)¶ Bases:
torch.nn.modules.module.Module
-
forward
(x)¶ Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
-
-
torchsat.models.classification.vgg.
vgg11
(num_classes, in_channels=3, pretrained=False, progress=True, **kwargs)¶ VGG 11-layer model (configuration “A”) from `”Very Deep Convolutional Networks For Large-Scale Image Recognition” <https://arxiv.org/pdf/1409.1556.pdf>’_ 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
-
torchsat.models.classification.vgg.
vgg11_bn
(num_classes, in_channels=3, pretrained=False, progress=True, **kwargs)¶ VGG 11-layer model (configuration “A”) with batch normalization `”Very Deep Convolutional Networks For Large-Scale Image Recognition” <https://arxiv.org/pdf/1409.1556.pdf>’_ 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
-
torchsat.models.classification.vgg.
vgg13
(num_classes, in_channels=3, pretrained=False, progress=True, **kwargs)¶ VGG 13-layer model (configuration “B”) `”Very Deep Convolutional Networks For Large-Scale Image Recognition” <https://arxiv.org/pdf/1409.1556.pdf>’_ 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
-
torchsat.models.classification.vgg.
vgg13_bn
(num_classes, in_channels=3, pretrained=False, progress=True, **kwargs)¶ VGG 13-layer model (configuration “B”) with batch normalization `”Very Deep Convolutional Networks For Large-Scale Image Recognition” <https://arxiv.org/pdf/1409.1556.pdf>’_ 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
-
torchsat.models.classification.vgg.
vgg16
(num_classes, in_channels=3, pretrained=False, progress=True, **kwargs)¶ VGG 16-layer model (configuration “D”) `”Very Deep Convolutional Networks For Large-Scale Image Recognition” <https://arxiv.org/pdf/1409.1556.pdf>’_ 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
-
torchsat.models.classification.vgg.
vgg16_bn
(num_classes, in_channels=3, pretrained=False, progress=True, **kwargs)¶ VGG 16-layer model (configuration “D”) with batch normalization `”Very Deep Convolutional Networks For Large-Scale Image Recognition” <https://arxiv.org/pdf/1409.1556.pdf>’_ 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
-
torchsat.models.classification.vgg.
vgg19_bn
(num_classes, in_channels=3, pretrained=False, progress=True, **kwargs)¶ VGG 19-layer model (configuration ‘E’) with batch normalization `”Very Deep Convolutional Networks For Large-Scale Image Recognition” <https://arxiv.org/pdf/1409.1556.pdf>’_ 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
-
torchsat.models.classification.vgg.
vgg19
(num_classes, in_channels=3, pretrained=False, progress=True, **kwargs)¶ VGG 19-layer model (configuration “E”) `”Very Deep Convolutional Networks For Large-Scale Image Recognition” <https://arxiv.org/pdf/1409.1556.pdf>’_ 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