Views
No views yet
git clone https://huggingface.co/XiangZ/hit-sr
cd hit-sr
pip install -r requirements.txt| Repo Name | Model | Training Set | Upscale | |||
|---|---|---|---|---|---|---|
XiangZ/hit-sir-2x | HiT-SIR | DIV2K | 2x | |||
XiangZ/hit-sir-3x | HiT-SIR | DIV2K | 3x | |||
XiangZ/hit-sir-4x | HiT-SIR | DIV2K | 4x | |||
XiangZ/hit-sng-2x | HiT-SNG | DIV2K | 2x | |||
XiangZ/hit-sng-3x | HiT-SNG | DIV2K | 3x | |||
XiangZ/hit-sng-4x | HiT-SNG | DIV2K | 4x | |||
XiangZ/hit-srf-2x | HiT-SRF | DIV2K | 2x | |||
XiangZ/hit-srf-3x | HiT-SRF | DIV2K | 3x | |||
XiangZ/hit-srf-4x | HiT-SRF | DIV2K | 4x | |||
XiangZ/hit-srf-2x-df2k | HiT-SRF | DF2K | 2x | |||
XiangZ/hit-srf-3x-df2k | HiT-SRF | DF2K | 3x | |||
XiangZ/hit-srf-4x-df2k | HiT-SRF | DF2K | 4x |
from hit_sir_arch import HiT_SIR
from hit_sng_arch import HiT_SNG
from hit_srf_arch import HiT_SRF
import cv2
import torch
# detect device
device = torch.device('cuda' if torch.cuda.is_available() else 'mps' if torch.backends.mps.is_available() else 'cpu')
# initialize model (change model and upscale according to your setting)
model = HiT_SRF(upscale=4)
# load model (change repo_name according to your setting)
repo_name = "XiangZ/hit-srf-4x-df2k"
model = model.from_pretrained(repo_name)
model.to(device)
# test and save results
with torch.no_grad():
sr_results = model.infer_image("path-to-input-image", device=device)
cv2.imwrite("path-to-output-location", sr_results)@inproceedings{zhang2024hitsr,
title={HiT-SR: Hierarchical Transformer for Efficient Image Super-Resolution},
author={Zhang, Xiang and Zhang, Yulun and Yu, Fisher},
booktitle={ECCV},
year={2024}
}