Skip to main content

A Collection of GANs - PyTorch

Project description

GANetic

A collection of GANs implemented in PyTorch.

Table of Contents

Usage

DCGAN

import torch

from gan_zoo.dcgan import Discriminator, Generator

netG = Generator(
    nz=100,  # length of latent vector
    nc=3,    # number of channels in the training images.
    ngf=64,  # size of feature maps in generator
)
netD = Discriminator(
    nc=3,    # number of channels in the training images.
    ndf=64,  # size of feature maps in discriminator
)

noise = torch.randn(1, 100, 1, 1)
fake_img = netG(noise)
prediction = netD(fake_img)

SRGAN

import torch

from gan_zoo.srgan import Generator, Discriminator

img = torch.randn(1, 3, 64, 64)
gen = Generator(
    scale_factor=4, # scale factor for super resolution
    nci=3,          # number of channels in input image
    nco=3,          # number of channels in output image
    ngf=64,         # number of filters in the generator
    no_of_residual_blocks=5 
)
disc = Discriminator(
    input_shape=(3, 256, 256),
    ndf=64,              # number of filters in the discriminator
    negative_slope=0.2,  # negative slope of leaky relu
)

HR_img = gen(img)
pred = disc(HR_img)

Citations

@article{radford2015unsupervised,
  title={Unsupervised representation learning with deep convolutional generative adversarial networks},
  author={Radford, Alec and Metz, Luke and Chintala, Soumith},
  journal={arXiv preprint arXiv:1511.06434},
  year={2015}
}
@inproceedings{ledig2017photo,
  title={Photo-realistic single image super-resolution using a generative adversarial network},
  author={Ledig, Christian and Theis, Lucas and Husz{\'a}r, Ferenc and Caballero, Jose and Cunningham, Andrew and Acosta, Alejandro and Aitken, Andrew and Tejani, Alykhan and Totz, Johannes and Wang, Zehan and others},
  booktitle={Proceedings of the IEEE conference on computer vision and pattern recognition},
  pages={4681--4690},
  year={2017}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

GANetic-0.0.1.tar.gz (3.1 kB view details)

Uploaded Source

File details

Details for the file GANetic-0.0.1.tar.gz.

File metadata

  • Download URL: GANetic-0.0.1.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for GANetic-0.0.1.tar.gz
Algorithm Hash digest
SHA256 a6d49890df8824011ebc5a5813520eb93a215c184815323aa1516b3315f05bdf
MD5 a3c62d0efee2223197fefd0cffe0e7fd
BLAKE2b-256 b68b0283e8d50c8501534f0129870e1edf4b2248b588de9cefcff734be857de7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page