ADFWI
An Automatic Differentiation-based Waveform Inversion Framework Implemented in PyTorch.
Install / Use
/learn @liufeng2317/ADFWIREADME
- 👩💻 Introduction
- ⚡️ Installation
- 👾 Examples
- 1. Gradient Comparation between AD & Central Difference
- 2. Iso-acoustic Model Tests
- 3. Iso-elastic & VTI-elastic Model Tests
- 4. Misfits Tests
- 5. Optimizer Tests
- 6. Regularization Methods
- 7. Multi-Scale Strategy in FWI
- 8. Deep Reparameterization
- 9. Uncertainty Estimation Using Deep Neural Networks (DNNs)
- 10. New Features
- 📝 Special Features
- ⚖️ LICENSE
- 🗓️ To-Do List
- 📬 Contact & Citation
:newspaper: Latest Update (April 2025)
Our new preprint "Deep Reparameterization for Full Waveform Inversion: Architecture Benchmarking, Robust Inversion, and Multiphysics Extension" is now available on arXiv.
:triangular_flag_on_post: News (March 2025)
The article titled "Automatic Differentiation-Based Full Waveform Inversion With Flexible Workflows" has been published in JGR: Machine Learning & Computation.
:triangular_flag_on_post: News (February 2025)
The detailed document can be found at http://www.adfwi.cn/.
👩💻 Introduction
ADFWI is an open-source framework for high-resolution subsurface parameter estimation by minimizing discrepancies between observed and simulated waveform. Utilizing automatic differentiation (AD), ADFWI simplifies the derivation and implementation of full waveform inversion (FWI), enhancing the design and evaluation of methodologies. It supports wave propagation in various media, including isotropic acoustic, isotropic elastic, and both vertical transverse isotropy (VTI) and horizontal transverse isotropy (HTI) medias.
In addition, ADFWI provides a comprehensive collection of Objective functions, regularization techniques, optimization algorithms, and deep neural networks. This rich set of tools facilitates researchers in conducting experiments and comparisons, enabling them to explore innovative approaches and refine their methodologies effectively.

⚡️ Installation
To install ADFWI, please follow these steps:
-
Ensure Prerequisites
- Python 3.8+: Python Downloads.
-
Create a Virtual Environment (Optional) It is recommended to create a virtual environment using
conda:conda create --name adfwi-env python=3.8 conda activate adfwi-env -
Install Required Packages
- Method 1: Clone the github Repository
This method provides the latest version, which may be more suitable for your research:
Then, install the necessary packages:git clone https://github.com/liufeng2317/ADFWI.git cd ADFWIpip install -r requirements.txt - Method 2: Install via pip
Alternatively, you can directly install ADFWI from PyPI:
pip install ADFWI-Torch
👾 Examples
Details can be found at the codebook.
1. Gradient Comparation between AD & Central Difference
A comparative analysis of gradient calculations obtained through AD and the central difference method.
<div style="text-align: center;"> <table> <tr> <th style="text-align: center;">Test Name</th> <th style="text-align: center;">Status</th> <th style="text-align: center;">Path</th> <th style="text-align: center;">Figure</th> </tr> <tr> <td style="text-align: center; vertical-align: middle;">Acoustic (vp)</td> <td style="text-align: center; vertical-align: middle;">✅</td> <td style="text-align: center; vertical-align: middle;"> <a href="./examples/gradient_checking/Acoustic-Marmousi2/03_1_compare_gradient.ipynb">Codes</a> </td> <td style="text-align: center; vertical-align: middle;"> <!-- <details> <summary>Gradient Comparation</summary> --> <img src="./examples/gradient_checking/Acoustic-Marmousi2/data/Figure_S1_acoustic_Gradient_Cmp.png" alt="Marmousi2GradientCmp" style="max-width: 120px; height: auto; max-height: 120px;" /> <!-- </details> --> </td> </tr> <tr> <td style="text-align: center; vertical-align: middle;">Elastic (vp/vs/rho)</td> <td style="text-align: center; vertical-align: middle;">✅</td> <td style="text-align: center; vertical-align: middle;"> <a href="./examples/gradient_checking/Elastic-Marmousi2/03_1_compare_gradient.ipynb">Codes</a> </td> <td style="text-align: center; vertical-align: middle;"> <details> <summary>Gradient Comparation</summary> <img src="./examples/gradient_checking/Elastic-Marmousi2/data/Elastic_vp_grad.png" alt="Marmousi2GradientCmp" style="max-width: 120px; height: auto; max-height: 120px;" /> <img src="./examples/gradient_checking/Elastic-Marmousi2/data/Elastic_vs_grad.png" alt="Marmousi2GradientCmp" style="max-width: 120px; height: auto; max-height: 120px;" /> <img src="./examples/gradient_checking/Elastic-Marmousi2/data/Elastic_rho_grad.png" alt="Marmousi2GradientCmp" style="max-width: 120px; height: auto; max-height: 120px;" /> </details> </td> </tr> </table> </div>