-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Simplify SubpixelConv2d #176
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
Conversation
Reduce the number of ops to do subpixel convolution
|
Hi, are you sure the code is correct? i cant found where to define |
|
emm... |
|
Great. What I worry is your implementation have different shuffle method with the original paper. Please double check, many thanks. |
|
@ShieLian @zsdonghao I'm still experimenting with the SRGAN project (the results are amazing!) and have also mentioned the slow model building time in the Subpixel-Conv2D layers in an issue. But i thought that was because of a CPU-core/speed bottleneck on my side (i have an older i7 Quad core and thought you need a bazillion-core xeon-machine for this kind of computation). So i was glad to see a solution to the problem! But as @zsdonghao is assuming – @ShieLian: your fix changes the image quality of the GANs output drastically. You can see a checkerboard pattern in the generated sample images as well as color artifacts and an overall low res, blurry output. I have tried letting the training run anew for a few epochs because the model weights from the previous training (checkpoint) seem to reset after the code change. But the resolution (sharp edges, high frequency details) does not get better and the checkerboard pattern is also persistent in all further results. @ShieLian If your code would produce the same output as before i should see no change at all in my generated images and should be able to use the same weights as before – or am i wrong here? If i revert the Subpixel-code (and model weights) the output images are clear and sharp again. I currently don't have access to the machine with my local repo, but will upload the images later so you can maybe check why the artifacts happen. The model buildup time is nearly instantaneous with this PR – would love to see it producing the same results as the original code! |
|
For my local implement, If the Input(1x2x2x4,Batch,H,W,C) is |
|
|
|
let me check |
|
I'm sorry, but i have no idea about the mathematics behind the changes. But i have started the SRGAN training from scratch – with the new code. And when i compare the quality and output progress of the new generated images to the old ones, the newer ones clearly are worse. Don't know why that is, but it has to be because of this change – since i did not modify anything else in the SRGAN repo. Take a look for yourself: here are two pictures, both from training epoch nr. 175. The new output image has a lot more artifacts and some parts again show the checkerboard pattern. Just look at the palm leaves – the results are clearly not the same. I will leave the training running for a while, but i don't think that the new model will reach the same fidelity as the old one. Old pixelshuffler code:New code:Could you please check the output again? |
|
@subzerofun i am training SRGAN as well, may finish in 1 to 2 days, I will let you know when training finish~ 😊 |
|
@subzerofun |
|
@subzerofun @subzerofun |
|
I think you misunderstood me, i did delete all model weights – all .npz files before starting the training again. The comparison from above is a newly trained model with the only difference being the changed tensorlayer version (this PR). Starting from epoch nr. 0 – 175, compared to the old Subpixel-function. There has to be a difference between the two functions (new/old) – unfortunately i don't understand the math behind it. @ShieLian But what could be the reason – if you say that the (numerical) outcome should be the same? Thank you for the patch, i will test your new version and compare it to the other results (will delete the old weights of course!). @zsdonghao Lucky you – the two days on your Titan sound great. It took me 5-6 days on my 1080 Ti to get to epoch 2000. |
|
@ShieLian @subzerofun , I re-train the SRGAN with simplified version for 1400 epochs, please have a look. From the result, it seems the simplified version is correct. Simplified layer:Previous version: |





Reduce the number of ops to do subpixel convolution
Fix #175