Appearance
Quickstart
This guide walks through running pretrained 4x super-resolution inference, inspecting evaluation metrics, and starting a short fine-tuning job.
1. Run Single-Image Inference (Python)
python
import torch
from PIL import Image
from sorasr.models import load_pretrained
from sorasr.engine import TiledInferencer
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
model = load_pretrained("sorasr-s-x4", map_location=device).eval()
inferencer = TiledInferencer(
model=model,
scale=4,
tile_size=256,
tile_overlap=16,
precision="bf16",
)
lr_image = Image.open("samples/street_lr.png").convert("RGB")
sr_image = inferencer.upscale_pil(lr_image)
sr_image.save("outputs/street_sr_x4.png")Tiled Inference Memory Safety
When input dimensions exceed 512 × 512, keep tile_size=256 and tile_overlap=16 enabled. Tiling caps peak GPU memory below 2.5 GB even for 4K target outputs while Hann-window blending eliminates tile seams.
2. Batch Upscaling via CLI
bash
sorasr infer \
--model sorasr-s-x4 \
--input ./samples/ \
--output ./outputs/ \
--scale 4 \
--tile-size 256 \
--precision fp163. Evaluate on a Benchmark Split
SoraSR evaluates Y-channel PSNR and SSIM after shaving scale boundary pixels by default, matching standard super-resolution protocols:
bash
sorasr eval \
--model sorasr-s-x4 \
--lr-dir ./datasets/Set14/LRbicx4 \
--hr-dir ./datasets/Set14/GTmod12 \
--scale 4 \
--metrics psnr ssim lpipsExpected output format:
text
Dataset: Set14 (14 images, scale=4, crop_border=4, test_y_channel=True)
PSNR : 28.94 dB
SSIM : 0.7912
LPIPS : 0.1426
Avg : 31.4 ms / image (RTX 4090, FP16)4. Launch a Baseline Training Job
Start a single-GPU warm-up run using the bundled DIV2K configuration:
bash
sorasr train \
--config configs/train_sorasr_s_x4.yaml \
--work-dir runs/sorasr_s_x4_div2k \
--seed 42For multi-GPU distributed training, curriculum scheduling, and perceptual fine-tuning, continue to Training Pipeline.