assafshocher / ZSSR

"Zero-Shot" Super-Resolution using Deep Internal Learning
Other
402 stars 102 forks source link

is jpg LR image support? #7

Closed Frankdog closed 5 years ago

Frankdog commented 6 years ago

I check the code, seems only png LR image support SR. Is other format image support (eg: jpg).

assafshocher commented 6 years ago

Hi, While ZSSR is able to handle JPEG artifacts, we technically only tested it on PNG files, so can't guarantee anything about other formats. one possibility is just transform your JPEG into PNG. Another way is to contribute a fix for supporting other formats (I will not be available to work on it anytime soon). Hope that helps!

SunnerLi commented 6 years ago

Hi @Frankdog and @assafshocher , In this two days, I also testing toward this project and notice the problem. The author use matplotlib to load the image. However, the data range is different in these two cases. If the image format is PNG, then the data range is between [0, 1]; If the image format is JPG, then the data range is between [0, 255]. Maybe you can divide the value directly after the image is loaded. Just revise as following in ZSSR.py line 65:

# Read input image (can be either a numpy array or a path to an image file)
self.input = input_img if type(input_img) is not str else img.imread(input_img)
self.input /= 255.0