--- id: lpips version: "0.1.4" license: unclear license_treatment: permissive maintenance: dormant --- # lpips — LPIPS Similarity metric License: permissive · Maintenance: dormant · Downloads: 1.2M/mo ## 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 above — 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 pip install lpips uv add lpips 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: unspecified - Install friction: low - Maintenance: dormant - Downloads: 1.2M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags perceptual image similarity metric, deep learning image distance, lpips perceptual loss, image quality assessment, neural network image comparison, learned perceptual patch similarity, image patch distance metric, image-similarity, perceptual-metric, computer-vision [View on SkillFed](https://skillfed.io/packages/lpips) · [View on PyPI](https://pypi.org/project/lpips/)