Skip to content

PyTorch Implementation of Trainable Bilateral Filter for Image Denoising

License

Notifications You must be signed in to change notification settings

sypsyp97/trainable_bilateral_filter_torch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Trainable Bilateral Filter for Image Denoising

A pure PyTorch implementation of trainable bilateral filter for image denoising, based on the paper published in Medical Physics: Ultralow-parameter denoising: Trainable bilateral filter layers in computed tomography

Example Results

GRAYSCALE RGB

Additional Features compare to the official implementation

  • Flexible processing of 2D and 3D images (currently slice-by-slice for 3D)
  • Support for both grayscale and RGB images
  • Cached kernel computations for improved performance
  • Multi-stage denoising pipeline

Future Improvements

  • Implement true 3D filtering with volumetric kernels
    • Full 3D spatial kernels using z-dimension sigma
    • 3D patch extraction with proper padding
    • Volumetric convolution for better feature preservation

Installation

  1. Clone the repository:
git clone https://github.com/sypsyp97/trainable_bilateral_filter_torch.git
cd trainable_bilateral_filter_torch
  1. Install the required dependencies:
pip install torch numpy matplotlib scikit-image loguru tqdm

Basic Usage

import torch
from bilateral_filter import DenoisingPipeline

# Initialize the model
model = DenoisingPipeline(num_stages=1)
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')

# Train the model
trained_model = train(model, clean_image, noisy_image, device=device)

# Denoise new images
with torch.no_grad():
    denoised = model(noisy_tensor)

Acknowledgments

This implementation is based on the paper Ultralow-parameter denoising: Trainable bilateral filter layers in computed tomography and acknowledges the official implementation available at: https://github.com/faebstn96/trainable-bilateral-filter-source

Citation

If you use this code in your research, please cite:

@article{wagner2022ultra,
  title={Ultralow-parameter denoising: Trainable bilateral filter layers in computed tomography},
  author={Wagner, Fabian and Thies, Mareike and Gu, Mingxuan and Huang, Yixing and Pechmann, Sabrina and Patwari, Mayank and Ploner, Stefan and Aust, Oliver and Uderhardt, Stefan and Schett, Georg and Christiansen, Silke and Maier, Andreas},
  journal={Medical Physics},
  volume={49},
  number={8},
  pages={5107-5120},
  year={2022},
  doi={https://doi.org/10.1002/mp.15718}
}

About

PyTorch Implementation of Trainable Bilateral Filter for Image Denoising

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages