On-device ×4 super-resolution with AdcSR (Adversarial Diffusion Compression, CVPR 2025) converted for Apple’s Core AI stack. AdcSR compresses the one-step diffusion model OSEDiff into a small diffusion-GAN: a pruned Stable Diffusion 2.1 UNet + a half-size VAE decoder, run in one forward pass — no iterative denoising, no prompt, no noise — so it is fast and small enough to run fully on-device, including iPhone.
⚡ One line — this model is the default behind the kit’s task op
(import CoreAIOps; no session, no model plumbing, downloads on first use):
let big = try await CoreAI.upscale(image)
Twenty ops, one shape — Cookbook.
▶️ Run it (source) — the UpscaleDemo runner (pick a photo, upscale it ×4 on-device):
git clone https://github.com/john-rocky/coreai-kit
open coreai-kit/Examples/UpscaleDemo/UpscaleDemo.xcodeproj
# → Run, pick a photo — the app loads AdcSR ×4 (the catalog's superResolution entry) automatically
# agents / headless (macOS):
cd coreai-kit/Examples/UpscaleDemo
swift run upscale-cli --model adcsr-x4 --image sample_small.png --output big.png
💻 Build with it — complete; the glue is kit API, copy-paste runs:
import CoreAIKitVision
let resolver = try await SuperResolver(catalog: "adcsr-x4")
let image = try ImageFile.load(imageURL) // any image file → CGImage + EXIF orientation
let upscaled = try await resolver.upscale(image.cgImage)
// upscaled: CGImage — 4× the input's pixels
The take-home is Examples/UpscaleDemo/Sources/QuickStart.swift
— this exact code as one typed function, no UI; the CLI is an argument shell over it, and
the GUI runs the same resolver on the photo you pick.
Big photos? Inputs are tiled and feather-blended internally; maxInputSide (default 512)
caps the input first so a full-res phone photo can’t produce a gigapixel result.
Integration checklist
https://github.com/john-rocky/coreai-kit → product CoreAIKitVisiondownloadProgress callback)SuperResolver after tiling (baking it per-tile blows up uniform tiles).lr [1,3,128,128] in [-1,1] (a low-resolution tile).sr [1,3,512,512] in [-1,1] (×4), with the reference’s per-image color-match baked in.import CoreAIKitVision
let sr = try await SuperResolver(model: .adcsrX4) // downloads this repo on first use
let big = try await sr.upscale(cgImage) // ×4; tiles any-size input + feather-blends
SuperResolver splits any-size input into overlapping 128-px LR windows, runs each, and blends
(and caps very large inputs so the result stays a reasonable size).
This Core AI conversion inherits both. See LICENSE (Apache-2.0, AdcSR) and the SD-2.1 OpenRAIL++-M
terms.
⬇️ Download: 🤗 mlboydaisuke/AdcSR-CoreAI — this card and the
model page are the same document; scripts/gen-cards keeps the Use it block in sync.
Reproduce it: python3 conversion/zoo_convert.py show adcsr-x4 prints the command and its
prerequisites; recipe.toml is the record.