--- license: apache-2.0 language: - en metrics: - FID - IS pipeline_tag: unconditional-image-generation tags: - generative-adversarial-network - pytorch - dcgan - deep-learning --- # Model Card for DCGAN (PyTorch) ## Model Details ### Model Description This is a **Deep Convolutional Generative Adversarial Network (DCGAN)** implemented in **PyTorch**. It is trained to generate synthetic images that resemble the target dataset distribution. - **Developed by:** Abhishek C. - **Funded by [optional]:** Self Funded - **Shared by:** None - **Model type:** Generative Adversarial Network (DCGAN) - **Language(s):** N/A (Image generation) - **License:** Apache-2.0 - **Finetuned from model [optional]:** Not applicable (trained from scratch) --- ## Uses ### Direct Use - Generating synthetic images from random noise vectors (`z ~ N(0,1)`). - Data augmentation for research and experimentation. - Educational purposes to study GAN training and generative modeling. ### Downstream Use - Fine-tuning the discriminator or generator on domain-specific datasets. - Using the pretrained generator as an initialization for conditional GANs. ### Out-of-Scope Use - Medical or safety-critical applications without validation. - Misuse for generating harmful or misleading content. --- ## Bias, Risks, and Limitations - Generated images may contain artifacts if training is insufficient. - Quality depends heavily on dataset diversity and size. - Model may amplify dataset biases. ### Recommendations - Always evaluate generated images before downstream use. - Do not use in decision-critical tasks. - Use larger datasets for stable performance. --- ## How to Get Started with the Model ```python import torch from torch import nn # Load pretrained generator (example structure) class Generator(nn.Module): def __init__(self, nz=100, ngf=64, nc=3): super().__init__() self.main = nn.Sequential( nn.ConvTranspose2d(nz, ngf*8, 4, 1, 0, bias=False), nn.BatchNorm2d(ngf*8), nn.ReLU(True), nn.ConvTranspose2d(ngf*8, ngf*4, 4, 2, 1, bias=False), nn.BatchNorm2d(ngf*4), nn.ReLU(True), nn.ConvTranspose2d(ngf*4, ngf*2, 4, 2, 1, bias=False), nn.BatchNorm2d(ngf*2), nn.ReLU(True), nn.ConvTranspose2d(ngf*2, nc, 4, 2, 1, bias=False), nn.Tanh() ) def forward(self, input): return self.main(input) # Example usage netG = Generator() noise = torch.randn(16, 100, 1, 1) fake_images = netG(noise)