# Deepimagestructureandtexturesimilarity

> Compute the DeepImageStructureAndTextureSimilarity metric — provided by torchmetrics. Use when the user has predictions and ground-truth and needs to compute DeepImageStructureAndTextureSimilarity, or asks how to score with DeepImageStructureAndTextureSimilarity.

- Skill: `qhjqhj00/deepimagestructureandtexturesimilarity` (Agent Skill)
- Install (CLI): `npx skillmds add qhjqhj00/deepimagestructureandtexturesimilarity`
- Raw SKILL.md: https://api.skillmd.com/api/skills/qhjqhj00/deepimagestructureandtexturesimilarity/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: qhjqhj00 (https://skillmd.com/u/qhjqhj00)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/qhjqhj00/deepimagestructureandtexturesimilarity

---


# deepimagestructureandtexturesimilarity

> Metric `DeepImageStructureAndTextureSimilarity` from `torchmetrics` (torchmetrics.image.DeepImageStructureAndTextureSimilarity)

## When to invoke this skill

The user has predictions + ground truth and asks to evaluate with DeepImageStructureAndTextureSimilarity, or
mentions `torchmetrics.image.DeepImageStructureAndTextureSimilarity` directly, or wants the standard torchmetrics implementation.

## Reference signature

```python
from torchmetrics.image import DeepImageStructureAndTextureSimilarity

# DeepImageStructureAndTextureSimilarity(reduction: Optional[Literal['mean', 'sum']] = 'mean', **kwargs: Any) -> None
```

## Library docstring

```
Calculates Deep Image Structure and Texture Similarity (DISTS) score.

The metric is a full-reference image quality assessment (IQA) model that combines sensitivity to structural
distortions (e.g., artifacts due to noise, blur, or compression) with a tolerance of texture resampling
(exchanging the content of a texture region with a new sample of the same texture). The metric is based on
a convolutional neural network (CNN) that transforms the reference and distorted images to a new representation.
Within this representation, a set of measurements are developed that are sufficient to capture the appearance
of a variety of different visual distortions.

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

- ``preds`` (:class:`~torch.Tensor`): tensor with images of shape ``(N, 3, H, W)``
- ``target`` (:class:`~torch.Tensor`): tensor with images of shape ``(N, 3, H, W)``

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

- ``lpips`` (:class:`~torch.Tensor`): returns float scalar tensor with average LPIPS value over samples

Args:
    reduction: specifies the reduction to apply to the output.
    kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.

Raises:
    ValueError:
        If `reduction` is not one of ["mean", "sum"]

Example:
    >>> from torch import rand
    >>> from torchmetrics.image.dists import DeepImageStructureAndTextureSimilarity
    >>> metric = DeepImageStructureAndTextureSimilarity()
    >>> preds = rand(10, 3, 100, 100)
    >>> target = rand(10, 3, 100, 100)
    >>> metric(preds, target)
    tensor(0.1882, grad_fn=<CloneBackward0>)
```

## Quick recipe

```python
import torchmetrics.image as _m
score = _m.DeepImageStructureAndTextureSimilarity(y_true, y_pred)
```

## Don'ts

- Don't reimplement when the library version handles edge cases (NaN, ties, empty inputs) better than a hand-rolled formula.
- Always check the library version's argument order — sklearn is `(y_true, y_pred)` while torchmetrics is `(preds, target)`.

