AAI_2025_Capstone_Chronicles_Combined
Custom GAN
To generate class-conditional synthetic chest X-rays, a custom Auxiliary Classifier GAN
(ACGAN) was implemented using PyTorch. Only the training set was used to develop the GAN,
preserving the test and validation sets for future evaluation. The model was scheduled for 5,000
epochs but employed early stopping, typically converging around 600 epochs.
The generator synthesizes 128×128 grayscale images conditioned on either the
PNEUMONIA or NORMAL class. It takes as input a 100-dimensional noise vector concatenated
with a one-hot encoded label (dimension 2). This combined vector is reshaped and passed
through five ConvTranspose2d layers to upsample from 4×4 to 128×128. Each layer, except the
last, is followed by batch normalization and ReLU activation to encourage stable gradients. The
final layer uses a Tanh activation to produce pixel values in the range [-1, 1], standard for GAN
based image generation. Relatively large feature maps in early layers (ngf=256) help the
generator capture fine details.
The discriminator mirrors this structure, reducing a 128×128 input through Conv2d
layers with LeakyReLU activations and dropout for regularization. Each convolutional layer
doubles the number of channels (starting from ndf=128). The discriminator’s output is split into
two heads: a binary real/fake prediction (Sigmoid) and a class prediction (Softmax over two
classes), allowing the ACGAN to generate realistic, class-conditional images.
Both the generator and discriminator were optimized using Adam with β₁=0.5 and
β₂=0.999. The generator learning rate (lr_g) was set to 0.0002, while the discriminator was
108
Made with FlippingBook - Share PDF online