--- license: apache-2.0 library_name: coreai pipeline_tag: image-to-image base_model: JingyunLiang/SwinIR tags: - super-resolution - swinir - coreai - apple-silicon --- # SwinIR-L real-world ×4 for Core AI The default upscaler of [`upscale`](https://github.com/arraypress/swift-upscale) and `imagine --upscale`: **faithful** 4× super-resolution — it recovers detail without inventing it. - `swinir-l-real-x4-128-float16.aimodel`: input `x` `[1,3,128,128]` float16 in `[0,1]` (RGB), output `output` `[1,3,512,512]` in `[0,1]`. Tile any picture with ~16 px overlap and feather the seams ([swift-upscale](https://github.com/arraypress/swift-upscale) does). ## Why this one Chosen in a bake-off of seven upscalers (×4 shrink-and-back on 5 generated and 5 stock photos, LPIPS lower is better): SwinIR-L scored **0.185 / 0.208** (generated / real) and 0.213 / 0.282 with blur, noise and JPEG damage, beating Real-ESRGAN x4plus (0.195 / 0.236) in every cell, with the best PSNR (28.05 / 24.45 dB). It keeps hair and foliage natural where Real-ESRGAN smooths them. ## Measured (M3 Max, macOS 27, GPU) - **Parity** with the PyTorch float32 model, per 128-px tile: **66–68 dB PSNR** (float16; float32 export 124–125 dB). Float16 is shipped: half the size, slightly faster, no visible difference. - **Tile size:** 128 px had the lowest cost per new pixel — 24.9 µs, against 26.9 at 256 px and 29.0 at 192 px. - **Seams:** a 256-px picture upscaled as overlapping tiles against PyTorch on the whole picture in one run: 41.6 dB overall, and the seam bands match as well as everywhere else (41.8 dB) — no seams. - **Speed:** 1024×1024 → 4096×4096 in **25–29 s** (three runs on a quiet machine; first load 0.2 s once compiled) — about 0.25 s per 128-px tile, so time grows with the number of tiles. ## Provenance - Weights: SwinIR `v0.0` release, `003_realSR_BSRGAN_DFOWMFC_s64w8_SwinIR-L_x4_GAN.pth`, byte-identical to the release asset (SHA-256 `99adfa91…328c0a`). - Export: `export_swinir.py` (this repository) — spandrel 0.4.1 loads the checkpoint; the attention masks are precomputed for the 128-px tile (SwinIR rebuilds them per call at other sizes, which crashed the converter); `coreai-torch 0.4.3`, `coreai-core 1.0.0b3`, float16 under autocast. - Licence: Apache-2.0 (`LICENSE`), with `NOTICE`.