<?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 Lior Hirsch on Medium]]></title>
        <description><![CDATA[Stories by Lior Hirsch on Medium]]></description>
        <link>https://medium.com/@liorhirsch?source=rss-6eaae1eaa50f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*kwWIE1k0AaTNsraA.</url>
            <title>Stories by Lior Hirsch on Medium</title>
            <link>https://medium.com/@liorhirsch?source=rss-6eaae1eaa50f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 11:57:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@liorhirsch/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[KPConv — How Does It Work?]]></title>
            <link>https://liorhirsch.medium.com/kpconv-how-does-it-work-b389015f6f41?source=rss-6eaae1eaa50f------2</link>
            <guid isPermaLink="false">https://medium.com/p/b389015f6f41</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[segmentation]]></category>
            <category><![CDATA[3d]]></category>
            <category><![CDATA[classification]]></category>
            <category><![CDATA[point-cloud]]></category>
            <dc:creator><![CDATA[Lior Hirsch]]></dc:creator>
            <pubDate>Sun, 28 Feb 2021 15:00:51 GMT</pubDate>
            <atom:updated>2021-02-28T15:00:51.995Z</atom:updated>
            <content:encoded><![CDATA[<h3>KPConv — How Does It Work?</h3><h4>An intuitive and mathematical guide to understanding KPConv for point cloud segmentation and classification tasks.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gnr45hBDV8lCurmsKB-l8A.jpeg" /></figure><blockquote><a href="https://arxiv.org/pdf/1904.08889.pdf">KPConv </a>(Kernel Point Convolution) is “a new design of point convolution, i.e. that operates on point clouds <strong>without any intermediate representation</strong>… KPConv is also <strong>efficient</strong> and <strong>robust to varying densities</strong>… and outperform <strong>state-of-the-art</strong> <strong>classification</strong> and <strong>segmentation</strong> approaches on several datasets” [6]</blockquote><p>A <strong>point cloud</strong> is a set of data points in space usually produced by a Lidar sensor. Each data point in the set has several mandatory features - XYZ coordinate and some possible features; the color of the point (RGB), intensity, etc. Point clouds are useful for 3D modeling of objects, scanning large areas from aerial sensors, and autonomous vehicle scene understanding, among other things.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EMvyRP4RXbJ2B2DFnpXbNA.gif" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*_kMia8WJDvH61foKpVmV1Q.gif" /><figcaption>Figure 1: The left example is from the <a href="http://semantic-kitti.org/">SemanticKitti</a> dataset. The right example is from the <a href="https://www.semantic3d.net/">Semantic3D </a>dataset.</figcaption></figure><p>Most SOTA(state-of-the-art) models for classification and segmentation of images use CNNs (convolutional neural networks). However, point clouds’ unique structure prevents us from using CNNs (we will discuss the differences in the following section). Therefore, an entire field of research arose trying to find deep learning solutions for processing point clouds.</p><p>The KPConv paper [6] introduces a novel NN layer that directly operates on point cloud data. It shows how to use this layer as part of a DNN for classification and segmentation tasks — achieving SOTA results.</p><p>This article will present how a KPConv layer works (both intuitively and mathematically) by diving into each module to fully understand this layer.</p><h3>Challenges with point clouds</h3><p>We can compare the structure of point clouds to images to understand the main challenges with point clouds. An image is a <strong>2D grid</strong> of pixels where each pixel has a color (RGB). The <strong>distance </strong>between two adjacent pixels is always fixed. The <strong>order </strong>of the pixels determines the image&#39;s representation, i.e., a change in the pixels&#39; order produces a new image. Moreover, there is extensive research on the classification and segmentation of images.</p><p>The complex structure of point cloud leads to four main challenges:</p><ol><li><strong>Sparse </strong>— The points are not evenly sampled in different regions.</li><li><strong>Unstructured </strong>— Unlike images, point clouds are not placed on a grid. Each point is sampled independently, and its distance to its neighbors varies.</li><li><strong>Unordered </strong>— As explained previously, a point cloud is represented by the XYZ coordinates. The order in which the points are stored does not alter the represented scene, so they are invariant to permutations.</li><li><strong>Lack of research </strong>— there is no excessive research on it, compared to images, and the problem is far from being solved.</li></ol><h3>KPConv: flexible and deformable convolution for point clouds</h3><p>The KPConv layer tries to overcome the explained challenges by creating a convolution[3] operation that works directly on the point cloud (without projecting the point cloud to a lower dimension).</p><p><strong>Let’s start with some intuition</strong></p><p>The intuition behind KPConv is similar to the intuition behind CNNs. In CNN, each pixel is represented by a list of values known as ‘channels‘ and is passed through <em>k</em> filters. The pixel&#39;s new representation is the dot product of neighboring pixel’s channels (including the pixel itself) by the filters.</p><p>Similarly, in a KPConv layer, each point has <em>fᵢ </em>features (similar to channels) and is multiplied by <em>k</em> kernel points (similar to filters). The new representation of the point is the sum of all the kernel values multiplied by the neighbor’s features.</p><p><strong>General description</strong></p><p>A KPConv layer is activated on every point in the point cloud. It gets a point (location and features) and its neighbors (location and features for each neighbor), and generates new features for the given point. The neighborhood of a point is defined by all the points located in a sphere with a fixed radius around a point. The neighbors&#39; locations are centered (see ahead) on the given point (XYZ values of each neighbor are centered relative to the given point location), similar to a convolution layer filter.</p><p>A KPConv layer is defined by several kernel points (similar to filters in CNN). The kernel points are positioned regularly (See Figure 3) in a sphere around the given point (i.e., each point tries to be as far as possible from any other point and still stays in the sphere around the center). Each kernel point has a set of weights (similar to filters), which are applied to the neighboring points. Each kernel point‘s weights are applied to the neighboring points relative to the distance between the kernel point and the neighbor. Thus, each kernel point has an area of influence defined by a correlation function (see ahead). The correlation function defines whether a kernel point influences a point and how the neighbor point contributes to calculating the kernel value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*AYun0sKEfDNtbC5tGGtWJQ.jpeg" /><figcaption>Figure 2: An illustration of a neighboring point to each kernel point correlations.</figcaption></figure><p>The given point&#39;s new features are calculated as the sum of all the neighbors&#39; features multiplied by their correlation and learned weights. At the input layer, each point&#39;s features are set to the point’s attributes, such as RGB, intensity, etc. In a way analogous to input RGB channels to a CNN. After the first operation of the KPConv layer on the point cloud, each point has new features (similar to channels in CNN), which are used to calculate the next layer of KPConv.</p><p>In the following sections, I will present a full description of each sub-part of the KPConv layer.</p><p><strong>Rigid kernel</strong></p><blockquote>“The convolution weights of KPConv are located in Euclidean space by kernel points, and applied to the input points close to them.” [6]</blockquote><p>The kernel points are points that are regularly positioned around each point in the point cloud. Each kernel point has a weight matrix and is applied to each point&#39;s close neighbors in the point cloud.</p><p>The kernel points’ locations are determined by solving an optimization problem. The kernel points need to be as far as possible from one another but as close as possible to the center (which is the location of the given point). One of the points is constrained to be at the center. The rigid kernel is related to kernel points, which are arranged regularly in a sphere. These are examples of kernel point locations with different <em>K</em> values:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/410/1*b0_xZEyAfA91lzSa3rCTxg.png" /><figcaption>Figure 3: The blue points are the kernel points, and the red point is the center of the sphere, which is the given point to the KPConv layer (one of the kernel points is placed in the center).</figcaption></figure><p>The use of multiple kernel points allows distinguishing information from different directions of the processed point’s neighboring. The regular arrangement of the kernel point produces uniform resolution in each direction.</p><p>Similar to CNN, where each kernel has a set of weights with the shape of the input channels and the output channels, each kernel point has a unique set of weights with the shape of [<em>fᵢₙ,fₒᵤₜ</em>], where <em>fᵢₙ </em>is the number of features of the point in the current layer and <em>fₒᵤₜ </em>is the number of features in the next layer.</p><p><strong>Kernel function</strong></p><blockquote>“kernel function g, which is where KPConv singularity lies.”</blockquote><p>The kernel function takes a neighbor position <em>xᵢ and </em>centers it on the given point <em>x</em>. The centered position of neighbor <em>xᵢ</em> is calculated by<em>:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/138/1*951jVcx1qmxdhygcKjobTA.png" /></figure><p>According to the neighbor location, the kernel function <em>g(yᵢ)</em> applies a different ratio (correlation) to the kernel weights. The kernel value for a given neighbor is calculated as a weighted sum of all the kernel weights with the kernel correlations:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/459/1*XGIp9S1fQ3oejtqyDo5J9g.png" /></figure><p>where <em>h(yᵢ, xₖ)</em> is a correlation function that will be explained later, <em>xₖ</em> is the kernel point location and <em>Wₖ</em> is the weight matrix of kernel <em>k</em>.</p><p>The kernel value that is calculated for each neighbor <em>yᵢ</em> is then multiplied by the neighbor features <em>fᵢ :</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/139/1*bv6xm7QGW0h-BLXpCdrHsA.png" /></figure><p>The new representation of the given point x is calculated as the sum of all the kernel values of <em>x</em>’s neighbors:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*h87zwbx2LUR-YRqOEJdK8g.png" /></figure><p><strong>Correlations</strong></p><p>The correlation function calculates the correlation between each neighbor <em>xᵢ</em> and a kernel point <em>xₖ</em>. The correlations are used to weigh each kernel&#39;s contribution to the total kernel value of each neighbor. The correlation is calculated according to the locations of each point (XYZ).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*N5SVKCKS3OnxeDb5g1mpQg.png" /></figure><p>Where σ is a hyper-parameter that is defined as the influence distance of the kernel points. The density of the point cloud determines this hyper-parameter.</p><p>This correlation function provides <strong>higher values when the points are close</strong> to each other, and its <strong>value is between [0,1]. </strong>These are two fundamental requirements they declared for the correlation function.</p><p><strong>Assemble All — with mathematics</strong></p><p>For a batch size of <em>n</em> points. Every point has a maximum of <em>nₙₑᵢ </em>neighbors. <em>k</em> is the number of kernel points. The features of each point are represented by <em>fᵢ</em>. <em>neighb_x </em>are the features of each neighborhood (<em>dim(neighb_x)=[n,nₙₑᵢ,fᵢ]</em>). <em>kernel_weights</em> are the weights of each kernel point. <em>dim(kernel_weights)=[k,fᵢₙ,fₒᵤₜ]</em>.</p><ol><li>Center each neighborhood <em>dim(neighbors) = [n,nₙₑᵢ,3].</em></li><li>Calculate the differences between each neighborhood and kernel points: <em>diffs = neighbors-kernels. dim(kernels)=[k,3], dim(diffs)=[n,nₙₑᵢ,k,3].</em></li><li>Calculate the correlation by applying <em>L1</em> norm to the differences and sum the differences along the 4ᵗʰ axis (XYZ axis). <em>correlations=min(1-Σ||diffs||/σ, 0). dim(correlations)=[n,k,nₙₑᵢ].</em></li><li>The new representation of each point is calculated the following way: <em>new_representation=Σ(correlations*neighb_x)</em>ᵀ<em>*kernel_weights. dim(new_representation)=[n,fₒᵤₜ]</em></li></ol><p><strong>Deformable kernel</strong></p><blockquote>“…deformable version of our convolution, which consists of learning local shifts applied to the kernel points.”</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*zXkDFM8yS0XdQmEgB-Xcew.png" /><figcaption>Figure 4: Deformable Convolution with shifts calculation</figcaption></figure><p>Similar to deformable CNN[4], KPConv implements a deformable version. The deformable version of KPConv generates shifts for each kernel point, which are added to each location of the kernel point to determine their new locations. The function <em>△(x) </em>generates <em>k</em> shifts based on the given point<em>. </em>Each shift contains three values (one value for each axis), i.e. <em>△(x) </em>generates <em>3k</em> values and are reshaped to <em>(3,k)</em>. The shifts are calculated according to the area of the given point <em>x</em>.</p><p>The changes that are needed to be made to use the deformable version are in the main KPConv function and the kernel function:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*Eq44zSvC4fO2qu13kM-36Q.png" /><figcaption>Deformable KPConv version</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/776/1*4SB_yocJdyXW4RMshvNQlQ.png" /><figcaption>Deformable kernel function</figcaption></figure><p>The offset function <em>△(x) </em>is calculated by a rigid KPConv layer with the same input parameters as the deformable parameters, and the output dimension is 3K. The output of <em>△(x) </em>is reshaped to <em>(K,3)</em> and is used to calculate the new location of each kernel point. Each kernel point&#39;s new location is calculated as the sum of the original location (similar to the rigid version) and the calculated shifts.</p><h3>How KPConv handles point cloud’s challenges?</h3><ol><li><strong>Sparse </strong>— As shown in[5], radius neighborhoods provide robustness to varying densities compared to KNN neighborhoods. KPConv layer samples neighborhoods using a per-dataset radius.</li><li><strong>Unstructured </strong>— KPConv creates a sphere around each point in the point cloud, which reduces the importance of the neighborhood&#39;s inner structure and increases the importance of the relations between the neighbors and the kernel points.</li><li><strong>Unordered </strong>— KPConv layer doesn’t give importance to the order of the points. It looks at each point&#39;s features and its neighborhood features to generate new embeddings.</li></ol><h3>Conclusion</h3><p>In this post, I explained the challenges we face when working with point clouds and how a KPConv layer overcome those challenges. Most of the existing methods project the point cloud to an intermediate representation, which can cause loss of information when processing the input. KPConv presents an elegant approach for processing point clouds that has similar logic to CNN.</p><h3>References</h3><p>[1] <a href="https://arxiv.org/pdf/2001.06280.pdf">https://arxiv.org/pdf/2001.06280.pdf</a></p><p>[2] <a href="https://www.mdpi.com/2072-4292/12/11/1729/htm">https://www.mdpi.com/2072-4292/12/11/1729/htm</a></p><p>[3] <a href="https://en.wikipedia.org/wiki/Convolutional_neural_network">https://en.wikipedia.org/wiki/Convolutional_neural_network</a></p><p>[4] <a href="https://towardsdatascience.com/deformable-convolutions-demystified-2a77498699e8">https://towardsdatascience.com/deformable-convolutions-demystified-2a77498699e8</a></p><p>[5] <a href="https://arxiv.org/pdf/1806.01759.pdf">https://arxiv.org/pdf/1806.01759.pdf</a></p><p>[6] <a href="https://arxiv.org/pdf/1904.08889.pdf">https://arxiv.org/pdf/1904.08889.pdf</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b389015f6f41" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>