Skip to main content

LPIPS Similarity Metric for MegEngine

Project description

LPIPS for MegEngine

MegEngine port for LPIPS metric.

Get Started

Run pip3 install mge-lpips to install this package. The provided mge_lpips.LPIPS is a normal MegEngine M.Module which can be used as a metric or a loss function.

import numpy as np
import megengine as mge
from mge_lpips import LPIPS

metric_lpips = LPIPS(net="alex")

in1 = np.random.uniform(-1, 1, size=(2, 3, 256, 256)).astype(np.float32)
in2 = np.random.uniform(-1, 1, size=(2, 3, 256, 256)).astype(np.float32)

d = metric_lpips(mge.Tensor(in1), mge.Tensor(in2))

Acknowledgements

The code of this project is modified from the original LPIPS project. The backbone model code is modified from torchvision. The weights are from the origian LPIPS project and torchvision.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

mge_lpips-0.1.0-py3-none-any.whl (48.8 kB view details)

Uploaded Python 3

File details

Details for the file mge_lpips-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mge_lpips-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 48.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.4.0 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.6.9

File hashes

Hashes for mge_lpips-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e6ea87854392de059cc74ccb38fe11bd45e0c75b127944ea4da0a9947fd50bbc
MD5 f8066f998f60129279be42391eabe5e3
BLAKE2b-256 15fa90ac9104d6e6b8b83630055641bb9082032fc45eedb3f7bc1db1b1c3a06c

See more details on using hashes here.

Supported by

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