-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python interface for loading super-resolution dataset #18
base: master
Are you sure you want to change the base?
Conversation
Thanks for the PR @AnimatedRNG |
0d3afd9
to
4f98349
Compare
@twtygqyy Awesome. I just pushed a few minor tweaks and fixes (changed the cache size, disabled shuffle). I mostly wrote this because my desktop doesn't have enough memory to run the Matlab script to create the dataset. I haven't actually trained using this method, but I'm running it right now and hopefully I'll get something similar to your pretrained model. To perform bicubic interpolation directly on tensors, you need the nightly build of Pytorch. I'm also using OpenCV for image augmentation and color conversions. I think you can probably replace some of these operations with numpy/PyTorch equivalents if needed. Also, I just realized that this model doesn't seem to operate in a linear colorspace -- maybe once I get things working I'll make the dataset also convert the images from/to sRGB. |
This custom PyTorch Dataset loads images from a folder, performs several image operations upon them, and then returns patches to the caller. To avoid expensive disk reads/writes, all of the images are cached in memory in compressed form, and then decompressed and cached as the iterator iterates over them.
4f98349
to
6e1880f
Compare
The image augmentation now uses PyTorch's API rather than OpenCV. |
On a different note, I finished training on DIV2K using this method and I was unable to replicate your results. I haven't looked much in For reference, here is the butterfly demo after 1 epoch of training: and after 100 epochs: For reference, here is how your pre-trained model looks: |
Hi @AnimatedRNG if you used PyTorch API to generate the data for training, and use Matlab generated data for evaluation, the script cannot output correct PSNR sore. The reason is due the different bicubic interpolation implementation between Matlab and python. Check out https://www.reddit.com/r/MachineLearning/comments/6vdo51/p_matlab_bicubic_imresize_implemented_in_python/ for more information. |
Ah, good point. I'll try generating some of my own bicubic-downsampled images and seeing if the results get any better. I'd rather use PyTorch's bicubic downsample than Matlab's (or the imresize Python implementation that you mentioned), mostly for performance reasons. PyTorch's bicubic downsample also happens to be compatible with OpenCV's bicubic downsample, which is another plus. So I'll either generate new .mat's for the demo/evaluation scripts or just load them as PNGs. |
@AnimatedRNG Thanks for the update. I think for this repo, the purpose is for reproducing paper result, thus Matlab preprocessing was applied for consistency so as to have a fair comparison with the paper. Ideally, I agree it is better to use bicubic without anti-aliasing for practical use. |
Hey,I'm glad to inform you that your suggests really work!!! |
This custom PyTorch Dataset loads images from a
folder, performs several image operations upon
them, and then returns patches to the caller.
To avoid expensive disk reads/writes, all of the
images are cached in memory in compressed form,
and then decompressed and cached as the iterator
iterates over them.