imgutils.restore.nafnet

Overview:

Restore the images using NafNet.

../../_images/nafnet_demo.plot.py.svg

This is an overall benchmark of all the NafNet models:

../../_images/nafnet_benchmark.plot.py.svg

Warning

Currently, we’ve identified a significant issue with NafNet when images contain gaussian noise. To ensure your code functions correctly, please ensure the credibility of your image source or preprocess them using SCUNet.

Note

New in version v0.4.4, images with alpha channel supported.

If you use an image with alpha channel (e.g. RGBA images), it will return a RGBA image, otherwise return RGG image.

restore_with_nafnet

imgutils.restore.nafnet.restore_with_nafnet(image: str | PathLike | bytes | bytearray | BinaryIO | Image, model: Literal['REDS', 'GoPro', 'SIDD'] = 'REDS', tile_size: int = 256, tile_overlap: int = 16, batch_size: int = 4, silent: bool = False) Image[source]

Restore an image using the NAFNet model.

Parameters:
  • image (ImageTyping) – The input image.

  • model (NafNetModelTyping) – The NAFNet model type (‘REDS’, ‘GoPro’, ‘SIDD’). Default is ‘REDS’.

  • tile_size (int) – The size of processing tiles. Default is 256.

  • tile_overlap (int) – The overlap between tiles. Default is 16.

  • batch_size (int) – The batch size of inference. Default is 4.

  • silent (bool) – If True, the progress will not be displayed. Default is False.

Returns:

The restored image.

Return type:

Image.Image