nafnet-sidd-GGUF / README.md
cstr's picture
docs: add provenance / EU AI Act Art. 53 note
b2e6a55 verified
|
Raw
History Blame Contribute Delete
3.43 kB
---
license: mit
tags:
- image-restoration
- denoising
- gguf
- crispembed
- nafnet
base_model: megvii-research/NAFNet
pipeline_tag: image-to-image
---
# NAFNet-SIDD-width32 GGUF
GGUF conversion of [megvii-research/NAFNet](https://github.com/megvii-research/NAFNet) (MIT license) for use with [CrispEmbed](https://github.com/CrispStrobe/CrispEmbed) scan cleanup.
## Model
NAFNet (Non-linear Activation Free Network) is a U-Net image restoration model that achieves state-of-the-art denoising without traditional nonlinear activations. Instead it uses SimpleGate (channel split + element-wise multiply) and Simplified Channel Attention.
- **Architecture**: U-Net with NAFBlocks
- **Config**: width=32, enc=[2,2,4,8], middle=12, dec=[2,2,2,2]
- **Channels**: 32 β†’ 64 β†’ 128 β†’ 256 β†’ 512 (middle) β†’ 256 β†’ 128 β†’ 64 β†’ 32
- **Parameters**: 29.2M
- **Training**: SIDD (Smartphone Image Denoising Dataset)
- **Performance**: PSNR 39.97 dB, SSIM 0.9599 on SIDD validation
## Files
| File | Type | Size | Notes |
|------|------|------|-------|
| `nafnet-sidd-w32-f16.gguf` | F16 | 56 MB | Full precision weights |
| `nafnet-sidd-w32-q8_0.gguf` | Q8_0 | 30 MB | Recommended |
| `nafnet-sidd-w32-q4_k.gguf` | Q4_K | 16 MB | Maximum compression |
## Usage with CrispEmbed
```bash
# CLI β€” preprocess scan before OCR
./build/crispembed --cleanup -m ocr_model.gguf --ocr scan.png
# Standalone cleanup
./build/crispembed --cleanup-only scan.png
```
```python
from crispembed import CrispScanCleanup
cleanup = CrispScanCleanup("nafnet-sidd-w32-q8_0.gguf")
cleaned = cleanup.process("scan.png") # numpy RGB array
```
## Architecture Details
Each NAFBlock:
1. LayerNorm2d → Conv1x1 (c→2c) → DepthwiseConv3x3 → SimpleGate (2c→c)
2. Simplified Channel Attention (global avg pool β†’ Conv1x1)
3. Conv1x1 (c→c) → residual connection (×beta)
4. LayerNorm2d → Conv1x1 (c→2c) → SimpleGate → Conv1x1 → residual (×gamma)
Downsampling: Conv2d stride 2, kernel 2Γ—2.
Upsampling: Conv1x1 + PixelShuffle(2).
## License
MIT (megvii-research/NAFNet). The GGUF conversion does not change the license.
## Citation
```bibtex
@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}
}
```
## Provenance and EU AI Act Art. 53 note
- **Upstream model:** [megvii-research/NAFNet](https://github.com/megvii-research/NAFNet).
- **Upstream licence:** `mit`. This repository redistributes under the same terms; it grants no rights the upstream licence does not.
- **What was done here:** format conversion and/or quantisation only (GGUF). No training, no fine-tuning, no merging, no distillation, no change to architecture, vocabulary or capability. Only the numeric representation of the upstream weights differs.
- **Training data:** documented β€” where it is documented at all β€” by the upstream provider; see the upstream model card. No training data was used, added or selected by this repository.
- **Provider status:** under Regulation (EU) 2024/1689 the upstream authors remain the provider of this model. Converting the serialisation format does not make this repository the provider of a new general-purpose AI model, and no such claim is made. Questions about training content, copyright policy or model capability belong upstream.