skillfed

lpips

LPIPS Similarity metric

lpips v0.1.4 1.2M downloads/30d#4,224 on PyPI4,268
Permissive license DORMANT released

What it is and what it does

LPIPS is a learned perceptual similarity metric that measures how different two images are by comparing their deep neural network feature representations. Rather than using pixel-level differences, it leverages the fact that intermediate activations from pre-trained networks (AlexNet, VGG, or SqueezeNet) correlate well with human perceptual judgments. The package provides three network variants with optional linear calibration layers trained on the Berkeley-Adobe Perceptual Patch Similarity (BAPPS) dataset.

You use it by instantiating a loss function object with your chosen network, then calling it on pairs of PyTorch tensors (images normalized to [-1, 1] range). It returns a scalar or batch of distances where lower values mean more similar images. The metric can be used for evaluation (comparing generated images to references) or as a differentiable loss function for optimization tasks like image generation, super-resolution, or deblurring.

Use it for:

  • Evaluate image generation quality by measuring perceptual distance between generated and reference images
  • Use as a loss function during training of image-to-image translation or super-resolution models
  • Compare different image processing algorithms (denoising, deblurring, color correction) against human perception
  • Benchmark perceptual quality of compressed or distorted images in computer vision pipelines
  • Optimize image synthesis tasks by backpropagating through the metric to guide model training

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Computes perceptual similarity between image pairs using deep neural network features, returning a scalar distance metric where lower values indicate more similar images.

Yes, if you need a perceptual image similarity metric for computer vision tasks. The package is stable, has low dependencies, and is widely used (1.2M monthly downloads). However, it is dormant—no active maintenance since 2021—so expect no bug fixes or updates. Install it for evaluation or loss functions in image generation, super-resolution, or quality assessment workflows where perceptual alignment matters more than pixel-level similarity.

Install

lpips on PyPI

pip

pip install lpips

uv

uv add lpips

poetry

poetry add lpips

Installing lpips

Before you install

Low installation friction with a pure Python wheel. The package is dormant (last release August 2021, last commit July 2024) but remains functional; it depends on stable, widely-used libraries (torch, torchvision, numpy, scipy, tqdm).

License in practice

Permissive BSD license allows commercial and private use with minimal restrictions.

Quickstart

pip install lpips

import lpips
import torch

loss_fn = lpips.LPIPS(net='alex')
img0 = torch.zeros(1, 3, 64, 64)  # RGB, normalized to [-1, 1]
img1 = torch.zeros(1, 3, 64, 64)
distance = loss_fn(img0, img1)

Requires PyTorch 1.0+ and torchvision; images must be PyTorch tensors with shape (N, 3, H, W) normalized to [-1, 1] range.

Verify before relying

  • Whether pre-trained model weights are downloaded automatically on first use or require manual setup
  • Memory requirements for different network variants (SqueezeNet, AlexNet, VGG) mentioned in the description
  • GPU memory constraints when processing large batches or high-resolution images

Package facts

License not declared (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 5 — torch, torchvision, numpy, scipy, tqdm
Maintenance dormant — 1,815 days since the last release
Last repo commit
First released
Downloads 1,205,472/month — #4,224 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: lpips-0.1.4-py3-none-any.whl

License :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3

Tags

perceptual image similarity metricdeep learning image distancelpips perceptual lossimage quality assessmentneural network image comparisonlearned perceptual patch similarityimage patch distance metric
image-similarityperceptual-metriccomputer-vision

More Artificial Intelligence packages