Noise2Noise: Learning Image Restoration without Clean Data——实验总结

这是一篇经典的图像去噪文章的简单测试


作者:墨理


基础信息



环境搭建(Cuda9.1):


cuda9.1 GTX 1080 11G


conda create -n n2n366 python=3.6.6

source activate n2n366

tensorflow -GPU的 安装 要使用 共享的编译好的  tensorflow-1.10.1-cp36-cp36m-linux_x86_64.whl

使用 pip install tensorflow-1.10.1-cp36-cp36m-linux_x86_64.whl 来进行安装,安装之后 pip list 查看 显示:
tensorflow         1.10.1    但是 已经可以使用。

pip install Keras==2.1.6

pip install opencv-python

pip install pillow

pip install matplotlib

#官方代码需要 安装这俩
pip install typeguard==2.2.2
pip install nibabel==2.3.0

使用数据( 人证照片 ):

train 500
test 200


训练


第二种 text 噪声 加噪去噪 效果验证:


–nb_epochs 300 训练时长 15h

nohup python train.py --image_dir dataset/train --test_dir dataset/test --image_size 128 --batch_size 4 --lr 0.001 --source_noise_model text,0,50 --target_noise_model clean --val_noise_model text,0,50 --loss mae --output_path text_clean  --nb_epochs 300 &

测试

这是一个大佬的非官方实现测试;


  • 下载预训练模型:

https://github.com/yu4u/noise2noise
0

  • 使用上面下载的预训练模型进行测试:

针对三种噪声、带噪和不带噪两种模型 的测试命令:
测试时,通过设置参数 –test_noise_model 类型,否则 默认会 添加 gaussian 噪声

python test_model.py --weight_file  weights/weights.056-4.172-28.07752_text_clean.hdf5 --image_dir dataset/commonSet --output_dir _text_clean --test_noise_model text,0,60  

python test_model.py --weight_file  weights/weights.057-4.796-27.68533_text_noise.hdf5  --image_dir dataset/commonSet --output_dir _text_noise --test_noise_model text,0,60 

python test_model.py --weight_file  weights/weights.056-66.803-30.57923_gauss_clean.hdf5  --image_dir dataset/commonSet --output_dir gaussian_clean --test_noise_model gaussian,0,60 

python test_model.py --weight_file  weights/weights.040-87.447-29.13496_gauss_noise.hdf5  --image_dir dataset/commonSet --output_dir gauss_noise --test_noise_model gaussian,0,60
python test_model.py --weight_file  weights/weights.038-4.547-24.81654_impulse_clean.hdf5  --image_dir dataset/commonSet --output_dir impulse_clean --test_noise_model impulse,0,60 

python test_model.py --weight_file  weights/weights.047-2.317-24.30238_impulse_noise.hdf5  --image_dir dataset/commonSet --output_dir impulse_noise --test_noise_model impulse,0,60

针对文本噪声测试效果如下:


纯净数据,加噪去噪,效果如下:

python test_model.py --weight_file text_clean/weights.300-1.180-36.05937.hdf5 --image_dir dataset/commonSet --output_dir commonSetOut --test_noise_model text,0,60 

图一:

1-5

带噪数据,不加噪,去噪 效果如下:

python test_model.py --weight_file text_clean/weights.300-1.180-36.05937.hdf5 --image_dir dataset/commonSet3 --output_dir commonSet3Out --test_noise_model clean

图二:

2


总结:


  noise2noise 300epoch训练得到的模型,可以较好的去除它本身加的随机 text 噪声,但是对于其他类型的文本噪声,并没有去噪效果。

原因如下:

  源代码中的 text噪声,虽说是随机生成的,但这些文本都是完整的数字或者字母,而图二: 下方的照片里面的噪声 种类 和 训练是 完全 不一致,因此它是没有 消除效果的。


  • ? 声明: 作为全网 AI 领域 干货最多的博主之一,❤️ 不负光阴不负卿 ❤️
  • 1-0

    © 版权声明
    THE END
    喜欢就支持一下吧
    点赞0 分享