Sunday, December 22, 2024

How to run HMA single image super resolution on Windows 11 computer

Prerequisites

Windows 11 PC with 64GB+ memory

Nvidia GPU with 24GB+ VRAM

Setup HMA


Install Cuda 11.8.0 https://developer.nvidia.com/cuda-toolkit-archive
Install cudnn 9.4.0 https://developer.nvidia.com/cudnn-archive

Install miniforge https://github.com/conda-forge/miniforge/releases/download/24.7.1-0/Miniforge3-24.7.1-0-Windows-x86_64.exe

Download HMA zip from https://github.com/korouuuuu/HMA 

   press code → Download ZIP onto C:\work\HMA

Fix bug of C:\work\HMA\hma\data\paired_imagenet_dataset.py according to https://github.com/korouuuuu/HMA/pull/5/files


Run Miniforge prompt and type following commands


conda update -y -n base -c defaults conda

conda update -y --all

cd C:\work\HMA

conda create -y -n HMA python=3.9

conda activate HMA

conda install -y pytorch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2 pytorch-cuda=11.8 -c pytorch -c nvidia

 pip install "numpy==1.23.0" "ipython==7.21.0" "opencv-python==4.5.4.58" "einops==0.4.1"

pip install -r requirements.txt

python setup.py develop

          


Download pretrained model file HMA_SRx2_pretrain.pth from

https://drive.google.com/drive/folders/13Bxt_BXtWgwwcO7tjfoL6zYZAUY1v3zi


Save it as

C:\work\HMA\experiments\pretrained_models\HMA_SRx2_pretrain.pth


Dataset preparation


(Dataset used is https://github.com/XPixelGroup/BasicSR/blob/master/docs/DatasetPreparation.md )


Download Set5 Set14 BSD100 Urban100 MANGA109

from https://drive.google.com/drive/folders/1gt5eT293esqY0yr1Anbm36EdnxWW_5oH


Unzip and arrange Set5 Set14 directories as

C:\work\HMA\datasets\Set5\LRbicx2

C:\work\HMA\datasets\Set5\GTmod2 (renamed from GTmod12)

C:\work\HMA\datasets\Set14\LRbicx2

C:\work\HMA\datasets\Set14\GTmod2( renamed from GTmod12)


Edit C:\work\HMA\options\test\HMA_SRx2.yml to delete test_3 test_4 test_5, leave Set5 Set14 as it is


Run test

On the Miniforge prompt

conda activate HMA

python hma/test.py -opt options/test/HMA_SRx2.yml


Suprer-esolution result images are written onto C:\work\HMA\results\HMA_test_X2\visualization


No comments:

Post a Comment