Skip to main content

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.

Metadata

Release files for mge-lpips 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for mge-lpips 0.1.0
File Interpreter ABI Platform
mge_lpips-0.1.0-py3-none-any.whl Python 3 none any Details

Release files / mge_lpips-0.1.0-py3-none-any.whl

Download URL mge_lpips-0.1.0-py3-none-any.whl
Size 48.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e6ea87854392de059cc74ccb38fe11bd45e0c75b127944ea4da0a9947fd50bbc
BLAKE2b-256 checksum
How to use checksums
15fa90ac9104d6e6b8b83630055641bb9082032fc45eedb3f7bc1db1b1c3a06c
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page