{"id":19786478,"url":"https://github.com/cszn/ffdnet","last_synced_at":"2025-04-05T16:06:12.320Z","repository":{"id":61081040,"uuid":"106525565","full_name":"cszn/FFDNet","owner":"cszn","description":"FFDNet: Toward a Fast and Flexible Solution for CNN based Image Denoising (TIP, 2018) ","archived":false,"fork":false,"pushed_at":"2021-10-09T22:05:04.000Z","size":107741,"stargazers_count":494,"open_issues_count":22,"forks_count":130,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-03-29T15:07:05.728Z","etag":null,"topics":["cnn","convolutional-neural-network","deep-learning","image-denoising","image-restoration"],"latest_commit_sha":null,"homepage":"https://ieeexplore.ieee.org/abstract/document/8365806/","language":"MATLAB","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cszn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-11T08:18:01.000Z","updated_at":"2025-03-26T14:44:06.000Z","dependencies_parsed_at":"2022-10-10T06:01:47.144Z","dependency_job_id":null,"html_url":"https://github.com/cszn/FFDNet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cszn%2FFFDNet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cszn%2FFFDNet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cszn%2FFFDNet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cszn%2FFFDNet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cszn","download_url":"https://codeload.github.com/cszn/FFDNet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247361684,"owners_count":20926643,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cnn","convolutional-neural-network","deep-learning","image-denoising","image-restoration"],"created_at":"2024-11-12T06:18:13.937Z","updated_at":"2025-04-05T16:06:12.290Z","avatar_url":"https://github.com/cszn.png","language":"MATLAB","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FFDNet\n\n![visitors](https://visitor-badge.glitch.me/badge?page_id=cszn/FFDNet) \n\n# [FFDNet: Toward a Fast and Flexible Solution for CNN based Image Denoising](https://arxiv.org/pdf/1710.04026.pdf)\n\n# New training and testing codes ([PyTorch](https://github.com/cszn/KAIR)) - 18/12/2019\n- [main_train_ffdnet.py](https://github.com/cszn/KAIR/blob/master/main_train_ffdnet.py)\n\n- [main_test_ffdnet.py](https://github.com/cszn/KAIR/blob/master/main_test_ffdnet.py)\n\n# Training and Testing Codes ([PyTorch](http://www.ipol.im/pub/pre/231/))\n\n## [FFDNet-pytorch](http://www.ipol.im/pub/pre/231/)\n### [An Analysis and Implementation of the FFDNet Image Denoising Method](http://www.ipol.im/pub/pre/231/)\n\n# PixelUnshuffle layer (PyTorch)\n\n``` python\nfrom torch.nn import Module\n\n\ndef pixel_unshuffle(input, upscale_factor):\n    r\"\"\"Rearranges elements in a Tensor of shape :math:`(C, rH, rW)` to a\n    tensor of shape :math:`(*, r^2C, H, W)`.\n    written by: Zhaoyi Yan, https://github.com/Zhaoyi-Yan\n    and Kai Zhang, https://github.com/cszn/FFDNet\n    01/01/2019\n    \"\"\"\n    batch_size, channels, in_height, in_width = input.size()\n\n    out_height = in_height // upscale_factor\n    out_width = in_width // upscale_factor\n\n    input_view = input.contiguous().view(\n        batch_size, channels, out_height, upscale_factor,\n        out_width, upscale_factor)\n\n    channels *= upscale_factor ** 2\n    unshuffle_out = input_view.permute(0, 1, 3, 5, 2, 4).contiguous()\n    return unshuffle_out.view(batch_size, channels, out_height, out_width)\n\n\nclass PixelUnShuffle(Module):\n    r\"\"\"Rearranges elements in a Tensor of shape :math:`(C, rH, rW)` to a\n    tensor of shape :math:`(*, r^2C, H, W)`.\n    written by: Zhaoyi Yan, https://github.com/Zhaoyi-Yan\n    and Kai Zhang, https://github.com/cszn/FFDNet\n    01/01/2019\n    \"\"\"\n\n    def __init__(self, upscale_factor):\n        super(PixelUnShuffle, self).__init__()\n        self.upscale_factor = upscale_factor\n\n    def forward(self, input):\n        return pixel_unshuffle(input, self.upscale_factor)\n\n    def extra_repr(self):\n        return 'upscale_factor={}'.format(self.upscale_factor)\n\n```\n\n\n# Abstract\nDue to the fast inference and good performance, discriminative learning methods have been widely studied in image denoising. However, these methods mostly learn a specific model for each noise level, and require multiple models for denoising images with different noise levels. They also lack flexibility to deal with spatially variant noise, limiting their applications in practical denoising. \nTo address these issues, we present a fast and flexible denoising convolutional neural network, namely FFDNet, with a tunable noise level map as the input. \nThe proposed FFDNet works on downsampled subimages,achieving a good trade-off between inference speed and\ndenoising performance. In contrast to the existing discriminative denoisers, FFDNet enjoys several desirable properties, including\n\n- the ability to handle a wide range of noise levels (i.e., [0, 75]) effectively with a single network, \n- the ability to remove spatially variant noise by specifying a non-uniform noise level map, and \n- faster speed than benchmark BM3D even on CPU without sacrificing denoising performance. \n\nExtensive experiments on synthetic and real noisy images are conducted to evaluate FFDNet in comparison with state-of-the-art denoisers. The results show that FFDNet is effective and efficient, making it highly attractive for practical denoising applications.\n\n# Network Architecture\n![architecture](https://github.com/cszn/FFDNet/blob/master/figs/ffdnet.png)\nThe input image is reshaped to four sub-images, which are then input to the CNN together with a noise level map. The final output is reconstructed by the four denoised sub-images\n\n# Test FFDNet Models\n- [Demo_AWGN_Gray.m](Demo_AWGN_Gray.m) is the testing demo of FFDNet for denoising grayscale images corrupted by AWGN.\n- [Demo_AWGN_Color.m](Demo_AWGN_Color.m) is the testing demo of FFDNet for denoising color images corrupted by AWGN.\n\n- [Demo_AWGN_Gray_Clip.m](Demo_AWGN_Gray_Clip.m) is the testing demo of FFDNet for denoising grayscale images corrupted by AWGN with clipping setting.\n- [Demo_AWGN_Color_Clip.m](Demo_AWGN_Color_Clip.m) is the testing demo of FFDNet for denoising color images corrupted by AWGN with clipping setting.\n\n- [Demo_REAL_Gray.m](Demo_REAL_Gray.m) is the testing demo of FFDNet for denoising real noisy (grayscale) images.\n- [Demo_REAL_Color.m](Demo_REAL_Color.m) is the testing demo of FFDNet for denoising real noisy (color) images.\n\n- [Demo_multivariate_Gaussian_noise.m](Demo_multivariate_Gaussian_noise.m) is the testing demo of FFDNet for denoising noisy images corrupted by multivariate (3D) Gaussian noise model `N([0,0,0]; Sigma)` with zero mean and covariance matrix `Sigma` in the RGB color space.\n\n\n# Results on Real Noisy Images from [The Darmstadt Noise Dataset](https://noise.visinf.tu-darmstadt.de/benchmark/#results_srgb)\n\n## PSNR: 37.61dB\n\n\nThe left is the noisy image from [The Darmstadt Noise Dataset](https://noise.visinf.tu-darmstadt.de/benchmark/#results_srgb). The right is the denoised image by FFDNet+.\n\n\u003cimg src=\"figs/0001_18.png\" width=\"400px\"/\u003e \u003cimg src=\"figs/0001_18_ffdnet.png\" width=\"400px\"/\u003e\n\n\u003cimg src=\"figs/0033_05.png\" width=\"400px\"/\u003e \u003cimg src=\"figs/0033_05_ffdnet.png\" width=\"400px\"/\u003e\n\n\u003cimg src=\"figs/0009_15.png\" width=\"400px\"/\u003e \u003cimg src=\"figs/0009_15_ffdnet.png\" width=\"400px\"/\u003e\n\n\u003cimg src=\"figs/0037_12.png\" width=\"400px\"/\u003e \u003cimg src=\"figs/0037_12_ffdnet.png\" width=\"400px\"/\u003e\n\n\n# Image Denoising for AWGN\n\nGrayscale Image Denoising\n\n\u003cimg src=\"figs/table1.png\" width=\"500px\"/\u003e \n\nColor Image Denoising\n\n\u003cimg src=\"figs/table2.png\" width=\"500px\"/\u003e \n\nThe left is the noisy image corrupted by AWGN with noise level 75. The right is the denoised image by FFDNet.\n\n\u003cimg src=\"utilities/figs/102061_75_75.png\" width=\"321px\"/\u003e \u003cimg src=\"utilities/figs/102061_75_75_PSNR_2698.png\" width=\"321px\"/\u003e\n\n# Real Image Denoising\n\nThe left is the real noisy image. The right is the denoised image by FFDNet.\n\n\u003cimg src=\"utilities/figs/David_Hilbert.jpg\" width=\"321px\"/\u003e \u003cimg src=\"utilities/figs/David_Hilbert_15.png\" width=\"321px\"/\u003e\n\n![example](https://github.com/cszn/FFDNet/blob/master/utilities/figs/Frog.gif)\n\n# Extension\n\n\u003cimg src=\"models/multivariate Gaussian noise .png\" width=\"500px\"/\u003e \n\n- [Demo_multivariate_Gaussian_noise.m](Demo_multivariate_Gaussian_noise.m) is the testing demo of FFDNet for denoising noisy images corrupted by multivariate (3D) Gaussian noise model `N([0,0,0]; Sigma)` with zero mean and covariance matrix `Sigma` in the RGB color space.\n\n# Requirements and Dependencies\nTo run the code, you should install Matconvnet first. \nAlternatively, you can use function [vl_ffdnet_matlab](utilities/vl_ffdnet_matlab.m) to perform denoising without Matconvnet.\n- MATLAB R2015b\n- [Cuda](https://developer.nvidia.com/cuda-toolkit-archive)-8.0 \u0026 [cuDNN](https://developer.nvidia.com/cudnn) v-5.1\n- [MatConvNet](http://www.vlfeat.org/matconvnet/)\n\n# Citation\n```\n@article{zhang2018ffdnet,\n  title={FFDNet: Toward a Fast and Flexible Solution for {CNN} based Image Denoising},\n  author={Zhang, Kai and Zuo, Wangmeng and Zhang, Lei},\n  journal={IEEE Transactions on Image Processing},\n  year={2018},\n}\n```\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcszn%2Fffdnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcszn%2Fffdnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcszn%2Fffdnet/lists"}