Implementing SRGAN

Hello everyone,
I tried to implement the SRGAN paper as well as SRPGAN and everything “works” for now. I say “works” because it works in the sense that everything fit well together but somehow my implementation is not working. Here is an overview of how my losses behave:

And my metrics:

As you can see the adversarial/discriminator losses doesn’t behave as I would expect.
I spent weeks on trying to make this implementation works and I helped myself with this implementation and this one as well as reading and rereading the paper but I still miss something…

My SRGAN implementation can be found here and is ready to use. You just have to clone the repo, install the dependencies in your env with pip install -r requirements.txt, install Pytorch 0.3.1 and execute python srgan.py train to launch the training (the dataset and everything will be downloaded automatically).

My goal for this implementation is to be able to have something working to host it on Algorithmia and then I’ll create a frontend website to “showcase” it, pretty much like letsenhance.io.

For instance, here are the results of my implementation given a picture after 2000 epochs:

Original image

Result of my implementation

Result of letsenhance.io

As you can see my implementation make the picture even worse by adding few colored pixels. I’m very far from the results of letsenhance.io .

So I wanted to ask if one of you guys knows how to solve this issue or even if one is willing to embark with me on this journey of having this implementation working. I have a great background in CS but as for math… it’s another story.

The implementation of my generator loss can be found here and the optimization/discriminator loss here

Thank you everyone :slight_smile:

3 Likes

Hello mate, I’m a bit bummed you’ve not got any replies to this.

I got a little annoyed at Let’s Enhance for charging for what they do so I decided to create my own and offer it for free.

I don’t have an ML or programming background so I’m stuck with models others have produced which are great but I’d love to get into producing my own in the future.

How far did you get with this project? Have you tested any other models that are freely available?

Hey @sliceofcheese ,
Thanks for stepping in!
I ported the project code to Pytorch 0.4 recently (the code is available on the master branch of the same repo). I don’t plan to improve it in any way anytime soon as it really takes a lot of time (took me one month and half full time for this one). And yeah I know Let’s enhance too and their results are much better than mine but the difference is, as you said, I offer mine for free while they don’t but at the same time I cannot afford to spend so much time improving it.

Still, there is a lot of stuff to add on top of this implementation to make it better such as adding and removing haze or exploring the E-GAN paper and replacing vanilla GANs from my current implementation by this one.

(I copy the content of the E-GAN paper post I made on a private part of the forums here for those who cannot access it on the http link)

A few weeks ago a new paper came out called E-GAN6 with a video12 accompanying it. I’ve read the paper and from what I could tell this seems to be far better than the existing GAN techniques/architectures. The LSUN bedrooms results look stunning and the promises of this paper are that with the help of evolutionary algorithms the issues inherent to GANs such as mode collapse, vanishing gradient, hyperparameters tunning and difficulty to measure the effectiveness of the network during training belongs to the past.

I personally experienced few of these issues myself when I made my own implementation of a super-resolution paper1 (“run and play” code here3, blog post here7 and demo here1 ). I had to tweak a lot of things, restart 1 week of training from scratch, find tricks to make the nash equilibrium stable etc…

Don’t forget that any PR is welcome :slight_smile:

Ah yes, I’m just beginning to realise what’s involved with ML an getting this thing to a place where it’s comparable to letsenhance.

I found this article on my journey https://medium.com/machine-learning-world/how-to-replicate-lets-enhance-service-without-even-coding-3b6b31b0fa2e

Have you seen this before? He seems to share the same sentiments as us and gets pretty decent results compared to letsenhance. Also publishes his repo for all.

Have you created a front end for your software? Please share if you have.

Didn’t saw it passing by no. But take this guy claims with a pinch of salt and compare the results you obtain with letsenhance instead of relying exclusively on what he says.

Have you created a front end for your software? Please share if you have.

I did here: https://torchlite.io/sr/

But the code resides in a private github repo where I kept all my production keys as well as sensitive information that I can’t share publicly. I made the website with django + docker + postgres even though there are certainly quicker ways to achieve this goal.

Will do mate. I’m going to implement his pre-trained model and see how it turns out.

Will perhaps invest in having someone teach it for me in the future, right now I don’t have the time nor the computer science qualifications to do it.

The three full-stack devs I’ve contacted to build and implement the program & website are each suggesting a different approach; Django, Flask & PHP.

1 Like

Nice project by the way @Ekami @jamesrequa :slight_smile:

1 Like