PyTorch and CUDA for GPR FWI
Project description
DeepGPR
DeepGPR provides a wave propagation module for PyTorch, designed for applications such as Ground Penetrating Radar (GPR) imaging and inversion. Its core concepts are derived from Deepwave. You can use it to perform both forward modeling and backpropagation—thereby enabling the simulation of wave propagation to generate synthetic data—as well as for Full Waveform Inversion (FWI). Furthermore, you can integrate this wave propagation functionality into a larger operational pipeline—incorporating various wavelets, loss functions, and other components—to achieve end-to-end forward and reverse propagation, powered by automatic differentiation and our high-performance operators.
Features
Supports 2D and 3D forward modeling of Maxwell's equations—via the Finite-Difference Time-Domain (FDTD) method—for both single and multiple excitation scenarios.
Gradients of the output receiver data can be computed with respect to model parameters (relative permittivity, conductivity), the initial wavefield, and source amplitudes.
Utilizes CPML, allowing the width of the PML layer to be configured independently for each boundary.
All operations are executed on the GPU.
Supports techniques such as checkpointing, DDP, and the utilization of CPU memory to minimize GPU memory consumption, thereby enabling the execution of large-scale models.
Start
Before use, you must ensure that you have an NVIDIA graphics card and have installed a CUDA-enabled version of PyTorch.
DeepGPR can then be installed using
pip install DeepGPR
A Small Forward Modeling Test
import torch
import DeepGPR
import matplotlib.pyplot as plt
# Set up the parameters and models
device=torch.device("cuda")
dx=0.02
dt=3e-11
nt=2000
er = torch.ones(100, 100,1) * 2
er[50:,:]=5
se = torch.zeros_like(er)
er.requires_grad_()
source_location=torch.tensor([[[10,10,0]]],device=device,dtype=torch.int)
receiver_location=torch.tensor([[[10,90,0]]],device=device,dtype=torch.int)
freq=2e8
peak_time = 1 / freq
source_amplitudes = torch.zeros((1,nt,1),device=device)
source_amplitudes[0,:,0]=DeepGPR.ricker(freq, nt, dt, peak_time).to(device)
#forward modeling
r = DeepGPR.compute(
device=device, dx=dx, dt=dt,
source_amplitudes=source_amplitudes,
source_location=source_location,
receiver_location=receiver_location,
er=er, se=se
)
(r[-1]**2).sum().backward()
_, ax = plt.subplots(1, 2, figsize=(10, 3))
ax[0].plot(r[-1].detach().flatten().cpu().numpy())
ax[0].set_title("Receiver data")
ax[1].imshow(er.grad.detach())
ax[1].set_title("Gradient")
plt.show()
There are more examples in the ./examples.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file deepgpr-0.0.4.tar.gz.
File metadata
- Download URL: deepgpr-0.0.4.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6aa84fdaaa3f7cf8f0122fa82089b0d17b4daba09d78b4699131fc0fc48d9c58
|
|
| MD5 |
2233213d8c51e18ee7f0987b85505794
|
|
| BLAKE2b-256 |
885fae7f8628b7b1585d9a346a5752fd12fef2be24d48b384d10d28745e1f1f6
|
File details
Details for the file deepgpr-0.0.4-py3-none-any.whl.
File metadata
- Download URL: deepgpr-0.0.4-py3-none-any.whl
- Upload date:
- Size: 2.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16240d2a2e08f94adca3a566fb33ee7ef3309b412da49db1265b13beaabeeea9
|
|
| MD5 |
bf59a3c14b9a2b578ecc7f2dff001ea4
|
|
| BLAKE2b-256 |
867ebf3c74a3fb39e57d870388e54ac61bedf78c99d3157c30cc7d0437fd6257
|