Skip to main content

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)

DeepGPR.plot_survey_geometry(er,source_location, receiver_location,dx)

#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()

result

result

There are more examples in the ./examples.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deepgpr-0.0.2.tar.gz (346.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deepgpr-0.0.2-py3-none-any.whl (350.2 kB view details)

Uploaded Python 3

File details

Details for the file deepgpr-0.0.2.tar.gz.

File metadata

  • Download URL: deepgpr-0.0.2.tar.gz
  • Upload date:
  • Size: 346.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.14

File hashes

Hashes for deepgpr-0.0.2.tar.gz
Algorithm Hash digest
SHA256 d7a5e221b95dc29934e40bc5452dd277818e7d2a34b4fb7436cd9d797b84d35a
MD5 307035f960a63426c73c9b9273f7f912
BLAKE2b-256 aef0abdb67be2d793e402616cf2caf60d6aef53b87742a14eeb07d9757d76164

See more details on using hashes here.

File details

Details for the file deepgpr-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: deepgpr-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 350.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.14

File hashes

Hashes for deepgpr-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c2d45bf4b4876aa74f742eb3cdefaff9f61023b61b63db43a1e3a9c874a651be
MD5 014c5fa66bf5beae85faa19ad9b62a74
BLAKE2b-256 83cf28116ea13773ac6f0f6d11f1abfa8c579b9b1953aebb3a0f73d60f80ee77

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page