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.2.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.2.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for jaxlpips-1.2.0.tar.gz
Algorithm Hash digest
SHA256 8aa6e0f99551bf23f210f224c918d3fd97a86391cbf8c4653f91554233c964d7
MD5 41b47f248a650fb847440cf6fc4fda4a
BLAKE2b-256 72bbf59a0a4603601f5a76898b608c88577ddeb0cd40f90dc8dfeed0246c2b9a

See more details on using hashes here.

Provenance

The following attestation bundles were made for jaxlpips-1.2.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.2.0-py3-none-any.whl.

File metadata

  • Download URL: jaxlpips-1.2.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.13.7

File hashes

Hashes for jaxlpips-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d49d4ef23657ec68ce905ca90124d097b5c73a1ecfecccd1f488af1a61967244
MD5 e6bc255508fae9900cd773e0fdddc735
BLAKE2b-256 4fd0ba6a225136ed4613c36ba3e6914ffc5484543981c25a8088d3f8ba562115

See more details on using hashes here.

Provenance

The following attestation bundles were made for jaxlpips-1.2.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