Views
No views yet
pip install dghs-imgutils1from imgutils.restore import restore_with_nafnet, restore_with_scunet
2from PIL import Image
3
4# Load your degraded image
5image = Image.open('degraded_image.jpg')
6
7# Restore using NAFNet (recommended for general restoration)
8restored_nafnet = restore_with_nafnet(image, model='REDS')
9
10# Restore using SCUNet (alternative approach)
11restored_scunet = restore_with_scunet(image, model='GAN')
12
13# Save restored images
14restored_nafnet.save('restored_nafnet.jpg')
15restored_scunet.save('restored_scunet.jpg')1from imgutils.restore import restore_with_nafnet
2
3# Custom processing parameters for high-resolution images
4restored_image = restore_with_nafnet(
5 image,
6 model='SIDD', # Choose from 'REDS', 'GoPro', 'SIDD'
7 tile_size=512, # Larger tiles for better performance
8 tile_overlap=32, # More overlap for seamless results
9 batch_size=8, # Higher batch size for faster processing
10 silent=False # Show progress bar
11)dghs-imgutils library which provides:1@misc{deepghs_image_restoration,
2 title = {{Image Restoration Models: NAFNet and SCUNet Implementations}},
3 author = {deepghs},
4 howpublished = {\url{https://huggingface.co/deepghs/image_restoration}},
5 year = {2023},
6 note = {High-performance image restoration models including NAFNet and SCUNet implementations for noise reduction, deblurring, and general image enhancement},
7 abstract = {This repository provides high-performance image restoration models including NAFNet and SCUNet implementations for various image enhancement tasks. The models are designed to restore degraded images by removing noise, artifacts, and other imperfections while preserving important visual details. These deep learning models leverage advanced neural network architectures optimized for computational efficiency and restoration quality. The repository contains multiple model variants trained on different datasets: NAFNet-REDS for general image restoration, NAFNet-GoPro for deblurring tasks, and NAFNet-SIDD for noise reduction. Additionally, SCUNet provides both GAN-based and PSNR-optimized approaches for comprehensive image enhancement.},
8 keywords = {image-restoration, image-enhancement, computer-vision, nafnet, scunet}
9}