Saltar al contenido
ModelPublicadoExterno
Browse files

ViT ISR Tiny LSDIR

A Vision Transformer for ×4 image super-resolution — built entirely from scratch in PyTorch, trained on 76,716 real-world images from the LSDIR benchmark, a tiny model with less than million parameters

TipoOtherVersiónModel weightsBcalidad

Fuente del modelo

Tipo
Other
Tamaño del archivo
3,03–9,10 MB
Versión
vModel weights
Actualizado
9 oct 2026
Fuente
Hugging Face

Descripción de la fuente

ViT-ISR-Tiny: Vision Transformer for ×4 Image Super-Resolution

PyTorch PSNR Params

A Vision Transformer for ×4 image super-resolution — built entirely from scratch in PyTorch, trained on 76,716 real-world images from the LSDIR benchmark, a tiny model with less than million parameters

👉 Try the Live Demo


What it does

Takes a low-resolution image and reconstructs a ×4 higher-resolution version using global self-attention — capturing long-range spatial relationships across the entire image rather than just local neighborhoods like CNNs do.


Architecture

The pipeline: patch embed → transformer blocks → reshape → PixelShuffle upsample → RGB output.

ComponentDetails
Patch size2×2 → 1,024 tokens per image
Embedding dim64
Transformer blocks6 (pre-norm, residual)
Attention heads4
MLP hidden dim256
Upsampling3× PixelShuffle ×2 (×8 total)
Parameters~786K · ~3 MB (fp32)

Why pre-norm: LayerNorm before each sub-layer keeps the residual path clean, stabilizing training in deep stacks.

Why PixelShuffle: Learned upsampling — the model decides what to put in new pixels by redistributing channel information into space, rather than stretching with interpolation.

Why patch size 2: Finer tokens preserve more spatial detail for reconstruction. Larger patches are cheaper but lose the high-frequency information SR depends on.


Training

SettingValue
DatasetLSDIR (76,716 train / 4,263 test)
OptimizerAdamW (lr=2e-4)
LossL1
Mixed precisionfp16 AMP
Batch size16
DegradationBicubic ×4 downscaling
HardwareRTX 4060 Laptop (8GB)

Test PSNR: 23.30 dB — evaluated on the held-out test split (never seen during training or checkpoint selection).


Usage

from huggingface_hub import hf_hub_download
import torch

weights_path = hf_hub_download("Sathya77/ViT-ISR-Tiny-LSDIR", "sr_best.pt")
checkpoint = torch.load(weights_path, map_location="cpu")

model = ImageSRTransformer()   # from model_architecture.py
model.load_state_dict(checkpoint["model_state_dict"])
model.eval()

Files

FileDescription
sr_best.ptBest checkpoint (weights + optimizer state)
model_weights.ptWeights only — for inference
config.jsonArchitecture config
training_config.jsonTraining config and results

Fuentes

1 fuente
Hugging FacePrincipalVersión 2f887fb3891e1d72ba3f59635f457ab5c2cc02ab
huggingface.co/Sathya77/ViT-ISR-Tiny-LSDIR/tree/2f887fb3891e1d72ba3f59635f457ab5c2cc02ab

Verificado 9 oct

Download files

Artefactos del modelo

2 artefactos

model_weights.pt

pt · 3,03 MB · SHA-256 0137e0236a7f…905b · Hugging Face

Download file

sr_best.pt

pt · 9,10 MB · SHA-256 baacfd3fea30…5c5d · Hugging Face

Download file

Extractos de fuentes

2 extractos

--- tags: - image-super-resolution - vision-transformer - pytorch - computer-vision - super-resolution - lsdir datasets: - LSDIR metrics: - psnr --- # ViT-ISR-Tiny: Vision Transformer for ×4 Image Super-Resolution ![PyTorch](https://img.shields.io/badge/Framework-PyTorch-orange) ![PSNR](https://img.shields.io/badge/Test%20PSNR-23.30%20dB-green) ![Params](https://img.shields.io/badge/Parameters-786K-lightgrey) A Vision Transformer for ×4 image super-resolution — built entirely from scratch in PyTorch, trained on 76,716 real-world images from the LSDIR benchmark, a tiny model with less than million parameters 👉 **[Try the Live Demo](https://huggingface.co/spaces/Sathya77/ViT-ISR-Tiny-LSDIR)** --- ## What it does Takes a low-resolution image and reconstructs a ×4 higher-resolution version using global self-attention — capturing long-range spatial relationships across the entire image rather than just local neighborhoods like CNNs do. --- ## Architecture The pipeline: patch embed → transformer blocks → reshape → PixelShuffle upsample → RGB output. | Component | Details | |-----------|---------| | Patch size | 2×2 → 1,024 tokens per image | | Embedding dim | 64 | | Transformer blocks | 6 (pre-norm, residual) | | Attention heads | 4 | | MLP hidden dim | 256 | | Upsampling | 3× PixelShuffle ×2 (×8 total) | | Parameters | ~786K · ~3 MB (fp32) | **Why pre-norm:** LayerNorm before each sub-layer keeps the residual path clean, stabilizing training in deep stacks. **Why PixelShuffle:** Learned upsampling — the model decides what to put in new pixels by redistributing channel information into space, rather than stretching with interpolation. **Why patch size 2:** Finer tokens preserve more spatial detail for reconstruction. Larger patches are cheaper but lose the high-frequency information SR depends on. --- ## Training | Setting | Value | |---------|-------| | Dataset | LSDIR (76,716 train / 4,263 test) | | Optimizer | AdamW (lr=2e-4) | | Loss | L1 | | Mixed precision | fp16 AMP | | Batch size | 16 | | Degradation | Bicubic ×4 downscaling | | Hardware | RTX 4060 Laptop (8GB) | **Test PSNR: 23.30 dB** — evaluated on the held-out test split (never seen during training or checkpoint selection). --- ## Usage ```python from huggingface_hub import hf_hub_download import torch weights_path = hf_hub_download("Sathya77/ViT-ISR-Tiny-LSDIR", "sr_best.pt")...

Source context: 0 downloads · 0 likes · Repo Sathya77/ViT-ISR-Tiny-LSDIR