Open IamGroot19 opened 4 years ago
Hi, thanks for commenting.
Supporting a grayscale image means slightly modifying the network architecture. This can be done in the config file, line 55. Just change the first conv-layer to get 1 input channel: [3, 3, 1, self.width]. (note that the image still needs to have channels-axis but it will be a singleton.
Another solution is to concatenate the image to itself channel-wise to get an RGB image that looks the same as your grayscale prior to inputting it to ZSSR.
In the future I will ad automatic support when identifying a grayscale image.
Thanks!
Hi, thanks for the quick response.
I tried both of your solutions.
I am unable to save a grayscale image (say MxN) as a 3 channel image (MxNx1) using the PIL library. I am able to save it using cv2 library but in that case, I still get the same error while running the ZSSR code, even after modifications in line55, Configs.py. ( Exact code would be:
self.filter_shape = ([[3, 3, 1, self.width]] + [[3, 3, self.width, self.width]] * (self.depth-2) + [[3, 3, self.width, 3]])
)
I tried concatenating the same image along axis=2 thrice to get a grayscale image but having 3-channel. This approach resulted in the image becoming more blurry and I don't want to introduce any unwanted changes to the image.
Any ideas? Thanks
Another query. Although currently, I am facing trouble in running the code for any grayscale image, my end objective is to use the model for small images (For example, to obtain 100x100 images from 25x25 images). Is there anything specific I must take care of in order to run code for such small images?
Try adding a singleton dim to the image read, at ZSSR.py ln 66, change to something like img.imread(input_img)[:, :, None]. You can also add a condition adding this singleton only if needed (bonus: and modifying the conf so that the architecture fits). if that works you can contrib.
That is odd, because the transformation from grayscale to rgb is done exactly like this and should produce any blurring effects.
25x25 can be a bit extreme. This is internal learning so the data-size is the size of the image. we have seen stable results at 40x40 for x2 SR. Going more extreme can work, depending on how texture-like your input image is (more formally: how big is the entropy of the patch-distribution). But I have no guarantees there, especially for x4. One tip is to use the gradual mode (which takes more time). It seems that it can be significant in your case.
Hi, the code works fine with all 24-bit images (both jpg & png) but when I tried to run it for 8 bit images (including the boat image in set14 i.e. 'img_003_SRF_2_LR.png'), I am getting some errors.
Just to be sure, I ran in it in the command line and got the same error messages. Any ideas?
Thanks.