Skip to main content

LPIPS perceptual loss for JAX

Project description

JAX LPIPS

LPIPS perceptual loss implementation for JAX.

Information on the metric is available in the original repo.
Pretrained network and LPIPS linear weights are available on Hugging Face.

Installation

Install jaxlpips with:

pip install jaxlpips

Why?

There are already some LPIPS versions for JAX.

This implementation provides:

  • Alexnet and VGG support
  • trimmed pretrained network parameters and calculations
  • safetensors for all parameters

Example

Supports "alexnet" and "vgg16" for pretrained_network to perform feature extraction.

Minimal example using dummy data:

import numpy as np
from jaxlpips import LPIPS

rng = np.random.default_rng(2781)

ref = rng.normal(size=(4, 64, 64, 3)).astype(np.float32)
tgt = rng.normal(size=(4, 64, 64, 3)).astype(np.float32)

lpips_loss_fn = LPIPS(pretrained_network="alexnet")

loss = lpips_loss_fn(ref, tgt)

References

[1] Zhang, Richard, et al. "The unreasonable effectiveness of deep features as a perceptual metric." Proceedings of the IEEE conference on computer vision and pattern recognition. 2018.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jaxlpips-1.1.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jaxlpips-1.1.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file jaxlpips-1.1.0.tar.gz.

File metadata

  • Download URL: jaxlpips-1.1.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for jaxlpips-1.1.0.tar.gz
Algorithm Hash digest
SHA256 cc373a11f562cc30f7673835183d0f9cc1d9759f8b572215b37609e7f8b4d6ea
MD5 57d5d93108c39cc23cf65f9fa9c27018
BLAKE2b-256 4417247e9da301e4943b485628137119ed4e94e2aadfd432c21a92f6fbb055c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for jaxlpips-1.1.0.tar.gz:

Publisher: python-publish.yml on tux-type/jaxlpips

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jaxlpips-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: jaxlpips-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for jaxlpips-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 460f1e5a83e22abbda902753c3e35fd0cdac48d73c69b076289b4e5fe1d551cc
MD5 b33679e36bc4513d7fe34753e3deebd4
BLAKE2b-256 c78757f1783666173618377f08cef4f9be093e7343b677787423e89d850c9a8a

See more details on using hashes here.

Provenance

The following attestation bundles were made for jaxlpips-1.1.0-py3-none-any.whl:

Publisher: python-publish.yml on tux-type/jaxlpips

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page