cig-bench 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cig_bench-0.1.0/LICENSE +21 -0
- cig_bench-0.1.0/MANIFEST.in +7 -0
- cig_bench-0.1.0/PKG-INFO +330 -0
- cig_bench-0.1.0/README.md +278 -0
- cig_bench-0.1.0/cig_bench/__init__.py +11 -0
- cig_bench-0.1.0/cig_bench/networks/__init__.py +6 -0
- cig_bench-0.1.0/cig_bench/networks/hrnet.py +330 -0
- cig_bench-0.1.0/cig_bench/networks/hrnet_skipconect.py +303 -0
- cig_bench-0.1.0/cig_bench/networks/hrnet_skipconect_opt.py +859 -0
- cig_bench-0.1.0/cig_bench/predictor/__init__.py +13 -0
- cig_bench-0.1.0/cig_bench/predictor/_download.py +217 -0
- cig_bench-0.1.0/cig_bench/predictor/channel.py +274 -0
- cig_bench-0.1.0/cig_bench/predictor/fault.py +237 -0
- cig_bench-0.1.0/cig_bench/predictor/karst.py +266 -0
- cig_bench-0.1.0/cig_bench/predictor/property.py +299 -0
- cig_bench-0.1.0/cig_bench/predictor/rgt.py +317 -0
- cig_bench-0.1.0/cig_bench/predictor/utils.py +435 -0
- cig_bench-0.1.0/cig_bench.egg-info/PKG-INFO +330 -0
- cig_bench-0.1.0/cig_bench.egg-info/SOURCES.txt +25 -0
- cig_bench-0.1.0/cig_bench.egg-info/dependency_links.txt +1 -0
- cig_bench-0.1.0/cig_bench.egg-info/not-zip-safe +1 -0
- cig_bench-0.1.0/cig_bench.egg-info/requires.txt +12 -0
- cig_bench-0.1.0/cig_bench.egg-info/top_level.txt +1 -0
- cig_bench-0.1.0/pyproject.toml +3 -0
- cig_bench-0.1.0/setup.cfg +4 -0
- cig_bench-0.1.0/setup.py +103 -0
cig_bench-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CIG_Bench Authors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
cig_bench-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cig_bench
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: CIG_Bench: a benchmark toolkit for seismic interpretation tasks (channel / fault / karst / property / RGT) built on HRNet.
|
|
5
|
+
Home-page: https://github.com/douyimin/CIG-bench
|
|
6
|
+
Author: Yimin Dou
|
|
7
|
+
Author-email: douyimin@ustc.edu.cn
|
|
8
|
+
License: MIT
|
|
9
|
+
Project-URL: Source, https://github.com/douyimin/CIG-bench
|
|
10
|
+
Project-URL: Project Page, https://douyimin.github.io/CIG-bench
|
|
11
|
+
Keywords: seismic,geophysics,deep-learning,hrnet,benchmark,fault-detection,channel-detection,rgt
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
24
|
+
Requires-Python: >=3.8
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: numpy>=1.20
|
|
28
|
+
Requires-Dist: scipy>=1.6
|
|
29
|
+
Requires-Dist: torch>=1.10
|
|
30
|
+
Requires-Dist: cigvis
|
|
31
|
+
Requires-Dist: modelscope
|
|
32
|
+
Requires-Dist: huggingface_hub
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
35
|
+
Requires-Dist: build; extra == "dev"
|
|
36
|
+
Requires-Dist: twine; extra == "dev"
|
|
37
|
+
Requires-Dist: wheel; extra == "dev"
|
|
38
|
+
Dynamic: author
|
|
39
|
+
Dynamic: author-email
|
|
40
|
+
Dynamic: classifier
|
|
41
|
+
Dynamic: description
|
|
42
|
+
Dynamic: description-content-type
|
|
43
|
+
Dynamic: home-page
|
|
44
|
+
Dynamic: keywords
|
|
45
|
+
Dynamic: license
|
|
46
|
+
Dynamic: license-file
|
|
47
|
+
Dynamic: project-url
|
|
48
|
+
Dynamic: provides-extra
|
|
49
|
+
Dynamic: requires-dist
|
|
50
|
+
Dynamic: requires-python
|
|
51
|
+
Dynamic: summary
|
|
52
|
+
|
|
53
|
+
<div align="center">
|
|
54
|
+
|
|
55
|
+
# CIG-Bench
|
|
56
|
+
|
|
57
|
+
**A Comprehensive Benchmark Toolkit for AI-Driven Subsurface Imaging Understanding**
|
|
58
|
+
|
|
59
|
+
[](https://pypi.org/project/cig-bench/)
|
|
60
|
+
[](LICENSE)
|
|
61
|
+
[](#requirements)
|
|
62
|
+
[](https://douyimin.github.io/CIG-bench)
|
|
63
|
+
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
`cig_bench` is the official inference library accompanying the paper
|
|
67
|
+
**"CIG-Bench: A Comprehensive Survey and Benchmark for AI-Driven Subsurface Imaging Understanding"**.
|
|
68
|
+
It provides ready-to-use, pretrained deep-learning baselines for the five core seismic-interpretation
|
|
69
|
+
tasks of CIG-Bench:
|
|
70
|
+
|
|
71
|
+
| Task | Predictor | Backbone |
|
|
72
|
+
| :--- | :--- | :--- |
|
|
73
|
+
| Fault segmentation | `FaultPredictor` | HRNet w/ skip-connection (opt.) |
|
|
74
|
+
| Relative Geologic Time (RGT) | `RGTPredictor` | HRNet w/ skip-connection (opt.) |
|
|
75
|
+
| Channel segmentation | `ChannelPredictor` | HRNet w/ skip-connection (opt.) |
|
|
76
|
+
| Karst-cave segmentation | `KarstPredictor` | HRNet w/ skip-connection (opt.) |
|
|
77
|
+
| Property modeling (Vp / Density / Impedance / GR / Lithology …) | `PropertyPredictor` | HRNet w/ skip-connection (opt.) |
|
|
78
|
+
|
|
79
|
+
All five predictors share a uniform API and load weights automatically from
|
|
80
|
+
[ModelScope](https://www.modelscope.cn/) (default) or
|
|
81
|
+
[Hugging Face Hub](https://huggingface.co/) on first use.
|
|
82
|
+
|
|
83
|
+
> 📄 Paper / project page: <https://douyimin.github.io/CIG-bench>
|
|
84
|
+
> 💻 Source code: <https://github.com/douyimin/CIG-bench>
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## Table of Contents
|
|
89
|
+
|
|
90
|
+
- [Installation](#installation)
|
|
91
|
+
- [Quick start](#quick-start)
|
|
92
|
+
- [Fault segmentation](#fault-segmentation)
|
|
93
|
+
- [RGT estimation](#rgt-estimation)
|
|
94
|
+
- [Geobody segmentation (channel / karst)](#geobody-segmentation-channel--karst)
|
|
95
|
+
- [Property modeling](#property-modeling)
|
|
96
|
+
- [Weight sources](#weight-sources)
|
|
97
|
+
- [Using local weights or a custom repo](#using-local-weights-or-a-custom-repo)
|
|
98
|
+
- [Project layout](#project-layout)
|
|
99
|
+
- [Requirements](#requirements)
|
|
100
|
+
- [Citation](#citation)
|
|
101
|
+
- [License](#license)
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## Installation
|
|
106
|
+
|
|
107
|
+
From PyPI:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
pip install cig_bench
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
From source:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
git clone https://github.com/douyimin/CIG-bench.git
|
|
117
|
+
cd CIG-bench/cig_bench_pkg
|
|
118
|
+
pip install .
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
For development (editable install with dev extras):
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
pip install -e ".[dev]"
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
You will additionally need at least one weight backend:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
# Recommended for users in mainland China
|
|
131
|
+
pip install modelscope
|
|
132
|
+
|
|
133
|
+
# Or the international default
|
|
134
|
+
pip install huggingface_hub
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Quick start
|
|
140
|
+
|
|
141
|
+
The first time you build a predictor, the corresponding `.pth` checkpoint is downloaded into a local
|
|
142
|
+
cache. Subsequent constructions of the same predictor reuse the cached weights.
|
|
143
|
+
|
|
144
|
+
### Fault segmentation
|
|
145
|
+
|
|
146
|
+
The fault model predicts a probability volume that is thresholded into a fault mask. Anisotropic
|
|
147
|
+
rescaling (`scale_t`, `scale_h`, `scale_w`) adapts the model to surveys with non-square spatial
|
|
148
|
+
sampling. The optional `rank` and `chunk_size` arguments split inference along the depth axis
|
|
149
|
+
to keep GPU memory bounded on large field volumes.
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
from cig_bench.predictor.fault import FaultPredictor
|
|
153
|
+
|
|
154
|
+
fault_predictor = FaultPredictor(device="cuda")
|
|
155
|
+
prob, used = fault_predictor.predict(
|
|
156
|
+
seis,
|
|
157
|
+
rank=4, chunk_size=64, # memory-bounded chunked inference
|
|
158
|
+
threshold=0.5,
|
|
159
|
+
scale_t=0.5, scale_h=0.85, scale_w=0.85,
|
|
160
|
+
resize_back=True, # return result at the original (T, H, W)
|
|
161
|
+
)
|
|
162
|
+
fault_predictor.visualize(used, prob)
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### RGT estimation
|
|
166
|
+
|
|
167
|
+
The RGT model regresses a smooth relative-geologic-time volume; horizons are then extracted as
|
|
168
|
+
iso-surfaces of that volume. Optional sparse horizon annotations may be passed as two auxiliary
|
|
169
|
+
channels (`horizon_rgt`, `horizon_mask`) to constrain the prediction.
|
|
170
|
+
|
|
171
|
+
```python
|
|
172
|
+
from cig_bench.predictor.rgt import RGTPredictor
|
|
173
|
+
|
|
174
|
+
rgt_predictor = RGTPredictor(device="cuda")
|
|
175
|
+
rgt_vol, used = rgt_predictor.predict(seis)
|
|
176
|
+
horizons = rgt_predictor.extract_horizons(rgt_vol, n_horizons=100)
|
|
177
|
+
rgt_predictor.visualize(used, rgt_vol, horizons)
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Geobody segmentation (channel / karst)
|
|
181
|
+
|
|
182
|
+
Both geobody predictors share the same multi-scale ensemble strategy. By default inference is run
|
|
183
|
+
at seven spatial scales (from 0.25× to 1.5× the input size) and the resulting probability volumes
|
|
184
|
+
are accumulated. A configurable post-processing step removes small connected components.
|
|
185
|
+
|
|
186
|
+
```python
|
|
187
|
+
from cig_bench.predictor.channel import ChannelPredictor
|
|
188
|
+
|
|
189
|
+
channel_predictor = ChannelPredictor(device="cuda")
|
|
190
|
+
scores, used = channel_predictor.predict(
|
|
191
|
+
seis,
|
|
192
|
+
scales=[0.5, 0.75, 1.0, 1.25, 1.5], # custom scale set
|
|
193
|
+
accumulate="sum",
|
|
194
|
+
)
|
|
195
|
+
mask = channel_predictor.postprocess(scores, threshold=0.75, min_size=50000)
|
|
196
|
+
channel_predictor.visualize(used, scores, mask)
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
The karst predictor is used identically — only the checkpoint changes:
|
|
200
|
+
|
|
201
|
+
```python
|
|
202
|
+
from cig_bench.predictor.karst import KarstPredictor
|
|
203
|
+
|
|
204
|
+
karst_predictor = KarstPredictor(device="cuda")
|
|
205
|
+
scores, used = karst_predictor.predict(seis)
|
|
206
|
+
mask = karst_predictor.postprocess(scores, threshold=0.75, min_size=50000)
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Property modeling
|
|
210
|
+
|
|
211
|
+
The property predictor follows the GEM-style conditional paradigm: it takes a seismic volume and
|
|
212
|
+
a sparse well-log property volume (zeros where no well is present) and outputs a dense 3D
|
|
213
|
+
property volume. Internally it stacks three channels — seismic, sparse property, binary well mask —
|
|
214
|
+
and feeds them to the HRNet backbone. The number and location of wells are not fixed; passing
|
|
215
|
+
more wells generally improves accuracy.
|
|
216
|
+
|
|
217
|
+
```python
|
|
218
|
+
import numpy as np
|
|
219
|
+
from cig_bench.predictor.property import PropertyPredictor
|
|
220
|
+
|
|
221
|
+
prop_predictor = PropertyPredictor(device="cuda")
|
|
222
|
+
vp_vol, used, wells = prop_predictor.predict(
|
|
223
|
+
seis, vp_log,
|
|
224
|
+
infer_shape=(640, 512, 512),
|
|
225
|
+
)
|
|
226
|
+
prop_predictor.visualize(used, vp_vol, wells)
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## Weight sources
|
|
232
|
+
|
|
233
|
+
`cig_bench` ships with two registries — `MODELSCOPE_REGISTRY` and `HF_REGISTRY` — that map each
|
|
234
|
+
task to a `(model_id, file_path)` pair. The active source is resolved in the following order:
|
|
235
|
+
|
|
236
|
+
1. The `source=` keyword argument passed to a predictor (`"modelscope"` or `"huggingface"`).
|
|
237
|
+
2. The environment variable `CIG_BENCH_WEIGHT_SOURCE`.
|
|
238
|
+
3. The default: `"modelscope"`.
|
|
239
|
+
|
|
240
|
+
Switch globally for all predictors:
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
export CIG_BENCH_WEIGHT_SOURCE=huggingface
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
Or per predictor:
|
|
247
|
+
|
|
248
|
+
```python
|
|
249
|
+
predictor = FaultPredictor(device="cuda", source="huggingface")
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
Aliases supported: `ms` / `model_scope` → `modelscope`; `hf` / `hugging_face` / `huggingface_hub` →
|
|
253
|
+
`huggingface`.
|
|
254
|
+
|
|
255
|
+
---
|
|
256
|
+
|
|
257
|
+
## Using local weights or a custom repo
|
|
258
|
+
|
|
259
|
+
```python
|
|
260
|
+
# 1) Use a local checkpoint (no download)
|
|
261
|
+
predictor = FaultPredictor("/path/to/fault.pth", device="cuda")
|
|
262
|
+
|
|
263
|
+
# 2) Override the default repo / filename / cache directory
|
|
264
|
+
predictor = FaultPredictor(
|
|
265
|
+
model_id="your-group/CIG-Benchmark",
|
|
266
|
+
file_path="fault.pth",
|
|
267
|
+
cache_dir="./weights_cache",
|
|
268
|
+
source="huggingface", # or "modelscope"
|
|
269
|
+
device="cuda",
|
|
270
|
+
)
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
To change the default repository IDs, edit `MODELSCOPE_DEFAULT_MODEL_ID` /
|
|
275
|
+
`HF_DEFAULT_MODEL_ID` (or the per-task entries) in
|
|
276
|
+
`cig_bench/predictor/_download.py`.
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
## Project layout
|
|
281
|
+
|
|
282
|
+
```text
|
|
283
|
+
cig_bench/
|
|
284
|
+
├── __init__.py
|
|
285
|
+
├── main.py
|
|
286
|
+
├── networks/ # HRNet variants
|
|
287
|
+
│ ├── hrnet.py
|
|
288
|
+
│ ├── hrnet_skipconect.py
|
|
289
|
+
│ └── hrnet_skipconect_opt.py
|
|
290
|
+
└── predictor/ # Inference pipelines
|
|
291
|
+
├── _download.py # Auto-download from ModelScope / HF
|
|
292
|
+
├── channel.py
|
|
293
|
+
├── fault.py
|
|
294
|
+
├── karst.py
|
|
295
|
+
├── property.py
|
|
296
|
+
├── rgt.py
|
|
297
|
+
└── utils.py
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
## Requirements
|
|
303
|
+
|
|
304
|
+
- Python ≥ 3.8
|
|
305
|
+
- `numpy ≥ 1.20`, `scipy ≥ 1.6`
|
|
306
|
+
- `torch ≥ 1.10` (GPU recommended; the predictors expose `rank` / `chunk_size` to bound memory)
|
|
307
|
+
- `cigvis` (for built-in `visualize(...)` methods)
|
|
308
|
+
- `modelscope` *and/or* `huggingface_hub` (depending on chosen weight source)
|
|
309
|
+
|
|
310
|
+
---
|
|
311
|
+
|
|
312
|
+
## Citation
|
|
313
|
+
|
|
314
|
+
If you use `cig_bench` in your research, please cite the accompanying survey & benchmark paper:
|
|
315
|
+
|
|
316
|
+
```bibtex
|
|
317
|
+
@article{dou2025cigbench,
|
|
318
|
+
title = {CIG-Bench: A Comprehensive Survey and Benchmark
|
|
319
|
+
for AI-Driven Subsurface Imaging Understanding},
|
|
320
|
+
author = {Dou, Yimin and Wu, Xinming},
|
|
321
|
+
year = {2025},
|
|
322
|
+
institution = {University of Science and Technology of China}
|
|
323
|
+
}
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
---
|
|
327
|
+
|
|
328
|
+
## License
|
|
329
|
+
|
|
330
|
+
This project is released under the [MIT License](LICENSE).
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# CIG-Bench
|
|
4
|
+
|
|
5
|
+
**A Comprehensive Benchmark Toolkit for AI-Driven Subsurface Imaging Understanding**
|
|
6
|
+
|
|
7
|
+
[](https://pypi.org/project/cig-bench/)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+
[](#requirements)
|
|
10
|
+
[](https://douyimin.github.io/CIG-bench)
|
|
11
|
+
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
`cig_bench` is the official inference library accompanying the paper
|
|
15
|
+
**"CIG-Bench: A Comprehensive Survey and Benchmark for AI-Driven Subsurface Imaging Understanding"**.
|
|
16
|
+
It provides ready-to-use, pretrained deep-learning baselines for the five core seismic-interpretation
|
|
17
|
+
tasks of CIG-Bench:
|
|
18
|
+
|
|
19
|
+
| Task | Predictor | Backbone |
|
|
20
|
+
| :--- | :--- | :--- |
|
|
21
|
+
| Fault segmentation | `FaultPredictor` | HRNet w/ skip-connection (opt.) |
|
|
22
|
+
| Relative Geologic Time (RGT) | `RGTPredictor` | HRNet w/ skip-connection (opt.) |
|
|
23
|
+
| Channel segmentation | `ChannelPredictor` | HRNet w/ skip-connection (opt.) |
|
|
24
|
+
| Karst-cave segmentation | `KarstPredictor` | HRNet w/ skip-connection (opt.) |
|
|
25
|
+
| Property modeling (Vp / Density / Impedance / GR / Lithology …) | `PropertyPredictor` | HRNet w/ skip-connection (opt.) |
|
|
26
|
+
|
|
27
|
+
All five predictors share a uniform API and load weights automatically from
|
|
28
|
+
[ModelScope](https://www.modelscope.cn/) (default) or
|
|
29
|
+
[Hugging Face Hub](https://huggingface.co/) on first use.
|
|
30
|
+
|
|
31
|
+
> 📄 Paper / project page: <https://douyimin.github.io/CIG-bench>
|
|
32
|
+
> 💻 Source code: <https://github.com/douyimin/CIG-bench>
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Table of Contents
|
|
37
|
+
|
|
38
|
+
- [Installation](#installation)
|
|
39
|
+
- [Quick start](#quick-start)
|
|
40
|
+
- [Fault segmentation](#fault-segmentation)
|
|
41
|
+
- [RGT estimation](#rgt-estimation)
|
|
42
|
+
- [Geobody segmentation (channel / karst)](#geobody-segmentation-channel--karst)
|
|
43
|
+
- [Property modeling](#property-modeling)
|
|
44
|
+
- [Weight sources](#weight-sources)
|
|
45
|
+
- [Using local weights or a custom repo](#using-local-weights-or-a-custom-repo)
|
|
46
|
+
- [Project layout](#project-layout)
|
|
47
|
+
- [Requirements](#requirements)
|
|
48
|
+
- [Citation](#citation)
|
|
49
|
+
- [License](#license)
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Installation
|
|
54
|
+
|
|
55
|
+
From PyPI:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install cig_bench
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
From source:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
git clone https://github.com/douyimin/CIG-bench.git
|
|
65
|
+
cd CIG-bench/cig_bench_pkg
|
|
66
|
+
pip install .
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
For development (editable install with dev extras):
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pip install -e ".[dev]"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
You will additionally need at least one weight backend:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Recommended for users in mainland China
|
|
79
|
+
pip install modelscope
|
|
80
|
+
|
|
81
|
+
# Or the international default
|
|
82
|
+
pip install huggingface_hub
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Quick start
|
|
88
|
+
|
|
89
|
+
The first time you build a predictor, the corresponding `.pth` checkpoint is downloaded into a local
|
|
90
|
+
cache. Subsequent constructions of the same predictor reuse the cached weights.
|
|
91
|
+
|
|
92
|
+
### Fault segmentation
|
|
93
|
+
|
|
94
|
+
The fault model predicts a probability volume that is thresholded into a fault mask. Anisotropic
|
|
95
|
+
rescaling (`scale_t`, `scale_h`, `scale_w`) adapts the model to surveys with non-square spatial
|
|
96
|
+
sampling. The optional `rank` and `chunk_size` arguments split inference along the depth axis
|
|
97
|
+
to keep GPU memory bounded on large field volumes.
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
from cig_bench.predictor.fault import FaultPredictor
|
|
101
|
+
|
|
102
|
+
fault_predictor = FaultPredictor(device="cuda")
|
|
103
|
+
prob, used = fault_predictor.predict(
|
|
104
|
+
seis,
|
|
105
|
+
rank=4, chunk_size=64, # memory-bounded chunked inference
|
|
106
|
+
threshold=0.5,
|
|
107
|
+
scale_t=0.5, scale_h=0.85, scale_w=0.85,
|
|
108
|
+
resize_back=True, # return result at the original (T, H, W)
|
|
109
|
+
)
|
|
110
|
+
fault_predictor.visualize(used, prob)
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### RGT estimation
|
|
114
|
+
|
|
115
|
+
The RGT model regresses a smooth relative-geologic-time volume; horizons are then extracted as
|
|
116
|
+
iso-surfaces of that volume. Optional sparse horizon annotations may be passed as two auxiliary
|
|
117
|
+
channels (`horizon_rgt`, `horizon_mask`) to constrain the prediction.
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
from cig_bench.predictor.rgt import RGTPredictor
|
|
121
|
+
|
|
122
|
+
rgt_predictor = RGTPredictor(device="cuda")
|
|
123
|
+
rgt_vol, used = rgt_predictor.predict(seis)
|
|
124
|
+
horizons = rgt_predictor.extract_horizons(rgt_vol, n_horizons=100)
|
|
125
|
+
rgt_predictor.visualize(used, rgt_vol, horizons)
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Geobody segmentation (channel / karst)
|
|
129
|
+
|
|
130
|
+
Both geobody predictors share the same multi-scale ensemble strategy. By default inference is run
|
|
131
|
+
at seven spatial scales (from 0.25× to 1.5× the input size) and the resulting probability volumes
|
|
132
|
+
are accumulated. A configurable post-processing step removes small connected components.
|
|
133
|
+
|
|
134
|
+
```python
|
|
135
|
+
from cig_bench.predictor.channel import ChannelPredictor
|
|
136
|
+
|
|
137
|
+
channel_predictor = ChannelPredictor(device="cuda")
|
|
138
|
+
scores, used = channel_predictor.predict(
|
|
139
|
+
seis,
|
|
140
|
+
scales=[0.5, 0.75, 1.0, 1.25, 1.5], # custom scale set
|
|
141
|
+
accumulate="sum",
|
|
142
|
+
)
|
|
143
|
+
mask = channel_predictor.postprocess(scores, threshold=0.75, min_size=50000)
|
|
144
|
+
channel_predictor.visualize(used, scores, mask)
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
The karst predictor is used identically — only the checkpoint changes:
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
from cig_bench.predictor.karst import KarstPredictor
|
|
151
|
+
|
|
152
|
+
karst_predictor = KarstPredictor(device="cuda")
|
|
153
|
+
scores, used = karst_predictor.predict(seis)
|
|
154
|
+
mask = karst_predictor.postprocess(scores, threshold=0.75, min_size=50000)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Property modeling
|
|
158
|
+
|
|
159
|
+
The property predictor follows the GEM-style conditional paradigm: it takes a seismic volume and
|
|
160
|
+
a sparse well-log property volume (zeros where no well is present) and outputs a dense 3D
|
|
161
|
+
property volume. Internally it stacks three channels — seismic, sparse property, binary well mask —
|
|
162
|
+
and feeds them to the HRNet backbone. The number and location of wells are not fixed; passing
|
|
163
|
+
more wells generally improves accuracy.
|
|
164
|
+
|
|
165
|
+
```python
|
|
166
|
+
import numpy as np
|
|
167
|
+
from cig_bench.predictor.property import PropertyPredictor
|
|
168
|
+
|
|
169
|
+
prop_predictor = PropertyPredictor(device="cuda")
|
|
170
|
+
vp_vol, used, wells = prop_predictor.predict(
|
|
171
|
+
seis, vp_log,
|
|
172
|
+
infer_shape=(640, 512, 512),
|
|
173
|
+
)
|
|
174
|
+
prop_predictor.visualize(used, vp_vol, wells)
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Weight sources
|
|
180
|
+
|
|
181
|
+
`cig_bench` ships with two registries — `MODELSCOPE_REGISTRY` and `HF_REGISTRY` — that map each
|
|
182
|
+
task to a `(model_id, file_path)` pair. The active source is resolved in the following order:
|
|
183
|
+
|
|
184
|
+
1. The `source=` keyword argument passed to a predictor (`"modelscope"` or `"huggingface"`).
|
|
185
|
+
2. The environment variable `CIG_BENCH_WEIGHT_SOURCE`.
|
|
186
|
+
3. The default: `"modelscope"`.
|
|
187
|
+
|
|
188
|
+
Switch globally for all predictors:
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
export CIG_BENCH_WEIGHT_SOURCE=huggingface
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Or per predictor:
|
|
195
|
+
|
|
196
|
+
```python
|
|
197
|
+
predictor = FaultPredictor(device="cuda", source="huggingface")
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Aliases supported: `ms` / `model_scope` → `modelscope`; `hf` / `hugging_face` / `huggingface_hub` →
|
|
201
|
+
`huggingface`.
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## Using local weights or a custom repo
|
|
206
|
+
|
|
207
|
+
```python
|
|
208
|
+
# 1) Use a local checkpoint (no download)
|
|
209
|
+
predictor = FaultPredictor("/path/to/fault.pth", device="cuda")
|
|
210
|
+
|
|
211
|
+
# 2) Override the default repo / filename / cache directory
|
|
212
|
+
predictor = FaultPredictor(
|
|
213
|
+
model_id="your-group/CIG-Benchmark",
|
|
214
|
+
file_path="fault.pth",
|
|
215
|
+
cache_dir="./weights_cache",
|
|
216
|
+
source="huggingface", # or "modelscope"
|
|
217
|
+
device="cuda",
|
|
218
|
+
)
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
To change the default repository IDs, edit `MODELSCOPE_DEFAULT_MODEL_ID` /
|
|
223
|
+
`HF_DEFAULT_MODEL_ID` (or the per-task entries) in
|
|
224
|
+
`cig_bench/predictor/_download.py`.
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Project layout
|
|
229
|
+
|
|
230
|
+
```text
|
|
231
|
+
cig_bench/
|
|
232
|
+
├── __init__.py
|
|
233
|
+
├── main.py
|
|
234
|
+
├── networks/ # HRNet variants
|
|
235
|
+
│ ├── hrnet.py
|
|
236
|
+
│ ├── hrnet_skipconect.py
|
|
237
|
+
│ └── hrnet_skipconect_opt.py
|
|
238
|
+
└── predictor/ # Inference pipelines
|
|
239
|
+
├── _download.py # Auto-download from ModelScope / HF
|
|
240
|
+
├── channel.py
|
|
241
|
+
├── fault.py
|
|
242
|
+
├── karst.py
|
|
243
|
+
├── property.py
|
|
244
|
+
├── rgt.py
|
|
245
|
+
└── utils.py
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## Requirements
|
|
251
|
+
|
|
252
|
+
- Python ≥ 3.8
|
|
253
|
+
- `numpy ≥ 1.20`, `scipy ≥ 1.6`
|
|
254
|
+
- `torch ≥ 1.10` (GPU recommended; the predictors expose `rank` / `chunk_size` to bound memory)
|
|
255
|
+
- `cigvis` (for built-in `visualize(...)` methods)
|
|
256
|
+
- `modelscope` *and/or* `huggingface_hub` (depending on chosen weight source)
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## Citation
|
|
261
|
+
|
|
262
|
+
If you use `cig_bench` in your research, please cite the accompanying survey & benchmark paper:
|
|
263
|
+
|
|
264
|
+
```bibtex
|
|
265
|
+
@article{dou2025cigbench,
|
|
266
|
+
title = {CIG-Bench: A Comprehensive Survey and Benchmark
|
|
267
|
+
for AI-Driven Subsurface Imaging Understanding},
|
|
268
|
+
author = {Dou, Yimin and Wu, Xinming},
|
|
269
|
+
year = {2025},
|
|
270
|
+
institution = {University of Science and Technology of China}
|
|
271
|
+
}
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## License
|
|
277
|
+
|
|
278
|
+
This project is released under the [MIT License](LICENSE).
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"""CIG_Bench - Computational Imaging & Geophysics benchmark toolkit.
|
|
2
|
+
|
|
3
|
+
Subpackages
|
|
4
|
+
-----------
|
|
5
|
+
- networks : HRNet-based network architectures.
|
|
6
|
+
- predictor : Inference pipelines (channel, fault, karst, property, rgt).
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
__version__ = "0.1.0"
|
|
10
|
+
|
|
11
|
+
__all__ = ["networks", "predictor"]
|