Self-Aligned Noise Augmentation (SEANA)
Noise-aligned view generation for Noise-Robust Self-Supervised Learning (SSL)
SEANA is a drop-in view generation module for joint-embedding SSL on noisy images for noise-robust representation learning. It learns an invertible variance-stabilizing transform from noisy training data, estimates the clean signal with a frozen denoiser, and resamples independent noise to create two noise-aware SSL views. Your encoder, SSL objective, and remaining augmentation pipeline stay the same. You don't need to train a dataset-specific denoiser and then also you don't need to use a denoiser or SEANA module at inference. Further details are available below and in the NeurIPS'26 publication.
| Learn from noisy data | Use your SSL pipeline | Fit once, reuse |
|---|---|---|
| No clean training targets, noise-model specification, or training a dataset-specific denoiser required. | Generate independent noise-aware source views before your usual crops, color transforms and other augmentations. | Pretrained DRUNet denoiser is the calibration default used by SEANA. Save the fitted SEANA module. Feel free to supply your own custom denoiser for SEANA calibration. |
Author: Oankar R. Patil.
Install with uv
Add SEANA to your uv project:
uv add seana-ssl
For an existing environment using uv's pip interface:
uv pip install seana-ssl
# Standard pip works too:
python -m pip install seana-ssl
For local development from a source checkout:
uv sync
uv run python -c "import seana"
# Or add the checkout to a different project:
uv add /path/to/SEANA
Pretrained DRUNet is the default denoiser. A standard install includes
PyTorch and DeepInverse, so SEANA() works without an extra dependency flag.
Constructing it loads cached pretrained weights or downloads them on first use.
Importing seana alone does not load DeepInverse or download weights.
Passing SEANA(my_denoiser) uses your module without loading DRUNet.
Quick start
Install SEANA and LightlySSL into a uv project:
uv add seana-ssl lightly torchvision
With pip, use python -m pip install seana-ssl lightly torchvision. The SEANA
package is seana-ssl, and the Python import is seana. Python 3.10+
is supported.
This LightlySSL SimCLR example fits SEANA once, then runs one SSL training epoch.
Supply noisy_train_loader with batches of original noisy images as floating
tensors in [0, 1], shaped [B, 3, H, W], followed by labels or other metadata.
Use at least two images per batch. Keep SSL augmentations and encoder
normalization out of this loader:
import torch
from torch import nn
from torchvision.models import resnet18
from lightly.loss import NTXentLoss
from lightly.models.modules import SimCLRProjectionHead
from lightly.transforms import SimCLRViewTransform
from seana import SEANA
device = "cuda" if torch.cuda.is_available() else "cpu"
# Fit once on the training split. Labels are ignored.
augmenter = SEANA(sigma_d=0.08, sigma_vst=0.1, device=device)
augmenter.fit(noisy_train_loader, steps=5000, patch_size=64, seed=0)
# Set up a standard LightlySSL SimCLR pipeline.
ssl_view = SimCLRViewTransform(input_size=224)
resnet = resnet18(weights=None)
model = nn.Sequential(
*list(resnet.children())[:-1],
nn.Flatten(1),
SimCLRProjectionHead(512, 512, 128),
).to(device).train()
criterion = NTXentLoss(temperature=0.5)
optimizer = torch.optim.Adam(model.parameters(), lr=1e-3)
for images, *_ in noisy_train_loader:
# SEANA first, then independent Lightly augmentations for each source.
source_a, source_b = augmenter(images.to(device))
view_a = torch.stack([ssl_view(image) for image in source_a])
view_b = torch.stack([ssl_view(image) for image in source_b])
optimizer.zero_grad(set_to_none=True)
loss = criterion(model(view_a), model(view_b))
loss.backward()
optimizer.step()
Cropping, photometric augmentation and normalization happen after SEANA. The fitted SEANA module stays frozen while the encoder and projection head train.
SEANA() uses frozen pretrained DRUNet, downloading its weights on first use.
SEANA(my_denoiser) uses your own module.
The example hyperparameter values sigma_vst (SEANA resampling strength in VST domain) and sigma_d (sigma denoising value supplied to DRUNet) are starting values, and need to be tuned for a given noisy dataset.
The library guide covers input scaling, fitting, custom denoisers, resampling strength and checkpoints.
The runnable LightlySSL example also provides a toy
dataset and checkpoint saving. From a repository checkout, run
uv run --python 3.12 --extra experiments examples/ssl_pipeline.py.
Try the Colab demo
The BBBC048 notebook brings the pipeline to real fluorescence microscopy images. Explore the resampling-strength slider and a baseline-versus-SEANA SSL comparison using the package from PyPI.
Demo budget: 70 SSL epochs and 50 linear-probe epochs per arm. These are shorter demonstration runs than the paper's training recipes. Follow the notebook's setup cells to load the repository helpers and prepared dataset.
Supply your own denoiser
seana = SEANA(my_denoiser, channels=1, sigma_vst=0.05, device="cuda")
seana.fit(train_loader, steps=5000, patch_size=64)
The denoiser must be an nn.Module mapping floating [B,C,H,W] tensors to the
same shape/device. Its forward pass must be differentiable with respect to its
input during VST fitting, although its own weights and BatchNorm statistics
stay frozen. A denoiser whose forward uses torch.no_grad() cannot train a VST
through that method.
The sigma_d and pretrained options configure the built-in DRUNet only.
Configure any noise level or weight loading directly on your custom denoiser.
SEANA owns the module by reference: it moves and freezes it. Pass a separate copy if another part of your application trains the same denoiser. Inputs may be CHW or BCHW for inference. Denoiser-specific image/patch-size constraints still apply.
Fitting options
fit() accepts a re-iterable loader of tensors or (images, labels) batches.
For dictionaries, pass batch_key="image". Other fields are ignored. One-shot
generators and empty loaders are rejected. Training images must have the configured
channel count and be at least as large as patch_size.
By default, the first 50 training batches calibrate one dataset-level intensity range. To use a known range:
seana = SEANA(my_denoiser, input_range=(0.0, 1.0), sigma_vst=0.1)
seana.fit(train_loader, calibrate=False, steps=5000, patch_size=64,
patch_batch_size=4, stride=4, lr=0.01)
The default spline has 128 knots and uses the captured global fitting objective.
Use variant="conditional" for the conditional VST, with the correct
channels specified at construction. Existing low-level imports
GlobalNoise2VST, ConditionalGlobalNoise2VST and DeepInvDRUNetWrapper remain
available for research code.
An optional seed isolates the loop's Python/PyTorch RNG state. Separate loader
generators and stochastic worker transforms remain the caller's responsibility.
The progress callback receives percent completion. Repeated fit() calls
continue the current VST weights. Construct a new augmenter for a fresh fit.
A failed fit remains unusable until fitting succeeds. Fitting needs autograd
and must run outside torch.inference_mode().
Denoising and reproducible resampling
estimate = seana.denoise(images) # No noise draw and no RNG advance.
a, b = seana(images, sigma_vst=0.0) # Equal views with resampling disabled.
a, b = seana(images, sigma_vst=(0.05, 0.15)) # One scale per image, shared by the pair.
generator = torch.Generator(device=device).manual_seed(123)
a, b = seana(images, sigma_vst=0.1, generator=generator)
Use a generator on the augmenter's device. Recreating it with the same seed
repeats the noise. Reusing it advances the stream. Each view receives independent
noise. Per-image strengths may be tensors shaped [B] or [B,1,1,1]. All
strengths must be finite and nonnegative. Outputs are clamped to the fitted
physical intensity range by default. clamp=False disables both input and output
clamps. denoise() is an estimate, not clean ground truth.
Save and reload
seana.save("weights/seana.pt")
restored = SEANA.load("weights/seana.pt", device=device)
For a custom denoiser, supply the same configured module:
restored = SEANA.load("weights/seana.pt", denoiser=my_reconstructed_denoiser,
device=device)
Checkpoints store the VST, denoiser tensors, settings and fit summary. DRUNet
reloads with pretrained=None, without another download. Custom denoisers are
never dynamically imported or unpickled: the provided class/representation is
checked and tensor states load strictly. Preserve any custom behavior not encoded
in state_dict() or extra_repr() yourself. Loading uses a typed payload and
torch.load(weights_only=True). Saving refuses an existing file. These are
inference artifacts, not optimizer-state resume checkpoints.
Building the library and running research code
uv lock --check
uv build
For the complete research checkout:
uv sync --python 3.12 --extra experiments --extra imagenet100 --extra bbbc048 \
--extra demo --group notebooks
Original SEANA code is MIT licensed. Dependencies, pretrained weights and the
repository's comparison methods/datasets retain their own terms. Please cite
Breaking Noise Shortcuts in Self-Supervised Learning via Noise-Aligned View
Generation, Oankar R. Patil. The repository's CITATION.cff
tracks publication details.
Metadata
Release files for seana-ssl 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| seana_ssl-0.1.5.tar.gz | 393.8 kB | Without provenance | Details for seana_ssl-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| seana_ssl-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for seana_ssl-0.1.5-py3-none-any.whl |
Total release size: 414.9 kB
Release files / seana_ssl-0.1.5.tar.gz
| Download URL | seana_ssl-0.1.5.tar.gz |
|---|---|
| Size | 393.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
54bd90a6f44f853e35da208939ae73017ef5668d588d7259a84875b335c7a322
|
|
BLAKE2b-256 checksum How to use checksums |
d7c4e2bf85553c7ff72bbac0ea75805f6c31d018edffce665acc79661169115b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / seana_ssl-0.1.5-py3-none-any.whl
| Download URL | seana_ssl-0.1.5-py3-none-any.whl |
|---|---|
| Size | 21.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
faf54419bd37068ded0506d5e464b03bc897fc8d04af14101e2aedebf3be8ab5
|
|
BLAKE2b-256 checksum How to use checksums |
3a2f84c82baa8e8a138ad0ac1675338b685c7dd241c5c7cadb8b8da71a550206
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for seana-ssl 0.1.5
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.