Image-to-Image
PyTorch
TensorRT
ONNX
dehazing
image-restoration
lidar
rgb-d
multimodal
physics-guided
edge-ai
Instructions to use Heatdh/PhysDNet with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- TensorRT
How to use Heatdh/PhysDNet with TensorRT:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Add model card
Browse files123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312---license: mitlibrary_name: pytorchpipeline_tag: image-to-imagetags: - dehazing - image-restoration - lidar - rgb-d - multimodal - physics-guided - edge-ai - tensorrt - onnxdatasets: - SeeingThroughFog - RESIDE - SUN-RGBD---
# PhysDNet: pretrained initial weights
**PhysDNet: Physics-Driven Gradient Amplification for Real-Time Image Dehazing** (NeurIPS 2026)
[Paper (arXiv)](https://arxiv.org/abs/2611.10376) · [Code and deployment scripts (GitHub)](https://github.com/Heatdh/PhysDnet)
PhysDNet is a lightweight dehazing network. It has an image encoder and a depth encoder, combined by mask-aware gated fusion, and it is trained with a physics-guided dual-head objective. Only standard operators are used (depthwise-separable convolutions, BatchNorm, ReLU6, bilinear upsampling), so the network compiles to TensorRT and to fixed-function INT8 NPUs.
The same architecture works with or without a depth sensor. We release checkpoints for three sensor setups:
| Your sensors | Start from | Trained on ||---|---|---|| **Monochrome camera + LiDAR** | `physdnet_{l,m,s}_mono_lidar.pth` | Seeing Through Fog (automotive) || **RGB camera only** (no depth sensor) | `physdnet_m_rgb.pth` | RESIDE-6K || **RGB camera + depth sensor** (RGB-D, stereo or LiDAR) | `physdnet_m_rgbd.pth` | SUN-RGBD, Kinect v2 scenes |
If you only want plain RGB dehazing, use `physdnet_m_rgb.pth`. You don't need LiDAR, a depth sensor or the STF dataset.
---
## ⚠️ Read this first: these are initial weights
These checkpoints are **starting points for your own training**. They are not plug-and-play production models.
- Each checkpoint was trained on **one dataset** with **one sensor setup**. The STF models were trained in phases, not in one long run to convergence (see [How the checkpoints were trained](#how-the-checkpoints-were-trained)).- Each model learned its camera, its depth density and range, and the haze it was trained on. Your sensors will almost certainly differ.- **Use these weights to initialize your model, then fine-tune on data from your own sensor suite.** The section [Adapting to your sensor suite](#adapting-to-your-sensor-suite) lists what to change.- For export, TensorRT, NPU compilation and benchmarking, **follow the [GitHub repository](https://github.com/Heatdh/PhysDnet)**. This page covers only what you need to get started.
We release only the strongest checkpoint for each setup.
**Updated checkpoints are planned.** We plan to release improved checkpoints on this page. Follow this repository or watch the [GitHub repository](https://github.com/Heatdh/PhysDnet) to be notified.
---
## Released checkpoints
### Monochrome camera + LiDAR (Seeing Through Fog)
| File | Variant | Params | GMACs (256²) | PSNR / SSIM | Intended target ||---|---|---|---|---|---|| `physdnet_l_mono_lidar.pth` | PhysDNet-L (`base_ch=96`) | 6.59 M | 18.98 | 36.46 dB / 0.9606 | Best quality; GPU and Jetson-class || `physdnet_m_mono_lidar.pth` | PhysDNet-M (`base_ch=64`) | 2.95 M | 8.56 | 35.53 dB / 0.9569 | **Recommended default**; Jetson Orin || `physdnet_s_mono_lidar.pth` | PhysDNet-S (`base_ch=32`) | 0.72 M | 2.24 | 32.80 dB / 0.9331 | Low-power INT8 NPUs |
Scores are from the STF validation set with synthetic haze, at 256×256.
Measured throughput at 256×256 and batch 1:
| Variant | Jetson Orin Nano, TensorRT FP16 | Fixed-function NPU, INT8 PTQ (<4 W) ||---|---|---|| PhysDNet-L | 38.8 FPS | 29 FPS || PhysDNet-M | 58.5 FPS | 45 FPS || PhysDNet-S | 108.3 FPS | 99 FPS |
### RGB camera only (RESIDE-6K)
| File | Variant | Params | GMACs (256²) | PSNR | Notes ||---|---|---|---|---|---|| `physdnet_m_rgb.pth` | PhysDNet-M (`base_ch=64`) | 2.95 M | 6.33 (depth branch folded) | 28.4 dB on SOTS-mix (1,000 images) | Trained with no depth input |
Use this for ordinary RGB dehazing. The depth branch was given zeros throughout training. For deployment, the repository's RGB-only export folds the depth branch into constants, so the exported graph has a single image input.
### RGB camera + depth sensor (SUN-RGBD, Kinect v2)
| File | Variant | Params | GMACs (256²) | PSNR / SSIM | Notes ||---|---|---|---|---|---|| `physdnet_m_rgbd.pth` | PhysDNet-M (`base_ch=64`), no physics head | 2.91 M | 8.56 | 31.41 dB / 0.9614 | Indoor scenes, depth up to 10 m |
Scores are from a held-out 15 % of the SUN-RGBD Kinect v2 scenes with synthetic haze. During training and testing the model saw only 3 % of depth pixels, chosen at random, to imitate a sparse depth sensor. With 10 % of pixels it scores the same (31.4 dB). Quality drops to 28.7 dB at 1 % and falls steeply below that (19.3 dB at 0.3 %).
This checkpoint was trained **without the physics head**, because that version scored higher on this dataset. The deployed network is identical either way: inference uses only the direct head. If you want physics-guided fine-tuning, see step 2 of the [fine-tuning recipe](#5-recommended-fine-tuning-recipe).
Scores in each table come from a different dataset. Don't compare them across tables. Every number holds only for its own data and sensors. Expect lower numbers on your data until you fine-tune.
Each `.pth` file is a dict. `model` holds the state dict and `config` holds the training configuration, including the model variant and `max_depth`.
---
## Inputs and outputs
All checkpoints take the same three inputs. What goes into them depends on the checkpoint:
| Tensor | Shape | `*_mono_lidar` | `*_rgb` | `*_rgbd` ||---|---|---|---|---|| `rgb_hazy` | B×3×H×W, [0, 1] | 12-bit monochrome, divided by 4095, **replicated to 3 channels** | RGB, divided by 255 | RGB, divided by 255 || `sparse_depth` | B×1×H×W, [0, 1] | LiDAR depth **÷ 120 m**, clipped to [0, 1], 0 where there is no return | **all zeros** | depth **÷ 10 m**, clipped to [0, 1], 0 where there is no measurement || `mask` | B×1×H×W, {0, 1} | 1 where a LiDAR return exists | **all zeros** | 1 where depth is valid |
The model returns a dict:
- `restored`: the direct-head output. **This is the deployed output.**- `transmission`: per-pixel transmission t̂, in [0.05, 0.95].- `airlight`: global airlight Â, B×3.- `physics_restored`: the Koschmieder inversion (I − Â(1 − t̂)) / (t̂ + ε). It is used during training, and it is also useful as a diagnostic.
`physdnet_m_rgbd.pth` has no physics head, so it returns zeros for `transmission`, `airlight` and `physics_restored`.
H and W must be multiples of 16, because the encoder has four 2× downsampling stages. The network is fully convolutional, but all checkpoints were trained on **256×256 crops**.
> **Depth units:** the network expects depth that has already been normalized, by 120 m for the LiDAR models and by 10 m for the RGB-D model. Raw metres are wrong. If you call the model or an exported ONNX graph directly, normalize first.
---
## Quick start
```pythonimport torchfrom model import get_model # from the GitHub repository
ckpt = torch.load("physdnet_m_mono_lidar.pth", map_location="cpu", weights_only=False)mcfg = ckpt["config"]["model"]model = get_model(mcfg["variant"], base_ch=mcfg["base_ch"], use_physics_head=mcfg.get("use_physics_head", True)) # False for *_rgbdmodel.load_state_dict(ckpt["model"])model.eval()
MAX_DEPTH = ckpt["config"]["data"]["max_depth"] # 120.0 for *_mono_lidar, 10.0 for *_rgbd
# img: 3 x H x W float tensor in [0, 1]# (*_mono_lidar: replicate the single channel to 3 channels)# depth_m: H x W depth in metres, 0 = no measurementrgb = img[None] # 1x3xHxWdepth = (depth_m / MAX_DEPTH).clamp(0, 1)[None, None] # 1x1xHxWmask = (depth_m > 0).float()[None, None] # 1x1xHxW
# For physdnet_m_rgb.pth there is no depth: use zeros instead.# depth = torch.zeros_like(rgb[:, :1]); mask = torch.zeros_like(rgb[:, :1])
with torch.no_grad(): out = model(rgb, depth, mask)restored = out["restored"]```
If a depth model temporarily gets no depth, passing zeros for `sparse_depth` and `mask` makes the gated fusion fall back to the image branch. This works, but quality is lower. If you have no depth sensor at all, start from `physdnet_m_rgb.pth` instead.
---
## Adapting to your sensor suite
First, pick the checkpoint closest to your sensors (see the table at the top). Then work through the items below that apply to you.
### 1. Camera
**What the checkpoints saw:**- `*_mono_lidar`: 12-bit monochrome frames from the STF `cam_stereo_left` camera at 1920×1024, normalized by 4095 and replicated to 3 channels.- `*_rgb` and `*_rgbd`: 8-bit RGB images.
**What to do:**
- **Different bit depth:** normalize by your sensor's real maximum, for example 255, 1023 or 4095. Don't divide by 65535 just because the data is stored as uint16.- **RGB camera with LiDAR:** the `*_mono_lidar` models output close to greyscale on colour input, because they never saw colour. Either fine-tune `*_mono_lidar` on paired RGB data, or start from `*_rgbd` and adapt it to your LiDAR (see step 2). If you have no paired data, the repository has a label-free colour adaptation (`finetune_real_haze.py`). In that method, the physics head's output acts as a colour teacher for the direct head.- **Monochrome camera without depth:** start from `*_rgb` and replicate your channel to 3, or from `*_mono_lidar` with zero depth. Fine-tune in either case.- **Different ISP, noise or compression:** match it in your haze synthesis (see step 4).
### 2. Depth sensor
**What the checkpoints saw:**- `*_mono_lidar`: STF's 64-beam LiDAR projected into the camera image. Coverage is very sparse: about **0.22 % of pixels** have a return, and some 256 crops have none. Depth is normalized by **120 m**.- `*_rgbd`: Kinect v2 depth with 3 % of pixels kept at random, normalized by **10 m**. Because the kept pixels are spread uniformly over the image, this looks different from LiDAR scan lines.- `*_rgb`: no depth.
**What to do:**
- **Different maximum range** (aerial use, long-range LiDAR, short-range indoor sensors): set `data.max_depth` to cover your range and fine-tune. This changes the scale the depth encoder saw during training, so do not change it without fine-tuning.- **Different sampling pattern:** if your sensor gives scan lines, a solid-state pattern, stereo holes or completed depth, fine-tune with that pattern so the gated fusion learns how far to trust it.- **Sparser or intermittent depth:** enable `lidar_drop_rate` (random depth dropout during training) so the model degrades gracefully when measurements are missing.- **Calibration:** projection quality matters more than density. Check intrinsics, extrinsics and time sync. Deskew spinning LiDAR if the platform moves. An offset of a few pixels between depth and image teaches the wrong geometry.
### 3. Resolution and field of view
**What the checkpoints saw:** random **256×256** crops. The STF frames are 1920×1024. The RESIDE and SUN-RGBD images are smaller and were rescaled where needed.
**What to do:**
- Pick your deployment resolution first, because the exported ONNX and TensorRT graphs use **fixed shapes**. Fine-tune with crops at, or close to, that resolution.- A very different field of view, such as wide-angle or a nadir aerial view, changes the depth statistics and the scene layout. Plan to fine-tune for longer.
### 4. Haze synthesis (paired training data)
**What the checkpoints saw:** all were trained on synthetic haze from the Koschmieder model, I = J·t + A(1 − t) with t = exp(−β·d).- `*_mono_lidar`: β ∈ [0.005, 0.04] m⁻¹, A ∈ [0.7, 1.0], outdoor driving distances.- `*_rgbd`: β ∈ [0.1, 0.8] m⁻¹, A ∈ [0.7, 1.0], indoor distances up to 10 m.- `*_rgb`: the haze that ships with RESIDE-6K.
**What to do:**
- **Match β to your scene distances.** The same β gives much denser haze over long distances, for example in aerial use. Start from your typical visibility V using β ≈ 3.912 / V.- **Render haze from smooth, dense depth** (depth completion, stereo, photogrammetry or simulation). For the `*_mono_lidar` models, we rendered training haze from nearest-neighbour-filled sparse LiDAR, which produces piecewise-constant haze with hard cell edges. A model can learn to exploit those edges, and they do not occur in real fog. Smooth depth gives a more realistic training signal.- If you can, add non-uniform haze: spatially varying β and A, and sun glare.- Real haze often breaks the homogeneous model. The direct head is not constrained by the physics, so it can learn residual corrections. Train on whatever real or semi-real pairs you have.
### 5. Recommended fine-tuning recipe
This is a starting point, not a tuned result:
1. Load the checkpoint you want and keep the architecture (`variant`, `base_ch`) unchanged.2. Keep the physics head **on** during training. It costs nothing at inference. It helps most when transmission is anchored: if you have depth, synthesize haze from it and supervise t̂ with the depth-derived transmission (`w_trans`). Without depth, as with `*_rgb`, expect it to be neutral rather than helpful. On SUN-RGBD it lowered the score, which is why `*_rgbd` ships without it, so compare both settings on your own data. To add the physics head to `*_rgbd`, build the model with `use_physics_head=True` and load the checkpoint with `strict=False`. The transmission and airlight heads then start from random weights.3. Use a lower learning rate than training from scratch, for example **5e-5 to 1e-4** with AdamW, a short warmup and cosine decay. If you have only a few hundred frames, freeze the encoders for the first few epochs.4. Start with reconstruction, physics and transmission losses only. Add the auxiliary terms (`w_fft`, `w_contrast`) later, as we did for the STF models.5. Select checkpoints by validation PSNR on **your** data, and check real hazy frames qualitatively. Synthetic-haze PSNR alone can hide shortcuts.
---
## How the checkpoints were trained
**Monochrome camera + LiDAR (`*_mono_lidar`)**
| Setting | Value ||---|---|| Data | Seeing Through Fog (Bijelic et al., CVPR 2020): 3,786 clear or overcast training frames, synthetic haze generated on the fly || Crops | 256×256, batch 16 (M), AdamW, lr 2e-4, weight decay 1e-4, grad clip 1.0 || Losses | Charbonnier reconstruction, perceptual (0.05), gradient (0.5), physics consistency (0.2), physics reconstruction (1.0), transmission supervision (2.0), transmission smoothness (0.1), FFT (0.1), contrastive (0.1) || Schedule | Phased: 10-epoch warmup, then cosine decay. The contrastive term starts at epoch 185. The run was resumed and extended to about 550 epochs. The checkpoint was selected by best validation PSNR |
**RGB only (`*_rgb`)**
| Setting | Value ||---|---|| Data | RESIDE-6K training split. Depth and mask inputs are zero throughout || Recipe | Same as above, but without transmission supervision (`w_trans = 0`), because RESIDE has no depth. 600-epoch budget, checkpoint selected by best validation PSNR || Test | SOTS-mix, 1,000 images |
**RGB + depth (`*_rgbd`)**
| Setting | Value ||---|---|| Data | SUN-RGBD, Kinect v2 scenes, 85 % train and 15 % test by scene. Haze synthesized on the fly from the Kinect depth || Depth input | 3 % of pixels kept at random, normalized by 10 m, with a validity mask || Recipe | Same data-driven losses as the STF models, with the physics head and its losses switched off. Checkpoint selected by best validation PSNR |
Inference uses the direct head only for all checkpoints. Where a checkpoint has a physics head, it is used during training only.
Because each model was trained on one dataset, and the STF models on a phased schedule, we describe the released weights as **initial weights**. They have not been fully converged or tuned for any particular deployment.
---
## Deployment
For deployment, follow the repository. In short:
1. Export to ONNX at a **fixed** input resolution (`export_to_onnx.py`). For `*_rgb`, use `export_rgb_only.py`, which produces a graph with a single image input.2. Build a TensorRT FP16 engine on the target device (for example with `trtexec`). Benchmark end to end, including depth projection.3. Optional: build an INT8 engine with calibration on representative hazy frames **from your sensors**. Dehazing is sensitive to quantization. On our NPU, vanilla INT8 PTQ cost about 1.5 dB.
---
## Limitations
- Each model was trained on a single dataset: driving scenes (STF), mixed indoor and outdoor scenes (RESIDE), or indoor scenes (SUN-RGBD). Other domains, such as aerial or maritime, need fine-tuning.- All training haze is synthetic and mostly homogeneous. Real fog, rain and snow differ from it.- Without adaptation, the `*_mono_lidar` models output monochrome images.- Dehazing does not automatically improve downstream detection. On real haze, check task metrics with your own detector before relying on dehazed frames.- This is a research release. Do not use it as the only perception input in safety-critical systems without your own validation.
---
## Citation
```bibtex@inproceedings{dhahri2026physdnet, title = {PhysDNet: Physics-Driven Gradient Amplification for Real-Time Image Dehazing}, author = {Dhahri, Rayen and Sun, Lei and Kartsch Morinigo, Victor Javier and Pagnoux, Alice and Benini, Luca and Paudel, Danda Pani and Van Gool, Luc}, booktitle = {Advances in Neural Information Processing Systems (NeurIPS)}, year = {2026}}```
Please also cite the dataset behind the checkpoint you use:
```bibtex@inproceedings{bijelic2020seeing, title = {Seeing Through Fog Without Seeing Fog: Deep Multimodal Sensor Fusion in Unseen Adverse Weather}, author = {Bijelic, Mario and Gruber, Tobias and Mannan, Fahim and Kraus, Florian and Ritter, Werner and Dietmayer, Klaus and Heide, Felix}, booktitle = {CVPR}, year = {2020}}
@article{li2019reside, title = {Benchmarking Single-Image Dehazing and Beyond}, author = {Li, Boyi and Ren, Wenqi and Fu, Dengpan and Tao, Dacheng and Feng, Dan and Zeng, Wenjun and Wang, Zhangyang}, journal = {IEEE Transactions on Image Processing}, year = {2019}}
@inproceedings{song2015sunrgbd, title = {SUN RGB-D: A RGB-D Scene Understanding Benchmark Suite}, author = {Song, Shuran and Lichtenberg, Samuel P. and Xiao, Jianxiong}, booktitle = {CVPR}, year = {2015}}```README.mdAdded+312