<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Vinit Samani on Medium]]></title>
        <description><![CDATA[Stories by Vinit Samani on Medium]]></description>
        <link>https://medium.com/@samanivinit25?source=rss-00babb4664b8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*CHQr5lq2-EmUUJX-NQbCeA.jpeg</url>
            <title>Stories by Vinit Samani on Medium</title>
            <link>https://medium.com/@samanivinit25?source=rss-00babb4664b8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 14:39:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@samanivinit25/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Battle of GANs: LSGAN vs WGAN vs WGAN-GP on Histopathology Images]]></title>
            <link>https://medium.com/@samanivinit25/battle-of-gans-lsgan-vs-wgan-vs-wgan-gp-on-histopathology-images-e115c990a313?source=rss-00babb4664b8------2</link>
            <guid isPermaLink="false">https://medium.com/p/e115c990a313</guid>
            <category><![CDATA[gans]]></category>
            <dc:creator><![CDATA[Vinit Samani]]></dc:creator>
            <pubDate>Tue, 08 Apr 2025 10:00:59 GMT</pubDate>
            <atom:updated>2025-04-08T10:00:59.838Z</atom:updated>
            <content:encoded><![CDATA[<p>Generative Adversarial Networks (GANs) have revolutionized image generation, but not all GANs are created equal. In this blog, I explore and compare the performance of <strong>LSGAN</strong>, <strong>WGAN</strong>, and <strong>WGAN-GP</strong> on generating histopathology images.</p><p>We evaluate each model both <strong>quantitatively</strong> using <strong>Inception Score (IS)</strong> and <strong>Fréchet Inception Distance (FID)</strong>, and <strong>qualitatively</strong> through visual inspection of generated samples. And as you’ll see, the best score doesn’t always mean the best quality.</p><h3>Dataset &amp; Setup</h3><p>We trained each GAN variant on a dataset of histopathological images. These images often contain fine-grained textures and patterns that are challenging to generate, making it a great testbed for generative models.</p><p>We used the same:</p><ul><li>Latent vector size nz</li><li>Generator architecture</li><li>Training epochs</li><li>Evaluation metrics: <strong>FID</strong> and <strong>Inception Score</strong></li></ul><h3>Evaluation Metrics — A Quick Primer</h3><ul><li><strong>Inception Score (IS):</strong> Measures both the quality and diversity of generated images using a pre-trained classifier. Higher is better.</li><li><strong>Fréchet Inception Distance (FID):</strong> Measures how close the distribution of generated images is to that of real ones. Lower is better.</li></ul><blockquote><em>However, </em><strong><em>metrics alone can be misleading</em></strong><em>. Let’s compare them side by side with generated samples.</em></blockquote><h3>Results and Analysis</h3><h3>LSGAN (Least Squares GAN)</h3><p><strong>📊 FID = 48.13 | IS = 2.02 ± 0.06</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*8GNZRl8V75tR--7KXmdRMA.png" /></figure><ul><li><strong>Visual Quality:</strong> Images look quite realistic with decent structure and texture. Clear patterns can be identified, and there’s variety among samples.</li><li><strong>Interpretation:</strong> While the FID and IS are not the best, <strong>the actual images are visibly superior</strong> compared to WGAN and WGAN-GP.</li><li><strong>Why it works:</strong> LSGAN stabilizes training using least-squares loss, which reduces vanishing gradients and encourages the generator to create data closer to the decision boundary of the discriminator.</li></ul><h3>🔹 WGAN (Wasserstein GAN)</h3><p><strong>📊 FID = 133.26 | IS = 1.72 ± 0.02</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*OBQ1qLuW2xeQ25KqHsfUpQ.png" /></figure><ul><li><strong>Visual Quality:</strong> Images are noisier and less detailed compared to LSGAN. Some patterns are recognizable, but they lack clarity and sharpness.</li><li><strong>Interpretation:</strong> The high FID is consistent with what we see. Despite having better theoretical foundations (Wasserstein loss), <strong>in practice WGAN underperformed</strong> in this specific setting.</li><li><strong>Possible Cause:</strong> WGAN is sensitive to weight clipping. If the clipping values are not chosen properly, it can lead to capacity underuse or gradient issues.</li></ul><h3>🔹 WGAN-GP (Gradient Penalty)</h3><p><strong>📊 FID = 414.35 | IS = 1.00 ± 0.0003</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/689/1*3lvBbseIu0ihCzn-drMegw.png" /></figure><ul><li><strong>Visual Quality:</strong> Images are completely unnatural and repetitive — more like TV static than histopathology.</li><li><strong>Interpretation:</strong> Surprisingly, the IS is technically the <strong>lowest possible</strong> (~1), indicating nearly no diversity or class certainty.</li><li><strong>Why this happened:</strong> While WGAN-GP is known for stable training in theory, it seems that the model <strong>collapsed</strong> here — likely due to poor hyperparameter tuning or an unstable GP coefficient. It’s a case of good model + bad setup = disaster.</li></ul><h3>Visual vs Metric Dilemma</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*3M0iK-zcpX4ddKipf1IF8Q.png" /></figure><h3>Key Takeaway:</h3><blockquote><strong><em>LSGAN gave the most realistic images even though it didn’t have the best metric scores.</em></strong></blockquote><p>This highlights a crucial point: <strong>don’t blindly trust FID and IS</strong>. These metrics have limitations, especially with medical datasets that may not align well with pre-trained ImageNet classifiers used in FID/IS calculations.</p><h3>Final Thoughts</h3><p>Training GANs is more of an art than a science. Your best model might not have the best scores. This experiment taught me that <strong>visual inspection is essential</strong>, especially in domains like medical imaging where human perception plays a huge role.</p><p>🔧 <strong>Tips from this experiment:</strong></p><ul><li>Always visualize outputs, even when metrics look promising.</li><li>Don’t over-rely on FID/IS for niche datasets like histopathology.</li><li>LSGAN might be a great baseline for medical image synthesis tasks.</li></ul><h3>📍 Next Steps</h3><p>I plan to:</p><ul><li>Try <strong>StyleGAN</strong> or <strong>Diffusion Models</strong> for improved visual fidelity.</li><li>Tune <strong>WGAN-GP</strong> better using learning rate schedules and improved GP λ.</li><li>Explore <strong>domain-specific metrics</strong> for histopathology image generation.</li></ul><p>💬 <strong>Have you tried GANs on medical images? What was your experience like? Drop a comment or connect!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e115c990a313" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>