RAISR-master:google图像新压缩技术RAISR的测试
本文测试代码来自:google图像新压缩技术RAISR的测试http://m.blog.csdn.net/sparkexpert/article/details/70786666
代码见:https://github.com/MKFMIKU/RAISR
学习的时候还有几篇大神的文章利与理解的:Google超分辨率论文RAISR实现小结http://blog.csdn.net/u011630458/article/details/69524582
PAISR:Rapid and Accurate Image Super Resolution 详解(内附代码code)http://blog.csdn.net/jiangjieqazwsx/article/details/69055753,里边的code网盘我看的时候已经失效了

Cd..return last layer,先回到C根目录,一层一层回

Cd 到python35 scrips的目录,一层一层到下一目录,

然后打Pip install numpy



然后在shell里import numpy 测试一下

没有报错,说明成功
8-19需要解决的问题:
1.Pip install script下载下来安不上

解决方案:
scipy的安装需要依赖于numpy,已经安装numpy
egg文件,类似Java的jar: egg文件用easy—install 1) 下载ez_setup.py,运行python ez_setup 2) easy_install *.egg
去这个网站:http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy下载numpy和script放在scripts目录下,在scripts目录下安装。因为scipy需要numpy的mlk依赖,官网上的numpy没有这个依赖,而且要先下载numpy




测试一下成功import

参考:https://www.zhihu.com/question/30188492?sort=created
http://blog.csdn.net/u014206910/article/details/60571325
2.Opencv
同样的方式:在安装这个cv2之前,要保证已经装好了numpy


测试成功:

参考:
http://www.jianshu.com/p/e788ada70b6d
http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy
2.解决的问题:h[j,t] = sparse.linalg.cg(Q[j,t],V[j,t])[0]报错cg

解决:from scipy.sparse.linalg import cg

参考:http://m.blog.csdn.net/sparkexpert/article/details/70786666
Train.py运行成功

2.Test.py中错误
先运行train.py在运行test.py
Test.py中Pip install matplotlib

结果:

5问题

解决:把model文件夹下的东西放入C:\Program Files\Python35\Lib\site-packages

6.然后报新错误

7.新错误


在尝试了n种解决方法后,看到opencv3.2无法用imread\imwrite直接读写含有中文字符的图像路径,因此读写要用以下2个方法:
import cv2 as c
import numpy as np
img=c.imdecode(np.fromfile(path,dtype=np.uint8),0) # 读。最后一个参数:0-灰度,1-彩色
c.imencode('.jpg',img)[1].tofile(path1) # 写
所以直接换了图片路径到桌面:mat = cv2.imread("C:/Users/Administrator/Desktop/0.jpg")
运行一下,速度很慢从8:25开始到9:30结束!!!!。

对比图:

8-19日:
1.训练集,测试集来试,下载了BSD300这个数据集,解压了其中的images文件夹:
D:\BaiduNetdiskDownload\BSDS300\images
参考网址:http://blog.csdn.net/u014722627/article/details/60140789
修改train.py:

出新问题:
以前一张图片的时候没有报错,是因为没有运行下面这段代码:

所以根据理解,我这样改了一下,然后运行,速度很慢12:31开始到15:30结束:

结果:

修改test.py:


给结果创建了个文件夹。
又出现了昨天的错误,所以我还是改回了原来的一张图片来做测试,运行一次不能自己创文件夹,改回去:



等待测试结果与昨天的图比较一下,一样,17:50开始到18:30结束。
要考虑我放进去的是一张jpg图,输出的是png图,我把原图修改到原来大小的四分之一,然后变为png图0.png。

(1)将0.png放到test.py里运行得到算法放大为原来4倍的png图fig2.png。
(2)将0.png用画图手动放大到原来的4倍0big.png
等待运行结果20:40开始到21:30结束,比较0big.png和fig2.png的RAISR,报错,因为上面那个没改为png

改好之后,运行21:52开始到22:00结束,任然报错,错误在我没写出来的修改:

改回去后在运行:22:07开始到22:09结束,成功生成fig2.png。
为了更好的比较,我把原图和放大图分开显示,修改代码等待运行结果22:55开始到23:05结束:

这样修改运行成功,也将他们放到两张图中但是一张图中有两张图的位置:

虽然是一张图的大小有298kb,和235kb放在一起500kb图片分开,但是不好继续改进。
8-20日要解决的问题:继续修改text1.py,查一下python的语法。
MATLAB双线性插值的程序,看一下代码,不行就换,结束!
修改代码的时候使用plt.savefig 保存生成的图片注意顺序:在plt.show() 后调用了plt.savefig() ,在plt.show() 后实际上已经创建了一个新的空白的图片(坐标轴),这时候你再plt.savefig() 就会保存这个新生成的空白图片。所以先调用plt.savefig().
最终修改的代码:

|