logo-gan
A small DCGAN trained from scratch to generate 64ร64 company-logo-style images. Trained on 1,500 real logos resized to 64ร64ร3.
This is the deliverable for model-requests #1 ("a GAN that learns to make company logos").
What it is
- Architecture: DCGAN. Generator = linear latentโ256ร8ร8, then 3ร ConvTranspose2d (256โ128โ64โ3, Tanh out). Discriminator = 3ร Conv2d (3โ64โ128โ256) + AdaptiveAvgPool + Linearโ1.
- Params (learnable): generator 2,805,123 + discriminator 659,585 = 3,464,708. (The saved checkpoint also carries BatchNorm running-stat buffers, so a raw numel count over all tensors reads 3,498,756 โ the extra ~34k are non-learnable running mean/var, not parameters.)
- Latent: 128-dim. Output: 64ร64ร3, [-1, 1].
- Training: 8,000 steps, batch 16, Adam (lr 2e-4, ฮฒ=(0.5, 0.999)), non-saturating GAN objective, seeded 0. Trained on an RTX 5090 in ~64s.
Data
1,500 logos (64ร64ร3, float 0โ1), assembled from public logo datasets on the Hub
and cached to logos_big.npy.
Quality โ measured, not asserted
Generated 64 samples (seed 42) from final.pt and measured:
| Check | Value | Reading |
|---|---|---|
| Min pairwise L2 (64 samples) | 51.7 | No mode collapse (0.0% of pairs < 0.01) |
| Mean pairwise L2 | 103.9 | Samples are diverse |
| Adjacent-pixel mean |diff| | 0.109 | Structured, not noise (real data 0.057, pure noise ~0.4โ0.6) |
| Per-channel std | 0.85 | Full dynamic range used |
So the generator is not collapsed and not producing noise โ it makes diverse, spatially-coherent, logo-shaped color fields.
What it is NOT
This is a 3.5M-param DCGAN on 1,500 images. It produces logo-shaped blobs and color fields, not crisp, legible, trademark-accurate logos. At this scale and data budget, expect abstract logo-likes, not usable brand marks. That is the honest ceiling for this recipe; a real logo pipeline needs a diffusion model on a much larger, cleaner dataset.
Files
final.ptโ generator + discriminator state dicts (g,d), plusstep,zdim. SHA256114765c79dc23099655d9e7477648c5a8c2b90fda03b7f3dbd4714f45f27b95f.grid_final.pngโ 64 generated samples (8ร8 grid). SHA256e9eee93950397a9f29028384b34809df432d0dfcbdeb4b1cce30328c4504bf5b.train_logo_gan_v2.pyโ the exact training script (seeded, reproducible).
Reproduce
import torch
from train_logo_gan_v2 import G
ck = torch.load("final.pt", map_location="cpu", weights_only=False)
g = G(ck["zdim"]); g.load_state_dict(ck["g"]); g.eval()
with torch.no_grad():
imgs = g(torch.randn(64, 128)) # (64,3,64,64) in [-1,1]