Based on this repository - the official PyTorch implementation of SwinIR: Image Restoration Using Swin Transformer.
SwinIR.py
is a minimal wrapper for the super resolution model, making it easy to use as a part from a bigger pipeline.network_swinir.py
from the official repo (unchanged).As a quick preview, this example demonstrates usage with only few lines:
import cv2
from SwinIR_wrapper import SwinIR_SR
# initialize super resolution model
sr = SwinIR_SR(model_type='real_sr', scale=4)
# load low quality image
img_lq = cv2.imread(path, cv2.IMREAD_COLOR)
# feed the image to the SR model
img_hq = sr.upscale(img_lq)
Please follow the license of the official repo of this paper. Thanks for their great work!