Report Update
Report Update
on
GAN-Based Medical Image Generation: Advanced
Architecture Extensions
Submitted in fulfillment of the requirement of
Project Phase – II
Submitted by
Sparsh Davra
SAP ID - 590011376
Candidate’s Declaration
I hereby declare that the work presented in this thesis entitled “GAN-Based Medical Image Generation:
Advanced Architecture Extensions” in fulfilment of the requirements for the award of Degree of Master of
Technology and submitted in the School of Computer Science and Engineering at University of Petroleum and
Energy Studies is an authentic record of my own work carried out during a period of August 2024 to May 2026
under the supervision of Dr. Chandra Mani Sharma and Dr. Juhi Agrawal, School of Computer Science and
Engineering, University of Petroleum and Energy Studies.
Sparsh Davra
(SAP-ID – 590011376)
This is to certify that the above statement made by the candidate is true to the best of our knowledge and belief
i
School of Computer Science & Engineering
University of Petroleum and Energy Studies
Dehradun, Uttarakhand, India – 248001
Website: [Link]
Certificate
This is to certify that the thesis entitled “GAN-Based Medical Image Generation: Advanced Architecture
Extensions” submitted by Sparsh Davra (SAP-ID 590011376) to University of Petroleum and Energy
Studies is record of bonafide research work carried under my supervision and is worthy of consideration for the
award of the degree of Master of Technology of the University.
To the best of our knowledge, the works continued in the thesis have not been submitted in part of full to
elsewhere for any degree or diploma.
ii
ACKNOWLEDGEMENT
It is with profound pleasure and sense of immense gratitude, that I convey my heartiest thanks
to Dr. Chandra Mani Sharma, Associate Dean(Academics) School of Computer Science,
University of Petroleum and Energy Studies (UPES), Dehradun, for providing an apt guidance,
keen interest and a perpetual support for the present research. His guidance, insight, and
encouragement provided immense importance for the direction and quality of the dissertation.
Further, I express my deep sense of gratitude to Dr. Juhi Agrawal for providing relevant
suggestions, positive feedback and constant support, which were greatly influential in the overall
improvement of this project. I feel great indebted to the School of Computer Science at UPES,
Dehradun for its academic environment and providing the infrastructure and resources.
I would also like to thank all the researchers and authors that have been cited in this dissertation.
Those are the defining works that guided my research and gave me a solid foundation for it. I
owe many thanks to my friends and mates for their continuous assistance, discussions and
motivation during my study. You inspired and kept my spirit up when the chips were down. Last
but not least --- A special note of gratitude and love to my family who stood by me
unconditionally believing and having faith in me throughout this journey.
(Sparsh Davra)
iii
ABSTRACT
When it comes to the professionalism of the physicians in obtaining & labelling
Imaging studies, there are many extreme practical limitations on obtaining a set of
data to train a deep learning-derived diagnostic system. Due to the extreme cost of
both Imaging acquisition as well as the manual labelling that accompanies imaging,
data scarcity is a major problem in the practical medical setting. A Generative
Adversarial Network (GAN) is a method for solving the problem of data scarcity.
GANs synthesize photorealistic images by learning from a statistical distribution. The
purpose of this two-phase study is to design, develop, and validate a GAN framework
that is capable of synthesizing high-resolution medical images with state-of-the-art
performance.
This report highlights four key contributions of the completed first phase of
development for Project Phase II, and how those contributions will resolve the
problems, architectural issues, and evaluation deficiencies of the first phase of Project
Phase I . The Progressive GAN will progressively build up your generator's and
discriminator's resolutions from 44x44 to 256x256 over the course of the training
process (by training in 7 steps), with a smooth alpha fade-out of the old resolution[3].
iv
Second, the use of residual discriminator with skip connections and minibatch
standard deviation like in StyleGAN2 [4] help gradients flow and discriminate
between different categories. Third, R1 gradient penalty regularization decreases the
training instability in 8% of total runs down from 23% [5]. Fourth, a multi-metric
evaluation protocol using Frchet Inception Distance (FID) as well as Inception score
(IS), precision recall curve (PRC), and perceptual path length (PPL) are define [6].
Initial outputs at 6464 progressive stage get FID = 38.1 and IS = 6.24, target final FID
< 15 and IS > 8.0 on 256256 resolution. Combined usage of mixed-precision training
and gradient checkpointing drops peak GPU memory usage from theoretically
unusable 28.4GB down to 14.2GB, enabling 256256 training on Tesla T4. Extension
to downstream objective with >=12% gain over real-data-only baselines adds on the
4.7 pp gain obtained in Phase I.
Keywords: Generative Adversarial Networks, Progressive GAN,
StyleGAN2, Medical Image Synthesis, Tumour Histopathology, Fréchet
Inception Distance, Data Augmentation, Transfer Learning, Mixed-
Precision Training.
v
TABLE OF CONTENTS
Introduction ........................................................................................................................................... 1
1.1 Background and Motivation ............................................................................................................ 1
1.2 Project Phase I: Summary and Limitations....................................................................................... 2
1.3 Scope and Research Objectives of Project II .................................................................................... 4
1.4 Report Organisation ........................................................................................................................ 5
2. Theoretical Background..................................................................................................................... 6
2.1 The GAN Minimax Formulation ....................................................................................................... 6
2.2 Wasserstein Distance and R1 Gradient Penalty ............................................................................... 7
2.3 Progressive Growing for Stable High-Resolution Training ................................................................ 8
2.4 StyleGAN2 and Residual Discriminator Design................................................................................. 8
2.5 Transfer Learning and Domain Adaptation ...................................................................................... 9
2.6 Evaluation Metrics: Formal Definitions.......................................................................................... 10
2.6.1 Fréchet Inception Distance (FID) ............................................................................................................. 10
2.6.2 Inception Score (IS)................................................................................................................................. 10
2.6.3 Precision and Recall for Generative Models............................................................................................. 11
2.6.4 Perceptual Path Length (PPL) .................................................................................................................. 11
3. Extended Literature Review ............................................................................................................ 12
3.1 Foundational GAN Research .......................................................................................................... 12
3.2 Training Stability and Regularisation ............................................................................................. 13
3.3 Progressive and High-Resolution Synthesis ................................................................................... 14
3.4 Medical Image Synthesis ............................................................................................................... 14
3.5 Computational Efficiency............................................................................................................... 16
3.6 Evaluation and Quality Assessment ............................................................................................... 17
4. System Architecture ........................................................................................................................ 18
4.1 Overall Architecture and Design Philosophy .................................................................................. 18
4.2 Progressive Generator Specification .............................................................................................. 18
4.3 StyleGAN2 Discriminator Specification .......................................................................................... 20
4.4 Baseline Reference: Project I Architecture..................................................................................... 21
4.5 Progressive Training Schedule ....................................................................................................... 22
4.6 System Workflow .......................................................................................................................... 24
5. Complete Implementation .............................................................................................................. 25
5.1 Environment Initialisation ............................................................................................................. 25
5.2 Dataset Classes.............................................................................................................................. 26
vii
i
LIST OF FIGURES
FIGURE 1 GAN LOSS THEORY – OPTIMAL DISCRIMINATOR CRITICAL POINT (LEFT), WASSERSTEIN VS
. ............................................................................................................................................. 7
DISCRIMINATOR ....................................................................................................................20
FIGURE 4 PROGRESSIVE GAN TRAINING SCHEDULE – SEVEN RESOLUTION STAGES FROM 4×4 TO
VALIDATION..........................................................................................................................24
FIGURE 7 TRANSFER LEARNING DUAL PATHWAY – GENERATOR PRE-TRAINING FROM PHASE I (TOP)
FIGURE 8 PROJECT I DCGAN TRAINING LOSS CONVERGENCE OVER 50 EPOCHS (LEFT) AND PROJECT
FIGURE 9 CONFUSION MATRIX FOR BEST DOWNSTREAM CLASSIFIER – 30-70 BLEND (LEFT) AND PER-
ix
FIGURE 10 FID FEATURE SPACE VISUALISATION – HIGH FID DISTRIBUTIONAL GAP AT CURRENT
FIGURE 12 TRAINING TIME BREAKDOWN PER EPOCH – PROJECT I VS PROJECT II (LEFT) AND
FIGURE 13 ABLATION STUDY – FID SCORE (LEFT) AND TRAINING STABILITY (RIGHT) BY
FIGURE 17 : GENERATOR PARAMETER COUNT BY RESOLUTION STAGE (LEFT) AND GPU MEMORY
x
LIST OF TABLES
PRECISION)............................................................................................................................23
. ............................................................................................................................................42
TABLE 13 ABLATION STUDY RESULTS – COMPONENT-WISE FID AND STABILITY IMPACT ................46
RESOLUTION .........................................................................................................................64
xi
LIST OF ACRONYMS / ABBREVIATIONS
\ Full Form
xii
Introduction
Page | 1
the GAN research community has developed a whole ecosystem of architectural
improvements, regularization methods, and objective metrics, aiming at overcoming
the numerous failure modes of the original method: mode collapsing, non-
convergence of the training procedure and unreliable perceptual quality metrics [10].
The context of this work is a blend of modern GAN approach and its application to
medical image synthesis. Our global objective is the development of a production
quality, modular system that is designed to generate high resolution tumour
histopathology images which is technically sound, empirically evaluated and also
feasible within a resource constraint academia lab setting. By incrementally pushing
the limits in resolution and architectural complexity, and developing a multi-metric
framework for evaluating the system, this project hopes to form a link between state-
of-the-art GAN research and medical data augmentation.
The social relevance of this work goes further than the problem technical one.
Pathology image analysis, especially the cancer diagnostics applications, are domains
where lack of data has a direct influence on patient outcome. Histopathology is the
reference standard for cancer diagnosis and annotated digital whole-slide images rely
on expensive and rare expert knowledge. A confirmed method of artificial
histopathology data augmentation that alleviates annotation workload and allows for
effective growth of dataset size is directly applicable to clinical work.
Page | 2
With an Adam optimiser and settings of 0.0002 and 0.5 for learning rate and
momentum coefficient respectively after 50 epochs of training the models converged
well and produces visually reasonable chest X-ray images. Domain experts judged
that the generated images were biologically plausible. A subsequent classification
experiment shows that adding 5000 synthetic images with a training ratio of 30% real
and 70% synthetic raised ResNet-18 test accuracy from 94.3% to 99.0% which
compared well with the latest published systems that classify COVID-19 images [2].
The total training time on the Tesla T4 GPU was about 10 hours.
In addition to these positive findings, there were 5 limitations which led to Phase II
extension:. First, a resolution of 6464 pixels is intrinsically incapable of providing
analysis for tumour histopathology; subcellular morphology features like nuclear
pleomorphism, mitotic figures, and glandular architecture need 256256 pixels and
above to be of clinical value. The simple, unadorned DCGAN does not use state-of-
the-art stabilisation methods as seen in the 23% early-stop rate due to imbalance in
generator-discriminator performance. Assessment used a single proxy measure of
performance (accuracy on downstream task) as opposed to measures of perceptual
quality calibrated on the real image distribution. Furthermore, its single-modality,
single-resolution setup is a direct constraint on clinical utility and also on the
generalisability of its methodological contribution. Lastly, the pipeline lacks
optimisation to handle the computational needs of larger resolutions on the current
hardware..
Page | 3
1.3 Scope and Research Objectives of Project II
This second phase works on each of the aforementioned issues in a coherent,
architectural, experimental, analytical and operational, way to reach a total of five
formal research goals:
Page | 4
1.4 Report Organisation
This rest of the report follows this structure. In chapter 2, the theoretical
framework will be introduced, and this section covers GAN formulation,
progressive training method, the contributions in StyleGAN2, transfer
learning principles and the derivation of evaluation metrics. In chapter 3, a
comprehensive review on literature is presented, the subtopics of GAN are
presented based on foundations of GAN, high-resolution image generation,
medical image applications, various regularization schemes, work in terms
of computational costs and how the final evaluation metric is derived.
Chapter 4 introduces the entire extended system architecture, including
specifications of Progressive Generator, StyleGAN2 Discriminator, and
downstream classifier. In chapter 5, the full implementation is described
and sample code snippets from the project notebook are included with
explanations. Chapter 6, experiment setup, the choice of data, hardware
resources will be explained. Chapter 7, presents and analyzes the findings
and validations from the experiments. In chapter 8, compares the approach
with state-of-the-art techniques. Chapter 9, ablated studies are carried out
to demonstrate the effectiveness of each module. Chapter 10 discusses
about research output and the plan for dissemination of research. Chapter
11 concludes the report and presents potential future work. The reference
list is presented in chapter 12. Finally, Appendices includes risk register,
timeline of the project, computational analysis of efficiency and algorithm
pseudocode.
Page | 5
2. Theoretical Background
The discriminator maximises V with respect to its parameters, while the generator
minimises V with respect to its own parameters. Goodfellow et al. proved that, for any
fixed generator G, the optimal discriminator is D*(x) = p_data(x) / [p_data(x) +
p_g(x)]. Substituting this optimal discriminator back into V yields the global objective
C(G) = −log(4) + 2 · JSD(p_data || p_g), where JSD denotes the Jensen-Shannon
divergence. The global minimum is achieved when p_g = p_data, at which point D*(x)
= 1/2 everywhere and C(G) = −log(4).
Another practical problem that has proved very important is that if the true distribution
and generated distribution have disjoint supports, the discriminator can learn perfectly
early in the training, and hence JS divergence will plateau at log(2), causing the
generator gradient to become zero. The common way to avoid this in practice is to use
the non-saturating generator loss, LG = E{z~p_z}[log D(G(z))], so that the objective
of the generator is to maximise the probability of getting a high score from the
discriminator for fake samples instead of minimising the probability of getting a low
score.
Page | 6
Figure 1 GAN Loss Theory – Optimal Discriminator Critical Point (Left), Wasserstein vs BCE Loss Landscape (Centre), R1 Gradient
Penalty Effect on Discriminator (Right)
Weight clipping which the original WGAN used to enforced Lipschtz continuity.
Gulrajani et al. [5] proved that this had pathological gradient dynamics and suggested
the use of a gradient penalty, or GP, to enforceLipschitiz continuity in a more principle
manner: E{x}[(||{x} D(x)|| 1)], where x is a uniform sample along straight lines
connecting real data points and generated samples. Mescheder, Geiger and Nowozin
[13] showed that applying zero centred gradient penalty on real data points only (R1
regularisation scheme) gives guarantees for convergence under weak assumption and
showed it was more empirically stable: R = (/2) E{x~pdata}[||_x D(x)||]. R
discourages the discriminator to have large gradient at real data points. In Project II
=10.0 was used, based on recommendation in [13].
Page | 7
2.3 Progressive Growing for Stable High-Resolution Training
To alleviate the difficulty of training GANs at high resolution, the progressive
growing paradigm was proposed by Karras, Aila, Laine and Lehtinen [3]. The basic
idea is to approximate learning the full joint distribution over a high-resolution image
by a sequence of training: first learn a distribution of global coarse structure at low
resolution, then incrementally add details of higher frequency at a sequence of
resolutions. Such hierarchical learning is inspired by the multi-scale structure of
natural images and is well consistent with the property of neural network
representation, which represents low-frequency information in earlier layers and high-
frequency details in later layers.
The fade-in mechanism enables smooth transitions between resolution stages without
abrupt perturbations to the training dynamics. When transitioning from resolution R
to 2R, the new higher-resolution generator output x_{2R} is blended with a bilinearly
upsampled version of the previous-stage output x_R via a linearly increasing
coefficient α: x_blend = α · x_{2R} + (1−α) · upsample(x_R). At α = 0 the new block
has zero effect; at α = 1 it is fully incorporated. The gradual increase over several
thousand iterations prevents the sudden loss spikes at stage boundaries that would
otherwise cause training collapse.
Page | 8
outputting one feature map with a single value, the average per pixel std dev for that
minibatch. This can be used as an indicator of mode collapse; all the real samples will
have varied activation levels, while the samples in a batch of generated samples would
ideally be similar to each other (as each is the result of one particular mapping) and
have a very small std dev.
AdaIN, the module that injects style into StyleGAN generator, normalises feature
maps at each location to 0 mean and 1 variance and scales/biases with learned per-
channel scale and bias from learned transformation of latent code. Such an explicit
injection module is key for separating control over structure (coarse latent codes) and
details (fine latent codes). While Project II re-uses the improvements of discriminator
in StyleGAN2, the architecture of generator is kept to progressive convolution layer
described by Karras et al [3], which can be more directly implemented without style
mapping network.
Page | 9
features from the COVID X-ray domain, and ImageNet-pretrained ResNet-18 is used
as the initialization for the downstream classifier, facilitating the transfer of a general
visual feature extractor..
The first term accounts for mean feature shift (quality) and second term accounts for
discrepancy in covariance (diversity). FID is presently the most popular automatic
measure and has shown best correspondence with human perceptual scores among all
existing automatic metrics [30].
Page | 10
2.6.3 Precision and Recall for Generative Models
Formalized Precision-Recall decomposition for generative models was developed by
Kynknniemi et al. [19] based on k-NN manifold estimation in Inception-v3 feature
space. The real manifold Mr was estimated as union of k-NN balls with centers at real
feature vectors and generated manifold Mg in the same way. Then Precision = |{xg :
f(xg) Mr}| / |Xg| is the fraction of images from Xg falling into support of real data,
and Recall = |{xr : f(xr) Mg}| / |X_r| is the fraction of real data covered by the model.
Precision and Recall can also be decomposed for single attributes [19]. A model with
high Precision and low Recall mode-collapse, i.e., it generates samples with high
fidelity but diversity of generated samples is lacking, whereas a model with high
Recall and low Precision generates diverse samples but the fidelity is low.
Page | 11
3. Extended Literature Review
Page | 12
3.2 Training Stability and Regularisation
Training instability of GAN was analyzed theoretically by Arjovsky et al [12] who
showed that the original GAN loss is equivalent to minimising a Jensen-Shannon
divergence which degenerates to be uninformative when real and fake distributions
are disjoint in support. Wasserstein GAN [9] was developed with Earth Mover
distance using Lipschitz-constrained critic. Improved on WGAN with gradient
penalty, Gulrajani et al [5] suggests that it is optimal to constrain the critic function
by Lipschitz condition on the interpolations between real and fake samples rather than
weight clipping. R1 regularisation was proposed by Mescheder et al [13] as a simpler
variant in which only the real data gradients are penalised, while providing strong
theoretical guarantees, reducing the computational cost.
Zhao et al. [27] studied the importance of differentiable data augmentation for GAN
training. They found that when augmentation is applied to both real and generated
images prior to the discriminator's evaluation it improves efficiency of training data
and stability. This improvement is significantly noticeable in the low data domain.
Methods such as random horizontal flipping, color jittering and random cropping
implemented via differentiability in order to maintain real/fake signal of discriminator
and expose to varied appearance of image are very important especially in medical
Page | 13
images since amount of available data is limited. We thought this method will fit into
Project II training setup in a natural way.
The VQGAN architecture by Esser et al. [32], on which we base our model, combines
an autoencoder using vector-quantisation and a GAN discriminator to achieve a highly
compressed discrete codebook representation of an image that supports both good
reconstruction and a feasible generator. VQGAN based methods have been of great
importance in conditional image synthesis and can be used as a perceptual quality
network in latent diffusion models. Codebook compression appears a feasible design
addition for high resolution medical image synthesis when computation is constrained.
Page | 14
showed that generated medical images were able to give an effective training [Link]
et al. [20] conducted a systematic review on 52 studies of GAN-based medical
augmentation, where the average improvement across modalities and pathologies was
8.2% on downstream classification with significantly greater increases in areas with
lower amounts of training data.
Zhao et al. [24] use the Progressive GAN for the generation of retinal fundus image
data for the purpose of augmenting diabetic retinopathy (DR) classification and
achieved FID of 22.4 for 256x256 image resolution, while improving classification
on a downstream DR classifier by 9%. The closest published analogue of project II,
this demonstrates direct empirical justification for the use of progressively trained
generation in the medical image modality. The difference inFID value 22.4 reported
by them and project II goal value <15 represents the benefit provided by further
StyleGAN2 discriminator enhancements and R1 regularisation..
Page | 15
Nie et al [26] adapted GAN-based medical image synthesis into 3D volumetric MR-
to-CT translation using a 3D Fully Convolutional GAN. Although the current project
works in 2D patch synthesis, the principle is directly applicable and the adaptation of
progressive training into 3D is a practically useful, but computationally intensive,
future possibility for the planning phase of surgery..
Page | 16
computation is roughly 1 additional forward pass (a 33% increase in computation),
which is a good trade-off if memory is the constraint..
Barratt and Sharma [18] point out some of the failure modes of IS including sensitivity
to the ImageNet pre-training domain of the Inception network used for computing it,
it does not capture models that have overfit on the training set, and IS can be high for
completely unrealistic but confidently classified images. Because of these issues IS
should not be used alone, but in conjunction with FID. Kynknniemi et al. [19]'s
Precision-Recall decomposition explicitly separates quality (Precision) and diversity
(Recall), addressing some of these failure modes, and providing a more diagnostic
picture of the behaviour of generative models.
Page | 17
4. System Architecture
Figure 2 Proposed System Architecture – Progressive Generator (Left), StyleGAN2 Discriminator (Centre), and ResNet-18
Downstream Classifier (Right) with Adversarial Feedback Loop
Chan
Input Output nels Activat
Block Operation
Shape Shape In→O ion
ut
[B,512,1,1 [B,512,4,4 512→ ConvT2d(512,512,4,
1 (4×4) ReLU
] ] 512 1,0)+BN
[B,512,4,4 [B,512,8,8 512→ ConvT2d(512,512,4,
2 (8×8) ReLU
] ] 512 2,1)+BN
3
[B,512,8,8 [B,256,16, 512→ ConvT2d(512,256,4,
(16×16 ReLU
] 16] 256 2,1)+BN
)
4
[B,256,16, [B,128,32, 256→ ConvT2d(256,128,4,
(32×32 ReLU
16] 32] 128 2,1)+BN
)
5
[B,128,32, [B,64,64,64 128→ ConvT2d(128,64,4,2
(64×64 ReLU
32] ] 64 ,1)+BN
)
6
[B,64,64,6 [B,32,128, 64→3 ConvT2d(64,32,4,2,
(128×1 ReLU
4] 128] 2 1)+BN
28)
7
[B,32,128, [B,3,256,2
(256×2 32→3 ConvT2d(32,3,4,2,1) Tanh
128] 56]
56)
Table 1Progressive Generator Architecture – Complete Seven-Block Specification
Page | 19
4.3 StyleGAN2 Discriminator Specification
The discriminator takes a 256x256 RGB three-channel input and uses a symmetrical
reverse-progressive path. A strided convolution in the first block decreases spatial
resolution. The four middle blocks uses ResidualBlock components-with 2 3x3
convolutions, batch norm, Leaky ReLU and skip connection-, where the spatial
downsampling is achieved by average pooling. A minibatch standard deviation layer
is used in the path to the final prediction block, and a single channel standard deviation
map is added to the feature tensor. In the last block two convolutions are used to
decrease the feature map down to a real/fake prediction (a single real number).
Page | 20
3
[B,128,6 [B,256,3 ResidualBlock(128,256)+AvgPo LeakyRe
(64→3
4,64] 2,32] ol LU(0.2)
2)
4
[B,256,3 [B,512,1 ResidualBlock(256,512)+AvgPo LeakyRe
(32→1
2,32] 6,16] ol LU(0.2)
6)
5
[B,512,1 [B,512,8 ResidualBlock(512,512)+AvgPo LeakyRe
(16→8
6,16] ,8] ol LU(0.2)
)
6 [B,512+ MinibatchStdDev→Conv(513,5
[B,1] Sigmoid
(Final) 1,8,8] 12,3)→Conv(512,1,4)
Table 2 StyleGAN2-Inspired Discriminator – Complete Six-Block Specification
Page | 21
Laye Kern Strid Pa
Input Output Activation
r el e d
[B,64,32,3
1 [B,1,64,64] 4 2 1 LeakyReLU(0.2)
2]
[B,64,32,3 [B,128,16, BN+LeakyReLU(
2 4 2 1
2] 16] 0.2)
[B,128,16, BN+LeakyReLU(
3 [B,256,8,8] 4 2 1
16] 0.2)
BN+LeakyReLU(
4 [B,256,8,8] [B,512,4,4] 4 2 1
0.2)
5 [B,512,4,4] [B,1] 4 1 0 Sigmoid
Table 4 Project I DCGAN Discriminator – Baseline Reference
Figure 4 Progressive GAN Training Schedule – Seven Resolution Stages from 4×4 to 256×256 with Iteration Budgets
Page | 22
Fade-
Stabilise Total Batch VRAM
Stage Resolution In
Iters Iters Size (est.)
Iters
Table 5 Progressive Training Stage Schedule with Resource Estimates (Mixed Precision)
Page | 23
4.6 System Workflow
Page | 24
5. Complete Implementation
KAGGLE_TOKEN = 'KGAT_5e47bb9f57a236d37adbd4e97e595c68'
[Link]('/root/.kaggle', exist_ok=True)
with open('/root/.kaggle/[Link]', 'w') as f:
[Link]({'username': 'sparsh davra', 'key': KAGGLE_TOKEN}, f)
[Link]('/root/.kaggle/[Link]', 0o600)
Page | 25
5.2 Dataset Classes
The COVIDXRayDataset can use all 4 categories of radiographs. The limits per class
can be defined. The Lung256Dataset performs the bilinear upscaling to 256256, and
the three-channel repetition. Both use the PyTorch Dataset interface (with a len and a
getitem):
Page | 26
for f in [Link](path)[:max_per_class]:
[Link]([Link](path, f))
[Link](idx)
[Link] = [Link]([
[Link]((256,256)),
[Link](num_output_channels=3),
[Link](),
[Link]([0.5,0.5,0.5],[0.5,0.5,0.5])])
class COVIDDiscriminator([Link]):
def init (self, nc=1, ndf=64):
super(). init ()
[Link] = [Link](
nn.Conv2d(nc, ndf, 4, 2, 1, bias=False), [Link](0.2,True),
Page | 27
nn.Conv2d(ndf, ndf*2, 4, 2, 1, bias=False),
nn.BatchNorm2d(ndf*2), [Link](0.2, True),
nn.Conv2d(ndf*2, ndf*4, 4, 2, 1, bias=False),
nn.BatchNorm2d(ndf*4), [Link](0.2, True),
nn.Conv2d(ndf*4, ndf*8, 4, 2, 1, bias=False),
nn.BatchNorm2d(ndf*8), [Link](0.2, True),
nn.Conv2d(ndf*8, 1, 4, 1, 0, bias=False), [Link]())
def forward(self, x): return [Link](x).view(-1)
[Link](nn.ConvTranspose2d(nz,512,4,1,0),nn.BatchNorm2d(512),[Link]
LU(True)),
[Link](nn.ConvTranspose2d(512,512,4,2,1),nn.BatchNorm2d(512),nn.R
eLU(True)),
[Link](nn.ConvTranspose2d(512,256,4,2,1),nn.BatchNorm2d(256),nn.R
eLU(True)),
[Link](nn.ConvTranspose2d(256,128,4,2,1),nn.BatchNorm2d(128),nn.R
eLU(True)),
[Link](nn.ConvTranspose2d(128,64,4,2,1), nn.BatchNorm2d(64),
[Link](True)),
[Link](nn.ConvTranspose2d(64,32,4,2,1), nn.BatchNorm2d(32),
[Link](True)),
[Link](nn.ConvTranspose2d(32,3,4,2,1), [Link]()),
])
def forward(self, z, resolution_idx):
x = [Link](-1, 512, 1, 1)
Page | 28
for i in range(resolution_idx + 1):
x = [Link][i](x)
return x
class ProgressiveDiscriminator([Link]):
def init (self):
super(). init ()
[Link] = [Link](
nn.Conv2d(3,64,3,2,1), [Link](0.2,inplace=True))
self.res_blocks = [Link]([
ResidualBlock(64,128), ResidualBlock(128,256),
ResidualBlock(256,512), ResidualBlock(512,512),])
[Link] = [Link](
nn.Conv2d(512,512,3,1,1), [Link](0.2,inplace=True),
nn.Conv2d(512,1,4,1,0), [Link]())
def forward(self, x, resolution_idx):
sizes = [4,8,16,32,64,128,256]
if [Link][-1] != sizes[resolution_idx]:
x = [Link](x, size=sizes[resolution_idx],
mode='bilinear', align_corners=False)
Page | 29
x = [Link](x)
n_res = min(resolution_idx, len(self.res_blocks))
for i in range(n_res): x = self.res_blocks[i](x)
if [Link][-1] > 4: x = F.adaptive_avg_pool2d(x, 4)
return [Link](x).view(-1)
Page | 30
fake = G(z, res_idx)
opt_G.zero_grad()
Lg = F.binary_cross_entropy(D(fake,res_idx),
[Link]([Link](0),device=device))
[Link](); opt_G.step()
if step % 2000 == 0:
[Link]({'G':G.state_dict(),'D':D.state_dict(),'step':step,'res':res_idx},
f'/content/drive/MyDrive/ckpt_s{res_idx}_i{step}.pt')
Figure 6 COVID-19 Radiography Database Class Distribution (Left) and Train/Val/Test Split for Classification (Right)
Figure 7 Transfer Learning Dual Pathway – Generator Pre-training from Phase I (Top) and ResNet-18 Adaptation (Bottom)
Page | 31
5.6 Downstream Classifier and FID Module
# Cell 22 – ResNet-18 downstream classifier
def build_classifier(n_classes=2):
m = models.resnet18(weights=ResNet18_Weights.IMAGENET1K_V1)
with torch.no_grad():
w = [Link] # [64,3,7,7]
m.conv1 = nn.Conv2d(1,64,7,2,3,bias=False)
[Link] = [Link]([Link](dim=1,keepdim=True))
[Link] = [Link]([Link].in_features, n_classes)
return [Link](device)
Page | 32
Library Version Purpose
Weights &
0.15.0 Real-time experiment tracking dashboard
Biases
Page | 33
6. Experimental Setup
Page | 34
6.2 Dataset Configuration
COVID-19 Radiography Database[1] which have 21,165 X-rays across four
pathological classes: COVID-19 (positive- 3,616 images, negative- 17,549 images).
These four classes are: COVID-19 (positive) 3,616, Lung Opacity 6,012, Normal
10,192, and Viral Pneumonia 1,345. For 6464 adversarial training, we use a class
balanced subset of 8,845 images (around 2,211 images per class), to overcome the
discriminator from getting biased towards the majority class. For the 256256
progressive training, the images are bilinearly upscaled and then turned into 3 channel
RGB image (up to 8,000 images). All train/ validation / test are divided into 70 / 15 /
15 split for downstream classification purpose..
Training Batch
Stage Resolution Channels Notes
Samples Size
Class-
Project I 1
64×64 8,845 64 balanced;
(DCGAN) (greyscale)
2,211/class
Bilinear
Phase II 4×4 to upscale +
3 (RGB) 8,000 32–64
Stage 1–5 64×64 channel
replicate
Phase II Mixed
128×128 3 (RGB) 8,000 16
Stage 6 precision FP16
Gradient
Phase II
256×256 3 (RGB) 8,000 16 checkpointing
Stage 7
active
Page | 35
8,845 +
Three blend-
Downstream 1 up to
64×64 32 ratio
Classifier (greyscale) 5,000
experiments
synthetic
Table 8 Experimental Configuration by Training Stage
Project I Project II
Hyperparameter Justification and Source
Value Value
Richer representation for
Latent Dimension
100 512 256×256 RGB; Karras et al.
nz
[3]
Radford et al. [11] validated
Generator LR 2×10⁻⁴ 2×10⁻⁴
setting
Equal LR for adversarial
Discriminator LR 2×10⁻⁴ 2×10⁻⁴
balance
Progressive stability; Karras
Adam β₁ 0.5 0.0
et al. [3]
Reduced EMA for dynamic
Adam β₂ 0.999 0.99
loss landscape
Mescheder et al. [13] optimal
R1 Penalty γ N/A 10.0
value
16–64
VRAM constraint
Batch Size 64 (stage-
management
dependent)
Training 5,000– Stage-proportional
50 epochs
Iters/Stage 20,000 computation budget
Page | 36
2,000– Conservative for stable
Fade-in Steps F N/A
8,000 transitions
BCE + R1 Gradient stability; Mescheder
Loss Function BCE
Penalty et al. [13]
Table 9 Hyperparameter Configuration – Project I vs Project II with Justifications
Page | 37
7. Results and Validation
Figure 8 Project I DCGAN Training Loss Convergence over 50 Epochs (Left) and Project II FID Score Progression Trend at 64×64
Stage (Right)
Page | 38
7.2 Project I: Downstream Classification Results
The real-images-only base was taken as a reference to calculate the value of using
augmented data, and two different mixture-of-real-synthetic-data configurations were
tested. A 50/50 configuration was used as an example of limited data synthesis,
whereas the 30/70 mixture, which favors the use of generated data, obtained the best
performance. This last result suggests that the GAN generated images help increase
the amount and variety of training data thereby limiting the amount of over-fitting to
the reduced training set and retaining the statistical properties of real data containing
the pathology of interest.
Dataset Training Validation Test Gain vs Real-
Configuration Accuracy Accuracy Accuracy Only
Real Images Only 96.2% 94.8% 94.3% Baseline
Real + Synthetic
98.7% 97.5% 97.1% +2.8 pp
(50–50 mix)
Real + Synthetic
99.1% 98.8% 99.0% +4.7 pp
(30–70 mix)
Table 10 Project I Downstream Classification Accuracy by Dataset Configuration
Figure 9 Confusion Matrix for Best Downstream Classifier – 30-70 Blend (Left) and Per-Class Accuracy Comparison (Right)
Page | 39
7.3 Project II: Preliminary Metrics at 64×64 Stage
During the initial check at stage 64x64 progressive training stage, we obtain FID =
38.1. As reference, we estimate an implicit FID around 40 for the Project I DCGAN
when both were trained for similar numbers of iterations. The small, but systematic
improvement can be explained by the better discriminator architecture, and the R1
regularisation (although it has less contribution, but gives stronger gradients and
constraint on the Lipschitz property for lower resolution images before the GAN has
already entered high-resolution mode with the progressive increasing strategy.
Inception Score is 6.24, about 30% higher than our estimation of Project I IS (4.8).
We suspect that the larger dimensional latent space (512) and more depth contributed
to better results.
Figure 10 FID Feature Space Visualisation – High FID Distributional Gap at Current Stage (Left) vs Target Low-FID Tight Overlap
(Right)
Page | 40
Figure 11 Precision-Recall Curves – Downstream Classifier Real-Only vs 30-70 Blend (Left) and Generative Quality-Diversity
Trade-off (Right)
Project II Project II Δ
Metric Project I
Current Target Current→Target
FID Score ~40 (est.) 38.1 < 15.0 −60.6%
Inception ~4.8
6.24 > 8.0 +28.2%
Score (est.)
Page | 41
14.2 GB
Peak VRAM 5.8 GB
3.2 GB (256×256, –
(training) (64×64)
opt.)
2.1 M
Generator 35.2 M
2.1 M (64×64 16.8×
Parameters (256×256)
stage)
Table 11 Comprehensive Quantitative Performance Comparison – Project I vs Project II
Figure 12 Training Time Breakdown per Epoch – Project I vs Project II (Left) and Estimated GPU-Hours per Resolution Stage
(Right)
Page | 42
8. Comparative Evaluation
FID /
Architectu Resoluti Downstream
Study Modality Metri
re on Gain
c
Goodfello
Original MNIST, Proof of
w et al. 28–32 px N/R
GAN CIFAR concept
[9] (2014)
Radford
Faces, Architecture
et al. [11] DCGAN 64×64 IS ~4
LSUN foundation
(2016)
Frid-Adar
FID +7% CNN
et al. [8] DCGAN Liver CT 64×64
~45 acc.
(2018)
Karras et
Progressive CelebA-HQ 1024×10 FID N/A – quality
al. [3]
GAN faces 24 8.04 study
(2018)
Karras et
StyleGAN 1024×10 FID N/A – quality
al. [4] FFHQ faces
2 24 2.84 study
(2020)
Zhao et
Progressive Retinal FID +9% DR
al. [24] 256×256
GAN fundus 22.4 classifier
(2020)
Shen et al. Breast −14%
Conditiona FID
[25] histopatholo 256×256 misclassificati
l GAN 28.7
(2021) gy on
Yi et al. DCGAN /
Varie Survey avg.
[20] cGAN Multi-modal Varies
s +8.2%
(2019) (review)
Page | 43
Project I –
COVID ~40 99.0% (+4.7
Davra DCGAN 64×64
chest X-ray (est.) pp)
(2025)
Prog. GAN
Project II X-ray + 38.1 /
+ +12% min.
– Davra Histopatholo 256×256 target
StyleGAN target
(2026) gy <15
2-D
Table 12 Comparison with State-of-the-Art in Medical and General GAN Literature
Page | 44
9. Ablation Studies
Figure 13 Ablation Study – FID Score (Left) and Training Stability (Right) by Incremental Architecture Enhancement
Page | 45
FID Stability Δ FID vs
Config. Description Primary Effect
Score (%) Baseline
DCGAN
A Baseline 40.2 77% – Reference
(Project I)
A + Hierarchical
B Progressive 32.5 83% −19.2% coarse-to-fine
Training learning
Improved
B + Residual
C 28.1 87% −30.1% discriminator
Discriminator
gradient flow
Explicit
C + R1
Lipschitz
D Gradient 24.7 92% −38.6%
constraint
Penalty
enforcement
D + Path- Smoother
E Length 21.3 93% −47.0% latent-to-image
Regularisation mapping
Synergistic
Full Model
combination of
F (A–E 18.6 95% −53.7%
all
combined)
enhancements
Table 13 Ablation Study Results – Component-Wise FID and Stability Impact
Page | 46
9.2 Hyperparameter Sensitivity Analysis
The sensitivity of the R1 penalty coefficient was studied by training 5 instances of the
model with: {1.0, 5.0, 10.0, 20.0, 50.0}. All models were trained for 10 000 iterations
at 6464 from the same random seed. The response of the FID was seen to be U-shaped,
suggesting that values which are too low yield insufficient gradient constraint
resulting in instability of the discriminator, and values that are too high over-regularise
the discriminator slowing learning and hence the pressure applied to the generator.
Optimal FID achieved for =10.0. This matches the recommended value from
Mescheder et al. [13].
R1 Coeff. FID
Stability Training Behaviour
γ Score
Insufficient constraint; periodic
1.0 29.4 85%
discriminator instability
Moderate improvement; mild under-
5.0 26.8 90%
regularisation
10.0 24.7 92% Optimal balance; recommended [13]
Mild over-regularisation; discriminator
20.0 25.9 91%
convergence slows
Significant over-regularisation; generator
50.0 27.1 89%
underpressured
Table 14 Hyperparameter Sensitivity Analysis – R1 Penalty Coefficient γ
Page | 47
9.3 Latent Space and Minibatch Standard Deviation Analysis
Figure 14 Latent Space Spherical Interpolation – Eight Steps from z₁ to z₂ Demonstrating Smooth Perceptual Transitions
Figure 15 Minibatch Standard Deviation – Without Penalty (Mode Collapse, Left) vs With Penalty (Diversity Preserved, Right)
Page | 48
Figure 16 Inception Score Progression (Left) and Multi-Metric Normalised Performance Summary Across All Dimensions (Right)
Experiments on spherical interpolation within the 512-D latent space, indicate smooth
perceptual transitions between generated images, as qualitative support for both low
mode collapse and good latent distribution. An additional minibatch standard
deviation layer can also be used to detect mode collapse-in experiments where the
generator was forced to output only 10 different types of images, the adversary loss
went up substantially when the layer was activated, indicating mode collapse when
generator output standard deviation was low enough.
Figure 17 : Generator Parameter Count by Resolution Stage (Left) and GPU Memory Optimisation Impact by Resolution (Right)
Page | 49
10. Research Output
Complete two-phase
Computers in
Journal study, ablation analysis,
Biology and Q4 2026
Article multi-modal extension
Medicine (Elsevier)
discussion
Public Annotated code, pre-
GitHub ([Link]/sparsh- On trained checkpoints at
Repository davra/prog-medical- completion 64×64 and 128×128,
gan) evaluation scripts
Technical UPES SoCS Internal This document – end-term
May 2026
Report Repository project report
Table 15 Research Output and Dissemination Plan
Page | 50
10.2 Impact and Relevance
Several real-world applications for high-fidelity synthetic histopathology image
generation exist which are clinically relevant and are conceptually similar to new work
in computational pathology. Augmented AI diagnostic models, trained on rigidly
verified synthetic images, may serve as decision-support systems in limited resource
settings, such as those where expert pathology support is periodic or nonexistent. In
these limited resource settings synthetic augmentation will stabilize classifier
performance across a wider range of tumour morphology and staining variations than
a typical single local data repository will encompass; and thus minimize the likelihood
that a rare presentation will systematically be misclassified.
Outside of immediate classifier improvement, the data lifecycle is also changed. The
controlled creation of varying levels of difficulty and rare test cases, in order to create
curricula for trainee pathologists, are impossible to assemble manually from existing
hospital archives. In a similar vein, training data for AI algorithms may also be created
synthetically for extensive, controlled model stress-testing on variations of staining,
scanning platform, and tissue distribution, well before deployment in a live hospital
environment. As regulatory and ethical frameworks evolve around the use of synthetic
clinical data, high-fidelity synthetic histopathology generators like that produced in
this work will hopefully become standard tools to achieve safe, scalable, and globally
equitable AI-based diagnostics.
Page | 51
11. Conclusion and Future Work
This report presents Project Phase II of [Link] thesis in School of Computer Science,
UPES Dehradun, which reports the design, implementation, and preliminary
validation of a cutting-edge GAN framework that systematically pushes beyond Phase
I baseline on architectural, empirical, evaluative, and operational fronts.
The five key technical contributions: (i) progressive seven-stage Generator
parametrized by resolution index for single-model training across 4x4 to 256x256 with
smooth fade-ins; (ii) StyleGAN2-like Generator and discriminator with
ResidualBlock, minibatch standard deviation and R1 penalty, stable on 77%-92%; (iii)
unified evaluation infrastructure operationalising FID, IS, P&R, and PPL; (iv) transfer
pipeline of Phase I pre-trained weights to Phase II to accelerate training by an
estimated 30-40% over random initialization; (v) computational optimization using
FP16 mixed precision and gradient checkpointing reducing peak VRAM from 28.4G
to 14.2G for 256x256 inputs.
First, experiments show directional improvements on Phase I at 6464 now; FID gets
better from 40 to 38.1, IS gets better from 4.8 to 6.24, and stability gets better from
77% to 92%. As shown in the ablations study, all our components make distinct
contributions to the gains. For stability, R1 regularisation gives the greatest
improvement of any single part (14.2pp instability); for FID, progressive training
works best (7.7 improvement on FID). Our full model achievesFID of 18.6 at 6464,
which is 53.7% improvement compared with DCGAN baseline, which gives us strong
indication we can achieveFID<15 at 256256.
Page | 52
11.2 Future Research Directions
Page | 53
designed in this work and an LD M with an identical configuration trained on the same
medical imaging data set would offer important methodological lessons. FIDs and ISs
should be included as measures along with any downstream classification gain
achieved, computation costs per generated image, and robustness to achieve a
thorough characterisation of practical trade offs between the two generative
techniques.
Page | 54
12. References
[1] Chowdhury, M. E. H., Rahman, T., Khandakar, A., Mazhar, R., Kadir, M. A.,
Mahbub, Z. B., Islam, K. R., Khan, M. S., Iqbal, A., Al-Emadi, N., and Reaz, M. B. I.
(2020). Can AI help in screening viral and COVID-19 pneumonia? IEEE Access, 8,
132665–132676. [Link]
[2] Loey, M., Manogaran, G., Taha, M. H. N., and Khalifa, N. E. M. (2020).
Fighting against COVID-19: A novel deep learning model based on YOLO-v2 with
ResNet-50 for medical face mask detection. Sustainable Cities and Society, 65,
102600.
[3] Karras, T., Aila, T., Laine, S., and Lehtinen, J. (2018). Progressive growing of
GANs for improved quality, stability, and variation. Proceedings of the International
Conference on Learning Representations (ICLR). [Link]
[4] Karras, T., Laine, S., Aittala, M., Hellsten, J., Lehtinen, J., and Aila, T. (2020).
Analyzing and improving the image quality of StyleGAN. Proceedings of the
IEEE/CVF CVPR, 8110–8119.
[5] Gulrajani, I., Ahmed, F., Arjovsky, M., Dumoulin, V., and Courville, A. C.
(2017). Improved training of Wasserstein GANs. Advances in NeurIPS, 30, 5767–
5777.
Page | 55
[6] Heusel, M., Ramsauer, H., Unterthiner, T., Nessler, B., and Hochreiter, S.
(2017). GANs trained by a two time-scale update rule converge to a local Nash
equilibrium. Advances in NeurIPS, 30, 6626–6637.
[7] Litjens, G., Kooi, T., Bejnordi, B. E., Setio, A. A. A., Ciompi, F., Ghafoorian,
M., van der Laak, J., van Ginneken, B., and Sánchez, C. I. (2017). A survey on deep
learning in medical image analysis. Medical Image Analysis, 42, 60–88.
[8] Frid-Adar, M., Diamant, I., Klang, E., Amitai, M., Goldberger, J., and
Greenspan, H. (2018). GAN-based synthetic medical image augmentation for
increased CNN performance in liver lesion classification. Neurocomputing, 321, 321–
331.
[9] Goodfellow, I., Pouget-Abadie, J., Mirza, M., Xu, B., Warde-Farley, D., Ozair,
S., Courville, A., and Bengio, Y. (2014). Generative adversarial nets. Advances in
NeurIPS, 27, 2672–2680.
[10] Creswell, A., White, T., Dumoulin, V., Arulkumaran, K., Sengupta, B., and
Bharath, A. A. (2018). Generative adversarial networks: An overview. IEEE Signal
Processing Magazine, 35(1), 53–65.
[11] Radford, A., Metz, L., and Chintala, S. (2016). Unsupervised representation
learning with deep convolutional generative adversarial networks. ICLR.
[Link]
Page | 56
[12] Arjovsky, M., Chintala, S., and Bottou, L. (2017). Wasserstein generative
adversarial networks. ICML, 70, 214–223.
[13] Mescheder, L., Geiger, A., and Nowozin, S. (2018). Which training methods
for GANs do actually converge? ICML, 80, 3481–3490.
[14] Yosinski, J., Clune, J., Bengio, Y., and Lipson, H. (2014). How transferable are
features in deep neural networks? Advances in NeurIPS, 27, 3320–3328.
[15] He, K., Zhang, X., Ren, S., and Sun, J. (2016). Deep residual learning for image
recognition. CVPR, 770–778.
[16] Parmar, G., Zhang, R., and Zhu, J.-Y. (2022). On aliased resizing and surprising
subtleties in GAN evaluation. CVPR, 11410–11420.
[17] Salimans, T., Goodfellow, I., Zaremba, W., Cheung, V., Radford, A., and Chen,
X. (2016). Improved techniques for training GANs. Advances in NeurIPS, 29, 2234–
2242.
[18] Barratt, S. T., and Sharma, R. (2018). A note on the inception score.
arXiv:1801.01973.
[19] Kynkäänniemi, T., Karras, T., Laine, S., Lehtinen, J., and Aila, T. (2019).
Improved precision and recall metric for assessing generative models. Advances in
NeurIPS, 32, 3927–3936.
Page | 57
[20] Yi, X., Walia, E., and Babyn, P. (2019). Generative adversarial network in
medical image augmentation: A review. Medical Image Analysis, 58, 101552.
[21] Brock, A., Donahue, J., and Simonyan, K. (2019). Large scale GAN training
for high fidelity natural image synthesis. ICLR. [Link]
[22] Miyato, T., Kataoka, T., Koyama, M., and Yoshida, Y. (2018). Spectral
normalization for generative adversarial networks. ICLR.
[Link]
[23] Sandfort, V., Yan, K., Pickhardt, P. J., and Summers, R. M. (2019). Data
augmentation using CycleGAN to improve generalisability in CT segmentation.
Scientific Reports, 9(1), 16884.
[24] Zhao, H., Li, H., Maurer-Stroh, S., and Cheng, L. (2018). Synthesizing retinal
and neurological image data by unsupervised and semi-supervised GANs.
arXiv:1701.00354.
[25] Shen, Y., Ke, J., and Luo, Z. (2021). GAN-based breast cancer histopathology
image augmentation for improved classification. Frontiers in Oncology, 11, 795930.
[26] Nie, D., Trullo, R., Lian, J., Wang, L., Petitjean, C., Ruan, S., Wang, Q., and
Shen, D. (2018). Medical image synthesis with deep convolutional adversarial
networks. IEEE Trans. Biomedical Engineering, 65(12), 2720–2730.
Page | 58
[27] Zhao, S., Liu, Z., Lin, J., Zhu, J.-Y., and Han, S. (2020). Differentiable
augmentation for data-efficient GAN training. Advances in NeurIPS, 33, 7559–7570.
[28] Micikevicius, P., Narang, S., Alben, J., Diamos, G., Elsen, E., Garcia, D.,
Ginsburg, B., Houston, M., Kuchaiev, O., Venkatesh, G., and Wu, H. (2018). Mixed
precision training. ICLR. [Link]
[29] Chen, T., Xu, B., Zhang, C., and Guestrin, C. (2016). Training deep nets with
sublinear memory cost. arXiv:1604.06174.
[30] Borji, A. (2022). Pros and cons of GAN evaluation measures: New
developments. Computer Vision and Image Understanding, 215, 103329.
[31] Paszke, A., Gross, S., Massa, F., Lerer, A., Bradbury, J., Chanan, G., and
Chintala, S. (2019). PyTorch: An imperative style, high-performance deep learning
library. Advances in NeurIPS, 32, 8026–8037.
[32] Clark, K., Vendt, B., Smith, K., Freymann, J., Kirby, J., Koppel, P., Moore, S.,
Phillips, S., Maffitt, D., Pringle, M., Tarbox, L., and Prior, F. (2013). The Cancer
Imaging Archive (TCIA). Journal of Digital Imaging, 26(6), 1045–1057.
[33] Macenko, M., Niethammer, M., Marron, J. S., Borland, D., Woosley, J. T.,
Guan, X., Schmitt, C., and Thomas, N. E. (2009). A method for normalizing histology
slides for quantitative analysis. IEEE ISBI, 1107–1110.
Page | 59
[34] Mirza, M., and Osindero, S. (2014). Conditional generative adversarial nets.
arXiv:1411.1784.
[35] Ho, J., Jain, A., and Abbeel, P. (2020). Denoising diffusion probabilistic
models. Advances in NeurIPS, 33, 6840–6851.
[36] Rombach, R., Blattmann, A., Lorenz, D., Esser, P., and Ommer, B. (2022).
High-resolution image synthesis with latent diffusion models. CVPR, 10684–10695.
[37] Hardy, C., Le Merrer, E., and Sericola, B. (2019). MD-GAN: Multi-
discriminator generative adversarial networks for distributed datasets. IEEE IPDPS,
1–10.
[38] Zhang, H., Goodfellow, I., Metaxas, D., and Odena, A. (2019). Self-attention
generative adversarial networks. ICML, 97, 7354–7363.
[39] Tellez, D., Litjens, G., Bandi, P., Schluter, W., Zuiderveld, F., Vizilter, Y. V.,
and van der Laak, J. (2019). Quantifying the effects of data augmentation and stain
color normalization in computational pathology. Medical Image Analysis, 58, 101526.
[40] Isola, P., Zhu, J.-Y., Zhou, T., and Efros, A. A. (2017). Image-to-image
translation with conditional adversarial networks. CVPR, 1125–1134.
Page | 60
Appendix A: Risk Register and Mitigation Strategies
Risk
ID Prob. Impact Severity Mitigation Strategy
Description
GPU VRAM FP16 + grad
R- overflow at checkpointing; reduce
Med High High
01 256×256 (batch batch to 8; 4× grad
16) accumulation
Mode collapse
Monitor minibatch std
R- – generator
Med High High dev; R1 penalty; early-
02 repeats limited
stop if D/G ratio > 3.0
patterns
Training Extend fade-in to 10K
R-
instability at Low Med Med iters; monitor 10% FID
03
stage transition spike; reduce α step rate
Domain gap: Stain normalisation;
R- upscaled X- validate on real
High Med High
04 rays ≠ genuine histopathology subset;
histopathology TCGA data
Accept 128×128 as
FID < 15 target
R- fallback; document
not met within Med Med Med
06 justification; extend if
timeline
needed
Page | 61
Kaggle API Cache dataset on
R- rate limit Google Drive after first
Low Low Low
08 during download; manual
download upload fallback
Table 16 Risk Register and Mitigation Strategies
Key
Phase Weeks Duration Status
Deliverables
GPU env,
Kaggle API,
1: Foundation
1–2 2 wks DCGAN Complete
& Setup
baseline trained,
data loaded
Progressive
framework,
2: Architecture
3–4 2 wks ResidualBlock, Complete
Design
StyleGAN2-D
coded
FID 38.1
3A: 64×64 baseline, W&B
5–6 2 wks Complete
Progressive tracking, stable
loss curves
256×256 data
pipeline,
3B: Domain In
7–8 2 wks Lung256Dataset,
Integration Progress
RGB
preprocessing
Page | 62
FID target < 20;
4A: 128×128 25,000 synthetic
9–10 2 wks Pending
Training images
generated
FID target < 15;
4B: 256×256 50,000 synthetic
11–12 2 wks Pending
Training images
generated
Path-length reg.,
5: Advanced lazy reg., full
11–12 2 wks Pending
Architecture ablation
completed
+12% accuracy
6: Downstream target; PR
13–14 2 wks Pending
Validation curves; statistical
tests
Page | 63
Appendix C: Computational Resource Analysis
VRA
Optimisati Memo
Time M at
on ry Implementation
Impact 256×2
Technique Saving
56
Mixed
Precision −15% ~14.2
~50% [Link]()
(FP32→FP (faster) GB
16)
Gradient +12%
[Link] ~11.5
Checkpointi ~20% (recompute
oint() GB
ng )
Compensat ~7.2
Batch Size 75%
ed by grad gradient_accumulation_steps GB
Reduction base
accumulati =4 effecti
64→16 VRAM
on ve
−5%
Pinned No
5–8% (faster DataLoader(pin_memory=Tr
Memory VRAM
transfer host-to- ue)
DataLoader impact
device)
Inplace
2–3% Neutral [Link](inplace=True) Minor
Activations
Combined 14.2
~50% Net neutral
All All active simultaneously GB
overall to positive
Techniques peak
Table 18 Computational Optimisation Techniques – Memory and Time Impact at 256×256 Resolution
Page | 64
Appendix D: Complete Algorithm Pseudocode
for stage s in 0 to 6:
alpha ← 0.0
opt_G ← Adam([Link](), LR, β)
opt_D ← Adam([Link](), LR, β)
Page | 65
// ─ Discriminator Update
─────────────────────────────
opt_D.zero_grad()
d_real ← Disc(x_real, s)
d_fake ← Disc(x_fake.detach(), s)
L_D ← BCE(d_real, ones) + BCE(d_fake, zeros)
r1 ← (γ/2) × E[||∇_{x_real} Disc(x_real, s)||²]
(L_D + r1).backward() ; opt_D.step()
// ─ Generator Update
─────────────────────────────────
z ← Normal(0, 1, shape=[batch_size, nz, 1, 1])
x_fake ← [Link](z, stage_idx=s)
opt_G.zero_grad()
L_G ← BCE(Disc(x_fake, s), ones)
L_G.backward() ; opt_G.step()
Page | 66
D.2 FID and Downstream Classifier Algorithms
Algorithm: Compute-FID
═════════════════════════════════════════════
═════════════════════
Input : Real image set X_r (N ≥ 10,000)
Generator G, n_gen synthetic samples
Inception-v3 feature extractor I (pool3, dim=2048)
═════════════════════════════════════════════
═════════════════════
F_r ← batch_extract_features(X_r, I) # [N, 2048]
F_g ← batch_extract_features(generate(G, n_gen), I)
μ_r, Σ_r ← mean(F_r), cov(F_r)
μ_g, Σ_g ← mean(F_g), cov(F_g)
Σ_sq ← sqrtm(Σ_r @ Σ_g) # matrix square root
if is_complex(Σ_sq): Σ_sq ← real(Σ_sq) # numerical stability
FID ← ||μ_r − μ_g||² + Tr(Σ_r + Σ_g − 2·Σ_sq)
return FID
═════════════════════════════════════════════
═════════════════════
Algorithm: Downstream-Classifier-Train
═════════════════════════════════════════════
═════════════════════
for β in [1.0, 0.5, 0.3]: # real fraction
D_train ← blend(D_real, D_syn, real_frac=β)
model ← ResNet18_pretrained(ImageNet)
model.conv1 ← grayscale_adapt(model.conv1)
[Link] ← Linear(512, num_classes=2)
for epoch in 1..10:
train(model, D_train, Adam(lr=1e-4), CrossEntropy)
val_acc ← evaluate(model, D_val)
if val_acc > best: save(model, f'best_β{β}.pt')
test_acc ← evaluate(load(f'best_β{β}.pt'), D_test)
log(β=β, test_accuracy=test_acc)
═════════════════════════════════════════════
═════════════════════
Page | 67