BETACLARITY — BetaSR (ONNX, INT8 quantized)
Edge-optimized super-resolution and denoising for medical imaging — quantized with the OdaxAI SDK.
Research use only. This model is
not intended for clinical decision-making. See the
Disclaimer below.
What's in this repo
This repository contains the
BetaSR latent-diffusion super-resolution model exported to ONNX and quantized for edge deployment using the
OdaxAI SDK — our open-source toolkit for adaptive layer-wise quantization on consumer hardware.
| Artifact | Size | Notes |
|---|
betasr_unet_int8.onnx | 109 MB | UNet quantized to INT8 with per-channel weights via OdaxAI SDK (3.97x compression) |
betasr_unet_fp32.onnx | 434 MB | UNet, full precision (reference) |
vqvae_encoder.onnx | 85 MB | VQ-VAE encoder (frozen, from CompVis) |
vqvae_decoder.onnx | 126 MB | VQ-VAE decoder (frozen, from CompVis) |
inference_onnx.py | <10 KB | Standalone DDIM inference loop, no PyTorch required |
Total minimal footprint for inference: ~320 MB (UNet INT8 + VAE encoder + VAE decoder).
How it was quantized
The UNet (the only fine-tuned component, ~454 MB in fp32) was exported to ONNX (opset 20, dynamic spatial axes) and quantized to INT8 with the OdaxAI SDK's quantizer:
1from odaxai.quantizer import OnnxQuantizer, QuantizationConfig
2
3config = QuantizationConfig(
4 size=128,
5 format="QDQ",
6 per_channel=True,
7 activation_type="uint8",
8 weight_type="int8",
9)
10quantizer = OnnxQuantizer("betasr_unet_fp32.onnx", config)
11result = quantizer.quantize("betasr_unet_int8.onnx", benchmark=True)
The VQ-VAE is shared with CompVis/ldm-super-resolution-4x-openimages and is kept at fp32 to preserve fidelity in the encode/decode roundtrip.
Quick start
1pip install onnxruntime pillow numpy huggingface-hub
2
3# On macOS, use the CoreML execution provider for Apple Neural Engine acceleration:
4# pip install onnxruntime (already includes CoreMLExecutionProvider)
5
6# On Linux with NVIDIA GPU:
7# pip install onnxruntime-gpu
8
9# Download the bundle
10huggingface-cli download OdaxAI/betaclarity-betasr-onnx --local-dir ./betasr-onnx
11
12# Run inference (auto-selects best provider on each platform)
13python ./betasr-onnx/inference_onnx.py \
14 --model-dir ./betasr-onnx \
15 --input my_xray.png \
16 --output enhanced.png \
17 --steps 10
The script automatically picks the best execution provider available:
| Platform | Provider | Acceleration |
|---|
| macOS (any) | CoreMLExecutionProvider | Apple Neural Engine + GPU |
| Linux + NVIDIA GPU | CUDAExecutionProvider | CUDA |
| Linux / Windows CPU | CPUExecutionProvider | optimized AVX/SIMD |
Why ONNX + INT8?
| Property | PyTorch fp32 | ONNX INT8 (this repo) |
|---|
| UNet size on disk | 454 MB | 109 MB |
| Cold-start memory | ~1.6 GB | ~400 MB |
| Runtime dependencies | torch (~2 GB) + diffusers + cuda | onnxruntime (~30 MB) |
| Apple Silicon support | via Metal MPS | native CoreML / Neural Engine |
| Mobile / embedded | no | yes |
This makes BetaSR deployable on a typical laptop without a discrete GPU, including all Apple Silicon Macs, Windows-on-ARM, and Linux edge devices.
Original PyTorch model
The full-precision PyTorch checkpoint (1.59 GB, including optimizer state) is available at
OdaxAI/betaclarity-betasr. Use that if you want to fine-tune further or run training.
Quantization toolkit
This bundle was produced with the
OdaxAI SDK, our open-source toolkit for ONNX post-training quantization with calibration. Reference benchmarks from the SDK on standard models:
| Model | Original | Quantized | Compression | Speedup |
|---|
| ResNet-50 | 97.4 MB | 24.6 MB | 3.96x | 1.58x |
| DistilBERT | 253.3 MB | 63.7 MB | 3.98x | 3.09x |
| BetaSR UNet (this repo) | 433.7 MB | 109.4 MB | 3.97x | benchmark TBD |
Disclaimer
The model described in this repository is provided for research and development use only.
It is not intended for use in clinical decision-making or for any other clinical use, and the performance of the model for clinical use has not been established. You bear sole responsibility for any use of this model, including incorporation into any product intended for clinical use.
License
Apache License 2.0 — see
LICENSE.
Quantization performed with the
OdaxAI SDK — also Apache-2.0 licensed for non-commercial research.
Copyright 2026 OdaxAI SRL.