<?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[VedaCV - Medium]]></title>
        <description><![CDATA[Summary of Computer Vision papers, discussing different architectures - Medium]]></description>
        <link>https://medium.com/vedacv?source=rss----835b79b08cd6---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>VedaCV - Medium</title>
            <link>https://medium.com/vedacv?source=rss----835b79b08cd6---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 05:52:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/vedacv" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Paper Summary : A Global sampling method for Alpha Matting]]></title>
            <link>https://medium.com/vedacv/paper-summary-a-global-sampling-method-for-alpha-matting-490a4217eb2?source=rss----835b79b08cd6---4</link>
            <guid isPermaLink="false">https://medium.com/p/490a4217eb2</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[alpha-matting]]></category>
            <category><![CDATA[fast-matting]]></category>
            <category><![CDATA[global-sampling]]></category>
            <category><![CDATA[matting]]></category>
            <dc:creator><![CDATA[Vedanta Jha]]></dc:creator>
            <pubDate>Thu, 28 Mar 2019 21:36:23 GMT</pubDate>
            <atom:updated>2019-03-28T21:50:18.835Z</atom:updated>
            <content:encoded><![CDATA[<h3>Paper Summary : A Global sampling method for Alpha Matting</h3><p><em>In this article, we will try and Understand how a global sampling method is used for Alpha matting</em></p><p>Let us first understand why the paper is named this way.</p><p>Global — It uses all the known samples(In a trimap, where some pixels are marked as unknown and the others are known), Unlike other sampling methods which collect only the nearby samples</p><p>Sampling — It first estimates the foreground and background color and then computes the alpha matte.</p><h3>Steps given in the paper to compute the alpha matte are the following:</h3><h3>1. Global Set</h3><p>They use a global set, which is defined below :</p><p>Our foreground (background) sample set consists of all known foreground (background) pixels on the unknown region’s boundary.They also tested<br>even larger sample sets comprising of all known pixels k-pixel (k &gt; 1) away from this boundary, and to the extreme of all known pixels in the image. They found that using the pixels on the unknown region’s <strong>boundary (k = 1)</strong><br>is sufficient to produce <strong>good results</strong>.They defined the following terms:</p><p><strong>Nf </strong>— Number of foreground samples,</p><p><strong>Nb </strong>— Number of background samples</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*hyNd7UemJ4-vcqen7ptr9A.jpeg" /><figcaption>This image indicate the sample sets<br>(red: F; green: B).</figcaption></figure><h3>2. Defining loss function</h3><p>The goal is to select a good pair of sample Foreground and background pair for any unknown pixel from all candidate pairs. A “Good” foreground and background pixel is one which gives the minimum loss, defined below :</p><p>The loss function contains two components:</p><p>a. The <strong>spatial distance</strong> of the sample from the unknown pixel is taken</p><p>A spatial cost function Es, favors spatially closed samples</p><p><strong>Es(Fi) = ∥xFi − xI ∥/Df</strong></p><p>where <strong>xFi</strong> and <strong>xI</strong> are the <strong>spatial coordinates</strong> of the Foreground sample and the unknown pixel I respectively.<strong>Df</strong> is the <strong>normalization factor</strong> which is the minimum distance of the unknown pixel from the nearest foreground boundary.</p><p>Similarly, <strong>Es(Bi)</strong> is defined for the boundary sample.</p><p>b. The second cost function takes into account the color fitness of the samples</p><p>Given a pair of samples (F i , B j ) with the sample indexes i and j,first estimate the alpha value αp of an <strong>unknown pixel I</strong> by:<br> <strong>αp = (I − Bj )(F i − Bj )/(∥F i − B j ∥)²</strong></p><p>Then a <strong>color cost function</strong> <strong>Ec</strong> is defined to describe how good a sample pair fits the matting equation (1):</p><p><strong>Ec(Fi , Bj ) = ∥I − ( αp*Fi + (1- αp)*Bj)∥</strong></p><p>Hence, The <strong>total loss function</strong> defined for samples (Fi,Bj) is the sum of the spatial error and the color cost error :</p><p><strong>E = Ec(Fi,Bj) + Es(Fi) + Es(Bi)</strong></p><h3>3.How to select samples</h3><p>Now, The point is how do we select the samples.</p><p>We have <strong>nf</strong> foreground samples and <strong>nb</strong> background samples, so a grid search for all the combination of samples would have a time complexity of <strong>O(nf*nb)</strong> for each unknown pixel, and let us say we have N unknown pixels, the total time complexity would amount to <strong>O(N*nf*nb)</strong></p><p>The paper suggests a Randomized algorithm inspired by the PatchMatch algorithm, They have named this algorithm the <strong>SampleMatch</strong> Algorithm</p><p>I have mentioned the steps of the <strong>SampleMatch</strong> Algorithm below:</p><p><strong>a</strong>. <strong>Sort</strong> all the foreground and background samples by a certain criterion, This paper uses Intensity to sort the samples.We denote their ordered set as follows:</p><p>Foreground -&gt;{F i ∣i = 1, 2, …, nF }</p><p>Background-&gt;{{B j ∣j = 1, 2, …, nB}</p><p>For each unknown pixels our target is to find a point in the FB search space which has (approximately) smallest cost.</p><p><strong>b</strong>. Maintain a current <strong>optimal</strong> (smallest cost) sample pair (F i , B j ) for each unknown pixel I(x, y). This current optimal sample pair is denoted by<br><strong>Φ(x, y) = (F i , B j ).</strong> After the initialization , The algorithm <strong>iterates</strong> between <strong>two steps</strong> between <strong>propagation</strong> and <strong>random search</strong>.</p><p><strong>Propagation:</strong></p><p>For the unknown pixel <strong>I(x, y)</strong> being scanned, <strong>Φ(x, y)</strong> is updated by considering the current optimal sample pairs <strong>Φ(x ′ , y ′)</strong> of its <strong>neighboring pixels</strong> <strong>(x ′ , y ′ ):</strong></p><p><strong>Φ(x, y) ← arg min (E(Φ(x ′ , y ′ )))</strong></p><p>Where E is the loss function defined before, (x’,y’) is in the <strong>first order neighborhood.</strong></p><p><strong>Random Search</strong></p><p>For the unknown pixel I(x, y) being scanned, we update its Φ(x, y) by a sequence of random trials:</p><p><strong>{(Fik , Bjk )∣k = 0, 1, 2…}.</strong> This sequence is <strong>generated by</strong>:<br><br><strong>(ik , jk ) = (i, j) + ω*(β^k)*R</strong>,</p><p>where <strong>R</strong> is a uniform <strong>random number</strong> in [−1, 1],<strong>β^k</strong> is the <strong>kth</strong> exponential of a ratio <strong>β = 0.5</strong>, and <strong>ω</strong> is the size of the <strong>search space</strong>.The sequence goes in the order of k=0, 1, 2… until the search window radius <strong>ωβ k</strong> is <strong>below 1</strong>.<br>In this step, Φ(x, y) is updated if the <strong>new pair</strong> (Fik , Bjk )<br>has a <strong>smaller cost</strong>.</p><p>Intuitively, the random search step tests a sequence of<br>random points (ik , jk ) in a neighborhood (in the FB space) of the current optimal point (i, j). The neighborhood radius ω*β decreases exponentially (in each iteration).</p><h3>4. Post Processing</h3><p>The paper applies a kind of post-processing (smoothing) by considering neighboring pixels can further improve the matting results.</p><h3>REFERENCES</h3><ol><li>. Wang and M. Cohen. An iterative optimization approachfor unified image segmentation and matting.ICCV, 2005</li><li>A Global Sampling Method for Alpha Matting Kaiming He1, Christoph Rhemann2, Carsten Rother3, Xiaoou Tang1,Jian Sun</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=490a4217eb2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/vedacv/paper-summary-a-global-sampling-method-for-alpha-matting-490a4217eb2">Paper Summary : A Global sampling method for Alpha Matting</a> was originally published in <a href="https://medium.com/vedacv">VedaCV</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding AlphaGAN matting]]></title>
            <link>https://medium.com/vedacv/understanding-alphagan-matting-1dfae112a412?source=rss----835b79b08cd6---4</link>
            <guid isPermaLink="false">https://medium.com/p/1dfae112a412</guid>
            <category><![CDATA[deep-matting]]></category>
            <category><![CDATA[alpha-matting]]></category>
            <category><![CDATA[alphagan]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Vedanta Jha]]></dc:creator>
            <pubDate>Sat, 23 Mar 2019 21:51:58 GMT</pubDate>
            <atom:updated>2019-03-23T22:08:29.231Z</atom:updated>
            <content:encoded><![CDATA[<p><em>In this article, we will explore how Generative Adversial Networks can be used for Natural Image Matting.</em></p><h3><strong>WHAT IS NATURAL IMAGE MATTING?</strong></h3><p>Natural image matting is defined as the problem of accurately estimating the opacity of a foreground object in an image or video sequence.</p><p>Formally, image matting approaches require as input an image, which is expected to contain a foreground object and the image background.</p><p>Mathematically, every pixel i in the image is assumed to be a linear combination of the foreground and background colors,expressed as:</p><p><em>Ii=αiFi+(1−αi)Bi, αi∈[0,1],</em></p><p>where Ii represents the ith pixel of the Image, similarly Fi represents the value of ith pixel of the Foreground Image and Bi for the background image.<em>α </em>is the foreground opacity. We have <strong>3 equations(For each R,G,B) and 7 unknowns</strong>.</p><p>This is a severely ill posed problem, we cannot possibly solve this equation with just these values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/268/1*2oOyGMu3dTNI_fK1k-zGvw.png" /><figcaption>This is an example of a trimap.The White region represents the foreground, black the background and gray are is the unknown region where we are supposed to find the value of alpha</figcaption></figure><p>Typically,some additional information in the form of scribbles or a trimap is given as additional information to decrease the difficulty of the problem.</p><p><strong>NOTE</strong>: One important thing is, Generally, alpha is equal to 1 for foreground(Not true for transparent foreground), 0 for background and lies between <strong>0 to 1 in the boundary</strong>, where both foreground and background are present.For example in the trimap image above, the gray area is where both foreground(hair) and background are present.</p><p>Generally the trimap serves as an <strong>initialization information</strong> and many methods propagate the alpha values from known image regions to the unknown region.</p><h3><strong>PREREQUISITES</strong></h3><ol><li><strong>PatchGAN Discriminator</strong>.</li></ol><p>The difference between a PatchGAN and regular GAN discriminator is that rather the regular GAN maps from a 256x256 image to a single scalar output, which signifies “real” or “fake”, whereas the PatchGAN maps from 256x256 to an <strong>NxN array</strong> of outputs X, where each X_ij signifies whether the patch ij in the image is real or fake. Which is patch ij in the input? Well, output X_ij is just a neuron in a convnet, and we can trace back its receptive field to see which input pixels it is sensitive to.</p><p>2. <strong>Atrous Spatial Pyramid Pooling (ASPP)</strong></p><p>Conventionally, at the transition of Conv layer and the fully connected layer , there is a single pooling layer or even no pooling layer.</p><p>In Spatial Pyramid Pooling(SPP), there are multiple <strong>pooling layers</strong> with <strong>different scales</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*Af0rCJ67rVYdfIfhwnwi3A.png" /><figcaption><strong>Three-Level Spatial Pyramid Pooling (SPP) in SPPNet with Pyramid {4×4, 2×2, 1×1}.</strong></figcaption></figure><p>Let us say, there are 256 filters at the end of Convolutional Layer.There are 3 different pooling layer, 1 pools 1 value from each filter, other pools 4 and the last one pools 16.Hence we 1*256 , 4*256 and 16*256 as the outputs of respective pooling layers. The output of these pooling layers are then concatenated to form a one dimensional input to the fully connected layer.</p><p>Atrous SPP just replaces the pooling layer with <strong>atrous(dilated) convolution</strong></p><p>3. <strong>1x1 Convolutions</strong></p><p>I know it is a basic concept for many, but I have always wondered what exactly is the use of a 1x1 convolution.</p><p>It is just used to change the number of features.For example, an image of 200 x 200 with 50 features on convolution with 20 filters of 1x1 would result in size of 200 x 200 x 20.</p><p>4. <strong>Generative Adversial Networks</strong></p><p>This topic deserves another article, but I will try to keep it as small as possible.</p><p>One neural network, called the <em>generator</em>, generates new data instances, while the other, the <em>discriminator</em>, evaluates them for authenticity; i.e. the discriminator decides whether each instance of data that it reviews belongs to the actual training dataset or not.</p><p>The aim of Generator is to fool the discriminator and that of Discriminator is to make sure it catches the data which is fake.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*m3W5pbL_4WyzEFba.png" /><figcaption>Generative Adversial Network</figcaption></figure><h3><strong>ARCHITECTURE</strong></h3><p>AlphaGAN uses Generative Adversial network for natural Image matting.The generator of this network is a convolutional encoder-decoder network that is trained both with help of the ground-truth alphas as well as the adversarial loss from the discriminator, and the discriminator is a patchGAN Discriminator. We will discuss the architecture of both the generator and discriminator in detail</p><h4><strong>GENERATOR</strong></h4><p>The Generator is an encoder decoder network. Let me clearly state the Input and output of the Generator.</p><p><strong>Input</strong>: 4 Channel Input. 3 Channel consists of the RGB Image composed by the Foreground Object, Background Object and the Real Alpha, 4th channel is the trimap.</p><p><strong>Output</strong>:The Generator outputs a predicted alpha.</p><p><strong>ENCODER</strong></p><ol><li>The Encoder takes the <strong>ResNet50</strong> Architecture, pretrained on <strong>ImageNet</strong>.</li><li>Convolutions in the 3rd and 4th block of the Resnet architecture are replaced by <strong>Dilated Convolutions</strong> with rate <strong>2</strong> and <strong>4</strong> respectively.</li><li>After the Resnet Block 4, the <strong>ASPP</strong> Module is added to resample features at several scales for accurately and efficiently predicting regions of an arbitrary scale</li><li>The output of ASPP is fed to the discriminator</li></ol><p><strong>DECODER</strong></p><ol><li>Just contains <strong>Convolutional layers</strong> and <strong>skip connections.</strong></li><li>Output of Encoder is <strong>bilinearly upsampled</strong>, so that the feature maps have the same resolution as those coming from Resnet block 1.The output of Resnet block 1 is fed to <strong>1*1 Convolution</strong>(The number of dimensions are reduced) , and then <strong>concatenated</strong> with the features</li><li>3x3 Convolution is applied, then <strong>upsampled</strong> using the <strong>saved pooling indices</strong> in the first layer of the encoder , concatenated again with the feature maps from same resolution of the Encoder.</li><li>Upsampled again using <strong>transposed convolution</strong> and concatenated again with the <strong>Input Image</strong>, and then it is lead to some final convolution layers.</li><li>All of these layers are followed by <strong>ReLU</strong> activation functions and <strong>batch-normalization</strong> layers , except the last one, which is followed by the <strong>sigmoid</strong> activation function to scale the output of the generator between 0 and 1, as needed for an alpha prediction</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*1Tv9nGjbm5FBCbSE12_x3w.jpeg" /><figcaption>The Generator architecture(figure from paper)</figcaption></figure><p><strong>DISCRIMINATOR</strong></p><p>Let me clearly state what the input of discriminator would be.Input is of 4 channel</p><p><strong>Real</strong> : Image constructed by foreground , background and the real alpha</p><p><strong>Fake</strong> : Image constructed by foreground, background and the fake alpha(generated by generator)</p><p>4th channel of the input in both case is the trimap.</p><p>The Discriminator used here is the PatchGAN discriminator with <strong>N = 70 (</strong>NxN is the size of patch)</p><p><strong>OBJECTIVE</strong></p><p>The goal of our networks is to predict the true alpha of an image, given the trimap.The paper uses 3 Loss functions</p><ol><li><strong>Adversial Loss</strong>(<strong>Lgan</strong>) :</li></ol><p>Lgan(G,D)= log D(x)+log(1−D(C(G(x)))</p><p>where x is a real input: an image composited from the ground-truth alpha and foreground appended with the trimap. C(y) is a composition function that takes the predicted alpha from G as an input and uses it to composite a fake image. G tries to generate alphas that are close to the ground-truth alpha, while D tries to distinguish real from fake composited images. G therefore tries to minimize Lgan against the discriminator D, which tries to maximize it</p><p>2. <strong>Alpha Prediction Loss</strong>(<strong>Liα</strong>):</p><p>It is the absolute difference between the ground truth alpha values and the predicted alpha values at each pixel. However, due to the non-differentiable property of absolute values, the following loss function is used to approximate it.</p><p>Liα=√(αip−αig)2+2,αip,αig∈[0,1],</p><p>where αip is the output of the prediction layer at pixel i thresholded between 0 and 1.αigis the ground truth alpha value at pixel i</p><p>3. <strong>Composition Loss(Lic):</strong></p><p>The second loss is called the compositional loss, which is the absolute difference between the ground truth RGB colors and the predicted RGB colors composited by the groundtruth foreground, the ground truth background and the predicted alpha mattes. Similarly, we approximate it by usingt he following loss function.</p><p>Lic=√(cip−cig)2+2.where c denotes the RGB channel,p denotes the image composited by the predicted alpha, and g denotes the image composited by the ground truth alphas.</p><p>Hence, The total Loss, <strong>L(G,D)</strong> as a function of both G and D is equal to :</p><p><strong>L (G,D)= Lgan(G,D) + Lic(G) + Liα(G),</strong></p><p>where we aim to find parameters of G which minimize L and those of D which maximize L</p><h3><strong>RESULTS</strong></h3><p>It presents state-of-the-art results on the alphamatting online benchmark for the gradient error and give comparable results in others. The method is particularly well suited for fine structures like hair, which is of great importance in practical matting applications, e.g. in film/TV production</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SsIIQyvnKslnaUmR.jpg" /><figcaption>Comparison of results on the Composition-1k testing dataset</figcaption></figure><h3><strong>CODE</strong></h3><p>The Link to Pytorch Implementation of AlphaGAN matting is <a href="https://github.com/Nerdyvedi/AlphaGAN-Matting">this</a>.</p><h3><strong>REFERENCES</strong></h3><ol><li>Jun-Yan Zhu, Taesung Park, Phillip Isola, and Alexei A. Efros. <strong>Unpaired image-to-image translation using cycle-consistent adversarial networks</strong>. In IEEE InternationalConference on Computer Vision, ICCV 2017, Venice, Italy, October 22–29, 2017, pages2242–2251, 2017. doi: 10.1109/ICCV.2017.244</li><li>Ning Xu, Brian L. Price, Scott Cohen, and Thomas S. Huang. <strong>Deep image matting</strong>.In 2017 IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2017,Honolulu, HI, USA, July 21–26, 2017, pages 311–320, 2017. doi: 10.1109/CVPR.2017.41</li><li>Sebastian Lutz, Konstantinos Amplianitis, Aljosa Smolic.<strong>AlphaGAN: Generative adversarial networks for natural image matting</strong></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1dfae112a412" width="1" height="1" alt=""><hr><p><a href="https://medium.com/vedacv/understanding-alphagan-matting-1dfae112a412">Understanding AlphaGAN matting</a> was originally published in <a href="https://medium.com/vedacv">VedaCV</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>