行业知识
UDIS图像拼接算法调试(UnsupervisedDeepImageStitching文章)
1、UDIS算法
论���名称:Unsupervised Deep Image Stitching: Reconstructing Stitched Features to Images
()代码地址:GitHub - nie-lang/UnsupervisedDeepImageStitching: TIP2021 - Unsupervised deep image stitching network
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.0anyio 3.3.4argon2-cffi 21.1.0astor 0.8.1astunparse 1.6.3attrs 21.2.0Babel 2.9.1backcall 0.2.0bleach 4.1.0brotlipy 0.7.0certifi 2021.5.30cffi 1.14.6chardet 4.0.0conda 4.10.3conda-package-handling 1.7.3cryptography 3.4.7cycler 0.11.0debugpy 1.5.1decorator 5.1.0defusedxml 0.7.1entrypoints 0.3gast 0.3.3google-pasta 0.2.0grpcio 1.41.1h5py 2.10.0idna 2.10imageio 2.33.0importlib-resources 5.4.0ipykernel 6.5.0ipython 7.29.0ipython-genutils 0.2.0ipywidgets 7.6.5jedi 0.18.0Jinja2 3.0.3json5 0.9.6jsonschema 4.2.1jupyter-client 7.0.6jupyter-core 4.9.1jupyter-server 1.11.2jupyterlab 3.2.3jupyterlab-language-pack-zh-CN 3.2.post0jupyterlab-pygments 0.1.2jupyterlab-server 2.8.2jupyterlab-widgets 1.0.2Keras-Applications 1.0.8Keras-Preprocessing 1.1.2kiwisolver 1.3.2MarkupSafe 2.0.1matplotlib 3.4.3matplotlib-inline 0.1.3mistune 0.8.4nbclassic 0.3.4nbclient 0.5.5nbconvert 6.2.0nbformat 5.1.3nest-asyncio 1.5.1networkx 3.1notebook 6.4.5numpy 1.19.5nvidia-cublas 11.5.1.101nvidia-cublas-cu114 11.6.5.2nvidia-cuda-cupti-cu114 11.4.120nvidia-cuda-nvcc-cu114 11.4.120nvidia-cuda-nvrtc 11.3.58nvidia-cuda-runtime 11.3.58nvidia-cuda-runtime-cu114 11.4.108nvidia-cudnn 8.2.0.51nvidia-cudnn-cu114 8.2.4.15nvidia-cufft-cu114 10.5.2.100nvidia-curand-cu114 10.2.5.120nvidia-cusolver-cu114 11.2.0.120nvidia-cusparse-cu114 11.6.0.120nvidia-dali-cuda110 1.6.0nvidia-dali-nvtf-plugin 1.6.0+nv21.10nvidia-nccl-cu114 2.11.4nvidia-pyindex 1.0.9nvidia-tensorflow 1.15.5+nv21.10nvidia-tensorrt 8.0.3.4opencv-python 4.8.1.78opt-einsum 3.3.0packaging 21.2pandocfilters 1.5.0parso 0.8.2pexpect 4.8.0pickleshare 0.7.5Pillow 8.4.0pip 21.1.3prometheus-client 0.12.0prompt-toolkit 3.0.22protobuf 3.19.1ptyprocess 0.7.0pycosat 0.6.3pycparser 2.20Pygments 2.10.0pyOpenSSL 20.0.1pyparsing 2.4.7pyrsistent 0.18.0PySocks 1.7.1python-dateutil 2.8.2pytz 2021.3PyWavelets 1.4.1pyzmq 22.3.0requests 2.25.1ruamel-yaml-conda 0.15.100scikit-image 0.16.2scipy 1.10.1Send2Trash 1.8.0setuptools 52.0.0.post20210125six 1.16.0sniffio 1.2.0supervisor 4.2.2tensorboard 1.15.0tensorflow-estimator 1.15.1tensorlayer 1.8.0termcolor 1.1.0terminado 0.12.1testpath 0.5.0tornado 6.1tqdm 4.61.2traitlets 5.1.1urllib3 1.26.6wcwidth 0.2.5webencodings 0.5.1websocket-client 1.2.1wheel 0.36.2widgetsnbextension 3.5.2wrapt 1.13.3zipp 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
上一篇:百度视频为什么打不开?
下一篇:电脑跟主机怎么连接不上