<?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 Aayushma Pant on Medium]]></title>
        <description><![CDATA[Stories by Aayushma Pant on Medium]]></description>
        <link>https://medium.com/@aayushma1?source=rss-9850e0594539------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*czshEHDcaw8dpDkHDVm-Bg.jpeg</url>
            <title>Stories by Aayushma Pant on Medium</title>
            <link>https://medium.com/@aayushma1?source=rss-9850e0594539------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 10:00:23 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@aayushma1/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[Stable Diffusion: Revolutionizing Generative Models]]></title>
            <link>https://aayushma1.medium.com/stable-diffusion-revolutionizing-generative-models-d594443a5d2d?source=rss-9850e0594539------2</link>
            <guid isPermaLink="false">https://medium.com/p/d594443a5d2d</guid>
            <category><![CDATA[stable-diffusion]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[innovation]]></category>
            <category><![CDATA[generative-model]]></category>
            <category><![CDATA[tech-revolution]]></category>
            <dc:creator><![CDATA[Aayushma Pant]]></dc:creator>
            <pubDate>Wed, 26 Jun 2024 05:39:06 GMT</pubDate>
            <atom:updated>2024-06-26T05:39:06.295Z</atom:updated>
            <content:encoded><![CDATA[<p>In the rapidly evolving field of generative models, <strong>Stable diffusion models</strong> have emerged as a groundbreaking technology, pushing the boundaries of what’s possible in creating realistic and high-quality data like images, text, audio and video. But how do these modern techniques stack up against traditional methods? Let’s delve into the fascinating world of image generation and explore the innovations that stable diffusion brings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oOMVRHjx5q8463fgsv8avA.jpeg" /><figcaption>Image generated from text prompt (Source from Author)</figcaption></figure><h3><strong>Traditional Diffusion Model: A Brief Overview</strong></h3><p>Diffusion Models are generative models that create images by simulating a diffusion process. Fundamentally, the Diffusion model works by adding Gaussian noise progressively to the image over several steps, to create a sequence of increasingly noisy images and then learning to reverse this noise addition to generate a new image. This iterative process allows the Denoising Diffusion Models to generate high-quality images by refining noisy inputs into coherent outputs. While effective, these denoising diffusion models these methods come with certain limitations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8GWJcvAEr_QfjOsa.png" /><figcaption>[Source from [1]]</figcaption></figure><ol><li><strong>High Dimensionality:</strong> These models operate in the high dimensional pixel space. This means noise is added and removed directly in the pixel value of the image, requiring a large amount of computational resources. For example, a colour image with 512x512 resolution has 786,432 possible values.</li><li><strong>Numerous Denoising Steps</strong>: Diffusion models typically require many denoising steps to produce high-quality images. This iterative process, while effective, can be time-consuming and computationally demanding.</li></ol><h3>Stable Diffusion Models: A New Paradigm</h3><p>Stable Diffusion Models, also known as <strong>Latent Diffusion Models</strong>, represent a significant leap from traditional diffusion models, in addressing these challenges. Instead of using the pixel space of the image, Stable Diffusion operates in the latent space. This approach leverages the power of stable diffusion to generate data in a compressed and abstract representation, making the process more computationally efficient.</p><h4>What is Latent Space?</h4><p><strong>Latent Space</strong> is a lower-dimensional representation of data, learned by a neural network, that captures the essential features of the input data. The idea is to encode complex high-dimensional data (like images) into a simpler, compact form while retaining as much relevant information as possible. For example, in the human mind, memories are not organized by distinct categories like childhood or work memories. Rather, they are organized in a multi-dimensional latent space based on various hidden factors such as emotions, sensory experiences, and contextual details. Similarly, latent space provides a computer with a compressed understanding of the world through a spatial representation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*enGatAEvNEwXJb-9MN52jQ.jpeg" /><figcaption>The Structure of the Variational Autoencoder consists of an encoder, latent space, and a decoder [Source from 8]</figcaption></figure><h3><strong>The architecture of the Stable Diffusion model</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dDnm0BFkEL9Fd-fS" /><figcaption>[Source from 1]</figcaption></figure><p>The architecture of the Stable Diffusion model includes several key components:</p><ol><li><strong>Latent Space Representation</strong></li></ol><p>As said earlier, Stable Diffusion operates in a latent space. The process involves encoding an image into a latent representation using a pre-trained encoder (often a variational autoencoder (VAE) or similar architecture) given by the below equation where it maps given image <strong><em>x</em></strong> to a latent space <strong><em>z</em></strong><em> </em>by the encoder<em> </em><strong><em>E</em></strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/71/0*BgInT1HDkvgY8ZxG" /></figure><p>This latent representation is then used as the starting point for the diffusion process. The encoder maps the input image into lower-dimensional latent data and by using the decoder we can reconstruct the image back from the latent representation given by :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/84/0*X9zcyEUAXBj9LlBb" /></figure><p><strong>2. Diffusion Process</strong></p><p>After encoding the image into latent data, the diffusion process comes into play and involves two main phases:</p><ul><li><strong>Forward Diffusion (Noise Addition)</strong>: This phase involves gradually adding Gaussian noise to the latent representation over time steps. This process can be mathematically described as:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/232/0*4e9zlZmzYegW0ktN" /></figure><p>where <em>zₜ</em> is the noisy latent at time step <em>t</em>,<br> <em>αₜ </em>is a noise schedule coefficient, and <br><em>𝛜ₜ</em> is Gaussian noise.</p><ul><li><strong>Reverse Diffusion (Denoising)</strong>: This phase involves learning to reverse the noise addition process to recover the original latent representation. A neural network (typically a U-Net) is trained to predict the noise component <em>𝛜ₜ</em> at each time step. Training involves minimizing the difference between the predicted and actual noise:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/304/0*jf0BKCbMIRigtufX" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*kz_zBZvIA7THn-MIApHW1w.gif" /><figcaption>Denoising the image produced from giving input text “ A Nepali girl smiling in traditional dress” in each sampling step [Source from Author]</figcaption></figure><p><strong>3. U- Net Architecture</strong></p><p>The U-Net architecture is crucial for the denoising process. It consists of an encoder-decoder structure with skip connections, allowing it to capture local and global information effectively.</p><p>Attention mechanisms are integrated into the U-Net to enhance the model’s ability to focus on relevant parts of the latent representation. It consists of two different mechanisms.</p><ul><li><strong>Self-Attention</strong>: Allows the model to capture dependencies across different spatial locations in the latent representation. The attention mechanism is defined as the below equation where Q, K and V are the query, key and value matrices, and dₖ is the dimensionality of key vectors respectively.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/374/0*5oP-h8OrpHLLaJgK" /></figure><ul><li><strong>Cross-Attention</strong>: Used in conditional diffusion models to incorporate additional information, such as text embeddings, into the generation process. For text inputs, they are first converted into embeddings (vectors) using a language model <strong>𝜏<em>θ </em></strong>(e.g. BERT, CLIP), and then they are mapped into the U-Net via the (multi-head) Cross-<strong><em>Attention(Q, K, V,c)</em></strong> layer. If c represents the conditioning information:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/557/0*OZMIM9glyUThNIgX" /></figure><p><strong>4. Conditioning Mechanisms</strong></p><p>Stable Diffusion can generate images conditioned on various types of auxiliary information. The purpose of conditioning is to <strong>steer the noise predictor so that the predicted noise will give us what we want </strong>after subtracting from the image. Conditioning can be achieved by:</p><ul><li><strong>Concatenation</strong>: Directly concatenating the conditioning information (e.g., class labels or text embeddings) with the latent representation.</li><li><strong>Adaptive Normalization</strong>: Using techniques like Conditional Batch Normalization (CBN) or Adaptive Instance Normalization (AdaIN) to modulate the latent representation based on the conditioning information.</li></ul><p>In the traditional diffusion model, <strong>pre-trained classifiers</strong> guide the generation process. This means these classifiers help in generating images that satisfy certain conditions like specific class labels, textual descriptions etc. Reliance on such a classifier can limit the performance of the model, as it requires a separate classifier for each type of conditioning (class levels, text prompts). Also generated images heavily depend on the performance of the classifier. So to eliminate these issues, the <strong>classifier-free diffusion principle</strong> is implemented in a stable diffusion model.<br>The stable diffusion model is trained to handle both conditional and unconditional generation tasks. This is achieved by modifying the training process:</p><ol><li><strong>Conditional Training</strong>: During training, the model receives both the input data (e.g., noisy latent representations) and the conditioning information (e.g., text prompts, and class labels).</li><li><strong>Unconditional Training</strong>: The model is also trained without any conditioning information. In this scenario, the conditioning input is replaced with a null value or omitted entirely.</li></ol><p>The model learns to perform both tasks, flexibly switching between conditional and unconditional modes during inference.</p><p><strong>5. Training</strong></p><p>The training process involves optimizing the model to minimize the difference between predicted and actual noise added during the forward diffusion process. The loss function typically used is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/0*z5ZwvYAJAaJl3A3z" /></figure><p>where ​ 𝛜ᵩ is the noise predicted by the model, zₜ is the noisy latent at time step <em>t</em>, and <em>c</em> is the conditioning information.</p><h3>Examples and Applications</h3><p>Stable Diffusion models have shown remarkable results in various image generation tasks, including:</p><p><strong>Text to Image Generation</strong></p><p>It introduces a functionality to generate the Images from the given text.</p><p><strong>Image-to-Image Generation</strong></p><p>It transforms an image into another one using stable diffusion. An input image and a text prompt are supplied as the input in image-to-image. The generated image will be conditioned by both the input image and text prompt</p><ul><li><strong>Upscaling</strong>: Enhancing the resolution of low-quality images.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/0*JrzVg1_biYPN9b0E.jpg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*1wR99pN-Urf5nN7A.png" /><figcaption>Upscaling Image from low quality to high [Source from 7]</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*X3d7HwfE6XveAR7z.jpg" /><figcaption>Upscaling Image from low quality to high [Source from 7]</figcaption></figure><ul><li><strong>Inpainting</strong>: Filling in missing parts of an image.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/0*Szz2jmwAo5TDDWpX.png" /><figcaption>Image Inpainting example</figcaption></figure><p>Prompt: “A cat on a bench”<br>Generated image:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/506/0*6NsH0y6Ib0YFZ5Dn.png" /><figcaption>Generated inpainted Image</figcaption></figure><p>Hence, Stable Diffusion represents a significant advancement over traditional diffusion models by leveraging latent space representations to improve computational efficiency and image quality. This innovative approach opens new possibilities for generative models, making them more practical and versatile for a wide range of applications.</p><h4>References</h4><ol><li>R. Rombach, A. Blattmann, D. Lorenz, P. Esser, and B. Ommer, “High-resolution image synthesis with Latent Diffusion Models,” arXiv.org, 13-Apr-2022. [Online]. Available: <a href="https://arxiv.org/abs/2112.10752">https://arxiv.org/abs/2112.10752</a>.</li><li><a href="https://github.com/CompVis/stable-diffusion/tree/main">https://github.com/CompVis/stable-diffusion/tree/main</a></li><li><a href="https://cvpr2022-tutorial-diffusion-models.github.io/">https://cvpr2022-tutorial-diffusion-models.github.io/</a></li><li><a href="https://scholar.harvard.edu/binxuw/classes/machine-learning-scratch/materials/stable-diffusion-scratch">Understanding Stable Diffusion from “Scratch” | Binxu Wang (harvard.edu)</a></li></ol><p>5. <a href="https://stable-diffusion-art.com/how-stable-diffusion-work/">https://stable-diffusion-art.com/how-stable-diffusion-work/</a></p><p>6. <a href="https://medium.com/@steinsfu/stable-diffusion-clearly-explained-ed008044e07e">https://medium.com/@steinsfu/stable-diffusion-clearly-explained-ed008044e07e</a></p><p>7. <a href="https://dublog.net/blog/stable-diffusion-2/">https://dublog.net/blog/stable-diffusion-2/</a></p><p>8. Attari, Vahid &amp; Arróyave, Raymundo. (2022). Machine learning-assisted high-throughput exploration of interface energy space in multi-phase-field model with CALPHAD potential. Materials Theory. 6. 10.1186/s41313–021–00038–0.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d594443a5d2d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Pixels to Photorealism: The Art of 3D Gaussian Splatting]]></title>
            <link>https://aayushma1.medium.com/from-pixels-to-photorealism-the-art-of-3d-gaussian-splatting-fdcdc1a9ac21?source=rss-9850e0594539------2</link>
            <guid isPermaLink="false">https://medium.com/p/fdcdc1a9ac21</guid>
            <category><![CDATA[photorealistic-rendering]]></category>
            <category><![CDATA[3d]]></category>
            <category><![CDATA[computer-graphics]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[gaussian-splatting]]></category>
            <dc:creator><![CDATA[Aayushma Pant]]></dc:creator>
            <pubDate>Sun, 09 Jun 2024 14:25:10 GMT</pubDate>
            <atom:updated>2024-06-09T14:25:10.665Z</atom:updated>
            <content:encoded><![CDATA[<p>Imagine watching fireflies glow in a dark field at night. Each firefly emits a light that is brightest at its position and fades as you move away. These glowing areas can be represented using <strong>3D Gaussians</strong>. When combined, they create a field of glowing blobs similar to a technique called Gaussian Splatting.</p><h3>What is Gaussian Splating?</h3><p>Gaussian Splatting is a powerful technique in computer vision and graphics used for 3D image reconstruction. It involves projecting 2D image features (such as key points or pixel intensities) into 3D space, represented as a Gaussian distribution centered at each 3D position. These Gaussians are then combined to form a continuous 3D representation of the scene, which is particularly useful for real-time radiance field rendering, enabling photorealistic scenes from a limited number of images.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*56Cq1iqnvZdsU9uVJ1AirQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/655/1*boV_pWMTLbzmmZeGI88PDg.png" /><figcaption>Gaussian Distribution at different values of sigma ( right 𝜎 is greater than left) [Source: Image by the author]</figcaption></figure><h4>The Math Behind Gaussian Splatting</h4><p>The Gaussian Splatting process involves calculating the Gaussian function for each keypoint or pixel in the image. This function resembles a smooth, bell-shaped curve, similar to a hill when plotted on a graph. The center of the bump is the most influential, with the influence decreasing smoothly as you move away from the center.</p><p>The Gaussian function is defined by the equation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/0*ifepr1QNnsF4Qr-A" /><figcaption>Gaussian Function</figcaption></figure><p>where (𝑥,𝑦,𝑧) are the coordinates of the keypoint or pixel, (𝑋,𝑌,𝑍)are the coordinates in 3D space, and 𝜎 is the standard deviation controlling the spread of the Gaussian.</p><p>In detail,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/0*ZVyzj2RXMQE2qVRb" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/0*0fSfAk4IUuIRR3zj" /></figure><p>which shows how the Gaussian value decreases as you move away from the center (x,y,z).</p><p>Summing up these Gaussians results in a smooth, continuous 3D surface approximating the shape defined by the <em>n </em>key points.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/222/0*SDej3QywoYeLWVk8" /></figure><h4>Example</h4><p>Let us understand this concept more clearly by a simple example. Consider defining 4 keypoints for a 2D rectangle and assigning a constant depth value to lift these keypoints into 3D space. Applying a Gaussian function creates smooth splats centered at each keypoint. These are then combined to form a 3D representation. This process helps transform a simple 2D shape into a 3D model using Gaussian Splatting, illustrating how individual points contribute to the overall 3D structure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*aTT_8ov4GMv5e00E0-6Hfg.gif" /><figcaption>Individual Gaussian Splat contribution verses combined splats.[Source: Image by the author]</figcaption></figure><p>When visualizing the above scenario, we get the above result. Here, the animation shows each Gaussian splat with a distinct color, highlighting the contribution of each key point on the right. On the left, a smooth, continuous 3D shape is represented by an isosurface formed by the combined 3D Gaussian splats from all key points defined by the same “blue color”.</p><h3>Rendering with 3D Gaussian Splatting</h3><p>Rendering in 3D Gaussian involves projecting these Gaussians onto the image plane. Each Gaussian’s contribution is computed based on its projection and its parameters like covariance matrix, and opacity (𝛼) allowing for flexible optimization.</p><p>The architecture of 3D Gaussian for real-time radiance field rendering can be given below. The method starts with a set of images of a static scene and corresponding camera calibrations from Structure from Motion (SfM) that produces a sparse point cloud. From these points, a set of 3D Gaussians is created, defined by its position, covariance matrix, and opacity (𝛼). This approach results in a compact 3D scene representation, capable of efficiently representing fine structures using anisotropic volumetric splats. Then these Gaussian parameters are optimized while adaptively controlling Gaussian density. The efficiency is enhanced by a tile-based rasterizer that enables <strong>𝛼-blending</strong> of splats to create the final image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PyR_ilfS1dF9NbO6.png" /><figcaption>The Architecture of 3D Gaussian for real-time radiance field rendering (Source: taken from[1])</figcaption></figure><p>In Gaussian Splatting, the scene is represented as a collection of Gaussians, each associated with color and opacity. The color of the radiance field is represented via spherical harmonics. The radiance field is thus approximated by these Gaussians:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/159/0*-yAMPUpzD0CbwpVz" /></figure><p>where <em>𝑐 </em>represents the color of the 𝑖-th Gaussian, and <em>G</em>​(<strong>x</strong>) is its value at point 𝑥.</p><p><strong>Mathematically,</strong></p><p>The projection of a Gaussian onto the image plane involves an affine transformation of the Gaussian function from the world coordinate system to the camera coordinate system via a viewing transformation matrix.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/346/0*k8a8iNeQW0z5rG-Q" /></figure><p>where 𝑢 and 𝑣 are coordinates on the image plane, and 𝑆 is the transformed covariance matrix in the camera coordinate system</p><p>After the transformation, the contributions of all Gaussians are composited. The colors and opacities are blended based on their projected positions and weights to produce a final image. The parameters of the Gaussians (mean, covariance, color, and opacity) can be optimized to better fit the scene’s radiance field. Optimization techniques, such as <a href="https://aayushma1.medium.com/gradient-descent-in-machine-learning-614bb3e676d7"><strong>Gradient Descent</strong></a>, can minimize the error between the rendered image and the ground truth.</p><p>Here is an example of rendering of 3D Gaussians generated from the sparse point clouds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oWEQpml5q9rinUxX.png" /><figcaption>Rendering Pipeline for Gaussian Splatting which starts by transforming world coordinates into the camera coordinate system. Gaussians are then radially projected based on their mean onto a plane tangent to the unit sphere, where colors are computed by alpha-blending 2D Gaussians. Finally, rays are cast onto the unit sphere for each pixel to retrieve and render the image’s color resulting in a rendered image. (Source: taken from[2])</figcaption></figure><h4>Practical Example: Modeling a Tree</h4><p>Let’s create a 3D model of a tree, representing its trunk and leaves, and project it onto a 2D plane:</p><pre>trunk_params = [(0, 0, i, 0.1, 0.1, 0.5, 0, 0, 0) for i in np.linspace(-2, 2, 10)]<br><br># Parameters for the leaves (a cluster of Gaussians around the top of the trunk)<br>leaves_params = [(np.random.uniform(-0.5, 0.5), np.random.uniform(-0.5, 0.5), np.random.uniform(1.5, 2),0.3, 0.3, 0.3, 0, 0, 0) for _ in range(50)]<br><br># Combine parameters<br>all_params = trunk_params + leaves_params</pre><p>Now create a 3D Gaussian function utilizing the above equation</p><pre>def gaussian_3d(x, y, z, mux, muy, muz, sx, sy, sz, rho_xy, rho_xz, rho_yz):<br>    X, Y, Z = np.meshgrid(x, y, z, indexing=&#39;ij&#39;)<br>    X_shifted = X - mux<br>    Y_shifted = Y - muy<br>    Z_shifted = Z - muz<br>    <br>    # Create the covariance matrix<br>    covariance_matrix = np.array([<br>        [sx**2, rho_xy * sx * sy, rho_xz * sx * sz],<br>        [rho_xy * sx * sy, sy**2, rho_yz * sy * sz],<br>        [rho_xz * sx * sz, rho_yz * sy * sz, sz**2]<br>    ])<br>    <br>    inv_covariance_matrix = np.linalg.inv(covariance_matrix)<br>    <br>    # Compute the exponent component-wise<br>    exponent = (X_shifted**2 * inv_covariance_matrix[0, 0] +<br>                Y_shifted**2 * inv_covariance_matrix[1, 1] +<br>                Z_shifted**2 * inv_covariance_matrix[2, 2] +<br>                2 * X_shifted * Y_shifted * inv_covariance_matrix[0, 1] +<br>                2 * X_shifted * Z_shifted * inv_covariance_matrix[0, 2] +<br>                2 * Y_shifted * Z_shifted * inv_covariance_matrix[1, 2])<br>    <br>    gaussian = np.exp(-0.5 * exponent)<br>    <br>    return gaussian</pre><p>Finally, generate and add each Gaussian to the volume. Summing along the Z-axis projects it onto the 2D plane, which is then normalized to create the given output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vnDRsewb5Ox8sPGmli6JUw.gif" /><figcaption>[Source: Image by the author]</figcaption></figure><p>By integrating Gaussian Splatting, we can effectively create and render photorealistic 3D models from 2D images, enhancing our capability in fields like computer vision, graphics, and augmented reality.</p><h4>Reference</h4><ol><li>Kerbl, B., Kopanas, G., Leimkühler, T., &amp; Drettakis, G., “3D Gaussian Splatting for Real-Time Radiance Field Rendering”, arXiv:2308.04079, 2023</li><li>Huang, L., Bai, J., Guo, J., &amp; Guo, Y., “Optimal Projection for 3D Gaussian Splatting”,arXiv.2402.00752v2, 2024</li></ol><p>3. <a href="https://huggingface.co/blog/gaussian-splatting">Hugging Face</a>, Article</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fdcdc1a9ac21" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Gradient Descent in Machine Learning]]></title>
            <link>https://aayushma1.medium.com/gradient-descent-in-machine-learning-614bb3e676d7?source=rss-9850e0594539------2</link>
            <guid isPermaLink="false">https://medium.com/p/614bb3e676d7</guid>
            <dc:creator><![CDATA[Aayushma Pant]]></dc:creator>
            <pubDate>Sun, 13 Jun 2021 04:24:19 GMT</pubDate>
            <atom:updated>2021-06-13T04:24:19.718Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UCZMK2pppzUH9cujysBKHg.png" /></figure><p>Life is a Gradient Descent. We set up the goals and we gradually move to achieve them from our current position. Similarly, different events in our lives are influenced by gradient descent. Like you walking the smallest distance from home to school, choosing the shortest path for reaching down at the base of the camp, predicting the stock in the stock market for getting less loss etc. We want all these things to occur with precision and accuracy. So let’s look into the popular optimization technique called <strong><em>Gradient Descent Algorithm </em></strong>that can help in minimizing the loss and makes every Machine learning model predict more accurately.</p><p><strong><em>What is Gradient Descent?</em></strong></p><p>Gradient Descent is one of the most popular optimization algorithms for training any Machine Learning model. The purpose of this optimization is to achieve the best design relative to minimizing losses and maximizing accuracy.</p><p>Before knowing how this all works we must understand the <strong>cost function</strong>.</p><h3>Cost function</h3><p>The objective in the case of gradient descent is to find a line that best fits given inputs, to give the appropriate output. With a known set of inputs and their corresponding outputs, a machine learning model attempts to make predictions according to the new set of inputs. We can find the best fit by<strong> changing the weight and bias </strong>so that our predicted value can get closer to the output value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/0*w7n6Fm8WisqNTfAH.jpg" /></figure><p>From the predicted result as shown in the figure, got by best fitting our linear regression model, we got an error like d1,d2,d3,d4 and d5. Thus it can also be understood as the difference between predicted output and actual value. Thus we get,</p><h3>ERROR = Y’(PREDICTED) — Y(ACTUAL)</h3><p>The Error would be the difference between the two predictions. The <strong>loss function</strong> is the error of a single training example whereas the <strong>cost function</strong> is the mean sum of all the loss function i.e. cost(MSE) = (d1²+d2²+d3²+d4²+d5²)/n where n=5.</p><p>Thus,</p><blockquote><strong><em>The goal of Machine learning algorithm is to minimize this cost function.</em></strong></blockquote><p><strong>How does it work and how the goal be achieved?</strong></p><p>A gradient is the slope of a function measuring the degree of change of a variable in response to the changes of another variable in each iteration. It gives a convex output by partial derivative of the parameters of input. It can be given by:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*8GguaOcWnnKiEScg.jpg" /></figure><p><em>This shows in every iteration our new position converses by the partial derivative(gradient) multiply by learning rate(alpha). We should take every step to ensure that we minimize the cost function and reach the global minimum.</em></p><p><strong><em>But the question is how to reach the minima???</em></strong></p><p>Gradient Descent Algorithm helps us to make these decisions efficiently and effectively with the use of derivatives which is the slope of the graph at a particular position. The slope is described by drawing a tangent that directs to reach the local minima. It can be given as below.</p><p>Now how can we make it to the global minimum so precisely? How to take the step? This can be understood by adjusting a step called the learning rate (alpha). A larger learning rate covers more distance and tends to overshoot the minimum whereas a smaller learning rate takes small efficient steps that lead to the lowest altitude. We can see this in the example below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*ZpywLYu61KJlA2cl.png" /><figcaption>learning rate: 0.10 reached minima at 84 steps</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*wtZly3xf2nvsq2c5.png" /><figcaption>learning rate at 1.0 reached minima at 6 steps</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*JfKoQRA6Bz3xs1yz.png" /><figcaption>learning rate at 2.80 reached minima with17 steps <a href="https://developers.google.com/machine-learning/crash-course/fitter/graph"><em>source</em></a></figcaption></figure><p>Hence from the above example, we ensured that we should correctly choose the learning rate. Technically, the small value of the learning rate tends to reach the minima more easily than the larger one gets overshoot and diverge instead of conversing into global minimum giving the false result. So, we should also be careful in choosing the learning rate.</p><p><strong>To sum up,</strong> gradient descent has become the best optimization technique for linear Regression model and also be used in further different Machine Learning techniques.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=614bb3e676d7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Principal Component Analysis (PCA) From Scratch]]></title>
            <link>https://aayushma1.medium.com/principal-component-analysis-pca-99c14bcec674?source=rss-9850e0594539------2</link>
            <guid isPermaLink="false">https://medium.com/p/99c14bcec674</guid>
            <category><![CDATA[details-of-pca]]></category>
            <category><![CDATA[ml-pca]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-mining-techniques]]></category>
            <category><![CDATA[apc]]></category>
            <dc:creator><![CDATA[Aayushma Pant]]></dc:creator>
            <pubDate>Tue, 01 Jun 2021 08:33:35 GMT</pubDate>
            <atom:updated>2021-06-13T03:36:27.279Z</atom:updated>
            <content:encoded><![CDATA[<p>Data of higher dimensions tend to create sparse matrixes and make it much more difficult to compute, analyze and visualize. It is therefore very important to reduce the dimensions to minimize redundant information, improve visualization and discover hidden correlated information. One of these methods of dimension reduction is PCA.</p><p>The principal component analysis also referred to as the K-L or Karhunen-Loeve method is the technique of reducing the dimensions of data without losing a lot of information from data. It searches for k n-dimensional orthogonal vectors that can be used to represent the data where k≤n.</p><p>The basic procedure for PCA determination is as follows:</p><ol><li><strong>Normalizing the Data</strong></li></ol><p>The first stage is the standardization of the data. The input data is normalized so that each attribute falls within the same range and is not dominated by the attribute of larger dimensions. Normalization facilitates calculations that can be done in many ways, such as the Min-max scalar, the Standard scalar, the Zero normalization (subtracting data of the average), etc.</p><p>To understand much deeper, let&#39;s dive into the given example. Suppose there are two measures X1 and X2 having 12 samples and 2 sizes. Our task is to locate the Principal Component of the data given by following the steps.</p><p>Subtracting the mean :</p><pre>#Importing necessary modules<br>import numpy as np<br>import matplotlib.pyplot as plt</pre><pre>x1_norm=x1-x1.mean()#X1&#39; normalized from X1<br>x2_norm=x2-x2.mean()#X2&#39; normalized from X2</pre><figure><img alt="Raw data converted into Zero mean normalized data" src="https://cdn-images-1.medium.com/max/352/1*0OXklLl2Okl8UBFbBj7LMQ.png" /><figcaption>Raw Data Converted into Zero mean Normalized Data</figcaption></figure><p>Plotting data through matplotlib. Here, the dots are our data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/377/1*-dFiRRhJtHKuTC8rLpuSOQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/377/1*_tft_XHoeyIfPG2ny5b2sA.png" /><figcaption>Visualization of Raw data and Zero mean normalized data</figcaption></figure><p>2<strong>. Calculation of Covariance Matrix</strong></p><p>The covariance matrix (S<em>x) </em>is a square symmetric matrix of dimension <em>m*m which is given as:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/154/1*13HUJrTxl9BzQpeXgaiCrQ.gif" /><figcaption>Covariance matrix where X is a column matrix of dimension (m*1)</figcaption></figure><p>The diagonal of the matrix Sx resembles the variance and off-diagonal are covariances. Our goal is to minimize the redundant off-diagonal elements and maximize the variance (diagonal element).</p><pre>X_matrix=np.array((x1_norm,x2_norm))<br>Sx=(1/(X_matrix.shape[1]-1))*np.matmul(X_matrix,np.transpose(X_matrix))</pre><pre><strong>Output</strong><br>Sx=array([[  3.51818182, -13.52454545],<br>       [-13.52454545,  55.58878788]])</pre><pre>(Since non-diagonal element of the matrix Sx are negative. So, we asssume both X1 and X2 variable decrease together.)</pre><p>3. <strong>Eigen Values and vector of Covariance Matrix</strong></p><p>Before exploring the concept of Eigenvectors, let&#39;s understand the goal of PCA. As described earlier, PCA is to compute the orthonormal matrix P such that our outcome becomes Y=PX, where P is the principal component of the given input vector X. The choice of P is made in such a way that it diagonalizes Sy. That means preserving the diagonal values. So our output becomes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/1*Rr_nWEy_sDsL1CVbxT9gzQ.png" /></figure><p>For achieving this goal, an eigenvector must be calculated. In linear algebra, an eigenvector vector of a linear transformation is a non-null vector that changes to the maximum by a scalar factor when this linear transformation is applied to it. The relevant eigenvalue often referred to as λ, is the scale factor of the eigenvector. Here the eigenvalues and eigenvector are calculated by:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/243/1*2QhCueJ6DTMc35IStVhtzg.png" /></figure><pre># eigen_value calculation<br>m=(Sx[0][0]+Sx[1][1])/2<br>p=(Sx[0][0]*Sx[1][1]-(Sx[1][0]*Sx[0][1]))<br>lambda1=m+(m**2-p)**(1/2)<br>lambda2=m-(m**2-p)**(1/2)</pre><pre>Output<br>lambda1=58.89203173874124<br>lambda2= 0.21493795822846806</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/191/1*LZEiuKbpl7ut0RYXR0drdA.png" /></figure><p>Calculating the eigenvector by keeping y=1.</p><pre>#eigen vector calculation<br>V1=np.array((Sx[0][1]/(lambda1-Sx[0][0]),1))<br>V2=np.array((Sx[0][1]/(lambda2-Sx[0][0]),1))</pre><pre>Output<br>eigen_vectorV1=[-0.24424066  1.        ]<br>eigen_vectorV2=[ 4.09432244  1.        ]</pre><p>Plotting the two eigenvectors V1(represented by green dotted lines) and V2 (denoted by red dotted lines). Here V1 vectors seem to be the best fit than V2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/377/1*hCkDmSMzrtAKtEesLZHD9w.png" /></figure><p>4.<strong> EigenVectors with the highest value</strong></p><p>The variances explained by the eigenvalues of the respective eigenvector are identified. To do this, the Eigenvalues are sorted in descending order. The proportion of variance explained by r principal components is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/372/1*Os3YGt9DGCnQkBNPZtlVAA.png" /></figure><p>This is only helpful when dimensions are highly correlated and r is smaller than m.</p><pre>k = lambda1 / (lambda1 + lambda2)<br>print(str(round(k*100,2))+&#39;% variance is explained by v1&#39;)<br>print(str(round((1-k)*100,2))+&#39;% variance is explained by v2&#39;)</pre><pre><strong>Output<br></strong>99.64% variance is explained by v1<br>0.36% variance is explained by v2</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/489/1*fUPFA3XTXAEqX0AkW57YvA.png" /><figcaption>The variance explained by two PCA</figcaption></figure><p>The principal component from the given eigenvectors can be given as:</p><pre>P=np.array((V1,V2))<br>Y=np.matmul(P,X_matrix)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/832/1*ifaVMdMwn7B9l4dd5_7G5Q.png" /><figcaption>Y1 and Y2 two principal component derived V1 and V2 eigenvectors respectively</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/370/1*iOrK2uthB-Z3FJULW2YkdA.png" /><figcaption>Visualization of Choosing both components and finding the value of Y (No PCA)</figcaption></figure><p>Hence from the above visualization, it is confirmed that the V1 vector (also principal component) is the best fit.</p><p>5. <strong>Dimension reduction using the principal component.</strong></p><p>Finally, we take the V1 vector as our main component and derive the dimension using it.</p><pre>P=np.array((V1))#orthonormal vector<br>Y=np.matmul(P,X_matrix)<br>Sy=(1/(Y.shape[0]-1))*np.matmul(Y,np.transpose(Y))</pre><pre><strong>Output</strong><br>Sy=62.40514745166816</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/386/1*i3jy36J3M2DZDXRc9vmn4w.png" /><figcaption>One dimensional data plot with 99% of variance explained.</figcaption></figure><p>This is how the reduction of dimensions is carried out by analyzing the principal components.</p><p>Check out my article on<a href="https://medium.com/swlh/quantum-computing-for-machine-learning-24664ee0d301"> Quantum Computing For Machine Learning</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=99c14bcec674" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quantum Computing for Machine Learning]]></title>
            <link>https://medium.com/swlh/quantum-computing-for-machine-learning-24664ee0d301?source=rss-9850e0594539------2</link>
            <guid isPermaLink="false">https://medium.com/p/24664ee0d301</guid>
            <category><![CDATA[use-of-quantum-computing]]></category>
            <category><![CDATA[quantum-computing]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Aayushma Pant]]></dc:creator>
            <pubDate>Sun, 01 Nov 2020 07:29:16 GMT</pubDate>
            <atom:updated>2021-06-01T09:16:03.674Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Have you ever wondered about beating the time? And solving a large number of mathematical matrices, data and queries within just a fraction of second. Then without dilemma, there comes a word “<strong>quantum”</strong>.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/0*XMlfCgqQy2DuaHvS.jpg" /></figure><p>Quantum computers unseal parallelism leading to the reduction of steps required to solve the problems. It uses the qubits that can be represented by the electrons orbiting the nucleus. As compared to our classical computers which work on bits and lies either in zero states or one state but not both at the same time, something strange happens with quantum computers.</p><p>The electrons of the qubits fall in an exciting state and ground state and even both states at the same time are called superposition. Besides these, the quantum particles interact with each other and are measured concerning each other. It means if one quantum particle in a pair is spin downstate then the other will be switched to spin up called quantum entanglement. Thus the computations in quantum computers are driven by the phenomenon of superposition and entanglement following the Wave-particle duality principle.</p><p>Featuring the superposition of qubits, ‘n’ qubits can explore 2ⁿ binary configurations. For example, ‘50’ qubits can perform 2⁵⁰ solutions at the same pulse, beating the time of the classical computers. The increment of qubits leads to the exponential rise of massive parallelism.</p><p>Apart from Quantum computing, fitting with Machine learning has always been challenging in today’s eras. As a subset of Artificial Intelligence, Machine learning algorithms are generally concerned with the collection of data, training of data, evaluation and deployment of the model for the prediction. Recommendation systems, AI-driven chatbot like Alexa, Siri, Prediction Machine, Natural language processing, Speech Recognizer are all the creation of Machine learning and Deep learning algorithms.</p><p>While training these models in classical computers, it generally deploys high cost and takes a long time and some can not be computed. But this can be made efficient with quantum support vector machines that facilitate the quantum algorithms and properties like entanglement and interference creating a massive quantum state space causing to fasten and improve kernel evaluation.</p><p>Similarly, for finding the Eigenvalues and large matrices of Eigenvectors, Quantum<a href="https://aayushma1.medium.com/principal-component-analysis-pca-99c14bcec674"> <strong>PCA</strong></a> and topology features can be used to find the Eigenvectors and values of high dimensional matrices. Also, clustering of high dimensional data can be done using quantum clustering finding. From Simulation algorithms of Quantum mechanics to the quantum Fourier transform algorithms various evolution has been carried out in Quantum Machine learning to learn the pattern of data that cannot be learnt by classical computers.<br><br>But the things are not as easy to implement. It takes about -460F for the qubits to become stable, discouraging the quantum computers with large numbers of qubits. Similarly, a unified quantum learning theory has not been developed, challenging us in this field to solve the unsolved queries.</p><p>Taking the problem as a challenge, IBM, Google and Microsoft are making an effort to create the revolutions. Research is carried out to reconstruct the new technology of physics and big data. From new algorithms like Simple quantum Neural Network and Training for solving the problem of training quantum networks to Quantum perceptron operating on classical neurons having non-linear functions are the revolutionary effort. Similarly, experiments like Smoking gun experiments for quantum speedups for Machine learning is yet another discovery in this field.</p><p>Quantum Computers for Machine Learning seems weird and tough. But it can be a remarkable innovation in optimizing the problems and changing the pattern of data security to the reduction of power consumption and accelerating the operations. Thus, there is no doubt that quantum machine learning can transform the future world of big data and science.</p><h4>Resources</h4><p><a href="https://www.futurebridge.com/industry/perspectives-mobility/quantum-computing-a-key-to-autonomous-vehicle-industry-success/">Image</a></p><ul><li><a href="https://en.wikipedia.org/wiki/Quantum_machine_learning">Quantum machine learning - Wikipedia</a></li><li><a href="https://www.kdnuggets.com/2019/04/quantum-computing-machine-learning.html">How can quantum computing be useful for Machine Learning - KDnuggets</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=24664ee0d301" width="1" height="1" alt=""><hr><p><a href="https://medium.com/swlh/quantum-computing-for-machine-learning-24664ee0d301">Quantum Computing for Machine Learning</a> was originally published in <a href="https://medium.com/swlh">The Startup</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>