Skip to content
class

InceptionV3

extendsPretrainedModelBackboneMixin
InceptionV3(config: InceptionConfig)

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 35×3535\times35, a Reduction-A block (_InceptionB) down to 17×1717\times17, four _InceptionC blocks with factorised 1×71\times7 and 7×17\times1 convolutions, a Reduction-B block (_InceptionD) down to 8×88\times8, two _InceptionE blocks with the expanded 1×31\times3/3×13\times1 parallel branches, and a final lucid.nn.AdaptiveAvgPool2d to 1×11\times1. Designed for 299×299299\times299 RGB inputs.

Parameters

Frozen architecture spec. Use inception_v3 for the paper-cited configuration. aux_logits only affects the classifier variant.

Attributes

Stored copy of the config that built this model.
The pre-Inception conv stack.
inception_a0, inception_a1, inception_a2_InceptionA
Three Inception-A blocks at 35×3535\times35 (factorised 5×55\times5 into two 3×33\times3).
reduction_a_InceptionB
Reduction-A block reducing spatial size 35×35→17×1735\times35 \to 17\times17.
inception_c0, inception_c1, inception_c2, inception_c3_InceptionC
Four Inception-C blocks at 17×1717\times17 with 1×71\times7 / 7×17\times1 factorisation.
reduction_b_InceptionD
Reduction-B block reducing spatial size 17×17→8×817\times17 \to 8\times8.
inception_e0, inception_e1_InceptionE
Two Inception-E blocks at 8×88\times8 with expanded 1×31\times3 / 3×13\times1 parallel branches.
Global average pool to 1×11\times1.
feature_infolist[FeatureInfo]
Per-stage descriptor (channels + reduction factor) exposed via BackboneMixin.

Notes

The headline factorisation idea is to replace an n×nn\times n convolution with an n×1n\times1 followed by a 1×n1\times n convolution: for n=7n = 7 this trades 49C249 C^2 parameters for 14C214 C^2 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

1
dunder

__init__

→None
__init__(config: InceptionConfig)

Instance methods

2
fn

forward_features

→Tensor
forward_features(x: Tensor)

Run the backbone's feature-extraction pass.

Parameters

Input image batch, shape (B, C, H, W).

Returns

Tensor

Feature 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.