movehand / raisr Goto Github PK
View Code? Open in Web Editor NEWA Python implementation of RAISR
License: MIT License
A Python implementation of RAISR
License: MIT License
Hi, nice and clean implementation, congrats.
I think the readme should explain a little bit more which kind of images to put in /train and /test (are these images the high resolution ones or the low resolution ones?)
Thank you for this!
It might be super useful to have a universal filter file that has already been trained with several images. I'd do this myself, but my laptop is pretty weak and training takes way too long.
give me the following:
Processing image 24990 of 24999 (train/5250.png)
Processing image 24991 of 24999 (train/69661.png)
Processing image 24992 of 24999 (train/86409.png)
Processing image 24993 of 24999 (train/49488.png)
Processing image 24994 of 24999 (train/10603.png)
Processing image 24995 of 24999 (train/47914.png)
Processing image 24996 of 24999 (train/93227.png)
Processing image 24997 of 24999 (train/118034.png)
Processing image 24998 of 24999 (train/155332.png)
Processing image 24999 of 24999 (train/79525.png)
Preprocessing permutation matrices P for nearly-free 8x more learning examples ...
Computing h ...
|/home/hat/.local/lib/python3.5/site-packages/numpy/linalg/linalg.py:1874: RuntimeWarning: overflow encountered in det
r = _umath_linalg.det(a, signature=signature)
Finished.
while testing the test.py, it raised an error:
File "test.py", line 27, in <module>
with open("filter", "rb") as fp:
FileNotFoundError: [Errno 2] No such file or directory: 'filter'
in train.py:
comment says # Downscale (bicubic interpolation)
but according to skimage documentation
skimage.transform.resize is using order=1 by default which is bilinear(see warp )
can you upload "filter" file? use test
if someone is interested we can work together if a GPU implementation is not already there.
Thank you
Hey, thanks for the great implementation of RAISR!
I wanted to compare it to some other solutions and noticed that the output images are [width2-1, height2-1] instead of 2x (so test.py with a 100x100 image will result in 199x199). I need to read the paper to get a better understanding but is this an expected result?
Error Code when patchsize=10 :
Q[angle,strength,coherence,pixeltype] += ATA
ValueError: operands could not be broadcast together with shapes (100,100) (121,121) (100,100)
Can't undestand why, anyone could help me ?
I've tried setting up your project using Python 2.7 (as far as I can tell PIL will not work with Python 3.x) and installed all listed dependencies. When I try running python train.py this error is encountered:
File "train.py", line 60
print('\r', end='')
^
SyntaxError: invalid syntax
Hi, does anyone know how I can resolve this issue?
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 183, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File "/usr/local/Cellar/python/3.7.2_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 109, in _get_module_details
__import__(pkg_name)
File "/Users/StephenPereira/raisr/train.py", line 14, in <module>
from skimage import transform
File "/usr/local/lib/python3.7/site-packages/skimage/__init__.py", line 167, in <module>
from .util.dtype import (img_as_float32,
File "/usr/local/lib/python3.7/site-packages/skimage/util/__init__.py", line 6, in <module>
from .apply_parallel import apply_parallel
File "/usr/local/lib/python3.7/site-packages/skimage/util/apply_parallel.py", line 8, in <module>
import dask.array as da
File "/usr/local/lib/python3.7/site-packages/dask/array/__init__.py", line 50, in <module>
from . import random, linalg, overlap, fft
File "/usr/local/lib/python3.7/site-packages/dask/array/fft.py", line 216, in <module>
fft = fft_wrap(np.fft.fft)
File "/usr/local/lib/python3.7/site-packages/dask/array/fft.py", line 142, in fft_wrap
if fft_func is scipy.fftpack.rfft:
AttributeError: module 'scipy.fftpack' has no attribute 'rfft'
what kind of picture do i have to put in the traing file
if I have a 700*700 pixels image,it can be changed to 1400 * 1400 pixels image.How can I change it to higher level images?
I used BSD500 to train raisr . but the result image is darker than the source , how can I maintain the Y component brightness
I putted the same images in the test
directory,and ues "python test.py -f filters/filter_BSDS500"to use your pretrained filter,but the results were still not clear.
If there is someting wrong with my steps,please tell me,i would be very grateful!
Thank you for your works!
I notice for test image,the default upscale time is 2,if I want to change it to 4 times,how can I realize it.
Thank you for your reply.
Traceback (most recent call last):
File "test.py", line 27, in
with open("filter", "rb") as fp:
IOError: [Errno 2] No such file or directory: 'filter'
@movehand this is an awesome project! I think that the best way to get it to grow is to add some development guidelines and some docs for other developers to hop on and help build new functionality. I think that sphinx would be a good place to get started so that docs can be created from parsing in-line documentation.
But I failed...
Firstly, I rewrote the code with Cupy rather than Numpy. However some functions used in Raisr, like gradient (maybe we can replace it with other apis available in Cupy? ), have not been realized in Cupy. I also tried to mix Numpy and Cupy. It works, but doesn't perform well. Maybe the exchange of data between GPU and CPU costs too much time.
Then, I tried Numba. Sadly its Cuda function does not support Numpy array methods. Beside, @jit does produce efficient machine code, but the promotion is limited.
To parallelize those loops, maybe we have to rewrite the code. If anyone wants to make Raisr GPU optimized on Python, contact me and we can work together.
In addition, I suggest the author to add the retraining feature by saving Q&V and other parameters. It would be useful and efficent, while eaiser to realize than GPU optimization.
Hi, it works pretty well, thank you. However I noticed the final resolution has one row and column less than expected (e.g. 256 in the source will give 511 in the result). It's a problem to measure PSNR and SSIM. Is it possible to fix that? THX
i trained using python3 train.py
all went well until this happened
Processing image 63 of 100 (train/158225.png)
Processing image 64 of 100 (train/158232.png)
Processing image 65 of 100 (train/158389.png)
Processing image 66 of 100 (train/158111.png)
Processing image 67 of 100 (train/158395.png)
Processing image 68 of 100 (train/158253.png)
Processing image 69 of 100 (train/158125.png)
Processing image 70 of 100 (train/158332.png)
Processing image 71 of 100 (train/158051.png)
Processing image 72 of 100 (train/158220.png)
Processing image 73 of 100 (train/158410.png)
OpenCV Error: Assertion failed (scn == 3 || scn == 4) in cvtColor, file /io/opencv/modules/imgproc/src/color.cpp, line 11144
Traceback (most recent call last):
File "train.py", line 54, in <module>
grayorigin = cv2.cvtColor(origin, cv2.COLOR_BGR2YCrCb)[:,:,0]
cv2.error: /io/opencv/modules/imgproc/src/color.cpp:11144: error: (-215) scn == 3 || scn == 4 in function cvtColor
kindly advise
@movehand
Hello, can I ask you a question about the running speed of the program?
GOOGLE says that the RAISR runtime is about 10^-2 to 10^-1 seconds.
But I test it and the actual running time of a 512*512 medium sized image on the i7 processor was tens of seconds.
Why the difference between the two running time is so huge?
I performed the training from scratch using the BSDS500 dataset and I noticed that the resulting filter bank is very different from the version uploaded on GitHub. Why?
I attach my version of the filter bank as .zip archive.
Hi there!
The question/suggestion is simple: can you add multithreading support? The script is currently using only one thread (of the 12 on my machine). Can this be done in the scripts them selfs, or is this an issue in Python?
Can this be trained more than once, for an improved model? Or does it overwrite any previous training and only use new data?
Line 20 in 510f730
Hi,
thanks for sharing the code. it works great.
one thing that i noticed that the code at the link above should be '==', correct? if the values are complex number, they should be converted to real.
feel free to correct me.
thanks,
jun
I used the DIV2K data set as the training set, which contains 800 images, when I was training the model, it took too long to train every single image, about 4 mins/image. So I have to use 20 images instead, but it still took about one and a half hour, so may I ask if you can share your trained filters file please?
And my email is : [email protected] , I would be greatful if you send me the file, thanks.
Do you have pre-trained filter file? It would be nice if you already have it.
This one came when I tried to train it:
C:\Users\rahma\Downloads\raisr-master\hashkey.py:40: RuntimeWarning: invalid value encountered in sqrt
sqrtlamda2 = np.sqrt(w[1])
This one came when I finished training:
C:\Users\rahma\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\linalg\linalg.py:2093: RuntimeWarning: overflow encountered in det
r = _umath_linalg.det(a, signature=signature)
This came when I tried to retrain (I tried to train using a RAW file, I think you can't use RAW files):
C:\Users\rahma\AppData\Local\Programs\Python\Python37\lib\site-packages\numpy\linalg\linalg.py:2093: RuntimeWarning: overflow encountered in det
r = _umath_linalg.det(a, signature=signature)
The code won't accept files in .tif or .tiff format, but this is a super easy fix. I cloned the repo on my local and just added '.tif', '.tiff' to the list of file extensions on line 43 in train.py and line 39 in test.py and it worked just fine.
I want to keep improving my filters!
Hi,
I wasn't able to obtain the HR results shown in the README with the pretrained filters. Would you mind sharing the filters used to generate these results?
Thank you for starting this amazing project.
Now that the result Q, P matrix can be saved in the project, Is there any researchers retrain a new filter using the pretrained filter training by BSDS datasets to enhancing the quality of your own datasets? If any, what the quality or performance is like? I'd appreciate if there are some suggestion for me.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.