<?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 Meetvora on Medium]]></title>
        <description><![CDATA[Stories by Meetvora on Medium]]></description>
        <link>https://medium.com/@meetvora090201?source=rss-264a1dc1a6f1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*MAdhmi0eodcRv0MpE8KY-A.jpeg</url>
            <title>Stories by Meetvora on Medium</title>
            <link>https://medium.com/@meetvora090201?source=rss-264a1dc1a6f1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 04:06:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@meetvora090201/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[Revolutionizing Semantic Segmentation: A Deep Dive into SemPLeS (Semantic Prompt Learning for WSSS)]]></title>
            <link>https://medium.com/@meetvora090201/revolutionizing-semantic-segmentation-a-deep-dive-into-semples-semantic-prompt-learning-for-wsss-88bbf6280da7?source=rss-264a1dc1a6f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/88bbf6280da7</guid>
            <category><![CDATA[weakly-supervised]]></category>
            <category><![CDATA[segmentation]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[nvidia]]></category>
            <dc:creator><![CDATA[Meetvora]]></dc:creator>
            <pubDate>Tue, 07 Jan 2025 16:15:53 GMT</pubDate>
            <atom:updated>2025-01-07T16:15:53.488Z</atom:updated>
            <content:encoded><![CDATA[<p>Semantic segmentation is foundation of computer vision, enabling machines to interpret images by assigning label to every pixel. This capability is crucial in various fields, from autonomous driving (identifying roads and obstacles) to medical imaging (highlighting tumors or tissues).</p><p>Traditionally, <strong>Fully-Supervised Semantic Segmentation (FSSS)</strong> achieves high accuracy by relying on pixel-level annotations. Though being effective, this approach demands a huge amount of manual effort to label the data which makes it expensive and time consuming.</p><p><strong>Weakly-Supervised Semantic Segmentation (WSSS)</strong> offers a promising alternative by using only image-level labels (e.g., “cat” or “dog” instead of marking every pixel). However, WSSS faces significant challenges: the lack of detailed annotations often leads to models focusing only on the most noticeable parts of objects or mistakenly including irrelevant backgrounds.</p><p><strong>Figure 1</strong> illustrates the difference between FSSS and WSSS. (a) FSSS uses detailed pixel-level annotations to segment objects. (b) WSSS relies only on image-level labels, which clamps its ability to identify precise boundaries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IJ5AyJOpifNkV43dQKSPCg.png" /><figcaption><strong>Figure 1: </strong>Comparison between Fully-Supervised Semantic Segmentation (FSSS) and Weakly-Supervised Semantic Segmentation (WSSS)<strong>. Source:</strong> <a href="http://cs231n.stanford.edu/slides/2017/cs231n_2017_lecture11.pdf">Stanford CS231n Lecture Notes (2017)</a></figcaption></figure><p>To address these challenges, NVIDIA introduces <strong>Semantic Prompt Learning for WSSS (SemPLeS)</strong>, a novel framework designed to revamp the segmentation process. By harnessing the power of <strong>CLIP</strong> (a model that bridges the gap between images and text to perform tasks like image captioning and text-to-image generation) <strong>SemPLeS</strong> learns to align segmented regions more precisely with their classes (while suppressing backgrounds)</p><p>In this article, we’ll explore the limitations of WSSS, how <strong>SemPLeS</strong> innovates to overcome them, and its impact on computer vision benchmarks.</p><h3>Challenges of Weakly-Supervised Segmentation</h3><p>WSSS is a powerful approach because it uses only image-level labels to train segmentation models. However, this comes with its own set of challenges:</p><ol><li><strong>Focus on the Most Noticeable Parts</strong><br> Without detailed annotations, WSSS methods often rely on heat maps (like CAMs) to locate objects. These heatmaps highlight only the most <strong>discriminative regions</strong> of an object, such as a cat’s face or a car’s wheels. As a result, other important parts of the object are ignored ( the entire cat or other parts of the car).</li><li><strong>Confusion with Co-Occurring Backgrounds</strong><br> Objects often appear alongside specific backgrounds. For instance, cats are commonly seen on grass, and cars are usually on roads. WSSS models sometimes include these backgrounds as part of the object because they co-occur so frequently. This leads to <strong>incorrect segmentation</strong> results.</li></ol><p>These challenges make it difficult for WSSS methods to match the precision of fully-supervised approaches. To overcome these limitations, NVIDIA introduces <strong>SemPLeS</strong> — a framework that refines WSSS by leveraging powerful models like CLIP.</p><h3>Challenges with Existing CLIP-based Methodologies</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/613/1*qhTIHi2E4iNBRuOg3XPJ9w.png" /><figcaption><strong>Figure 2:</strong> Existing CLIP-based WSSS methodology, utilizing manual prompting and human heuristic knowledge. <strong>Source: </strong><a href="https://arxiv.org/pdf/2401.11791">https://arxiv.org/pdf/2401.11791</a></figcaption></figure><p>Despite the effectiveness of CLIP-based methodologies in WSSS, several challenges remain:</p><ol><li><strong>Limited Focus on Foreground Classes</strong><br> Many CLIP-based methodologies utilize manual prompts exclusively for <strong>foreground object</strong> classes (e.g., “a photo of a dog” or “a car”). While this helps identify specific objects, it often ignores the representation of background regions or other objects present in the image, particularly in complex scenes with diverse or overlapping elements.</li><li><strong>Manual and Heuristic Background Prompts</strong><br> Current methods often rely on manually defined background prompts, such as “a photo of a road” or “a photo of the sky”. These general prompts are not adaptive to the varied contexts present in real world data (which can be complex in nature) and can fail to capture the subtle differences across backgrounds.</li><li><strong>Underutilization of the CLIP Latent Space</strong><br> The CLIP latent space encodes rich semantic information that connects images and text, yet existing approaches only scratch the surface of its potential (manual prompting). By focusing on fixed or static prompts, these methods fail to explore the broader semantic relationships within the latent space that could increase segmentation accuracy and generalizability.</li><li><strong>Dependency on Manual Efforts</strong><br> The design of effective prompts involves significant manual effort, often requiring domain specific knowledge. This dependency takes a lot of time and restricts the flexibility of these methods when applied to new datasets or tasks.</li></ol><h3>Introducing SemPLeS: Semantic Prompt Learning</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/664/1*Y0e11dduRaBDAU5SztcG4Q.png" /><figcaption><strong>Figure 3: </strong>SemPLeS automatically learns class-specific semantic prompts from the CLIP latent space without manual intervention. <strong>Source: </strong><a href="https://arxiv.org/pdf/2401.11791">https://arxiv.org/pdf/2401.11791</a></figcaption></figure><p>To address the challenges in WSSS, NVIDIA introduces <strong>SemPLeS </strong>by leveraging <strong>CLIP</strong>. In this section we briefly see <strong>SemPLeS </strong>works:</p><ol><li><strong>Leveraging CLIP’s Latent Space</strong><br> CLIP connects images and text, understanding the relationship between visual features (like objects) and language (object labels). SemPLeS uses this latent space to improve alignment between segmented regions and object categories, creating more accurate boundaries.</li><li><strong>Contrastive Prompt Learning(CPL)</strong><br> SemPLeS learns to prompt that are embedded in the latent space: Using this methodology, the need to manually define prompts is eliminated and learned prompts can easily <strong>capture co-occuring backgrounds</strong> associated with each class.</li><li><strong>Prompt-Guided Semantic Refinement(PGSR)</strong><br> PSGR builds on the learned prompts by focusing on <strong>suppressing co-occurring background elements</strong>. This step enhances the semantic alignment between objects and their respective classes.</li></ol><p>By combining these techniques, SemPLeS produces <strong>pseudo masks </strong>that are<strong> </strong>detailed, refined approximations of object boundaries far superior to those generated by traditional WSSS methods.</p><h4>Methodology</h4><p>The authors propose a three-step solution for effective segmentation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dC6KW7YL0RNHFagMTFfmUg.png" /><figcaption><strong>Figure 4: </strong>Overview of SemPLeS: mask generation, refinement, and suppression. <strong>Source: </strong><a href="https://arxiv.org/pdf/2401.11791">https://arxiv.org/pdf/2401.11791</a></figcaption></figure><p><strong>Step 1: Segment-Label Matching</strong></p><p>In this step, the mask generator <em>S</em> produces foreground masks <em>M</em> for a given input image <em>X</em>. While the implementation of how these masks are generated is limited in the paper, the approach leverages the <strong>latent space of the CLIP model</strong>. This shared latent space between images and text aids alignment between the objects of interest in the image and their corresponding class labels or text labels (e.g., “a photo of a <strong>cat</strong>”).</p><p>To train the mask generator <em>S</em> effectively, the authors propose a triplet:<br> (<em>X_fk, X_bk, t_k</em>):</p><p><strong>Foreground Image (<em>X_fk</em>)</strong>: This is obtained by applying the predicted mask <em>M_k</em> for the <em>k</em>-th object category onto the input image <em>X</em>:</p><blockquote>X_fk = M_k ⋅ X</blockquote><p>For instance, if there are four object categories, and the second category represents “cat,” <em>M_2</em> will highlight the regions of the input image corresponding to the cat.</p><p><strong>Background Image (<em>X_bk</em>)</strong>: The background is extracted by reversing the predicted mask <em>M_k</em>:</p><blockquote>X_bk = (1 — M_k) ⋅ X</blockquote><p><strong>Text Input (<em>t_k</em>)</strong>: This describes the target class/label using a general template (i.e. “a photo of a cat.”)</p><p>Using these components together, the authors utilize <strong>contrastive learning</strong> to align the foreground region (<em>X_fk</em>) with its corresponding text description (<em>t_k</em>) and ensure the background (<em>X_bk</em>) is different from the text. This alignment is achieved by <strong>maximizing</strong> the similarity between the image-text pairs for the foreground and <strong>minimizing</strong> it for the background which could be understood with the help of the loss function described below.</p><p><strong>Matching Loss Function</strong>:<br> The authors define a <strong>matching loss</strong> to guide the alignment:<br> <em>L_match = E_X [-log(sim(v_fk, u_fk))] + λ_b ⋅ E_X [-log(1 — sim(v_bk, u_fk))]</em></p><ul><li><em>sim</em>: Cosine similarity function.</li><li><em>v_fk</em> and <em>v_bk</em>: Encoded representations of foreground and background images, respectively.</li><li><em>u_fk</em>: Encoded representation of the text description.</li><li><em>λ_b</em>: A weight to balance the background repulsion loss.</li></ul><blockquote>To preserve the semantic representation in pretrained latent space of the CLIP model, both the image encoder (<em>E_I</em>) and text encoder (<em>E_T</em>) are freezed during training. This prevents overfitting and preserves generalization.</blockquote><p>Whilst this step aids a strong alignment between image and text, the generated masks can falsely include <strong>co-occurring backgrounds.</strong></p><p><strong>Step 2: Contrastive Prompt Learning (CLP)</strong></p><p>To address the limitation of co-occurring backgrounds in coarse masks, the authors introduce <strong>Contrastive Prompt Learning (CLP)</strong>. This approach replaces manual background prompts with <strong>learnable prompts</strong> (<em>p_k</em>), these prompts are specifically trained to represent the backgrounds associated with each object category (i.e. photo of cat with grass as background). By aligning these prompts with background features in the shared latent space of CLIP, <strong>CLP</strong> eliminates the need for manually defining the prompts while also ensuring category-specific/class-specific background representation (i.e. road is highly correlated to cars in the context of background).</p><p>The training process uses a dual-objective loss (<em>L_prompt</em>). First, the prompts are aligned with background regions by <strong>maximizing the similarity between the background prompt (<em>p_k</em>) and the background image representation </strong>(i.e. maximizing the similarity between grass and the background prompt associated with it). Then, the prompts are discouraged to describe the target object by <strong>minimizing their similarity with the target object’s text label (<em>t_k</em>) </strong>(i.e. minimizing similarity between the target label cat and the background prompt for grass)<strong>.</strong> This contrastive approach refines the learned prompts, enabling precise mask generation for segmentation. Unlike earlier methods, <strong>CLP</strong> captures class associated backgrounds automatically, utilizing rich semantics of vision-language models.</p><p>The loss function utilized to achieve this objective is as follows:</p><p><em>L_prompt = L_I_prompt + λ_T · L_T_prompt</em></p><p>= <em>E_X [-log(sim(u_bk, v_bk))] + λ_b ⋅ E_X [-log(1 — sim(u_bk, u_fk))]</em></p><ul><li>Here, <em>λ_T</em> is a weighting factor for balancing the two components.</li><li><strong><em>u_bk = E_T(p_k)</em></strong>: The background prompt’s representation from the text encoder.</li><li><strong><em>v_bk = E_I(X_bk)</em></strong>: The background image’s representation from the image encoder.</li><li><strong><em>u_fk = E_T(t_k)</em></strong>: The target object text label’s representation from the text encoder.</li></ul><blockquote>During training, only the prompts (<em>p_k</em>) are updated to minimize the loss <em>L_prompt</em>.</blockquote><p><strong>Step 3: Prompt-guided Semantic Refinement (PGSR)</strong></p><p>To improve the initial object masks (<em>M</em>) and remove unnecessary background details, the SemPLeS framework introduces <strong>Prompt-guided Semantic Refinement (PGSR)</strong>. This step uses the background prompts (<em>p_k</em>) derived from step 2 to guide the mask generator (<em>S</em>) in creating refined masks (<em>M’</em>) by reducing the influence of background information related to the target category (if the target is a “cat,” the PSGR ensures that the mask excludes background elements associated with cats, such as furniture or grass).</p><p>The refinement loss (<em>L_refine</em>) ensures the mask generator <em>(S) </em>focuses only on the target object by discouraging any similarity between the target object’s features and background information <strong>(i.e. mimize the similarity between target object and background information)</strong>. The total loss (<em>L_total</em>) combines this refinement with the matching step <em>(L_match) </em>to ensure that the final masks accurately align with the target categories/labels. After training, the framework only needs the mask generator (<em>S</em>) to produce clear and precise object masks (<em>M’</em>) in the segmentation pipeline.</p><p>The loss function utilized to achieve this objective is as follows:</p><p><em>L_total = L_match + λ_T ·L_refine</em></p><p>where <em>L_refine = E_X [-log(1 — sim(v_fk, u_bk))]</em></p><h4><strong>Datasets and Evaluation metrics</strong></h4><ul><li>The authors conducted their experiments on <strong>PASCAL VOC 2012 </strong>and <strong>MS COCO 2014</strong> segmentation datasets and utilized <strong>mIoU (</strong>mean intersection over union) as a common evaluation metric for all their experiments.</li><li><strong>PASCAL VOC 2012 </strong>dataset consists of 20 object classes along with a background class. The training, validation and testing set consists of 1464, 1449 and 1456 images respectively.</li><li><strong>MS COCO 2014 </strong>dataset consists of 80 object classes, with training and validation split of 82081 and 40137 images respectively.</li></ul><h4>Implementation details</h4><ul><li>The authors used <strong>CLIP</strong> with <strong>ViT-B/32</strong> as the image encoder.</li><li>Cosine feature similarity is used, with non-positive scores clamped to a small positive number.</li><li>Learnable prompts are randomly initialized with a sequence length (<em>K</em>) of 30.</li><li>Batch size: <strong>64</strong>.</li><li>Initial learning rate: <strong>5e-4</strong> for <strong>PASCAL VOC 2012</strong> and <strong>5e-6</strong> for <strong>MS COCO 2014</strong>.</li><li>Framework trained for <strong>60 epochs</strong> on both datasets.</li><li>PASCAL VOC 2012: <strong>λ_b = 2.4</strong>, <strong>λ_T = 0.02</strong>, <strong>λ = 0.05</strong>.</li><li>MS COCO 2014: <strong>λ_b = 0.75</strong>, <strong>λ_T = 0.01</strong>, <strong>λ = 0.2</strong>.</li><li><strong>AdamW optimizer</strong> used with a cosine learning rate scheduler.</li><li>Framework implemented in <strong>PyTorch</strong>.</li><li>Training conducted on <strong>NVIDIA V100 GPUs</strong>.</li></ul><h3><strong>Results</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/1*nNZy3rjB397D3dhNVmxkgg.png" /><figcaption><strong>Figure 5: </strong>Qualitative results of CAMs. “GT denotes ground truth”. Unlike other frameworks, SemPLeS focuses on the entire target object rather than the selected features of the target objects. <strong>Source: </strong><a href="https://arxiv.org/pdf/2401.11791">https://arxiv.org/pdf/2401.11791</a></figcaption></figure><p>The authors utilize the refined masks <em>M’ </em>(as CAMs) to generate pseudo masks and compare them with previous works. CAMs and pseudo masks achieved <strong>68.7% </strong>and <strong>78.4% </strong>in mIoU respectively on <strong>PASCAL VOC 2012 </strong>training set surpassing prior state-of-the-art frameworks resulting in best performance. Using the pseudo masks as labels for segmentation models, <strong>SemPLeS </strong>achieves state-of-the-art performance on <strong>PASCAL VOC 2012 </strong>with <strong>83.4% </strong>and <strong>82.9% </strong>mIoU on validation and testing sets respectively, as well as <strong>56.1%</strong> mIoU on <strong>MS COCO 2014 </strong>validation set.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/1*z_1DxMlYdwsrXAG6Z0QjIw.png" /><figcaption><strong>Figure 6: </strong>Qualitative results for segmentation maps. “GT denotes ground truth”. <strong>Source: </strong><a href="https://arxiv.org/pdf/2401.11791">https://arxiv.org/pdf/2401.11791</a></figcaption></figure><p>The SemPLeS framework demonstrates strong compatibility with diverse WSSS methods, including CNN (e.g., CLIMS), Transformer, and SAM-based approaches. As shown in Figure 6 (Table 4), <strong>SemPLeS </strong>improves the performance of all these methods by leveraging learnable prompts to better exploit the CLIP latent space. This highlights the framework’s robustness and effectiveness in supporting existing techniques.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*zadGBRHAbxmV4sxrAG0bUQ.png" /><figcaption><strong>Figure 6:</strong> Tables 4 and 5 of the paper describe the quantitative results obtained from the proposed SemPLeS framework and quantitative ablation studies of loss functions respectively. <strong>Source: </strong><a href="https://arxiv.org/pdf/2401.11791">https://arxiv.org/pdf/2401.11791</a></figcaption></figure><p>The authors conduct the ablation study to analyze the impact of loss functions as shown in Figure 6 (Table 5). Insights obtained from the studies are as follows:</p><ul><li>Using only the matching loss <em>L_match </em>achieves <strong>67.6%</strong> mIoU, showing its baseline effectiveness.</li><li>Adding the refinement loss <em>L_refine </em>without prompt learning shows no significant improvement (the prompts are randomly initialized and not learned).</li><li>Using <em>L_T_prompt </em>to repel text labels (<strong>minimizing learnable prompt’s similarity with the target object’s text label) </strong>shows meager improvement.</li><li>Applying only <em>L_I_prompt </em>for background alignment results in <strong>67.9%</strong> mIoU (as the prompts may still capture the foreground semantics).</li><li>Combining <em>L_I_prompt</em> and <em>L_T_prompt</em> for learning background prompts while avoiding foreground descriptions improves mIoU to <strong>68.7%</strong>, effectively reducing false activations of co-occurring backgrounds.</li></ul><p><strong>Conclusion and Limitation</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/743/1*DZ2nmjeGfPRBACcJ_aCjnQ.png" /><figcaption><strong>Figure 7: </strong>Failure case analysis (Limitation of SemPLeS) <strong>Source: </strong><a href="https://arxiv.org/pdf/2401.11791">https://arxiv.org/pdf/2401.11791</a></figcaption></figure><p>In this article, we introduced the SemPLeS framework, which leverages vision-language learning through <strong>Segment-Label Matching</strong>, <strong>Contrastive Prompt Learning, and Prompt-guided Semantic Refinement</strong>. By automatically learning prompts, SemPLeS effectively suppresses co-occurring backgrounds which results in precise segmentation without needing to manually write prompts. Experiments on PASCAL VOC 2012 and MS COCO 2014 benchmarks demonstrate its competitive performance and compatibility with other WSSS methods. However, the existing method like existing WSSS methods still grapples to segment partially visible objects or the ones that are camouflaged or similar to their surroundings (Figure 7).</p><h3>References</h3><p>[1] <a href="https://www.pingcap.com/article/a-comprehensive-guide-to-openais-clip-model/#:~:text=Definition%20and%20Overview,tool%20in%20the%20AI%20landscape.">A Comprehensive Guide to OpenAI’s CLIP Model</a></p><p>[2] <a href="https://arxiv.org/pdf/2401.11791">Semantic Prompt Learning for Weakly-Supervised Semantic Segmentation</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=88bbf6280da7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>