Downloads · 30 days
0
mikestealth/nafnet-models
nafnet-models is a machine learning model from mikestealth. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
[](https://github.com/mikecokina/nafnetlib) [](https://opensource.org/license/mit) [](https://www.python.org/doc/versions/)
Downloads · 30 days
0
Access
Public
Updated Nov 27, 2024
Repo size
1.2 GB
Likes
2
Public
Click a slice to open those files.
.pth1.2 GB · 100%
From the Hugging Face model README
A streamlined implementation of inference for the megvii-research/NAFNet model, focusing solely on straightforward prediction tasks without additional features like training or fine-tuning.
This repository contains implementations of the NAFNet (Nonlinear Activation Free Network) for image restoration tasks such as deblurring and denoising. The core of the project includes a modular framework for easy processing of images using pre-trained models.
Via PyPI
You can easily install the nafnetlib package from PyPI:
pip install nafnetlib
You can install the dependencies using pip:
pip install -r requirements.txt
These dependencies will be automatically installed when you install nafnetlib via pip.
Initialization and Image Processing To use the deblurring or denoising functionality, you can initialize the corresponding processor class (DeblurProcessor or DenoiseProcessor), and then use the process() method to process images.
Here’s an example of how to use the DeblurProcessor and DenoiseProcessor:
from PIL import Image
from nafnetlib import DeblurProcessor, DenoiseProcessor
# Initialize the deblurring processor
db_processor = DeblurProcessor(
model_id="reds_width64",
model_dir="/absolute/path/to/model/directory",
device="cuda"
)
# Print available models
print(db_processor.available_models())
# Initialize the denoising processor
db_processor = DenoiseProcessor(
model_id="sidd_width64",
model_dir="/absolute/path/to/model/directory",
device="cuda"
)
# Load image for processing
img_path = "path/to/image/file"
image = Image.open(img_path)
# Process the image (e.g., deblur or denoise)
db_processor.process(image).show()
The following models are available for different image restoration tasks:
Models: gopro_width64, gopro_width32
Models: sidd_width64, sidd_width32
Models: reds_width64
These models are derived from the megvii-research/nafnet GitHub repository.
Baseline-GoPro-*, Baseline-SIDD-* and NAFSSR-L_*
When initializing the processors, models are automatically downloaded if they are not found in the specified directory.
Supported models come from megvii-research/nafnet.
Feel free to fork the repository and submit issues or pull requests. Contributions are welcome!
This project is licensed under the MIT License - see the LICENSE file for details.
If NAFNet helps your research or work, please consider citing NAFNet.
@article{chen2022simple,
title={Simple Baselines for Image Restoration},
author={Chen, Liangyu and Chu, Xiaojie and Zhang, Xiangyu and Sun, Jian},
journal={arXiv preprint arXiv:2204.04676},
year={2022}
}
If NAFSSR helps your research or work, please consider citing NAFSSR.
@InProceedings{chu2022nafssr,
author = {Chu, Xiaojie and Chen, Liangyu and Yu, Wenqing},
title = {NAFSSR: Stereo Image Super-Resolution Using NAFNet},
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) Workshops},
month = {June},
year = {2022},
pages = {1239-1248}
}