Reusable package for physics-aware inversion of InSAR land deformation using a compact 3D Swin Transformer with dual decoder heads for S0 and Sg.
This repository is the clean reusable package extracted from the Punjab experiments. It is designed for users who want to run the same inversion workflow on their own deformation stacks stored in NetCDF or HDF5.
- loads a deformation stack from
NetCDForHDF5 - tiles the stack into spatiotemporal windows
- trains a dual-decoder 3D Swin model with forward-consistency and smoothness regularization
- exports stitched
S0andSgpredictions back to NetCDF
The current package assumes:
- one deformation variable with shape
time x y x xafter reordering - optional
time,lat, andlonvariables - optional mask variable
The variable names and dimension order are controlled in a JSON config file, so users do not need to rename their data files.
Build the image:
docker build -t swin3d-dual-decoder-insar-inversion .Inspect your dataset:
docker run --rm \
-v $(pwd)/sample_data:/workspace/sample_data \
-v $(pwd)/runs:/workspace/runs \
swin3d-dual-decoder-insar-inversion \
inspect --config configs/example_netcdf_train.jsonTrain:
docker run --rm \
-v $(pwd)/sample_data:/workspace/sample_data \
-v $(pwd)/runs:/workspace/runs \
swin3d-dual-decoder-insar-inversion \
train --config configs/example_netcdf_train.jsonPredict:
docker run --rm \
-v $(pwd)/sample_data:/workspace/sample_data \
-v $(pwd)/runs:/workspace/runs \
swin3d-dual-decoder-insar-inversion \
predict --config configs/example_netcdf_train.json --checkpoint runs/example/checkpoints/best.ptpip install -e .Then run:
swin3d-insar-inversion inspect --config configs/example_netcdf_train.json
swin3d-insar-inversion train --config configs/example_netcdf_train.json
swin3d-insar-inversion predict --config configs/example_netcdf_train.json --checkpoint runs/example/checkpoints/best.ptsrc/swin3d_dual_decoder_insar_inversion/Core packageconfigs/Example JSON configs for NetCDF and HDF5 inputssample_data/Small bundled real-data example subsetDockerfileContainer builddocker-compose.ymlOptional local container workflow
Training writes:
history.csvmetrics.jsoncheckpoints/best.ptresolved_config.json
Prediction writes:
predictions.nc
with stitched S0_pred, Sg_pred, and prediction_count.
S0andSgare model outputs in the inversion state space. Their physical interpretation depends on the training formulation and the scaling of the forward physics.- The default training workflow is unsupervised with respect to the latent storage fields. It uses observed deformation for forward-consistency plus regularization terms.
- The package is intentionally smaller and cleaner than the Punjab working repository.
- The repository includes a tiny real Punjab subset in
sample_data/punjab_real_sample.h5so the inspect/train/predict path can be tested immediately.