# qbxlvnf11/conditional-gan architecture

> Architecture diagram of the GitHub repository qbxlvnf11/conditional-gan, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-09). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/qbxlvnf11/conditional-gan
- Repository: https://github.com/qbxlvnf11/conditional-gan

## Overview

##### Project Type and Purpose
- This is a single-notebook machine-learning project (Jupyter Notebook) implementing a Conditional Generative Adversarial Network (CGAN) to generate Fashion-MNIST images.
- Purpose: Train a generator and discriminator in adversarial fashion, conditioning both models on image labels to steer the generation process.

##### File Structure
- Top-level files only:
- LICENSE
- README.md (project description, math, data, references)
- conditional-GAN-generating-fashion-mnist.ipynb (all code: model definitions, training and visualization)
- No separate “src” or “data” folders: all logic and data-fetch occur inside the notebook.

##### Key Insights from README
- Two core neural nets: Generator (noise + label → synthetic image) and Discriminator (image + label → real/fake score).
- Uses PyTorch (implied by reference notebook) and Fashion-MNIST dataset (loaded via Kaggle link).
- Training loop separated into `generator_train_step()` and `discriminator_train_step()` with adversarial loss formulas shown.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Resources
    subgraph "Project Files"
        README["README.md"]:::doc
        LICENSE["LICENSE"]:::doc
    end

    %% Main Components
    TrainLoop["Optimizers & Training Loop"]:::process
    DataLoader["Data Loader<br/>(fetch & preprocess)"]:::data
    Noise["Noise z∈ℝ¹⁰⁰ + Label y"]:::data
    Generator["Generator Network"]:::network
    Discriminator["Discriminator Network"]:::network
    LossComp["Loss Computation Module"]:::process
    Visualization["Visualization / Monitoring"]:::ui

    %% Flow
    TrainLoop -->|controls| DataLoader
    TrainLoop -->|controls| Noise
    DataLoader -->|"real image + y"| Discriminator
    Noise -->|"z + y"| Generator
    Generator -->|"fake image + y"| Discriminator
    Discriminator -->|"scores (real/fake)"| LossComp
    Generator -->|"generated image"| LossComp
    LossComp -->|"gradients → update Disc"| Discriminator
    LossComp -->|"gradients → update Gen"| Generator
    TrainLoop -->|triggers| Visualization

    %% Click Events
    click DataLoader "https://github.com/qbxlvnf11/conditional-gan/blob/main/conditional-GAN-generating-fashion-mnist.ipynb"
    click Generator "https://github.com/qbxlvnf11/conditional-gan/blob/main/conditional-GAN-generating-fashion-mnist.ipynb"
    click Discriminator "https://github.com/qbxlvnf11/conditional-gan/blob/main/conditional-GAN-generating-fashion-mnist.ipynb"
    click LossComp "https://github.com/qbxlvnf11/conditional-gan/blob/main/conditional-GAN-generating-fashion-mnist.ipynb"
    click TrainLoop "https://github.com/qbxlvnf11/conditional-gan/blob/main/conditional-GAN-generating-fashion-mnist.ipynb"
    click Visualization "https://github.com/qbxlvnf11/conditional-gan/blob/main/conditional-GAN-generating-fashion-mnist.ipynb"
    click README "https://github.com/qbxlvnf11/conditional-gan/blob/main/README.md"
    click LICENSE "https://github.com/qbxlvnf11/conditional-gan/tree/main/LICENSE"

    %% Styles
    classDef data fill:#E3F2FD,stroke:#90CAF9,color:#0D47A1,stroke-width:1px;
    classDef network fill:#E8F5E9,stroke:#81C784,color:#1B5E20,stroke-width:1px,stroke-dasharray: 5 5;
    classDef process fill:#FFF3E0,stroke:#FFB74D,color:#E65100,stroke-width:1px;
    classDef ui fill:#F3E5F5,stroke:#BA68C8,color:#4A148C,stroke-width:1px;
    classDef doc fill:#ECEFF1,stroke:#B0BEC5,color:#263238,stroke-width:1px,stroke-dasharray: 2 2;
```
