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).
- Source code and weights: https://github.com/megvii-research/NAFNet
- License: MIT (code and weights), Copyright (c) 2022 megvii-model. The full license text is below.
- Training data: REDS dataset (Seungjun Nah et al., "NTIRE 2019 Challenge on Video Deblurring and Super-Resolution: Dataset and Study"), https://seungjunnah.github.io/Datasets/reds.html, licensed under Creative Commons Attribution 4.0 International (CC BY 4.0), https://creativecommons.org/licenses/by/4.0/.
Files
NAFNet_REDS.mlpackageβ Core MLmlprogram, 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