Shortcuts

InceptionV3

class mmpretrain.models.backbones.InceptionV3(num_classes=1000, aux_logits=False, dropout=0.5, init_cfg=[{'type': 'TruncNormal', 'layer': ['Conv2d', 'Linear'], 'std': 0.1}, {'type': 'Constant', 'layer': 'BatchNorm2d', 'val': 1}])[源代码]

Inception V3 backbone.

A PyTorch implementation of Rethinking the Inception Architecture for Computer Vision

This implementation is modified from https://github.com/pytorch/vision/blob/main/torchvision/models/inception.py. Licensed under the BSD 3-Clause License.

参数:
  • num_classes (int) – The number of categroies. Defaults to 1000.

  • aux_logits (bool) – Whether to enable the auxiliary branch. If False, the auxiliary logits output will be None. Defaults to False.

  • dropout (float) – Dropout rate. Defaults to 0.5.

  • init_cfg (dict, optional) – The config of initialization. Defaults to use trunc normal with std=0.1 for all Conv2d and Linear layers and constant with val=1 for all BatchNorm2d layers.

示例

>>> import torch
>>> from mmpretrain.models import build_backbone
>>>
>>> inputs = torch.rand(2, 3, 299, 299)
>>> cfg = dict(type='InceptionV3', num_classes=100)
>>> backbone = build_backbone(cfg)
>>> aux_out, out = backbone(inputs)
>>> # The auxiliary branch is disabled by default.
>>> assert aux_out is None
>>> print(out.shape)
torch.Size([2, 100])
>>> cfg = dict(type='InceptionV3', num_classes=100, aux_logits=True)
>>> backbone = build_backbone(cfg)
>>> aux_out, out = backbone(inputs)
>>> print(aux_out.shape, out.shape)
torch.Size([2, 100]) torch.Size([2, 100])
forward(x)[源代码]

Forward function.

Read the Docs v: latest
Versions
latest
stable
mmcls-1.x
mmcls-0.x
dev
Downloads
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.