A smart agriculture company wants to generate realistic images of diseased plant leaves because collecting diseased-leaf images is difficult and expensive. Design a GAN-based solution and explain the Generator, Discriminator, adversarial training, objective function, and synthetic-image augmentation workflow.
What's actually being asked
Design a GAN-based pipeline to synthesize diseased plant-leaf images (scarce real data) for augmentation — explain the Generator, Discriminator, adversarial training, objective function, and the augmentation workflow.
Answer
Generator
G takes random noise z ~ p_z and, ideally, a disease-class label y (healthy, blight, rust, mildew, ...) — making this a conditional GAN — and maps it to a synthetic leaf image: G(z|y). A DCGAN-style generator (transposed-convolution upsampling blocks, batch norm, ReLU, tanh output) works well for leaf-texture images; for finer control over lesion patterns and leaf colour, a StyleGAN-style generator with style-mixing gives better fidelity.
Discriminator
D takes an image (real leaf photo or G's fake) plus the same class label y and outputs the probability that it's real: D(x|y). A convolutional classifier (conv blocks + downsampling + sigmoid) works as D.
Adversarial training and objective function
Training is the conditional GAN value function:
min_G max_D 𝔼[log D(x|y)] + 𝔼[log(1 − D(G(z|y)|y))]
Dis updated to maximizelog D(x|y) + log(1 − D(G(z|y)|y))— get better at telling real diseased-leaf photos fromG's fakes.Gis updated to foolD. The saturating objective minimizeslog(1 − D(G(z|y)|y)); in practice the non-saturating version is used instead —Gmaximizeslog D(G(z|y)|y)— because it gives much stronger gradients early on, whenDis easily rejectingG's still-weak fakes (the saturating loss's gradient is nearly flat exactly whenGneeds it most).
Training alternates a few D updates, then a G update, repeated over many epochs, ideally until D hovers around 50% accuracy — meaning it genuinely can't tell real from fake anymore.
Synthetic-image augmentation workflow
- Collect whatever real diseased-leaf images exist (even a few hundred per class).
- Train the conditional GAN above, conditioned on disease class.
- Once
Gproduces convincing samples (visually checked, ideally by a plant-pathology expert), sample a large batch of synthetic images per under-represented disease class. - Mix synthetic images with real ones in the training set for the downstream disease-classification CNN, keeping a sensible real:synthetic ratio — synthetic should supplement, not dominate, or the classifier risks learning GAN artifacts instead of real disease patterns.
- Validate the final classifier only on held-out real images, never synthetic, to confirm the augmentation actually improved generalization rather than just overfitting to
G's biases.
Yaha samajhna zaroori hai ki synthetic data sirf scarcity ko patch karta hai — asli test hamesha real, unseen leaves par hona chahiye.
Why this fits the scenario
Diseased leaves are hard to collect because the disease has to actually occur, be caught at the right stage, and be photographed. A conditional GAN directly targets this gap: it lets the team generate more examples of exactly the rare classes they're short on, rather than generic leaf images.
Exam tip
Always write both the saturating and non-saturating generator objective and say which one is used in practice, with the reason (stronger gradients early in training) — this specific pairing is a favourite thing examiners check for.