Xception
PretrainedModelBackboneMixin_XceptionBodyXception(config: XceptionConfig)Xception feature-extracting backbone (no classification head).
Implements the "Extreme Inception" topology from Chollet, "Xception: Deep Learning with Depthwise Separable Convolutions", CVPR 2017 (arXiv:1610.02357). The architecture replaces every Inception module of Inception-v3 with a depthwise separable convolution — the limiting case of an Inception block in which every output channel of the pointwise convolution receives its own independent spatial filter. This makes the cross-channel and spatial correlations fully decoupled, dramatically reducing parameters and FLOPs:
The body is organised into three phases — entry flow (3 blocks, with 1×1 strided residuals and channel doubling from 64 → 728), middle flow (8 identical 728-ch blocks with additive identity shortcuts), and exit flow (1 strided transition block plus two final separable convolutions expanding to 1536 → 2048 channels). Designed for a 299×299 input — the same crop size as Inception-v3 — so the spatial-reduction schedule isolates the depthwise-separable factorisation as the sole source of accuracy improvement.
Parameters
configXceptionConfigxception factory
for the paper-cited configuration.Attributes
configXceptionConfigconv1, conv2nn.Conv2dconv1 carries stride 2.bn1, bn2nn.BatchNorm2dblock1, block2, block3nn.Moduleblock4, …, block11nn.Moduleblock12nn.Moduleconv3, conv4_ExitSepConvbn3, bn4nn.BatchNorm2dconv3 and conv4.avgpoolnn.AdaptiveAvgPool2d(B, 2048, 1, 1).feature_ infolist[FeatureInfo]BackboneMixin.Notes
Sub-module attribute names match timm's legacy_xception
layout so that state-dict round-trips are key-compatible with
standard pretrained weight files.
Examples
Build an Xception backbone and run a forward pass at the
native 299×299 resolution:
>>> import lucid
>>> from lucid.models.vision.xception import xception
>>> backbone = xception()
>>> x = lucid.randn(2, 3, 299, 299)
>>> out = backbone(x)
>>> out.last_hidden_state.shape # 299 / 32, rounded up — not pooled
(2, 2048, 10, 10)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.