class
XceptionForImageClassification
extends
PretrainedModelClassificationHeadMixinXceptionForImageClassification(config: XceptionConfig)Xception with dropout + linear classification head.
Combines an Xception backbone with a dropout layer
(probability config.dropout, default 0.5 per the paper) and
a linear projection to config.num_classes logits. When
labels are supplied to forward, a cross-entropy
loss is computed and returned alongside the logits inside an
XceptionOutput dataclass.
Parameters
configXceptionConfigArchitecture spec. Use the
xception_cls factory for
the paper-cited configuration.Attributes
configXceptionConfigStored copy of the config that built this model.
conv1, conv2, bn1, bn2, block1, …, block12, conv3, conv4, bn3, bn4, avgpoolSame backbone components as on
Xception; see that
class for shape semantics.classifiernn.ModuleBuilt by
ClassificationHeadMixin._build_classifier —
a lucid.nn.Sequential wrapping
lucid.nn.Dropout and lucid.nn.Linear.Notes
The classification flow is
Chollet (2017) reports 79.0% top-1 ImageNet validation accuracy with this configuration at the 299×299 input resolution, edging out Inception-v3's 78.2% at the same parameter count (~22.9M).
Examples
Run inference at the native 299×299 input resolution:
>>> import lucid
>>> from lucid.models.vision.xception import xception_cls
>>> model = xception_cls()
>>> x = lucid.randn(4, 3, 299, 299)
>>> out = model(x)
>>> out.logits.shape
(4, 1000)Used by 2
Constructors
1Instance methods
1forward(x: Tensor, labels: Tensor | None = None)