1、UDIS算法
论文名称:Unsupervised Deep Image Stitching: Reconstructing Stitched Features to Images
1、配置环境
UDIS算法本身环境:
-
python 3.6
-
numpy 1.18.1
-
tensorflow 1.13.1
-
tensorlayer 1.8.0
pip install tensorflow-gpu==1.13.1 -i https://mirrors.aliyun.com/pypi/simple/ pip install tensorflow==1.13.1 -i https://mirrors.aliyun.com/pypi/simple/ pip install opencv-python -i https://mirrors.aliyun.com/pypi/simple/ pip install scikit-image==0.16.2 -i https://mirrors.aliyun.com/pypi/simple/
论文中在RTX 2080T训练,未在RTX 2080T实验,据说RTX30系列配置不了TensorFlow1环境,反正作者实验在30系列失败。因此选择在网上租服务器。选择在autodl网站租服务器:AutoDL算力云 | 弹性、好用、省钱。租GPU就上AutoDL,在任意服务器都有TensorFlow1.15环境,因此选择RTX 3090T,24G训练。下面是详细环境情况,可以进行参考。
absl-py 1.0.0 anyio 3.3.4 argon2-cffi 21.1.0 astor 0.8.1 astunparse 1.6.3 attrs 21.2.0 Babel 2.9.1 backcall 0.2.0 bleach 4.1.0 brotlipy 0.7.0 certifi 2021.5.30 cffi 1.14.6 chardet 4.0.0 conda 4.10.3 conda-package-handling 1.7.3 cryptography 3.4.7 cycler 0.11.0 debugpy 1.5.1 decorator 5.1.0 defusedxml 0.7.1 entrypoints 0.3 gast 0.3.3 google-pasta 0.2.0 grpcio 1.41.1 h5py 2.10.0 idna 2.10 imageio 2.33.0 importlib-resources 5.4.0 ipykernel 6.5.0 ipython 7.29.0 ipython-genutils 0.2.0 ipywidgets 7.6.5 jedi 0.18.0 Jinja2 3.0.3 json5 0.9.6 jsonschema 4.2.1 jupyter-client 7.0.6 jupyter-core 4.9.1 jupyter-server 1.11.2 jupyterlab 3.2.3 jupyterlab-language-pack-zh-CN 3.2.post0 jupyterlab-pygments 0.1.2 jupyterlab-server 2.8.2 jupyterlab-widgets 1.0.2 Keras-Applications 1.0.8 Keras-Preprocessing 1.1.2 kiwisolver 1.3.2 MarkupSafe 2.0.1 matplotlib 3.4.3 matplotlib-inline 0.1.3 mistune 0.8.4 nbclassic 0.3.4 nbclient 0.5.5 nbconvert 6.2.0 nbformat 5.1.3 nest-asyncio 1.5.1 networkx 3.1 notebook 6.4.5 numpy 1.19.5 nvidia-cublas 11.5.1.101 nvidia-cublas-cu114 11.6.5.2 nvidia-cuda-cupti-cu114 11.4.120 nvidia-cuda-nvcc-cu114 11.4.120 nvidia-cuda-nvrtc 11.3.58 nvidia-cuda-runtime 11.3.58 nvidia-cuda-runtime-cu114 11.4.108 nvidia-cudnn 8.2.0.51 nvidia-cudnn-cu114 8.2.4.15 nvidia-cufft-cu114 10.5.2.100 nvidia-curand-cu114 10.2.5.120 nvidia-cusolver-cu114 11.2.0.120 nvidia-cusparse-cu114 11.6.0.120 nvidia-dali-cuda110 1.6.0 nvidia-dali-nvtf-plugin 1.6.0+nv21.10 nvidia-nccl-cu114 2.11.4 nvidia-pyindex 1.0.9 nvidia-tensorflow 1.15.5+nv21.10 nvidia-tensorrt 8.0.3.4 opencv-python 4.8.1.78 opt-einsum 3.3.0 packaging 21.2 pandocfilters 1.5.0 parso 0.8.2 pexpect 4.8.0 pickleshare 0.7.5 Pillow 8.4.0 pip 21.1.3 prometheus-client 0.12.0 prompt-toolkit 3.0.22 protobuf 3.19.1 ptyprocess 0.7.0 pycosat 0.6.3 pycparser 2.20 Pygments 2.10.0 pyOpenSSL 20.0.1 pyparsing 2.4.7 pyrsistent 0.18.0 PySocks 1.7.1 python-dateutil 2.8.2 pytz 2021.3 PyWavelets 1.4.1 pyzmq 22.3.0 requests 2.25.1 ruamel-yaml-conda 0.15.100 scikit-image 0.16.2 scipy 1.10.1 Send2Trash 1.8.0 setuptools 52.0.0.post20210125 six 1.16.0 sniffio 1.2.0 supervisor 4.2.2 tensorboard 1.15.0 tensorflow-estimator 1.15.1 tensorlayer 1.8.0 termcolor 1.1.0 terminado 0.12.1 testpath 0.5.0 tornado 6.1 tqdm 4.61.2 traitlets 5.1.1 urllib3 1.26.6 wcwidth 0.2.5 webencodings 0.5.1 websocket-client 1.2.1 wheel 0.36.2 widgetsnbextension 3.5.2 wrapt 1.13.3 zipp 3.6.0
2、训练情况
第一阶段ImageAlignment
1、准备数据集
下载COCO数据集中的val2014:COCO - Common Objects in Context
cd ImageAlignment/ python synthetic_dataset.py
运行后生成50000张训练集,5000张测试集-MSCOCO。
下载UDIS-D数据集:UDIS-D_免费高速下载|百度网盘-分享无限制 (baidu.com)密码:1234
2、训练代码
1、基于MSCOO数据集,修改constant.py文件中的TRAIN_FOLDER'/'ITERATIONS=600000'/'GPU,原batch_size是4,本人训练的时候改为了8。训练了36小时。保存训练文件的文件checkpoints_homo里是空的就可以,原代码迭代200000次保存一次,本人修改为100000保存一次,训练600000次结束。sunmary存放训练日志,使用tensorboard查看训练日志情况,命令行中输入tensorboard --logdir=xxx,这里的xxx是你的日志文件存放的文件夹路径。
cd ImageAlignment/Codes/ 运行python train_H.py
2、基于UDIS数据集,又修改constant.py文件中的TRAIN_FOLDER'/'ITERATIONS=1000000'/'GPU,原batch_size是4,因为耗内存,本人训练的时候又改为了4。训练了22小时。,其实,UDIS数据集只训练了400000,但是因为是在MSCOCO数据集的基础上训练的,即600000次文件上,只有设置为1000000,才能继续训练。这里的checkpoints_homo文件不是为空,而是要有刚才的训练文件600000次。
cd ImageAlignment/Codes/ 运行python train_H.py
3、测试代码
修改'ImageAlignment/Codes/constant.py' 中的 'TEST_FOLDER=UDIS中的testing文件'/'GPU'
1、测试PSNR和SSIM
运行python inference.py
2、生成训练第二阶段需要的数据集warp1/warp2/mask1/mask2,修改'ImageAlignment/Codes/constant.py' 中的 'TRAIN_FOLDER=UDIS中的training文件'/'GPU'/TEST_FOLDER=UDIS中的testing文件
python output_inference.py
第二阶段ImageReconstruction
1、准备文件
下载vgg19.npy文件:GitHub - machrisaa/tensorflow-vgg: VGG19 and VGG16 on Tensorflow,然后移动vgg19.npy到 'ImageReconstruction/vgg19/'。
2、训练代码
修改'ImageReconstruction/Codes/constant.py' 文件中的'TRAIN_FOLDER'/'ITERATIONS=200000'/'GPU,训练文件存在checkpoints文件夹中,保证文件夹为空。
cd ImageReconstruction/Codes/ 运行python train.py
3、测试代码
生成拼接图片
修改'ImageReconstruction/Codes/constant.py' 中的 'TEST_FOLDER'/'GPU'
运行python inference.py