1、环境配置
conda create -n restormer python=3.9
conda activate restormer
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118
pip install matplotlib scikit-learn scikit-image opencv-python yacs joblib natsort h5py tqdm
pip install einops gdown addict future lmdb numpy pyyaml requests scipy tb-nightly yapf lpips
python setup.py develop --no_cuda_ext
2、train
cd Restormer
修改 Deraining/Options/Deraining_Restormer.yml 里面的数据集路径
运行
python basicsr/train.py -opt /root/autodl-tmp/Restormer-main/Deraining/Options/Deraining_Restormer.yml
开始训练:
3、test
3.1 演示
python demo.py --task Task_Name --input_dir path_to_images --result_dir save_images_here
在图像目录上执行虚化去模糊的示例用法:
python demo.py --task Single_Image_Defocus_Deblurring --input_dir './demo/degraded/' --result_dir './demo/restored/'
直接在图像上执行 Defocus Debulling 的示例用法:
python demo.py --task Single_Image_Defocus_Deblurring --input_dir './demo/degraded/portrait.jpg' --result_dir './demo/restored/'
3.2 测试
python test.py
运行
evaluate_PSNR_SSIM.m