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.0.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.0.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jaxlpips-1.0.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.0.0.tar.gz
Algorithm Hash digest
SHA256 3342bf46f72acf895551b98254e72de6bfe0f97ad0d60b7ba816630b8ee39068
MD5 9a9e62468533a59a73862a4e5713e6a0
BLAKE2b-256 de305967cdb6f883b14155934eeb8156e52e4b1688af0b6df39147c287d40c1b

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: jaxlpips-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.4 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.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 72d3e9416512d24e663324ae2ed2f06b0fc69be09da712563f72d563bb881d37
MD5 9e6175261a0c2164af75fa4afc8a6b7b
BLAKE2b-256 d4070e4a0c0e6fa3cb9a55c27225facb8ff6b90af6bb4c62e671dc6f6ead6cba

See more details on using hashes here.

Provenance

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