Add SAII-CLDM data package
Browse files- .gitattributes +1 -0
- README.md +35 -0
- marmousi/marmousi_256_train.npz +3 -0
- overthrust/Overthrust_trueimp.mat +3 -0
- prepare_marmousi_256_train.py +106 -0
.gitattributes
CHANGED
|
@@ -58,3 +58,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 58 |
# Video files - compressed
|
| 59 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 60 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 61 |
+
overthrust/Overthrust_trueimp.mat filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
task_categories:
|
| 4 |
+
- image-to-image
|
| 5 |
+
tags:
|
| 6 |
+
- seismic-inversion
|
| 7 |
+
- acoustic-impedance
|
| 8 |
+
- marmousi
|
| 9 |
+
- overthrust
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
# SAII-CLDM Data
|
| 13 |
+
|
| 14 |
+
This dataset package supports the official SAII-CLDM open-source implementation.
|
| 15 |
+
|
| 16 |
+
Payload files:
|
| 17 |
+
|
| 18 |
+
```text
|
| 19 |
+
marmousi/marmousi_256_train.npz
|
| 20 |
+
overthrust/Overthrust_trueimp.mat
|
| 21 |
+
prepare_marmousi_256_train.py
|
| 22 |
+
```
|
| 23 |
+
|
| 24 |
+
`marmousi_256_train.npz` is derived from the official Marmousi model and contains `256 x 256` log-velocity patches with flip and elastic-deformation augmentations.
|
| 25 |
+
|
| 26 |
+
`Overthrust_trueimp.mat` is the Overthrust benchmark file used by the evaluation code.
|
| 27 |
+
|
| 28 |
+
`prepare_marmousi_256_train.py` is a minimal data preparation script documenting the Marmousi-derived training data recipe. It expects an official Marmousi MATLAB file and writes the training `.npz` file.
|
| 29 |
+
|
| 30 |
+
Example `.env` entries for the code repository:
|
| 31 |
+
|
| 32 |
+
```bash
|
| 33 |
+
MARMousi_NPZ=./data/saii-cldm-data/marmousi/marmousi_256_train.npz
|
| 34 |
+
OVERTHRUST_DATA_DIR=./data/saii-cldm-data/overthrust
|
| 35 |
+
```
|
marmousi/marmousi_256_train.npz
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:47f1635106f8c78ee736a902f92773759d07d0437ed4ecfa6317ddf13266da3b
|
| 3 |
+
size 820511994
|
overthrust/Overthrust_trueimp.mat
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:59345b022a90f174efd444004192f9edf93ef5f65c556a84f52e9596f1695bd5
|
| 3 |
+
size 334424
|
prepare_marmousi_256_train.py
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Prepare the Marmousi-derived 256 x 256 training NPZ for SAII-CLDM."""
|
| 3 |
+
|
| 4 |
+
import argparse
|
| 5 |
+
from datetime import datetime
|
| 6 |
+
from pathlib import Path
|
| 7 |
+
|
| 8 |
+
import numpy as np
|
| 9 |
+
import scipy.io
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
def build_patch_indices(shape, size=256, interval=300, border=5):
|
| 13 |
+
height, width = shape
|
| 14 |
+
indices = set()
|
| 15 |
+
|
| 16 |
+
for offset in (border, 80, 160, 230):
|
| 17 |
+
for row in range(offset, height - size, interval):
|
| 18 |
+
for col in range(offset, width - size, interval):
|
| 19 |
+
indices.add((row, col))
|
| 20 |
+
|
| 21 |
+
for row in range(height - size - border, 0, -interval):
|
| 22 |
+
for col in range(width - size - border, 0, -interval):
|
| 23 |
+
indices.add((row, col))
|
| 24 |
+
|
| 25 |
+
return sorted(indices)
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
def elastic_patches(data, indices, size=256, border=5, seed=1234):
|
| 29 |
+
try:
|
| 30 |
+
import imgaug as ia
|
| 31 |
+
from imgaug import augmenters as iaa
|
| 32 |
+
except ImportError as exc:
|
| 33 |
+
raise SystemExit(
|
| 34 |
+
"imgaug is required for elastic deformation. Install it with `pip install imgaug`."
|
| 35 |
+
) from exc
|
| 36 |
+
|
| 37 |
+
if seed is not None:
|
| 38 |
+
ia.seed(seed)
|
| 39 |
+
np.random.seed(seed)
|
| 40 |
+
|
| 41 |
+
seq = iaa.Sequential(
|
| 42 |
+
[iaa.ElasticTransformation(alpha=(30, 40), sigma=10)],
|
| 43 |
+
random_order=True,
|
| 44 |
+
)
|
| 45 |
+
|
| 46 |
+
patches = []
|
| 47 |
+
for row, col in indices:
|
| 48 |
+
padded = data[row - border : row + size + border, col - border : col + size + border]
|
| 49 |
+
patches.append(seq.augment_image(padded)[border : border + size, border : border + size])
|
| 50 |
+
return patches
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
def prepare(input_mat, output_npz, key="A", size=256, seed=1234, dry_run=False):
|
| 54 |
+
mat = scipy.io.loadmat(input_mat)
|
| 55 |
+
if key not in mat:
|
| 56 |
+
keys = ", ".join(k for k in mat if not k.startswith("__"))
|
| 57 |
+
raise KeyError(f"Key {key!r} was not found in {input_mat}. Available keys: {keys}")
|
| 58 |
+
|
| 59 |
+
marmousi = np.log(mat[key][500:][::4])
|
| 60 |
+
indices = build_patch_indices(marmousi.shape, size=size)
|
| 61 |
+
originals = [marmousi[row : row + size, col : col + size].reshape(size, size) for row, col in indices]
|
| 62 |
+
|
| 63 |
+
if dry_run:
|
| 64 |
+
print(f"input_shape={mat[key].shape}")
|
| 65 |
+
print(f"working_shape={marmousi.shape}")
|
| 66 |
+
print(f"base_patches={len(originals)}")
|
| 67 |
+
print(f"output_shape=({len(originals) * 5}, {size}, {size})")
|
| 68 |
+
return
|
| 69 |
+
|
| 70 |
+
left_right = [np.flip(patch, axis=1) for patch in originals]
|
| 71 |
+
up_down = [np.flip(patch, axis=0) for patch in originals]
|
| 72 |
+
both = [np.flip(patch, axis=0) for patch in left_right]
|
| 73 |
+
elastic = elastic_patches(marmousi, indices, size=size, seed=seed)
|
| 74 |
+
|
| 75 |
+
data = np.stack(originals + left_right + up_down + both + elastic, axis=0)
|
| 76 |
+
description = (
|
| 77 |
+
"Derived from the official Marmousi model; contains 256 x 256 log-velocity "
|
| 78 |
+
"patches with left-right flip, up-down flip, both-direction flip, and elastic "
|
| 79 |
+
"deformation augmentations."
|
| 80 |
+
)
|
| 81 |
+
|
| 82 |
+
output_npz = Path(output_npz)
|
| 83 |
+
output_npz.parent.mkdir(parents=True, exist_ok=True)
|
| 84 |
+
np.savez(
|
| 85 |
+
output_npz,
|
| 86 |
+
data=data,
|
| 87 |
+
creation_time=datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
|
| 88 |
+
description=description,
|
| 89 |
+
)
|
| 90 |
+
print(f"saved {output_npz} with data shape {data.shape}")
|
| 91 |
+
|
| 92 |
+
|
| 93 |
+
def main():
|
| 94 |
+
parser = argparse.ArgumentParser(description=__doc__)
|
| 95 |
+
parser.add_argument("--input-mat", required=True, help="Official Marmousi MATLAB file.")
|
| 96 |
+
parser.add_argument("--output", default="marmousi_256_train.npz", help="Output NPZ path.")
|
| 97 |
+
parser.add_argument("--key", default="A", help="MATLAB matrix key to read.")
|
| 98 |
+
parser.add_argument("--size", type=int, default=256, help="Patch size.")
|
| 99 |
+
parser.add_argument("--seed", type=int, default=1234, help="Random seed for elastic deformation.")
|
| 100 |
+
parser.add_argument("--dry-run", action="store_true", help="Print the expected output shape without writing the NPZ.")
|
| 101 |
+
args = parser.parse_args()
|
| 102 |
+
prepare(args.input_mat, args.output, key=args.key, size=args.size, seed=args.seed, dry_run=args.dry_run)
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
if __name__ == "__main__":
|
| 106 |
+
main()
|