
可以对破损的图片进行修复,由此衍生出他的第二个功能,也即本文中的去水印,效果如下图,如果效果真的如此,那么感觉这是目前最好的一个”能实际应用到项目中去的”的去水印工具😲,毕竟用了很个多去水印的工具,没有一个好用的,废话不多说,下面试着来安装!!
需要自己训练模型,因而弃用!

安装neuralgym
//项目地址:https://github.com/JiahuiYu/generative_inpainting
#cd /usr/share/nginx/html/python
#pip3 install git+https://github.com/JiahuiYu/neuralgym
------------------------------------------------------------------------
Looking in indexes: http://mirrors.aliyun.com/pypi/simple
Collecting git+https://github.com/JiahuiYu/neuralgym
Cloning https://github.com/JiahuiYu/neuralgym to /tmp/pip-req-build-c65j26i7
Running command git clone --filter=blob:none -q https://github.com/JiahuiYu/neuralgym /tmp/pip-req-build-c65j26i7
Resolved https://github.com/JiahuiYu/neuralgym to commit 88292adb524186693a32404c0cfdc790426ea441
Preparing metadata (setup.py) ... done
Building wheels for collected packages: neuralgym
Building wheel for neuralgym (setup.py) ... done
Created wheel for neuralgym: filename=neuralgym-0.0.1-py3-none-any.whl size=40442 sha256=f3158e57a8ae8a3f4c07a27f8b647cbec2ae64087b2c6c8d91402160757cbcda
Stored in directory: /tmp/pip-ephem-wheel-cache-ltvpkxrm/wheels/85/ae/ea/bc3de80eb51055fc9eac1bff334a5e2d3afd3b904b706dd43b
Successfully built neuralgym
Installing collected packages: neuralgym
Successfully installed neuralgym-0.0.1
//复制项目(如果失败请多尝试几次)
#git clone https://github.com/JiahuiYu/generative_inpainting.git
//重命名项目为fix_img 主要是为了方便使用
#cd fix_img
#git submodule update --init --recursive
//安装tensorflow (在版本 1.3.0、1.4.0、1.5.0、1.6.0、1.7.0 上测试)。
#pip3 show tensorflow
#pip3 install tensorflow==1.13.1 -i http://mirrors.aliyun.com/pypi/simple
//解决python调用TensorFlow时出现FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecat
//把np.dtype([(“quint8”, np.uint8, 1)])修改为np.dtype([(“quint8”, np.uint8, (1,))])
//下载已经训练好的模型
https://drive.google.com/drive/folders/1uvcDgMer-4hgWlm6_G9xjvEQGP8neW15
下载模型目录并将其放在model_logs/(重命名checkpoint.txt为,checkpoint因为google驱动器在下载后自动添加ext)。如上所述运行测试或恢复训练。所有模型均使用分辨率为 256x256 且最大孔尺寸为 128x128 的图像进行训练,超过此值可能会导致结果恶化。我们提供了几个示例测试用例。请运行:
#python3 /usr/share/nginx/html/python/fix_img/test.py --image examples/places2/case1_input.png --mask examples/places2/case1_mask.png --output /root/case1_output.png --checkpoint_dir model_logs/release_places2_256