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

Modify Conditional GAN to work with variable image sizes #17

Open
suryajasper opened this issue Nov 27, 2023 · 0 comments
Open

Modify Conditional GAN to work with variable image sizes #17

suryajasper opened this issue Nov 27, 2023 · 0 comments
Assignees

Comments

@suryajasper
Copy link
Owner

suryajasper commented Nov 27, 2023

Refer to following python script: https://github.com/suryajasper/SynthMining/blob/51f0f808d8dca6cf42f7eb808221438d7a15f926/synthesis_pipeline/condGAN/cond_DCGAN_network.py

      layers = []
      in_channels = channels + embedding_size

      for out_channels in conv_channels:
          layers.append(nn.Conv2d(
              in_channels=in_channels,
              out_channels=out_channels,
              kernel_size=4,
              stride=2,
              padding=1,
              bias=False
          ))
          layers.append(nn.LeakyReLU(0.2, inplace=True))
          in_channels = out_channels

      layers.append(nn.Conv2d(
          in_channels=in_channels,
          out_channels=1,
          kernel_size=4,
          stride=1,
          padding=0,
          bias=False
      ))
      layers.append(nn.Sigmoid())

      self.main = nn.Sequential(*layers)
  1. Add optional keyword argument to Generator and Discriminator constructors called img_size. Assert that img_size is an integer power of 2
  2. Rebuild sequential design of Generator to allow for variable img_size. Note that the sequential design features hidden convolutional layers, batch norms, and activations that reduce the channel size by half through the in_features / out_features and double the image size. These operations can be performed iteratively using a for loop that progressively increases the dimensionality of the modified latent vector into the image size.
  3. Rebuild sequential design of Discriminator to allow for variable img_size. Note that the sequential design features hidden convolutional layers, batch norms, and activations that reduces both the channel size and image size by half. These operations can be performed iteratively using a for loop that progressively lowers the dimensionality of the input image into a single output node expressing the probability the image is real.
@suryajasper suryajasper converted this from a draft issue Nov 27, 2023
@suryajasper suryajasper self-assigned this Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

No branches or pull requests

1 participant