• Docs >
• Spatial Correlation Coefficient (SCC)
Shortcuts

# Spatial Correlation Coefficient (SCC)¶

## Module Interface¶

class torchmetrics.image.SpatialCorrelationCoefficient(high_pass_filter=None, window_size=8, **kwargs)[source]

Compute Spatial Correlation Coefficient (SCC).

As input to forward and update the metric accepts the following input

• preds (Tensor): Predictions from model of shape (N,C,H,W) or (N,H,W).

• target (Tensor): Ground truth values of shape (N,C,H,W) or (N,H,W).

As output of forward and compute the metric returns the following output

Parameters:

Example

>>> import torch
>>> _ = torch.manual_seed(42)
>>> from torchmetrics.image import SpatialCorrelationCoefficient as SCC
>>> preds = torch.randn([32, 3, 64, 64])
>>> target = torch.randn([32, 3, 64, 64])
>>> scc = SCC()
>>> scc(preds, target)
tensor(0.0023)


## Functional Interface¶

torchmetrics.functional.image.spatial_correlation_coefficient(preds, target, hp_filter=None, window_size=8, reduction='mean')[source]

Compute Spatial Correlation Coefficient (SCC).

Parameters:
Return type:

Tensor

Returns:

Tensor with scc score

Example

>>> import torch
>>> from torchmetrics.functional.image import spatial_correlation_coefficient as scc
>>> _ = torch.manual_seed(42)
>>> x = torch.randn(5, 3, 16, 16)
>>> scc(x, x)
tensor(1.)
>>> x = torch.randn(5, 16, 16)
>>> scc(x, x)
tensor(1.)
>>> x = torch.randn(5, 3, 16, 16)
>>> y = torch.randn(5, 3, 16, 16)
>>> scc(x, y, reduction="none")
tensor([0.0223, 0.0256, 0.0616, 0.0159, 0.0170])