Skip to content

Repository files navigation

AdaSemSeg

AdaSemSeg: An Adaptive Few-shot Semantic Segmentation of Seismic Facies

Python 3.8+ PyTorch License arXiv Weights DOI Datasets DOI

Official reproducibility repository for the paper AdaSemSeg: An Adaptive Few-shot Semantic Segmentation of Seismic Facies by Surojit Saha and Ross Whitaker, IEEE Transactions on Geoscience and Remote Sensing, 2025 (arXiv:2501.16760).

This repository provides a complete, working implementation of AdaSemSeg together with all baselines, competing methods, ablation studies, trained model weights, and reproduction scripts needed to reproduce the quantitative and qualitative results reported in the paper.

Keywords: class-agnostic segmentation · variable class taxonomy · few-shot learning · meta-learning · cross-domain generalization · gaussian process regression · self-supervised learning · domain adaptation · zero-shot transfer · seismic facies · SimCLR pretraining

What is AdaSemSeg?

Interpreting seismic facies is a pixel-wise multi-class segmentation task, but annotating 3D seismic volumes is expensive. Few-shot semantic segmentation (FSSS) offers a realistic alternative: given only a handful of annotated slices from a novel, unseen seismic volume, predict facies on the remaining slices without fine-tuning on the target volume — a cross-domain, gradient-free adaptation setting, not just unseen-class generalization within a fixed domain.

Existing FSSS methods require the number of classes to be fixed at training time. This is a problem for seismic facies because different surveys have different numbers of facies and incompatible naming conventions:

Dataset Country Classes Facies example
F3 Netherlands 6 Zechstein, Scruff, Chalk, Rijnland, Upper Germanic, Lower Germanic
Parihaka New Zealand 6 Waihou, Wai-iti, Maxwell, Manganui, Mt. Messenger, Urenui
Penobscot Canada 7 Horizon groups 1–7

Different numbers of facies across datasets
Figure 1: Seismic facies datasets differ in both the number of facies and their naming conventions, making a fixed-class segmentation model impractical.

AdaSemSeg addresses this by decomposing multi-class segmentation into a set of class-agnostic binary segmentation tasks that share a single backbone. The number of binary tasks scales with the number of facies in the current dataset, so the architecture itself never has to change. A shared DGPNet backbone performs Gaussian-process regression in the latent space for each facies independently; the final multi-class label is obtained by aggregating the binary predictions.

AdaSemSeg architecture
Figure 2: AdaSemSeg training overview. A shared DGPNet predicts class-wise binary masks; the same weights are reused for every facies, so the model naturally adapts to varying class counts.

At inference time, only a few annotated support slices from the target volume are needed:

Few-shot facies segmentation task
Figure 3: Given only a few annotated slices (support set) from an unseen seismic volume, AdaSemSeg predicts the facies label for every pixel in a query slice.

Key design choices

  • Class-agnostic architecture, variable number of target classes: Because each facies is handled as a separate binary task on a shared backbone, the number of trainable parameters is fixed and does not grow with the number of facies — AdaSemSeg can be trained jointly on datasets with different numbers of classes without architectural changes.
  • Cross-domain generalization, no target-domain fine-tuning: Parameters are meta-trained on source datasets under a leave-one-dataset-out protocol; the target dataset is entirely absent from training, and target data only supplies a support set at inference — no gradient updates on target-domain data. This is a stronger setting than most Generalized Few-Shot Segmentation (GFS-Seg) and class-incremental few-shot segmentation work, which typically test unseen classes within a fixed training domain rather than an entirely unseen domain.
  • Self-supervised, in-domain pretrained initialization: The image encoder is initialized with SimCLR contrastive representations learned from unlabeled seismic data (F3, Parihaka, Penobscot), rather than depending on ImageNet statistics — see pretraining/simclr/ for the full training setup and how to reuse the pretrained encoder.
  • GP regression in latent space: Gaussian-process regression at the bottleneck and decoder layers provides robust adaptation from few support examples.
  • Not seismic-specific in principle: the underlying idea — a class-agnostic, shared-backbone architecture that adapts to a new domain and a new number of target classes from a handful of support examples, with no fine-tuning — applies to any few-shot semantic segmentation setting where both the domain and the target taxonomy can vary at deployment time (e.g. cross-scanner/cross-institution medical image segmentation). Seismic facies is the evaluated case study, not an architectural boundary.

Handling a variable class taxonomy is not new on its own — prior work such as MSeg and LMSeg address it by building one unified, fixed taxonomy across multiple training datasets. That solves variable class counts at training time, but not generalization to a target domain excluded from that unified taxonomy altogether, and it does not evaluate under a no-fine-tuning constraint. Within seismic interpretation specifically, the standard segmentation networks used on F3/Parihaka/Penobscot — DeconvNet, U-Net, DeepLabv3 — don't attempt this at all: each is trained and evaluated as a fixed-class, single-dataset supervised model:

Method Variable Classes Cross-Domain No Fine-Tuning
DeconvNet / U-Net / DeepLabv3 (standard seismic segmentation)
MSeg / LMSeg ✗ (fixed, unified taxonomy)
AdaSemSeg

ProtoSemSeg (also seismic-specific) is the one prior method that attempts the same combination — see Table III for the resulting performance gap; its checkpoints are also available on the Hub for direct comparison.

Which question does which experiment answer?

If you're evaluating whether AdaSemSeg addresses a specific concern, this maps each claim to the exact table/script that provides evidence for it:

Question Dimension Evidence Table Reproduce with
Does the same architecture handle datasets with a different number of target classes, with no per-dataset redesign? Class-agnostic architecture F3 (6 classes), Parihaka (6), Penobscot (7) are all evaluated with the identical shared-backbone AdaSemSeg architecture Tables I, III, VII (spans all three datasets) scripts/reproduce_table1.py, scripts/reproduce_table3.py, scripts/reproduce_table7.py
Does it generalize to a target dataset never seen during training — not just unseen classes in a known dataset? Cross-domain generalization, leave-one-dataset-out Every reported result trains on 2 of {F3, Parihaka, Penobscot} and evaluates on the third Tables I, III, VII scripts/reproduce_table1.py, scripts/reproduce_table3.py, scripts/reproduce_table7.py
Does it beat a method that is allowed to fine-tune on the target dataset? No-fine-tuning vs. transfer learning AdaSemSeg vs. a U-Net fine-tuned on target support slices Table III scripts/reproduce_table3.py
Does it beat a competing few-shot method that also handles varying class counts? Comparison to prior class-flexible FSSS AdaSemSeg vs. ProtoSemSeg (prototype-based) Table III scripts/reproduce_table3.py
Does self-supervised, in-domain (seismic) pretraining of the encoder actually help, vs. random init? Self-supervised pretraining ablation SimCLR-init vs. random-init on Parihaka, 1-shot and 5-shot Table IV scripts/reproduce_table4.py
How sensitive is the result to how the support set is chosen (fixed K-shot sampling vs. nearest slice to the query)? Support-set selection strategy Same checkpoints evaluated under both strategies Table I scripts/reproduce_table1.py
Does data augmentation meaningfully contribute, separate from pretraining? Augmentation ablation With/without augmentation comparison Table V scripts/reproduce_table5.py
Is it practical to deploy (inference cost)? Computational cost GPU/CPU inference time Table VI scripts/reproduce_table6.py
Does it hold up when a facies class is rare/under-represented in the support set? Class-imbalance robustness Per-class sensitivity analysis Table VII scripts/reproduce_table7.py
How much does meta-learning itself (vs. training a model from scratch only on target data) buy you? Meta-learning vs. target-only baseline AdaSemSeg vs. Baseline-1/Baseline-2 (target-data-only training) Table II scripts/reproduce_table2.py
Is the pretrained ResNet encoder architecturally compatible with generic ResNet-based segmentation pipelines (not just AdaSemSeg's own DGPNet)? Plug-and-play encoder reuse Encoder is stock torchvision.models.resnet18/50, standard input convention Not a paper table — see pretraining/simclr/

Repository contents

  • methods/adasemseg/ — Proposed AdaSemSeg method
  • methods/baselines/ — Baseline-1, Baseline-2, and transfer-learning experiments
  • methods/protosemseg/ — Competing prototype-based few-shot method
  • pretraining/simclr/ — Self-supervised SimCLR pretraining for the image encoder
  • configs/ — Unified datasets.yaml and shared hyperparameters
  • scripts/ — One-command evaluation and reproduction wrappers
  • checkpoints/ — AdaSemSeg, ProtoSemSeg, and SimCLR initialization weights (downloaded from Zenodo, see Model weights)
  • docs/ — Paper figures, method descriptions, and running.md
  • REPRODUCE.md — Step-by-step reproduction of every table/figure in the paper

Installation

# Create a conda environment
conda env create -f environment.yml
conda activate adasemseg

# Or use pip
pip install -r requirements.txt

Download datasets and weights

This repository ships code only — no large binaries are committed to git, so cloning it stays fast. Datasets and trained weights are hosted externally on Zenodo and pulled in on demand:

Run:

python scripts/download_assets.py --all

This populates ./data and ./checkpoints in place. To fetch only one or the other:

python scripts/download_assets.py --data      # datasets only
python scripts/download_assets.py --weights   # checkpoints only

By default the code looks for data under ./data:

data/
├── F3/
│   ├── train/...
│   ├── test/...
│   └── split_train_val_test_f3.json
├── Parihaka/
│   ├── parihaka_facies_train_images.npy
│   ├── parihaka_facies_train_labels.npy
│   └── split_train_val_test_parihaka.json
└── Penobscot/
    ├── seismic.npy
    ├── seismic_labels.npy
    └── split_train_val_test_penobscot.json

seismic.npy/seismic_labels.npy for Penobscot are derived from a raw source volume (dataset.h5, not redistributed here) via data/Penobscot/process_data.py, included so the exact preprocessing — and the source dataset it starts from — is transparent and reproducible.

To use a different location, set:

export ADASEMSEG_DATA_ROOT=/path/to/data

On Windows PowerShell:

$env:ADASEMSEG_DATA_ROOT = "C:\path\to\data"

Quick evaluation

Evaluate a published AdaSemSeg checkpoint using its paper scenario from checkpoints/scenarios.json:

# 5-shot sampling on F3 (trained on Parihaka + Penobscot)
python scripts/evaluate_adasemseg.py --scenario simclr_5-shot_sampling_f3 --device cuda:0

# Nearest-slice evaluation on Parihaka (trained on F3 + Penobscot)
python scripts/evaluate_adasemseg.py --scenario simclr_5-shot_nearest_slice_parihaka --device cuda:0

# Crossline-only evaluation on Penobscot
python scripts/evaluate_adasemseg.py --scenario simclr_5-shot_sampling_penobscot --classes penobscot_facies_data_crossline --device cuda:0

See checkpoints/scenarios.json for the full list of available scenarios, and REPRODUCE.md for reproducing every table and figure in the paper.

Results

Support-set sampling: K-shot vs. nearest slice

AdaSemSeg is evaluated with two support-set strategies. For F3 and Penobscot, using K=5 support slices spanning the volume works best. For Parihaka, structural variation along both axes makes the nearest slice more effective.

Inline direction

Dataset K=5 PA MCA FwIoU FwF1 Nearest PA MCA FwIoU FwF1
F3 0.89 0.79 0.81 0.89 0.85 0.73 0.78 0.85
Penobscot 0.95 0.95 0.91 0.96 0.96 0.95 0.94 0.97
Parihaka 0.78 0.68 0.66 0.79 0.86 0.76 0.76 0.86

Crossline direction

Dataset K=5 PA MCA FwIoU FwF1 Nearest PA MCA FwIoU FwF1
F3 0.87 0.73 0.80 0.88 0.80 0.58 0.71 0.81
Penobscot 0.97 0.95 0.93 0.96 0.96 0.94 0.92 0.95
Parihaka 0.79 0.65 0.67 0.80 0.84 0.68 0.74 0.85

Paper Table I: AdaSemSeg evaluation using K=5 support examples vs. the nearest slice. Bold = best per row. More details in REPRODUCE.md.

Comparison with competing methods

AdaSemSeg is compared against ProtoSemSeg (a prototype-based FSSS method) and transfer learning (a U-Net fine-tuned on a few target slices). AdaSemSeg consistently outperforms both, often by large margins, despite never fine-tuning on the target dataset.

Target dataset Shots Metric AdaSemSeg ProtoSemSeg Transfer learning
Parihaka inline 1 FwF1 0.84 0.52 0.54
Parihaka inline 5 FwF1 0.86 0.58 0.62
Penobscot inline 1 FwF1 0.93 0.58 0.67
Penobscot inline 5 FwF1 0.96 0.71 0.89
F3 inline 1 FwF1 0.85 0.55 0.84
F3 inline 5 FwF1 0.89 0.68 0.84

Selected FwF1 scores from paper Table III (the full few-shot comparison). See REPRODUCE.md for the complete PA / MCA / FwIoU / FwF1 table across all datasets and both 1-shot and 5-shot settings.

Ablation: SimCLR initialization

Initializing the image encoder with SimCLR representations learned from unlabeled seismic data substantially improves AdaSemSeg on the challenging Parihaka dataset:

Shots Init PA MCA FwIoU FwF1
1 Random 0.61 / 0.56 0.58 / 0.50 0.48 / 0.42 0.64 / 0.59
1 SimCLR 0.84 / 0.82 0.75 / 0.71 0.74 / 0.71 0.84 / 0.83
5 Random 0.72 / 0.55 0.66 / 0.57 0.59 / 0.43 0.72 / 0.60
5 SimCLR 0.86 / 0.84 0.76 / 0.68 0.76 / 0.74 0.86 / 0.85

Paper Table IV: SimCLR vs. random initialization on Parihaka inline / crossline. SimCLR initialization consistently produces the best scores.

Qualitative results

Below are example support sets and predictions on the Penobscot dataset. AdaSemSeg captures thin, geologically consistent facies boundaries even though it was trained only on F3 and Parihaka.

Penobscot inline support set and predictions
Paper Fig. 18/19 (inline): Penobscot inline support images, ground truths, and AdaSemSeg predictions.

Penobscot crossline support set and predictions
Paper Fig. 18/19 (crossline): Penobscot crossline support images, ground truths, and AdaSemSeg predictions.

Reproducing the paper

Every table and figure reported in the paper can be reproduced from this repository:

Paper item Script / command Location
Table I — K-shot vs. nearest slice python scripts/reproduce_table1.py scripts/
Table II — Baselines on target data python scripts/reproduce_table2.py scripts/
Table III — ProtoSemSeg & transfer learning python scripts/reproduce_table3.py scripts/
Table IV — Initialization ablation python scripts/reproduce_table4.py scripts/
Table V — Data augmentation ablation python scripts/reproduce_table5.py scripts/
Table VI — Inference time (GPU / CPU) python scripts/reproduce_table6.py scripts/
Table VII — Sensitivity to under-represented classes python scripts/reproduce_table7.py scripts/
Prediction figures python scripts/reproduce_figures.py scripts/
Per-scenario evaluation python scripts/evaluate_adasemseg.py --scenario <name> scripts/

Detailed commands, dataset splits, and expected outputs are documented in REPRODUCE.md and docs/running.md.

Model weights

We extract 2D patches of size 256 × 256 along the inline and crossline directions to train the AdaSemSeg and other methods studied in this work for all the data volumes. [...] We use the leave-one-out policy to create the data for the meta-training and meta-testing. For example, to evaluate the AdaSemSeg on the Parihaka dataset (target data used in the meta-testing stage), we train the AdaSemSeg on the Penobscot and F3 dataset (source data used in the meta-training stage). Similarly, the AdaSemSeg is evaluated on the Penobscot and F3 datasets when the model is trained on the remaining two datasets. Under this experimental setting, we assess the generalization of the AdaSemSeg to unseen target datasets.

— Section III-A, Experimental Setup

Because of this leave-one-out design, there is one trained model per target dataset per shot count, for both AdaSemSeg and ProtoSemSeg. Checkpoints are downloaded from Zenodo (see Download datasets and weights) into a matching <method>/<dataset>/<shots>-shot/ layout:

checkpoints/
├── simclr/
│   └── simclr_resnet50_epoch10.pth.tar   # shared image-encoder init, not per-dataset
├── adasemseg/
│   ├── f3/
│   │   ├── 1-shot/bestmodel.pth.tar
│   │   └── 5-shot/bestmodel.pth.tar
│   ├── parihaka/
│   │   ├── 1-shot/bestmodel.pth.tar
│   │   └── 5-shot/bestmodel.pth.tar
│   └── penobscot/
│       ├── 1-shot/bestmodel.pth.tar
│       └── 5-shot/bestmodel.pth.tar
└── protosemseg/
    ├── f3/
    │   ├── 1-shot/bestmodel.pth.tar
    │   └── 5-shot/bestmodel.pth.tar
    ├── parihaka/
    │   ├── 1-shot/bestmodel.pth.tar
    │   └── 5-shot/bestmodel.pth.tar
    └── penobscot/
        ├── 1-shot/bestmodel.pth.tar
        └── 5-shot/bestmodel.pth.tar

Each 5-shot checkpoint above is evaluated under both AdaSemSeg support-selection strategies (K=5 sampling and nearest-slice) to produce the two rows per dataset in Table 1 — support strategy is an evaluation-time flag, not a separate trained model.

  • checkpoints/scenarios.json — Maps each paper scenario to its checkpoint, shot count, support strategy, and classes
  • checkpoints/checkpoints_index.json — Flat index of every checkpoint downloaded from Zenodo

Reusing the pretrained SimCLR encoder

The SimCLR-pretrained image encoder is a drop-in, plug-and-play initialization for any ResNet-based encoder-decoder segmentation network (U-Net, DeepLab, FPN, segmentation_models_pytorch, etc.) — not only for AdaSemSeg's own DGPNet. The backbone is an unmodified torchvision.models.resnet18/resnet50, so reuse requires no architectural adapter beyond a standard state_dict key-prefix fix.

See pretraining/simclr/ for the full training setup (architecture, augmentations, hyperparameters, data — matching Appendix B-A of the paper) and the loading snippet for reusing the pretrained encoder in your own segmentation pipeline.

Citation

If you use this code, please cite the paper:

@article{saha2025adasemseg,
  title={AdaSemSeg: An Adaptive Few-shot Semantic Segmentation of Seismic Facies},
  author={Saha, Surojit and Whitaker, Ross},
  journal={IEEE Transactions on Geoscience and Remote Sensing},
  year={2025},
  doi={10.1109/TGRS.2025.3595010}
}

If you use the trained model weights or the processed datasets, please also cite the corresponding Zenodo record:

@dataset{saha2026adasemsegweights,
  title={AdaSemSeg: Trained Model Checkpoints for Adaptive Few-Shot Semantic Segmentation of Seismic Facies},
  author={Saha, Surojit and Whitaker, Ross},
  year={2026},
  publisher={Zenodo},
  doi={10.5281/zenodo.21762769},
  url={https://doi.org/10.5281/zenodo.21762769}
}

@dataset{saha2026adasemsegdata,
  title={AdaSemSeg: Processed Seismic Facies Datasets (F3, Parihaka, Penobscot)},
  author={Saha, Surojit and Whitaker, Ross},
  year={2026},
  publisher={Zenodo},
  doi={10.5281/zenodo.21764042},
  url={https://doi.org/10.5281/zenodo.21764042}
}

License

This project is released under the MIT License. See LICENSE for details.

About

Class-agnostic few-shot semantic segmentation of seismic facies — generalizes to unseen datasets with no target-domain fine-tuning

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages