# arnaud58/ganilla-witness-style architecture

> Architecture diagram of the GitHub repository arnaud58/ganilla-witness-style, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/arnaud58/ganilla-witness-style
- Repository: https://github.com/arnaud58/ganilla-witness-style

## Overview

##### Project type and purpose
- This is a machine-learning style-transfer project built on top of the CycleGAN (“ganilla”) network.
- Purpose: take two image datasets (landscape photos and Witness game screenshots) and train/infer a model that translates images back and forth between the two styles.

##### File structure
- Top‐level directories/files:
- images/           ← sample inputs & outputs visualized
- index.html       ← static viewer for results
- landscape2witness/← pretrained model weight files (.pth)
- loss_log.txt     ← training loss history
- opt.txt          ← training hyperparameters snapshot
- readme.md        ← usage instructions & project description
- No source code here; it delegates to the external GANilla PyTorch repo for training/inference (via test.py).

##### README for insights
- Confirms use of “cycle_gan” model, “resnet_fpn” generator architecture, batch_size=4, epoch=100.
- Indicates that you must clone the external GANilla repo, then run a one-line inference command referencing this repo’s folders to produce artifacts.

##### Essential elements without overthinking
- Break the project into these logical modules
- Files (.pth, opt.txt, loss_log.txt, index.html) at their respective components

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Data Sources"
        DS1["Dataset A<br/>(Landscape photos)"]:::data
        DS2["Dataset B<br/>(Witness screenshots)"]:::data
    end

    DS1 --> Pre["Preprocessing & Data Loader"]:::data
    DS2 --> Pre

    subgraph "CycleGAN Model (GANilla)"
        direction TB
        Code["GANilla Codebase"]:::external
        G["Generator G<br/>(A→B)<br/>(ResNet_FPN)"]:::model
        F["Generator F<br/>(B→A)<br/>(ResNet_FPN)"]:::model
        DA["Discriminator D_A"]:::model
        DB["Discriminator D_B"]:::model
        Loss["Loss Modules"]:::model
        Code --> G
    end

    Pre --> G
    Pre --> F
    G --> DA
    F --> DB
    DA --> Loss
    DB --> Loss
    Loss -->|"Backprop/Weights Update"| G
    Loss -->|"Backprop/Weights Update"| F

    subgraph "Model Weights Store"
        WeightsStore["Checkpoints Directory"]:::artifact
        G_A["100_net_G_A.pth"]:::artifact
        G_B["100_net_G_B.pth"]:::artifact
        D_A["100_net_D_A.pth"]:::artifact
        D_B["100_net_D_B.pth"]:::artifact
        WeightsStore --> G_A
        WeightsStore --> G_B
        WeightsStore --> D_A
        WeightsStore --> D_B
    end

    Loss --> WeightsStore

    subgraph "Training Artifacts"
        Opt["opt.txt"]:::artifact
        LossLog["loss_log.txt"]:::artifact
    end

    Loss --> LossLog
    Loss --> Opt

    subgraph "Inference & Output"
        Test["Inference Script<br/>(test.py)"]:::model
        WeightsStore --> Test
        Pre --> Test
        FakeB["fake_B images"]:::artifact
        FakeA["fake_A images"]:::artifact
        Test --> FakeB
        Test --> FakeA
        Images["Generated Images"]:::artifact
        FakeB --> Images
        FakeA --> Images
        Index["index.html"]:::artifact
        Images --> Index
    end

    subgraph "Documentation"
        Readme["readme.md"]:::external
    end

    classDef data fill:#D0E6FF,stroke:#0366d6,color:#0366d6
    classDef model fill:#E6FFEA,stroke:#28a745,color:#28a745
    classDef artifact fill:#FFF4E5,stroke:#d18600,color:#d18600
    classDef external fill:#E5E5E5,stroke:#6a737d,color:#6a737d

    click Images "https://github.com/arnaud58/ganilla-witness-style/tree/master/images/"
    click Index "https://github.com/arnaud58/ganilla-witness-style/blob/master/index.html"
    click WeightsStore "https://github.com/arnaud58/ganilla-witness-style/tree/master/landscape2witness/"
    click G_A "https://github.com/arnaud58/ganilla-witness-style/blob/master/landscape2witness/100_net_G_A.pth"
    click G_B "https://github.com/arnaud58/ganilla-witness-style/blob/master/landscape2witness/100_net_G_B.pth"
    click D_A "https://github.com/arnaud58/ganilla-witness-style/blob/master/landscape2witness/100_net_D_A.pth"
    click D_B "https://github.com/arnaud58/ganilla-witness-style/blob/master/landscape2witness/100_net_D_B.pth"
    click LossLog "https://github.com/arnaud58/ganilla-witness-style/blob/master/loss_log.txt"
    click Opt "https://github.com/arnaud58/ganilla-witness-style/blob/master/opt.txt"
    click Readme "https://github.com/arnaud58/ganilla-witness-style/blob/master/readme.md"
```
