Skip to main content

pyramid-loss

PyTorch implementation of Laplacian and Gaussian pyramid for seismic data.

PyPI version Python PyTorch


Installation

pip install pyramid-loss

Usage

Build Pyramids

import torch
from pyramid_loss import gaussian_kernel, create_laplacian_pyramid, create_gaussian_pyramid

ns = 3
nt = 100
nr = 300
x  = torch.rand(1, ns, nt, nr)

size     = 5   ### Kernel Size
channels = x.shape[1]
sigma    = 3   ### Standard Deviation
levels   = 5  ### number of level

kernel   = gaussian_kernel(size=size, channels=channels, sigma=sigma)
lap_pyr  = create_laplacian_pyramid(x, kernel, levels=levels)
gau_pyr  = create_gaussian_pyramid(x, kernel, levels=levels)

Compute Loss

from pyramid_loss import PyramidLoss

loss_fn = PyramidLoss(
    pyramid     = 'laplacian',   # 'laplacian' | 'gaussian'
    loss        = 'l1',          # 'l1'        | 'l2'
    levels      = levels,
    channels    = channels,
    use_weights = True,          # False → weight=1 for all levels
                                 # True  → weight=2^level per level (default)
    weights     = [1.0, 2.0, 4.0, 8.0, 16.0],  # or pass custom weights
)

y    = torch.rand(1, 3, 256, 256)
loss = loss_fn(x, y)

References

  • [1] gonglixue — LaplacianLoss-pytorch
  • [2] Burt, P. J., & Adelson, E. H. (1987). The Laplacian Pyramid as a Compact Image Code. Readings in Computer Vision, pp. 671–679, Elsevier.

Metadata

Release files for pyramid-loss 0.1.1

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

Source distribution (sdist)

Source distribution for pyramid-loss 0.1.1
File Size Uploaded Provenance Actions
pyramid_loss-0.1.1.tar.gz 5.1 kB Without provenance Details for pyramid_loss-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pyramid-loss 0.1.1
File Interpreter ABI Platform Actions
pyramid_loss-0.1.1-py3-none-any.whl Python 3 none any Details for pyramid_loss-0.1.1-py3-none-any.whl

Total release size: 10.4 kB

Release files / pyramid_loss-0.1.1.tar.gz

Download URL pyramid_loss-0.1.1.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
12f5216bd57ac1f61b5483331e8f8c3e1b2d2c0287a2f6b3de23adb5c2b44313
BLAKE2b-256 checksum
How to use checksums
447b8500103dca0be632719c5795d539b704d525c8f49a581a71b287811fffc9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.5

Release files / pyramid_loss-0.1.1-py3-none-any.whl

Download URL pyramid_loss-0.1.1-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cc4afe9112b4c2e6b381773e55e3612166a93793c1444f045a3c1613bc3b405b
BLAKE2b-256 checksum
How to use checksums
c240e5549b00c2c759733ec4cbe5a0eee8fdb2a2053d20a7287fd7c90121621d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.5

Security for pyramid-loss 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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