NAFNet REDS (width 64) β€” Core ML

Core ML conversion of NAFNet ("Simple Baselines for Image Restoration", Liangyu Chen, Xiaojie Chu, Xiangyu Zhang, Jian Sun) with the pretrained deblurring weights NAFNet-REDS-width64.pth. It removes motion and camera blur from a photo. Used on device by the Halo iPhone app (the "Remove blur" tool).

Files

  • NAFNet_REDS.mlpackage β€” Core ML mlprogram, minimum deployment target iOS 18.

Conversion

  • Input input: RGB image 384 Γ— 384, pixel values 0…255 (scaling to 0…1 and back happens inside the model).
  • Output output: RGB image 384 Γ— 384, 0…255 (clamped to 0…1 inside the model).
  • Precision: float16 for the whole model. PSNR of PyTorch fp32 against Core ML on four tiles: 59.9–62.7 dB.
  • LayerNorm2d is rewritten with plain operations so the model traces; otherwise the network is unchanged.
  • Larger photos are processed in 384 Γ— 384 tiles with a 64 px overlap and blended back together.

The conversion script lives in the Halo app's repository at Tools/ModelConversion/convert_nafnet.py.

MIT License (NAFNet)

MIT License

Copyright (c) 2022 megvii-model

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Downloads last month
13
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support