ae
ARDA ERDOĞAN

Can a classifier learn from data that was never real?

A conditional WGAN-GP generating synthetic fruit images, then a fifteen-experiment grid testing whether a classifier trained only on those fakes can match one trained on photographs. It came within one to two percent at every size — and at one size, it won.

PyTorch · conditional WGAN-GP · 15-experiment grid

The question

Synthetic training data is one of those ideas that sounds obviously useful and is hard to evaluate from the outside. If a generative model has learned a class well enough, can its output substitute for real examples? And if it can, does that hold at small dataset sizes — where you would actually want it — or only once you already have plenty of real data?

Reading about it was not settling the question, so I built the grid and measured it.

The setup

Three classes — apple, banana, orange — at 64×64 RGB, sourced from the Fruits 360 dataset. The split holds 1,300 training images per class, 159 for validation and 492 per class held out for test. Every number below is measured on that held-out test set.

The generator is about 1.5M parameters: a 128-dimensional latent plus a class label, projected to 256×4×4 and upsampled through four blocks to 64×64. Class conditioning is done properly with conditional batch normalisation, where the scale and shift are predicted per class from learned embeddings rather than the label just being concatenated on. The projection critic is about 4.9M parameters.

Training used a gradient penalty coefficient of 10, three critic steps per generator step, and two time-scale update rule learning rates — 1e-4 for the generator against 2e-4 for the critic — over 100 epochs.

What the numbers said

Images / classReal onlySynthetic onlyReal + synthetic
10098.98%97.29%98.85%
20099.12%97.02%98.78%
40097.83%98.71%96.82%
80099.73%98.85%98.85%
130099.12%98.92%99.32%
Five dataset sizes across three training scenarios — fifteen runs, evaluated on 492 held-out images per class.

Synthetic-only training stayed within one to two percent of real-only at every size, which is the headline: the generator had learned the classes well enough to stand in for photographs. At 400 images per class it actually came out ahead — 98.71% against 97.83% — which looks like the GAN acting as an implicit regulariser rather than the fakes being better than reality.

Combining both sources gave the single best result, 99.32% at full scale. The honest caveat is that this is a three-class problem on a clean dataset where every scenario clears 96%; the margins are narrow enough that I would not extrapolate them to a harder domain without re-running the grid there.

SOURCEardaerdogani/cwgan-gp-fruits