saii-cldm-synthetic / MODEL_CARD.md
mally-2000's picture
Update repository references after rename
83d0971 verified
---
library_name: diffusers
pipeline_tag: image-to-image
tags:
- seismic-inversion
- impedance-inversion
- diffusion
- ddpm
- overthrust
---
# Seismic-LDDPM
Seismic-LDDPM is a latent DDPM pipeline for seismic impedance inversion. The
pipeline takes a low-frequency impedance image (`dipin`) and a synthetic seismic
record (`record`) and predicts the impedance image.
This repository includes:
- Diffusers-format model components: `vq_model`, `unet`, `scheduler`, and
`condition_encoder`.
- `SeismicImpInvLDDPMPipeline` in `codes/pipeline.py`.
- A complete Overthrust benchmark sample at `data/Overthrust_trueimp.mat`.
- Root `infer.py` and supporting inference code under `codes/`.
## Installation
```bash
git clone https://huggingface.co/mally-2000/saii-cldm-synthetic
cd saii-cldm-synthetic
pip install -r requirements.txt
```
## Overthrust Evaluation
The Overthrust evaluation script is intentionally fixed to the bundled
`data/Overthrust_trueimp.mat`. It cuts the full model into six `256 x 256`
patches, synthesizes the seismic records and low-frequency impedance inputs,
runs inference, stitches the six predictions back together, and computes the
metrics.
```bash
python codes/eval_overthrust.py \
--model . \
--output outputs/overthrust \
--num-inference-steps 1000
```
Outputs:
- `outputs/overthrust/full_target.npy`
- `outputs/overthrust/full_prediction.npy`
- `outputs/overthrust/full_reconstruction.npy`
- `outputs/overthrust/comparison_impedance.png`
- `outputs/overthrust/metrics_summary.json`
## Benchmark Result
Evaluated locally on the bundled Overthrust benchmark with 1000 DDPM steps,
`noise_snr=15`, `dipin_v=0.012`, `f0=30`, `phase=0`, `seed=1234`, and patch
indices `[0, 1, 2, 3, 4, 5]`.
| Space | PSNR | SSIM | PCC | RRE | NMSE |
|---|---:|---:|---:|---:|---:|
| Normalized | 30.7698 | 0.9339 | 0.9963 | 0.0435 | 0.001894 |
| Impedance | 33.4413 | 0.9554 | 0.9957 | 0.0324 | 0.001050 |
| VQ reconstruction | 37.7954 | 0.9677 | 0.9983 | 0.0209 | 0.000435 |
![Overthrust evaluation](assets/demo.png)
## Single-Sample Inference
For a single default Overthrust patch:
```bash
python infer.py
```
The script builds one Overthrust test sample internally, synthesizes the
low-frequency impedance and seismic record, and saves `prediction.npy`,
`target.npy`, and `comparison.png` under `outputs/infer_LDDPM`.
For SAII-CLDM model-driven sampling:
```bash
python infer.py CLDM
```
## Python Usage
```python
import torch
from codes.pipeline import SeismicImpInvLDDPMPipeline
pipe = SeismicImpInvLDDPMPipeline.from_pretrained(
"mally-2000/saii-cldm-synthetic",
torch_dtype=torch.float32,
trust_remote_code=True,
).to("cuda")
result = pipe(
dipin=dipin, # torch.Tensor, BCHW
record=record, # torch.Tensor, BCHW
num_inference_steps=1000,
seed=1234,
)
prediction = result.impedance_samples
```
## Notes
- `codes/dataset.py` contains a lightweight `SeismicBase` and
`OverthrustTrueimpDataset`; it does not depend on the original training
repository's `ldm.data.seisimic`.
- Synthetic record generation is seeded through the benchmark configuration so
the published Overthrust evaluation is reproducible.
- The bundled Overthrust file is used only as a compact benchmark input for
reproducing this model's inference pipeline.