data
SemanticSegmentationOutput
extends
ModelOutputSemanticSegmentationOutput(logits: Tensor, loss: Tensor | None = None, hidden_states: tuple[Tensor, ...] | None = None)Output of any {Family}ForSemanticSegmentation model.
Attributes
logitsTensorPer-pixel class logits, shape
(B, num_classes, H, W). Spatial
resolution may match the input or be downsampled — call
F.interpolate to upsample when needed.loss(Tensor or None, optional)Scalar segmentation loss (cross-entropy / Dice / per-class) when
targets were supplied.
hidden_states(tuple[Tensor, ...] or None, optional)Optional encoder / decoder feature maps.
Notes
Returned by FCN, U-Net, Attention U-Net, MaskFormer, and Mask2Former when used for semantic segmentation.
Examples
>>> model = AutoModelForSemanticSegmentation.from_pretrained("fcn_resnet50")
>>> out = model(lucid.randn(1, 3, 512, 512))
>>> out.logits.shape
(1, 21, 512, 512)