pytorch-msssim
Fast and differentiable MS-SSIM and SSIM for pytorch.
Decision gist · record as of 2026-08-14
Yes, if you need a fast, differentiable SSIM/MS-SSIM implementation for PyTorch. The low install friction, permissive license, and proven performance (benchmarked against TensorFlow and scikit-image) make it a solid choice for image quality assessment and loss functions. Dormant maintenance is a minor concern—the core algorithm is stable and unlikely to need updates, but expect no active support for new PyTorch or Python versions.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires torch to be installed; input images must be in a known numeric range (e.g., [0, 255] or [0, 1]) and denormalized if needed.
- Low friction: pure Python wheel with only torch as a runtime dependency.
- Maintenance is dormant (last release 2023-05-25, last commit 2024-03-12), so expect no active bug fixes or feature updates, though the core algorithm is stable.
License · maintenance · safety
permissive license (permissive) — MIT license (permissive) allows commercial and private use with minimal restrictions—suitable for most projects.
last release 2023-05-25 (1177 days) · last repo commit 2024-03-12 · 1,252 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 300,858 downloads/mo, #7,840 on PyPI
Alternatives
Verify before relying
pip install pytorch-msssim
from pytorch_msssim import ssim, ms_ssim
# X, Y: (N,3,H,W) batches of images in range [0, 255]
ssim_val = ssim(X, Y, data_range=255, size_average=False)
ms_ssim_val = ms_ssim(X, Y, data_range=255, size_average=False)- Whether the package supports modern PyTorch versions and recent Python releases (requires_python is unspecified).
- Performance characteristics on GPU vs. CPU and with different image sizes or batch dimensions.
- Compatibility with 3D images beyond the 2020.08.21 update note.
What it is and what it does
pytorch-msssim provides PyTorch implementations of SSIM (Structural Similarity Index) and MS-SSIM (Multi-Scale SSIM), two perceptual image quality metrics commonly used to measure similarity between images. Unlike naive implementations, it uses separable Gaussian kernels—decomposing 2D convolutions into two 1D operations—which reduces computational complexity and improves cache locality, making it significantly faster than alternatives like TensorFlow or scikit-image while remaining fully differentiable for use as a loss function in neural networks.
The package is typically used in image generation, reconstruction, and compression tasks where pixel-level losses (like L2) are inadequate. You can call ssim() and ms_ssim() as functions for one-off computations, or instantiate SSIM and MS_SSIM modules to reuse Gaussian kernels across multiple forward passes. It handles both single images and batches, supports grayscale and RGB, and includes 3D image support; inputs must be denormalized to a known range (e.g., [0, 255] or [0, 1]) for correct results.
Use it for
- Use as a loss function in autoencoders or image-to-image translation networks (e.g., super-resolution, denoising).
- Evaluate image generation quality in GANs or diffusion models by computing MS-SSIM between generated and reference images.
- Benchmark image compression algorithms by measuring perceptual similarity before and after compression.
- Monitor image reconstruction fidelity in medical imaging or scientific applications where structural detail matters more than pixel values.
- Compare image quality across different preprocessing or augmentation pipelines in computer vision workflows.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need a fast, differentiable SSIM/MS-SSIM implementation for PyTorch.
The low install friction, permissive license, and proven performance (benchmarked against TensorFlow and scikit-image) make it a solid choice for image quality assessment and loss functions. Dormant maintenance is a minor concern—the core algorithm is stable and unlikely to need updates, but expect no active support for new PyTorch or Python versions.
Install
pytorch-msssim on PyPI
Before you install
Low friction: pure Python wheel with only torch as a runtime dependency. Maintenance is dormant (last release 2023-05-25, last commit 2024-03-12), so expect no active bug fixes or feature updates, though the core algorithm is stable.
Requires torch to be installed; input images must be in a known numeric range (e.g., [0, 255] or [0, 1]) and denormalized if needed.
License in practice
MIT license (permissive) allows commercial and private use with minimal restrictions—suitable for most projects.
Quickstart
pip install pytorch-msssim
from pytorch_msssim import ssim, ms_ssim
# X, Y: (N,3,H,W) batches of images in range [0, 255]
ssim_val = ssim(X, Y, data_range=255, size_average=False)
ms_ssim_val = ms_ssim(X, Y, data_range=255, size_average=False)
Verify before relying
- Whether the package supports modern PyTorch versions and recent Python releases (requires_python is unspecified).
- Performance characteristics on GPU vs. CPU and with different image sizes or batch dimensions.
- Compatibility with 3D images beyond the 2020.08.21 update note.
Package facts
| License | permissive license permissive |
| Python support | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagetorch |
| Maintenance | Dormant 1,177 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 300,858 / month, #7,840 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3 |
Evidence: pytorch_msssim-1.0.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “image similarity metric pytorch”
- pytorch-msssimComputes fast, differentiable SSIM and MS-SSIM metrics for PyTorch…
- pytorch-fidComputes Fréchet Inception Distance (FID), a metric for measuring…
- lpipsComputes perceptual similarity between image pairs using deep neural…
Give your agent the search over MCP, or paste the wish link into any chat.
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to call 100+ LLM providers (OpenAI, Anthropic, Gemini, Bedrock, Azure, and others) using OpenAI-compatible API format, available as both a Python SDK and a self-hosted AI Gateway proxy server.
Install it if you need to work with multiple LLM providers or want to centralize LLM routing in your organization.
Client library and CLI tool for downloading, uploading, and managing models, datasets, and repositories on the Hugging Face Hub platform.
Install it if you work with Hugging Face Hub models or datasets.
LangChain provides a framework for building agents and LLM-powered applications by composing language models, tools, and memory through a unified API that abstracts over multiple model providers.
hf-xet provides chunk-based deduplication and efficient file transfer for the Hugging Face Hub, enabling faster uploads and downloads of large files with local disk caching.
Tokenizers converts raw text into token sequences for NLP models, with support for training custom vocabularies and using pre-built tokenizers (BPE, WordPiece) optimized for speed via Rust.
Transformers provides a unified framework for loading, fine-tuning, and running state-of-the-art pretrained models across text, vision, audio, video, and multimodal tasks using PyTorch, JAX, or TensorFlow.
Install it if you need to run or train any transformer-based model for NLP, vision, audio, or multimodal tasks.
See also piq · image-similarity-measures · lpips · liac-arff · torchsr · cuequivariance-torch · torch-stoi · causal-conv1d · tensorflow-graphics · roma