Thera图像超分辨率模型使用
1 什么是 Thera
Thera:可能是目前最好的图像超分辨率技术
介绍: therasr.github.io/
demo: huggingface.co/spaces/prs-eth/thera
2 准备工作
2.1 python 执行环境
# 创建并激活虚拟环境
conda create -n py310 python=3.10
conda activate py310
# 代码下载
git clone https://github.com/prs-eth/thera.git
# 修改安装包文件 requirements.txt
# 将 jaxlib==0.4.11+cuda11.cudnn86 修改为 jax==0.4.11 CPU版本
# 安装依赖包
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
2.2 模型下载
访问 hugging face 镜像网站下载模型文件https://hf-mirror.com/prs-eth/thera-rdn-pro/tree/main,下载模型文件 model.pkl,并将其放在 super_resolve.py 同级目录下
3 模型使用
# 准备工作就绪之后 执行命令
# scale 为图像缩放参数
./super_resolve.py sample.jpg sample_res.jpg --scale 3.14 --checkpoint model.pkl
参考:
https://therasr.github.io/
https://github.com/prs-eth/thera
https://hf-mirror.com/prs-eth/thera-rdn-pro/tree/main