Inception v3 feature-extracting backbone.
Implements the topology from Szegedy et al., "Rethinking the
Inception Architecture for Computer Vision", CVPR 2016: a deep
pre-Inception stem (3×Conv → MaxPool → 2×Conv → MaxPool), three
_InceptionA blocks at , a Reduction-A
block (_InceptionB) down to , four
_InceptionC blocks with factorised and
convolutions, a Reduction-B block
(_InceptionD) down to , two
_InceptionE blocks with the expanded
/ parallel branches, and a final
lucid.nn.AdaptiveAvgPool2d to . Designed
for RGB inputs.
Parameters
configInceptionConfiginception_v3 for the
paper-cited configuration. aux_logits only affects the
classifier variant.Attributes
configInceptionConfigstemnn.Sequentialinception_ a0, inception_ a1, inception_ a2_InceptionAreduction_ a_InceptionBinception_ c0, inception_ c1, inception_ c2, inception_ c3_InceptionCreduction_ b_InceptionDinception_ e0, inception_ e1_InceptionEavgpoolnn.AdaptiveAvgPool2dfeature_ infolist[FeatureInfo]BackboneMixin.Notes
The headline factorisation idea is to replace an convolution with an followed by a convolution: for this trades parameters for while adding an extra ReLU and matching the original receptive field along a separable manifold. Inception v3 uses three block topologies (A, B, C) at three spatial resolutions (35×35, 17×17, 8×8), each tailored to the receptive-field budget at that stage. Approximately 23.8 M parameters (without auxiliary head); achieves a top-5 ImageNet error of 3.5% on the validation set.
Examples
>>> import lucid
>>> from lucid.models.vision.inception import inception_v3
>>> backbone = inception_v3()
>>> x = lucid.randn(1, 3, 299, 299)
>>> out = backbone(x)
>>> out.last_hidden_state.shape # (B, 2048, 1, 1)
(1, 2048, 1, 1)Used by 2
Constructors
1Instance methods
2forward(x: Tensor)Override in subclasses to define the computation.
Run the backbone's feature-extraction pass.
Parameters
(B, C, H, W).Returns
TensorFeature map at the deepest stage. Concrete subclasses may additionally stash earlier stages on the instance so multi-stage consumers can fetch them.
Examples
The map returned is the one feature_info lists last, so a
neck can size itself from that entry without running the model.
>>> import lucid
>>> from lucid.models import create_model
>>> backbone = create_model("resnet_18").eval()
>>> last = backbone.feature_info[-1]
>>> last.num_channels, last.reduction
(512, 32)
>>> backbone.forward_features(lucid.randn((1, 3, 64, 96))).shape
(1, 512, 2, 3)
Each side is divided by the advertised reduction on its own, so
a non-square input keeps its aspect ratio.