RAISR-master: The test code debugging record of RAISR, a new compression technology for google Images (Python implementation, without any knowledge of python, including pip install solution ),

Source: Internet
Author: User
Tags install matplotlib

RAISR-master: The test code debugging record of RAISR, a new compression technology for google Images (Python implementation, without any knowledge of python, including pip install solution ),

RAISR-master: test the new google Image Compression Technology RAISR

The test code of this article comes from: the test http://m.blog.csdn.net/sparkexpert/article/details/70786666 of the new google Image Compression Technology RAISR.

See: https://github.com/MKFMIKU/RAISR for code

When learning there are several great god's article profit and understanding: Google super resolution paper RAISR implementation summary http://blog.csdn.net/u011630458/article/details/69524582

PAISR: Rapid and Accurate Image Super Resolution

 

 

Cd .. return last layer, first return to the C root directory, layer by layer

 

Cd to the directory of Python 35 scrips, one layer to the next directory,

 

Run Pip install numpy.

 

Then import numpy in shell to test it.

No error reported, indicating success

Problems to be Solved:

1. Pip install script cannot be downloaded

Solution:

Scipy installation depends on numpy. numpy has been installed.

Egg file, similar to Java jar: egg file, use easy-install
1) download ez_setup.py and run python ez_setup
2) easy_install *. egg

Go to this website: http://www.lfd.uci.edu /~ Gohlke/pythonlibs/# numpy download numpy and script are stored in the scripts directory and installed in the scripts directory. Because scipy requires numpy mlk dependency, numpy on the official website does not have this dependency, and you need to download numpy first.

 

 

Test the import successfully.

Reference: https://www.zhihu.com/question/30188492? Sort = created

Http://blog.csdn.net/u014206910/article/details/60571325

2. Opencv

In the same way: before installing cv2, make sure that numpy has been installed.

Test successful:

Refer:

Http://www.jianshu.com/p/e788ada70b6d

Http://www.lfd.uci.edu /~ Gohlke/pythonlibs/# numpy

2. Solved problems: h [j, t] = sparse. linalg. cg (Q [j, t], V [j, t]) [0] Error cg

Solution: from scipy. sparse. linalg import cg

Reference: http://m.blog.csdn.net/sparkexpert/article/details/70786666

Train. py runs successfully

 

2. Error in Test. py

Run train. py first and run test. py.

Pip install matplotlib in Test. py

Result:

5 Problems

 

Solution: Put the items in the model folder into C: \ Program Files \ Python35 \ Lib \ site-packages.

6. Then, a new error is reported.

 

7. New errors

 

After trying n solutions, we can see that opencv3.2 cannot use imread \ imwrite to directly read and write image paths containing Chinese characters. Therefore, the following two methods are required for reading and writing:

Import cv2 as c

Import numpy as np

Img = c. imdecode (np. fromfile (path, dtype = np. uint8), 0) # Read. Last parameter: 0-gray, 1-color

C.imencode('.jpg ', img) [1]. tofile (path1) # Write

So I directly changed the image path to the Desktop: mat = cv2.imread ("C:/Users/Administrator/Desktop/0.jpg ")

Run it. The speed starts from !!!!.

 

Comparison chart:

 

 

October 19:

1. train set, test set, download the BSD300 dataset, and decompress the images Folder:

D: \ BaiduNetdiskDownload \ BSDS300 \ images

Reference: http://blog.csdn.net/u014722627/article/details/60140789

Modify train. py:

New problem:

In the previous image, no error was reported because the following code was not run:

 

So as I understand it, I changed it and ran it at a very slow speed from:

Result:

Modify test. py:

A folder is created for the result.

Another error occurred yesterday, so I switched back to an original image for testing. I couldn't create my own folder once I ran it, and changed it back:

 

 

Wait for the test results to compare with the figure shown yesterday. Similarly, the test results will end from.

I want to import a jpg image, and the output is a PNG image. I changed the original image to 1/4 of the original size, and then changed it to PNG Image 0.png.

 

(1)put 0.png to test.pyand run it to the original pngmap fig2.png in the algorithm.

(2) manually scale 0.png images to the original 4x 0big.png

Wait until the running result starts from to and compare the RAISR of 0big.pngand fig2.png. The error is reported because the previous one was not changed to png.

After the change, run and end at. If any of the errors is reported, I did not write the changes:

After the change is made, go to "22: 07" and start at, and generate "fig2.png" successfully.

For better comparison, I will display the source image and the enlarged image separately, and modify the code to wait until the running result starts from:

In this way, the operation is successful, and they are also placed in two graphs, but one graph has two positions:

Although the size of an image is 298kb and is separated from kb, it is difficult to continue improving.

Problem to be solved on October 20: Continue to modify text1.py and check the python syntax.

MATLAB bilinear interpolation program, look at the code, don't change, end!

Useplt.savefigNote the sequence of saving the generated images: Inplt.show()And then calledplt.savefig(), Inplt.show()You have created a new blank image (coordinate axis ).plt.savefig()The new blank image is saved. So call plt. savefig () first ().

Final modified code:

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.