Inkvec Super-Resolution (inkvec-sr-001)
A fine-tuned MambaIRv2-Small (9.77M parameters) 4Γ super-resolution model for logos, icons and flat artwork, packaged as a pre-processing stage before vectorisation. Sharper, harder edges give a boundary tracer cleaner contours to follow.
This is the standalone release of the super-resolution pre-pass shipped inside
Inkvec, LogoLabs' raster-to-vector tracer. The
companion in-engine denoiser (a ConvNeXt U-Net for JPEG/WebP damage) is at
Logolabs/inkvec-denoiser-001.
Licence: Both the fine-tuned weights (
logo_sr_x4.pt) and the bundled MambaIRv2 architecture code are released under the Apache-2.0 Licence. Commercial, independent, and academic use are fully supported.
What it's for
Feed it a raster logo or icon that has been through JPEG/WebP compression, a screenshot pipeline, a resize, or a chat app, and it hands back a 4Γ upscaled image with sharper edges, flatter interiors, and reduced compression artefacts β purpose-built to make the downstream vectorisation step produce tighter, lower-parameter SVGs.
On JPEG q50 input the SR + trace pipeline takes ΞEββ from 1.001 to 0.438 and the parameter count from 19.81Γ the artist's to 6.78Γ. On a real wordmark: 35.57 dB vs bicubic's 31.23 dB (+4.34 dB).
Architecture
MambaIRv2-Small (Guo et al., CVPR 2025) β an Attentive State-Space Model (ASSM) with
128 prompt tokens using Gumbel-Softmax routing, built on the original MambaIR (Guo et
al., ECCV 2024). The architecture file (mambairv2_arch.py) is made standalone with vendored
to_2tuple / trunc_normal_ shims β no basicsr dependency required.
Key specs:
- Parameters: 9.77M
- Scale factor: 4Γ
- Checkpoint:
perceptual-finetune/last, step 19,000 - Weights format: fp16, ~20 MB
- Trained on: Logo + SVG-stack icon art
What's in this repo
| file | purpose |
|---|---|
logo_sr_x4.pt |
model weights (fp16, ~20 MB) + architecture kwargs |
mambairv2_arch.py |
MambaIRv2 architecture, standalone (no basicsr needed) |
requirements.txt |
Python dependencies |
Checkpoint contents
torch.load("logo_sr_x4.pt") returns a dict with keys:
arch_kwargsβ constructor arguments forMambaIRv2(**arch_kwargs)state_dictβ model weights (fp16)scaleβ upscale factor (4)trained_stepβ training step (19,000)source_runβ name of the training run
Evaluation
Scored on 120 held-out validation images at 4Γ, ranked by foreground PSNR (alpha > 0). Logos are mostly empty background, and whole-image PSNR rewards reproducing blank space β the top two models swap order between the two columns:
42.67 dB fg 43.85 dB overall perceptual-finetune/last (19000) β this checkpoint
41.99 dB fg 43.33 dB overall geometry-finetune/last (8500)
41.89 dB fg 43.48 dB overall geometry-finetune/best (8750)
41.89 dB fg 43.63 dB overall chained-x16/best (19200)
40.50 dB fg 42.66 dB overall official-x4-prodigy/best (3750)
39.98 dB fg 42.08 dB overall alpha2048/last (9000)
Usage
With Inkvec (recommended)
# Auto mode: traces first, cleans only if degradation is detected
inkvec input.png -o output.svg --sr auto
# Always clean
inkvec input.png -o output.svg --sr on
Standalone Python
import torch
from pathlib import Path
# Download from HuggingFace
from huggingface_hub import hf_hub_download
weights = hf_hub_download("Logolabs/inkvec-sr-001", "logo_sr_x4.pt")
arch_py = hf_hub_download("Logolabs/inkvec-sr-001", "mambairv2_arch.py")
# Load
import sys, importlib.util
spec = importlib.util.spec_from_file_location("mambairv2_arch", arch_py)
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod)
blob = torch.load(weights, map_location="cpu", weights_only=False)
net = mod.MambaIRv2(**blob["arch_kwargs"])
net.load_state_dict({k: v.float() for k, v in blob["state_dict"].items()}, strict=False)
net = net.cuda().eval()
# Upscale
from PIL import Image
import numpy as np
img = np.asarray(Image.open("input.png").convert("RGB"), np.float32) / 255.0
patch = torch.from_numpy(img).permute(2, 0, 1)[None].cuda()
with torch.no_grad():
out = net(patch).clamp(0, 1)
Determinism
MambaIRv2's ASSM uses F.gumbel_softmax(logits, hard=True) which samples stochastic Gumbel
noise on every forward pass β even under model.eval() and torch.no_grad(). Left unpinned,
consecutive runs of the same image produce pixel discrepancies of up to 12.45 levels.
Inkvec fixes this by pinning the RNG with seed 0x5641_4331 ("VAC1") before every forward
pass, guaranteeing bit-exact SVG reproducibility. Replacing gumbel_softmax with argmax
(zero-temperature limit) degrades quality: ΞEββ worsens from 0.5364 to 0.5492.
Requirements
torch>=2.4
numpy
Pillow
einops
timm
mamba-ssm # CUDA selective-scan kernels
Note: Inkvec's
tools/inkvec_sr/scan.pyprovides a pure-PyTorch Hillis-Steele associative scan that works without themamba-ssmCUDA kernels, enabling CPU and non-NVIDIA GPU inference (slower but functional).
Known limitations
- CUDA recommended β
mamba-ssmkernels are CUDA-only (the pure-PyTorch fallback works but is slower). - RGB-only trunk β alpha is carried through separately via Lanczos interpolation. RGB is zeroed where alpha β 0 to prevent dark halos that would become spurious traced contours.
- Domain-specific β trained on logos + SVG-stack icon art. Photographs are out of distribution.
Citation
If you use this model, please cite both Inkvec and the original MambaIRv2 paper:
@software{inkvec_sr2026,
title = {Inkvec Super-Resolution: a MambaIRv2 x4 upscaler for vectorisation pre-processing},
author = {LogoLabs and Deleanu, Stefan-Lucian},
year = {2026},
url = {https://huggingface.co/Logolabs/inkvec-sr-001}
}
@inproceedings{guo2025mambairv2,
title = {MambaIRv2: Attentive State Space Restoration},
author = {Guo, Hang and Guo, Yong and Zha, Yaohua and Zhang, Yulun and Li, Wenbo and Dai, Tao and Xia, Shu-Tao and Li, Yawei},
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
year = {2025}
}
Acknowledgements
We acknowledge EuroHPC JU for awarding the project ID EHPC-AIF-2026PG01-907 access to
resources on Arrhenius GPU at NAISS, Sweden. The Arrhenius system is operated by the
National Academic Infrastructure for Supercomputing in Sweden (NAISS). Compute time on
Arrhenius was instrumental in the wider Inkvec research effort behind this release β
including the training of the companion
inkvec-denoiser-001 restoration
model β though the super-resolution fine-tune packaged here was trained and evaluated on
local hardware.
The architecture fine-tuned here is MambaIRv2 (Guo et al., CVPR 2025), which builds on
the original MambaIR (Guo et al., ECCV 2024). We thank the authors for releasing the
official implementation under Apache-2.0 at
github.com/csguoh/MambaIR, from which the standalone
architecture file in this repository is derived.
Evaluation results
- PSNR (overall) on Logo/Icon Validation Set (120 images)self-reported43.850
- PSNR (foreground, alpha > 0) on Logo/Icon Validation Set (120 images)self-reported42.670