Skip to content
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

Addition Of CycleGAN model #135

Open
shreyas-kowshik opened this issue May 8, 2019 · 5 comments
Open

Addition Of CycleGAN model #135

shreyas-kowshik opened this issue May 8, 2019 · 5 comments

Comments

@shreyas-kowshik
Copy link
Contributor

shreyas-kowshik commented May 8, 2019

As suggested by @dhairyagandhi96 , I have chalked out an implementation for the cycleGAN model

  • Write the UNet architecture for the generator [For 256x256 and 128x128 images]

  • Write the discriminator. The paper's implementation reference would be followed.

  • Training would be done on the apples2oranges dataset first followed by the horses2zebras dataset.

  • Formulation of the identity loss for the generators and discriminators and the adversarial losses.

The code will be organised in a separate repository with the utility functions, I/O, model definitions and training files.

What more details are required?
@staticfloat

@DhairyaLGandhi
Copy link
Member

I think having a section here/ Metalhead.jl on GANs is fine.

First order of business is to get a general model working. Are there any specifics that you see that need to be addressed in Flux to get this to run on a broad basis?

@shreyas-kowshik
Copy link
Contributor Author

shreyas-kowshik commented May 9, 2019

Generator :

struct DownConv
 max_pool 
 double_conv # Chain(Conv,BN,Relu) * 2
end

DownConv(in_ch,out_ch) = ... # (Define a DownConv instance here)
function (dconv::DownConv)(x)
 ... # Implement a max pool and a double_conv here
end

# This is for the down sampling part.
struct UpConv
 double_conv
 conv_transpose
end

UpConv(in_ch,out_ch) = ... # (Define UpConv Instance)

function (uc::UpConv)(x,y)
 z = uc(x)
 cat(z,y)
end
struct UNet
 down_convs
 up_convs
end

function UNet()
 # Define down_convs as an array of down_conv
 # Define up_convs as an array up_conv
 UNet(down_convs,up_convs)
end

function (un::UNet)(x)
 # Run down_convs and save outputs
 # Run up_convs
end

Discriminator :

struct ConvBlock
 layers
end

function CB(in_ch,out_ch) = ConvBlock(Chain(...))

dis = Chain(CB...) # Max number of channels will be taken as a hyperparameter

There would be a generator and a discriminator defined for each domain.

Loss functions :

function loss(x,y) # x and y are images, one of each domain
 # identity losses
 # reconstruction losses
 # adversarial losses
end

Utility functions :

functions get_images()

I plan to organise the code as :

loss.jl
models.jl
util.jl
train.jl
inference.jl

@staticfloat
Copy link
Contributor

Hey Shreyas, this all looks reasonable to me; feel free to start hacking this out, and let us know when you run into something that is difficult; let's do our best to try and figure out what are going to be the difficult pieces as early as possible, and devote appropriate resources into making them as painless as possible! :)

@shreyas-kowshik
Copy link
Contributor Author

@staticfloat I've put together the pieces here :
https://github.com/shreyas-kowshik/CycleGAN.jl

I am unable to test the implementation as the model does not fit on my GPU. I've talked to @dhairyagandhi96 regarding this.

@DhairyaLGandhi
Copy link
Member

Yeah, we will get them access to some GPU machines to test their code out on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants