Restormer
Restormer (Zamir et al., CVPR 2022): a transposed-attention U-Net transformer that removes motion blur (GoPro), rain streaks (Rain13K) or real camera noise (SIDD). MIT code and weights.
experimental Fork of swz30/Restormer@68dc6ac · backends: portable, kernels
- Paper Restormer: Efficient Transformer for High-Resolution Image Restoration CVPR 2022 · first released 18 Nov 2021
Paper 2021 Added in 0.2.0 Evaluated with 0.2.0
Use it
pip install fastforks Lean install with only what this model needs: pip install fastforks-core
from fastforks import restoration
model = restoration.load("restormer-deblur") # kernels on a supported GPU, else portable PyTorch
result = model(image)
result.image
result.backend # what ran: mode, device, dtype, kernels fastforks bench restormer-deblur Times the model on this machine. load(…, mode="portable") or mode="kernels" picks a backend; usage guide.
Speed and memory
Every backend on one GPU (RTX 5060 Ti 16 GB) and the same input, the authors’ code included. Kernels runs fp16. Portable runs fp16 on CUDA.
Input: synthetic, 512x512 (the task’s standard size)
| Backend | dtype | Time per call (ms) | vs original fp16 | Peak memory allocated / reserved | Load (s) | First call (s) |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | not measured | – | – | – | – |
| Original fp16.half() on 1 modules, fp16 inputs; upstream test.py, float32, no tile | fp16 | 234 | – | 1,221 MiB/1,418 MiB | 0.3 | 0.23 |
| Portable fp32 | fp32 | not measured | – | – | – | – |
| Portable | fp16 | 228 | 1.0× | 850 MiB/1,000 MiB | 0.3 | 0.71 |
| Kernels | fp16 | 180 | 1.3× | 850 MiB/918 MiB | 0.6 | 0.50 |
| Portable + torch.compile | 143 | 1.6× | 660 MiB/778 MiB | 44 (build) | – | |
| TensorRT fp16 | fp16 | 162 | 1.4× | 656 MiBenginenot comparable | 58 (build) | – |
Measured on RTX 5060 Ti 16 GB, torch 2.14.1+cu130, 2026-11-14 to 2026-11-15. First call, 3 warm-up, peak reset, median of 3 rounds x median of 5. Ratios divide two
times of this table (same GPU, same input). Original fp16 is the authors’ own precision option, else torch.autocast. torch.compile and TensorRT: build time instead of load time. TensorRT memory (engine, not comparable) is the GPU memory the engine took, read from the driver because TensorRT allocates outside PyTorch, so it can't be compared with the PyTorch peaks of the other rows.
Other devices
| Device | Backend | dtype | ms / call | Peak memory | Output vs reference | Input |
|---|---|---|---|---|---|---|
| Apple M1 Pro 16 GB MPS, torch 2.14.1, 2026-11-15 | Original | fp32 | 2395 | 6,858 MiB process | – | 512x512 |
| Portable | fp16 | 1476 | 3,657 MiB process | matches | 512x512 | |
| Portable | fp32 | 1376 | 4,735 MiB process | matches | 512x512 | |
| Kernels | fp16 | not implemented | – | 512x512 | ||
CUDA memory is torch’s peak allocated / reserved; Apple has no such counter, so the Mac rows show the process footprint (weights, Python and torch included). “Output vs reference” compares the device’s output with the stored golden output under the card’s tolerance; – = not checked on that device. Kernels “not implemented” = no kernels for this model on that backend yet: it runs portable there.
Licence and weights
Commercial use allowed
Our reading of the licences, not legal advice.
Weights
motion_deblurring.pth 105 MB· hosted on GitHubfastforks downloads and checks these files on first use (fastforks download restormer-deblur).
Accuracy
The test set through the authors’ code and through ours: same checkpoint, same protocol. The distance between the original’s fp32 and fp16 runs is what half precision alone costs; our runs should stay within it.
GoPro test (every 15th: 75 frames)
deblurring, PSNR / SSIM (RGB)
| Run | dtype | psnr ↑ | ssim ↑ | Δ psnr vs fp32 original | images | ms / image |
|---|---|---|---|---|---|---|
| Original fp32 | fp32 | 32.85 | 0.9405 | reference | 75 | – |
| Original fp16 | not measured | |||||
| Portable fp32 | fp32 | 32.85 | 0.9405 | ±0.00 | 75 | – |
| Portable | fp16 | 32.85 | 0.9405 | ±0.00 | 75 | – |
| Kernels | fp16 | 32.85 | 0.9405 | ±0.00 | 75 | – |
Each degraded image at its own size, one pass without tiles (the model pads internally); PSNR and SSIM of the output rounded to uint8 on RGB, no border crop, averaged over the images (the authors' test scripts). Original = the authors’ code, same checkpoint and protocol. Measured on original fp32: RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-14; portable fp32, portable, kernels: RTX 5060 Ti, torch 2.14.1+cu130, fastforks f104019b, 2026-11-14.
Closeness to the original
Beyond the test-set scores: the raw output of ours against the original’s fp32 output on the same input, pixel by pixel. CPU, float32: max |diff| <= 0.0001 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.001 and p99 <= 0.005 (absolute error of the output image).
| Check | Tolerance | Measured |
|---|---|---|
| CPU fp32, max |diff| | ≤ 0.0001 | not recorded |
| GPU default dtypes, mean |diff| | ≤ 0.001 | 0.00016 |
| GPU default dtypes, p99 |diff| | ≤ 0.005 | 0.00054 |
Recorded for restormer-deblur on RTX 5060 Ti, torch 2.14.1+cu130, 2026-11-14, with these kernels: cudnn_hacc
Details
Restormer (Zamir et al., CVPR 2022): a U-Net of transformer blocks for high-resolution image restoration: channel ('transposed') self-attention whose cost grows linearly with the pixels (MDTA) and a gated depthwise-conv feed-forward (GDFN), four 2 x down / up levels plus refinement blocks. `restormer-deblur` removes motion blur (GoPro), `restormer-derain` removes rain streaks (Rain13K), `restormer-sidd` removes smartphone sensor noise (SIDD).
- Input / output
- Input: one RGB image. Output: the restored (upscaled) image,
model.scalex the input size, RGB in [0, 1].What the numbers mean, and which models need the camera focal length
tile=runs large images in overlapping tiles (as ComfyUI). - Input size
- any H x W >= 32, padded to a multiple of 32; tested up to 1024x2048 (6,152 MiB allocated)
- Outputs
image- CUDA kernels
cudnn_haccconvolutions with fp16 accumulation (cuDNN)
- Apple (MPS)
- fp32, fp16
Full reference, generated from the repository
Restormer (Zamir et al., CVPR 2022): a transposed-attention U-Net transformer that removes motion blur (GoPro), rain streaks (Rain13K) or real camera noise (SIDD). MIT code and weights.
Commercial use: yes.
| variant | input | backend | time (ms) | peak memory (MiB, allocated / reserved) |
|---|---|---|---|---|
restormer-deblur | synthetic (512x512) | original portable kernels portable + torch.compile TensorRT fp16 | 234 228 180 143 162 | 1221 / 1418 850 / 1000 850 / 918 660 / 778 757 / 774 |
restormer-derain | synthetic (512x512) | original portable kernels portable + torch.compile TensorRT fp16 | 234 228 180 144 162 | 1221 / 1418 850 / 1000 850 / 920 660 / 778 757 / 774 |
restormer-sidd | synthetic (512x512) | original portable kernels portable + torch.compile TensorRT fp16 | 218 181 179 142 162 | 1221 / 1416 850 / 920 850 / 940 660 / 778 757 / 774 |
Details
- Original code: https://github.com/swz30/Restormer at
68dc6ac472db - Code licence: MIT (permissive); files:
LICENSE - Weights licence: MIT
- Licence evidence: https://github.com/swz30/Restormer/blob/68dc6ac472db26f16361150cb7a96a1bc87da93f/LICENSE.md ; https://github.com/swz30/Restormer/releases/tag/v1.0
- Training data: GoPro deblurring (GOPRO_Large, Nah et al. 2017: 3214 blurred / sharp frame pairs) (Motion_Deblurring/Options/Deblurring_Restormer.yml: GoPro train (2103 blurred / sharp pairs), progressive patch sizes 128 to 384.)
restormer-derain: Rain13K (13712 synthetic rainy / clean pairs merged from Rain14000, Rain1800, Rain800, Rain12; MPRNet's training set) (Deraining/Options/Deraining_Restormer.yml: Rain13K (13712 synthetic rainy / clean pairs), progressive patch sizes 128 to 384.)restormer-sidd: Smartphone Image Denoising Dataset (SIDD, noisy / ground-truth smartphone photos) (Denoising/Options/RealDenoising_Restormer.yml: SIDD-Medium sRGB (320 noisy / clean pairs), progressive patch sizes 128 to 384.)
- Kernel libraries:
cudnn_hacc - Variants:
restormer-deblur,restormer-derain,restormer-sidd - Outputs: image
- Input size: any H x W >= 32, padded to a multiple of 32
- Tested up to (portable, fp16, RTX 5060 Ti 16 GB):
restormer-deblur1024x2048 (6.0 GiB peak allocated, 8.5 reserved);restormer-derain1024x2048 (6.0 GiB peak allocated, 8.5 reserved);restormer-sidd1024x2048 (6.0 GiB peak allocated, 7.9 reserved) restormer-deblur512x512, first call: portable + torch.compile 44 s (cold Inductor cache), TensorRT fp16 58 s (ONNX + engine).restormer-derain512x512, first call: portable + torch.compile 41 s (cold Inductor cache), TensorRT fp16 55 s (ONNX + engine).restormer-sidd512x512, first call: portable + torch.compile 36 s (cold Inductor cache), TensorRT fp16 60 s (ONNX + engine).restormer-debluroriginal 512x512: .half() on 1 modules, fp16 inputs; upstream test.py, float32, no tilerestormer-derainoriginal 512x512: .half() on 1 modules, fp16 inputs; upstream test.py, float32, no tilerestormer-siddoriginal 512x512: .half() on 1 modules, fp16 inputs; upstream test.py, float32, no tilerestormer-deblurload / first call: original 0.36 s / 0.897 s, portable 0.28 s / 0.712 s, kernels 0.6 s / 0.528 srestormer-derainload / first call: original 0.34 s / 0.898 s, portable 0.29 s / 0.721 s, kernels 0.58 s / 0.527 srestormer-siddload / first call: original 0.34 s / 0.886 s, portable 0.29 s / 0.891 s, kernels 0.59 s / 0.529 s- Protocol, first call, 3 warm-up, peak reset, median of 3 rounds x median of 5
Measured
Each degraded image at its own size, one pass without tiles (the model pads internally); PSNR and SSIM of the output rounded to uint8 on RGB, no border crop, averaged over the images (the authors' test scripts). Each rainy image at its own size, one pass without tiles; PSNR and SSIM of the output rounded to uint8 on the Y channel (BT.601), no border crop, averaged over the images (Restormer's MATLAB evaluation). Original = the original code named under Details, same checkpoint and protocol.
| variant | dataset | original fp32 | portable | portable fp32 | kernels | note |
|---|---|---|---|---|---|---|
restormer-deblur | GoPro test (every 15th: 75 frames), deblurring, PSNR / SSIM (RGB) | 32.85 / 0.9405 | 32.85 / 0.9405 | 32.85 / 0.9405 | 32.85 / 0.9405 | |
restormer-derain | Rain100L test (100 images), deraining, PSNR / SSIM (Y) | 39.08 / 0.9785 | 39.08 / 0.9785 | 39.08 / 0.9785 | 39.08 / 0.9785 | |
restormer-derain | Rain100H test (100 images), deraining, PSNR / SSIM (Y) | 31.48 / 0.9054 | 31.48 / 0.9053 | 31.48 / 0.9053 | 31.48 / 0.9054 | |
restormer-sidd | SIDD validation (every 2nd: 640 crops), denoising, PSNR / SSIM (RGB) | 39.98 / 0.9226 | 39.98 / 0.9226 | 39.98 / 0.9226 | 39.98 / 0.9226 |
Measured on NVIDIA GeForce RTX 5060 Ti, torch 2.14.1+cu130, fastforks f104019b, 2026-11-14.
Parity
CPU, float32: max |diff| <= 0.0001 vs the original. GPU, float16 (the default), portable and kernels: mean |diff| <= 0.001 and p99 <= 0.005 (absolute error of the output image).
| variant | kernels error vs original, mean / p99 | GPU, torch | kernels used |
|---|---|---|---|
restormer-deblur | 0.00016 / 0.00054 | RTX 5060 Ti, torch 2.14.1+cu130 | cudnn_hacc@cudnn92400 |
restormer-derain | 0.00022 / 0.00087 | RTX 5060 Ti, torch 2.14.1+cu130 | cudnn_hacc@cudnn92400 |
restormer-sidd | 0.00019 / 0.00071 | RTX 5060 Ti, torch 2.14.1+cu130 | cudnn_hacc@cudnn92400 |
Example output
No example rendered for this checkpoint yet.