<?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 Arnab Das on Medium]]></title>
        <description><![CDATA[Stories by Arnab Das on Medium]]></description>
        <link>https://medium.com/@arnabdas95?source=rss-22dc36bb375b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*kRq91bAg2lDIZQPRnY-uxw.png</url>
            <title>Stories by Arnab Das on Medium</title>
            <link>https://medium.com/@arnabdas95?source=rss-22dc36bb375b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 13:05:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@arnabdas95/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[Your GPU Is Fast. So Why Is Your AI Model Still Slow?]]></title>
            <link>https://medium.com/@arnabdas95/your-gpu-is-fast-so-why-is-your-ai-model-still-slow-af97cc874229?source=rss-22dc36bb375b------2</link>
            <guid isPermaLink="false">https://medium.com/p/af97cc874229</guid>
            <category><![CDATA[performance-optimization]]></category>
            <category><![CDATA[mlops]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[gpu]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Arnab Das]]></dc:creator>
            <pubDate>Mon, 02 Nov 2026 03:46:57 GMT</pubDate>
            <atom:updated>2026-11-02T03:46:57.000Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C698C-PVq4al-u6ThGf8Lw.png" /></figure><p>Suppose, a sports car that can run 300 km/h. Now drive it through a city with a traffic light every 200 meters. That big engine won’t get you there much sooner.</p><p>I keep seeing the same thing with AI inference. A model takes 50 ms per prediction, someone decides the GPU is too slow, and the fix is a bigger GPU. Sometimes that helps. Often it barely changes anything, because the GPU wasn’t what was slowing things down.</p><p>The real cause tends to be one of a few things: memory bandwidth, moving data between the CPU and GPU, the cost of launching lots of tiny kernels, or a batch size that doesn’t fit the workload. This post goes through each one and how to tell which one you’re dealing with.</p><h3>Start with the whole pipeline</h3><p>Say you have a simple vision model that looks at an image and decides whether it’s a cat or a dog. The model’s forward pass is only one part of the job. The full path looks roughly like this:</p><pre>Input → Preprocessing → CPU-to-GPU transfer → GPU compute → Postprocessing → Output</pre><p>Here are some made-up but realistic timings:</p><pre>Preprocessing          3 ms<br>CPU → GPU transfer     2 ms<br>GPU compute            8 ms<br>Postprocessing         2 ms<br>-----------------------------<br>Total                 15 ms</pre><p>Now suppose you buy a GPU that runs the compute twice as fast. 8 ms becomes 4 ms, and the total becomes 3 + 2 + 4 + 2 = 11 ms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*93GDwdgofzFdBUbsctMwEQ.png" /></figure><p>You doubled GPU speed and got about a 1.36x speedup overall. This is <strong>Amdahl’s Law</strong>: speeding up one part of a system only helps as much as that part’s share of the total time. If the GPU was only about half the time to begin with, there’s a hard limit on what a faster GPU can do.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_J1i6oF7RDMRs1kxhl3j0g.png" /></figure><h3>Compute-bound vs. memory-bound</h3><p>This is the most useful idea in GPU performance work, so it’s worth getting clear.</p><p>A workload is <strong>compute-bound</strong> when the GPU spends most of its time doing math. Large matrix multiplications, convolutions and wide dense layers usually fall here. A faster GPU helps these directly.</p><p>A workload is <strong>memory-bound</strong> when the GPU spends most of its time waiting for data. The math units are idle, waiting on memory.</p><p>Think of a kitchen where the chef can cook 100 dishes an hour, but ingredients come up slowly from the storeroom. The chef spends half the shift waiting. A better chef won’t help. Faster deliveries will.</p><p>On a GPU, the usual memory-bound suspects are:</p><ul><li>Element-wise operations (adding, scaling, activations)</li><li>Normalization layers</li><li>Anything that reads and writes a lot of data but does little math per byte</li><li>Heavy postprocessing on large tensors</li></ul><p>That’s why a “simple” LayerNorm or activation sometimes shows up surprisingly high in a profile. <strong>The math is cheap. Moving the data isn’t.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0ZTlN_gHosB-dwHBFUfVnQ.png" /></figure><h3>Memory bandwidth and the roofline model</h3><p>GPU marketing leads with TFLOPS, which is how many floating-point operations the chip can do per second in theory. Memory bandwidth gets less attention, but for many inference workloads it matters just as much.</p><p>The roofline model is a simple way to work out which one limits you. It starts with <strong>arithmetic intensity</strong>:</p><pre>arithmetic intensity = FLOPs / bytes moved</pre><p>Low arithmetic intensity means you’re probably memory-bound. High means you’re probably compute-bound. The best performance you can get is roughly:</p><pre>achievable performance = min(peak compute, memory bandwidth × arithmetic intensity)</pre><p>Whichever of the two is smaller is your ceiling. If you’re on the bandwidth side, a GPU with more FLOPS won’t move you at all. What helps is moving less data: reusing values while they’re still in cache, avoiding intermediate tensors you don’t need, and using lower precision so each value takes fewer bytes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MgjYBlspG4-RozInnHx4IA.png" /></figure><h3>Kernel launch overhead</h3><p>Every operation your framework runs on the GPU becomes one or more <strong>kernels</strong>, and launching each one has a fixed cost.</p><p>Take a block of the model that does activation → normalization → add → activation → normalization. That’s five kernel launches. If each kernel only does a few microseconds of work, the launch cost can be as large as the work itself, and you pay it five times.</p><p>It’s like ordering five small items and getting five separate deliveries. Each item is tiny, but you deal with the delivery five times.</p><p>The usual fix is <strong>kernel fusion</strong>, which combines those operations into a single kernel. You launch once, keep intermediate values in registers instead of writing them back to memory, and skip most of the overhead. Compilers like TensorRT, torch.compile and XLA do a lot of this for you. <strong>CUDA Graphs</strong> help in a different way: they record a whole sequence of launches once and replay it with much less CPU overhead.</p><p>Fusion isn’t free, though. A fused kernel can use too many registers, hurt occupancy, or become hard to maintain if you write it by hand. Measure before and after.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wJN6Jw8PedRxpbyr78O7qg.png" /></figure><h3>Batch size: latency vs. throughput</h3><p>Say you have 100 images to process. You can send them one at a time or in batches:</p><pre>Batch size   Batch time   Time per image<br>     1          1 ms          1.00 ms<br>     4          2.5 ms        0.63 ms<br>     8          4 ms          0.50 ms<br>    16          6.5 ms        0.41 ms</pre><p><em>(Illustrative numbers, not a benchmark.)</em></p><p>Bigger batches keep the GPU busier, so the time per image drops and throughput goes up. The catch is that each request now has to wait for its batch to fill and then for the whole batch to finish, so latency goes up.</p><p>Which one matters depends on what you’re building. Medical imaging, autonomous systems and anything a user is waiting on usually care about latency. Overnight jobs and bulk processing care about throughput. A bigger batch isn’t automatically better. It’s a choice that depends on your use case.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2KxJ9DX7GciUun_xnnNnaw.png" /></figure><h3>Getting data to the GPU</h3><p>Sometimes the GPU is barely involved in the slowdown. The data has a long path to travel first:</p><pre>CPU → system RAM → PCIe → GPU memory → GPU cores</pre><p>For small inputs or very frequent transfers, the PCIe step can take a real share of your time. Things that help:</p><ul><li><strong>Pinned (page-locked) host memory</strong>, which makes transfers faster and lets them run asynchronously</li><li><strong>Asynchronous copies on CUDA streams</strong>, so the next batch is copying while the current one is computing</li><li><strong>Fewer sync points</strong>. Every .item() or .cpu() in the hot path makes the CPU wait for the GPU.</li><li><strong>Keeping data on the GPU</strong> when you’ll use it again, instead of sending it back and forth</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y18s2yjGRXckJg6fYxVUlA.png" /></figure><h3>How to find your actual bottleneck</h3><p>Measure first. Guessing is how you end up buying a new GPU you didn’t need. Here’s the process I’d follow:</p><ol><li><strong>Time the whole request</strong>, not just model(x). Include preprocessing, transfers and postprocessing.</li><li><strong>Break the time down by stage</strong> so you can see where it actually goes.</li><li><strong>Look past GPU utilization.</strong> “GPU 95% busy” only means a kernel was running, not that it was running efficiently. Check memory bandwidth usage, SM occupancy and PCIe traffic.</li><li><strong>Use a profiler.</strong> Nsight Systems shows the timeline across CPU and GPU, which is great for spotting gaps, syncs and transfer stalls. Nsight Compute goes deep on individual kernels and tells you whether each one is compute-bound or memory-bound.</li><li><strong>Re-measure under realistic load</strong>, and look at P95 and P99 latency, not just the average. Averages hide the slow requests your users actually notice.</li></ol><p>A rough guide once you know what you’re dealing with:</p><ul><li><strong>Compute-bound:</strong> mixed precision (FP16/BF16/INT8), better-optimized kernels, or yes, a faster GPU</li><li><strong>Memory-bound:</strong> move fewer bytes, reuse data, fuse element-wise ops, lower precision</li><li><strong>Launch overhead:</strong> kernel fusion, CUDA Graphs</li><li><strong>CPU↔GPU transfer:</strong> pinned memory, async copies, keep data on the GPU</li><li><strong>Low throughput:</strong> tune batch size and the number of concurrent requests</li><li><strong>Slow preprocessing:</strong> parallelize it, or move it onto the GPU (DALI, for example)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z7UbW52FWM2TeX2erRQgbw.png" /></figure><h3>Look at the whole system</h3><p>A GPU at 95% utilization doesn’t mean the system is well optimized. You can have great throughput and terrible tail latency. You can have a very fast model sitting idle because preprocessing can’t keep up.</p><p>Back to the car: a big engine is nice, but the transmission, tires and fuel line all need to keep up with it. Inference is the same. The model is one piece of a longer pipeline.</p><p>So before you upgrade hardware or start writing custom CUDA, ask one question: what is limiting performance right now?</p><p>Once you can answer that with real measurements, optimization stops being guesswork and becomes ordinary engineering. And it’s usually cheaper than a new GPU.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=af97cc874229" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MobileNet Architecture Explained Simply: How AI Works on Your Phone]]></title>
            <link>https://medium.com/@arnabdas95/mobilenet-architecture-explained-a-simple-guide-to-efficient-deep-learning-338f0572b021?source=rss-22dc36bb375b------2</link>
            <guid isPermaLink="false">https://medium.com/p/338f0572b021</guid>
            <category><![CDATA[inference]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[computer-vision]]></category>
            <dc:creator><![CDATA[Arnab Das]]></dc:creator>
            <pubDate>Mon, 26 Oct 2026 03:36:57 GMT</pubDate>
            <atom:updated>2026-10-26T04:29:25.141Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zAUyzJAB-cq7ETPzGbheGw.png" /><figcaption>Figure: 1</figcaption></figure><h3>Introduction</h3><p>Have you ever wondered how your phone can recognize a cat, detect a face, or identify objects in a photograph?</p><p>These tasks are possible because of deep learning. However, many deep learning models require significant computing power and memory, which can make them difficult to run on smartphones and small devices.</p><p><strong>MobileNet is a lightweight deep learning architecture designed to make image recognition more efficient.</strong></p><p>In this blog, we will understand how MobileNet works, learn about <strong>depthwise</strong> and <strong>pointwise</strong> convolution, and compare its computational requirements with those of a traditional convolutional neural network (CNN).</p><h3>1. Why Do We Need MobileNet?</h3><p>Imagine building an application that recognizes cats and dogs from photographs.</p><p>A large neural network might provide good accuracy, but it could also require more memory, processing power, and energy.</p><p>Running such a model on a small device can be challenging (it is a trade off between accuracy vs efficiency).</p><p>We need a model that can:</p><ul><li>Recognize images accurately.</li><li>Process images efficiently.</li><li>Use less memory and computing power.</li></ul><p>MobileNet was designed to help achieve this balance.</p><h3>2. The Main Idea Behind MobileNet</h3><p>To understand MobileNet, we first need to understand convolution.</p><p>A convolution filter moves across an image and looks for patterns. For example, it might learn to detect an edge or a particular texture.</p><p>In a traditional CNN, a standard convolution processes spatial information and <strong>combines information from all input channels in the same operation</strong>. Below the image gives you an overall idea how it works.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T_90xJal4Uc5yLjquu53NQ.png" /><figcaption>Figure 2: Standard Convolution Operation</figcaption></figure><p>MobileNet uses a technique called <strong>depthwise separable convolution</strong>. It divides this work into two simpler operations:</p><ol><li><strong>Depthwise convolution:</strong> Processes each input channel separately.</li><li><strong>Pointwise convolution:</strong> Combines information across channels.</li></ol><p>By separating these operations, MobileNet can significantly reduce the number of calculations needed to produce output feature maps.</p><h3>3. Depthwise Convolution: Processing Each Channel Separately</h3><p>Let’s use a numerical example to understand this.</p><p>Suppose we have an input image with these dimensions (same as the previous CNN example):</p><ul><li>Height: 5 pixels</li><li>Width: 5 pixels</li><li>Input channels: 3 (Red, Green, and Blue)</li></ul><p>Our input shape is <strong>5 × 5 × 3</strong>.</p><p>We will use a 3 × 3 filter, stride 1, and no padding.</p><p>In depthwise convolution, we apply a separate 3 × 3 filter to each input channel.</p><p>For three input channels, we use three filters:</p><ul><li>One filter for Channel 1.</li><li>One filter for Channel 2.</li><li>One filter for Channel 3.</li></ul><p>Each filter moves across its channel independently. At every position, we multiply the overlapping values and add the results to produce one output value.</p><p>Because the input is 5 × 5 and the filter is 3 × 3, the output size is:</p><p>Output height = 5 − 3 + 1 = 3</p><p>Output width = 5 − 3 + 1 = 3</p><p>Each input channel produces one 3 × 3 output feature map.</p><p>After depthwise convolution, the output shape is <strong>3 × 3 × 3 (refer Figure 3 step 1, 2 and 3)</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*67cldZYfUJvoXc3A3RUMGQ.png" /><figcaption>Figure 3: DepthWise and PointWise Calculation in MobileNet Architecture</figcaption></figure><p>This image shows the input channels, separate depthwise filters, pointwise filters, and final outputs.</p><p>The important point is that depthwise convolution processes each channel independently. It does not mix information between channels.</p><h3>4. Pointwise Convolution: Combining the Channels</h3><p>After depthwise convolution, we have three feature maps, each with dimensions 3 × 3 <strong>(refer Figure 3 step 3)</strong>.</p><p>Now we want to produce <strong>four output channels</strong>.</p><p>This is where pointwise convolution comes in.</p><p>Pointwise convolution uses a 1 × 1 filter. Although the filter covers only one spatial position, it extends across all three input channels.</p><p>At a particular spatial position, suppose the three depthwise output values are:</p><ul><li>Channel 1: 6</li><li>Channel 2: 25</li><li>Channel 3: 0</li></ul><pre>A pointwise filter with weights [1, 0, 0] produces:<br>(6 × 1) + (25 × 0) + (0 × 0) = 6<br>A second filter with weights [0, 1, 0] produces:<br>(6 × 0) + (25 × 1) + (0 × 0) = 25<br>A third filter with weights [0, 0, 1] produces:<br>(6 × 0) + (25 × 0) + (0 × 1) = 0<br>A fourth filter with weights [1, 1, 1] produces:<br>(6 × 1) + (25 × 1) + (0 × 1) = 31</pre><p><strong><em>All of the weights are chosen only to make the calculations easy. In a trained neural network, the weights are learned from data.</em></strong></p><p>Each pointwise filter produces one output channel. Therefore, four filters produce four output channels.</p><p>The final output shape is <strong>3 × 3 × 4</strong>(Refer Figure 3 step 4,5 and 6).</p><h3>5. Standard Convolution vs. MobileNet: A Numerical Comparison</h3><p>Now let’s compare both methods using exactly the same input and output dimensions.</p><h3>Common configuration</h3><pre>ParameterValue:<br>Input size (Height × Width × Channels): 5 × 5 × 3<br>Number of input channel: 3<br>Kernel size: 3 × 3<br>Stride: 1<br>Padding: 0 (valid convolution)<br>Number of output channels: 4<br>Output size: 3 × 3 × 4</pre><h3>A. Standard convolution</h3><p>In standard convolution, each output channel has one filter covering all three input channels.</p><p>Weights in one filter:</p><p>3 × 3 × 3 = 27</p><p>Since we need four output channels:</p><p>27 × 4 = <strong>108 weights</strong></p><p>Each output value requires 27 multiply-accumulate operations (MACs).</p><p>There are 3 × 3 spatial positions and four output channels.</p><p>Total *MACs:</p><p>3 × 3 × 4 × 27 = <strong>972 MACs</strong></p><p>*<em>MAC stands for multiply-accumulate. It is a common way to measure the computational work performed by a convolution layer. These calculations count convolution weights and MACs, excluding optional biases and other operations. Actual execution speed depends on the hardware and implementation.</em></p><h3>B. MobileNet convolution</h3><p>MobileNet divides the operation into depthwise and pointwise convolution.</p><h4>Step 1: Depthwise convolution</h4><p>We use one 3 × 3 filter for each of the three input channels.</p><p>Number of weights:</p><p>3 × 3 × 3 = <strong>27 weights</strong></p><p>Each of the three output feature maps contains nine spatial positions. Each position requires nine MACs.</p><p>Total MACs:</p><p>3 × 3 × 3 × 9 = <strong>243 MACs</strong></p><h4>Step 2: Pointwise convolution</h4><p>We use four 1 × 1 filters, each covering the three input channels.</p><p>Number of weights:</p><p>1 × 1 × 3 × 4 = <strong>12 weights</strong></p><p>Each output value requires three MACs. There are nine spatial positions and four output channels.</p><p>Total MACs:</p><p>3 × 3 × 4 × 3 = 108 <strong>MACs</strong></p><h4>Total for MobileNet</h4><p>Total weights:</p><p>27 + 12 = <strong>39 weights</strong></p><p>Total MACs:</p><p>243 + 108= 351 <strong>MACs</strong></p><h3>Final comparison</h3><p>In this example, MobileNet uses approximately <strong>64% fewer weights and MACs</strong> than standard convolution, while producing the same output dimensions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x2YigDy3nWO1o_5EpSUN0g.png" /><figcaption>Figure 4: Visual Comparison of Standard Convolution and DepthWise seperable Convolution</figcaption></figure><p>This image visually compares how standard convolution processes all channels together, while MobileNet separates the work into depthwise and pointwise convolution.</p><h3>6. What Does the MobileNet Architecture Look Like?</h3><p>The original MobileNetV1 architecture follows a straightforward flow:</p><p>Input Image → Initial Convolution → Depthwise Separable Convolution Blocks → Global Average Pooling → Classification Layer → Output</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zXWq39DaYPWmXoJxqVex8w.png" /><figcaption>Figure 5: MobileNet Architecture</figcaption></figure><p>Let’s understand each component.</p><ul><li><strong>Initial convolution:</strong> Extracts basic visual features.</li><li><strong>Depthwise separable convolution blocks:</strong> Learn increasingly complex patterns while reducing computation.</li><li><strong>Global average pooling:</strong> Summarizes each final feature map into a single value.</li><li><strong>Classification layer:</strong> Produces scores for the possible image classes.</li></ul><p>The depthwise separable convolution blocks form the main part of MobileNetV1.</p><p>MobileNetV2 and MobileNetV3 introduce additional architectural improvements, so their complete designs differ from this simplified flow.</p><h3>7. MobileNetV1, V2, and V3</h3><p>MobileNet has evolved through several versions.</p><h3>MobileNetV1 — The original idea</h3><p>MobileNetV1 introduced depthwise separable convolution as the main building block. Its goal was to reduce computation and model size while maintaining useful accuracy.</p><h3>MobileNetV2 — Improved feature processing</h3><p>MobileNetV2 introduced inverted residual blocks and linear bottlenecks.</p><p>In simple terms, the network expands the number of channels, processes features, and then projects them into a smaller representation.</p><h3>MobileNetV3 — Further optimization</h3><p>MobileNetV3 introduced improvements such as Squeeze-and-Excitation blocks, the Hard-Swish activation function, and hardware-aware architectural optimization.</p><p>In simple terms:</p><ul><li>V1 introduced the efficient convolution approach.</li><li>V2 improved how features are processed inside the network.</li><li>V3 introduced further architectural and hardware-aware optimizations.</li></ul><h3>8. Where Can We Use MobileNet?</h3><p>MobileNet is useful whenever we need computer vision on devices with limited computing resources.</p><p>Examples include:</p><ul><li><strong>Image classification:</strong> Recognizing cats, dogs, vehicles, and other objects.</li><li><strong>Object detection:</strong> Finding and locating objects in an image.</li><li><strong>Image segmentation:</strong> Identifying which pixels belong to an object or region.</li><li><strong>Medical imaging:</strong> Extracting features from ultrasound, X-ray, and other medical images.</li><li><strong>Edge AI:</strong> Running AI directly on embedded devices without sending every image to a cloud server.</li></ul><p>For example, MobileNet can serve as a feature extractor within a larger model that analyzes ultrasound frames. The complete system must still meet the required accuracy, latency, and validation standards.</p><p>MobileNet is not automatically the best choice for every application. The right model depends on the task, hardware, input resolution, and accuracy requirements.</p><h3>Conclusion</h3><p>MobileNet completely changed the game by making computer vision feasible on everyday consumer devices.</p><p>By swapping out traditional convolutions for <strong>depthwise separable convolutions</strong>, it drastically cuts down math overhead without sacrificing performance. Later iterations like V2 and V3 pushed efficiency even further with clever structural tweaks.</p><p>At the end of the day, MobileNet’s core superpower is simple: <strong>giving us reliable AI inference with a fraction of the computational weight.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=338f0572b021" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Design Patterns Inside Ultrasound Machines]]></title>
            <link>https://medium.com/@arnabdas95/design-patterns-inside-ultrasound-machines-a06c99dc5d7c?source=rss-22dc36bb375b------2</link>
            <guid isPermaLink="false">https://medium.com/p/a06c99dc5d7c</guid>
            <category><![CDATA[real-time-systems]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[healthcare]]></category>
            <category><![CDATA[medical-software]]></category>
            <category><![CDATA[product-design]]></category>
            <dc:creator><![CDATA[Arnab Das]]></dc:creator>
            <pubDate>Tue, 17 Mar 2026 04:38:56 GMT</pubDate>
            <atom:updated>2026-03-17T04:38:56.048Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DhJ1nk-Ky2dqKiXvF-JbHg.png" /></figure><p>Design patterns are often taught using academic abstractions: shapes, payment gateways, or coffee shop decorators. But when I began working on ultrasound medical systems, I wasn’t thinking about “Gang of Four” diagrams. I was thinking about frame rates, safety regulations, and hardware constraints.</p><p>Over time, I realized something: In medical software, design patterns aren’t about elegance — they’re about survival. In a system where a software crash isn’t just a bug but a clinical delay, these patterns emerge naturally because any other architecture eventually collapses.</p><p>Here is how they manifest in the real world.</p><h3><strong>1. The Strategy Pattern: Imaging Modes</strong></h3><p>Ultrasound machines aren’t just one device; they are a dozen devices in one. You have <strong>B-Mode</strong> (the classic grayscale), <strong>Doppler</strong> (blood flow), and <strong>M-Mode</strong> (motion tracking).</p><p>Each mode requires a completely different processing pipeline and rendering logic. We use the <strong>Strategy Pattern</strong> not because we want “pluggable code,” but to isolate risk.</p><ul><li><strong>The Reality:</strong> Mixing Doppler logic with B-Mode logic creates a “spaghetti” mess that makes <strong>FDA Validation</strong> (the formal process of proving software is safe for intended use) a nightmare. By isolating them into discrete strategies, we ensure that a change in how we calculate blood flow velocity doesn’t accidentally break the basic imaging path.</li></ul><h3><strong>2. The State Pattern: Contextual Logic</strong></h3><p>A button press on an ultrasound console means nothing without context.</p><ul><li>If the system is in a <strong>Freeze State</strong>, the “Save” button stores a static image.</li><li>In an <strong>Acquisition State</strong>, it might start a cine-loop recording.</li><li>In a <strong>Measurement State</strong>, it might set a caliper point.</li></ul><p>Instead of a 2,000-line switch statement, the <strong>State Pattern</strong> allows the system to swap its entire personality. This reduces “illegal state transitions” — preventing the system from trying to fire a high-voltage pulse while the user is just reviewing a saved file.</p><h3><strong>3. The Observer Pattern: Decoupling the Frame Stream</strong></h3><p>When a new frame comes off the hardware, everyone wants a piece of it.</p><ol><li>The <strong>Display</strong> needs to render it.</li><li>The <strong>Measurement Engine</strong> needs to track a fetal heart rate.</li><li>An <strong>AI Module</strong> might be scanning for anomalies.</li></ol><p>Using an <strong>Observer Pattern</strong> is critical for system stability. If the “AI Module” hangs for 20ms, it shouldn’t “block” the UI thread. The system broadcasts the frame and moves on. In medical devices, the image must <em>always</em> flow; everything else is secondary.</p><h3><strong>4. The Facade &amp; Adapter: Taming the Metal</strong></h3><p>Ultrasound software lives on top of terrifyingly complex hardware — probes with hundreds of elements, high-voltage beamformers, and specialized FPGAs.</p><ul><li><strong>The Facade:</strong> We use this to hide the hardware’s complexity. The application-level code asks for “Start Stream,” and the Facade handles the hundreds of registers that need to be flipped in the background.</li><li><strong>The Adapter:</strong> This is our best friend for AI integration. AI models change every six months; our core architecture lasts a decade. We wrap third-party inference engines in Adapters so that when we switch from a local model to a cloud-based API, the rest of the system remains stable.</li></ul><h3><strong>5. The Command Pattern: User Intent as Data</strong></h3><p>When a sonographer turns a <strong>Gain</strong> knob (the “volume control” for image brightness) rapidly, they generate a stream of intents.</p><p>By encapsulating these as <strong>Commands</strong>, we can:</p><ul><li><strong>Queue</strong> them if the processor is busy.</li><li><strong>Coalesce</strong> them (if five gain changes happen in 10ms, only the last one matters).</li><li>Treat user input as an <em>intent</em> to be managed, rather than a function to be executed immediately. This is vital in real-time systems where timing is everything.</li></ul><h3>The Singleton Pattern: Hardware Authority</h3><p>In a medical device, you aren’t just managing data; you are managing physical, high-voltage hardware. There is only one beamformer board and one transducer connector. If two different modules tried to send conflicting instructions to the hardware simultaneously, it could lead to system instability or hardware damage.</p><p><strong>The Reality:</strong> We use the Singleton pattern to create a single “Source of Truth” for the hardware interface. By ensuring only one instance of the Hardware Controller exists, we prevent “resource contention” — the digital equivalent of two people trying to steer a car in different directions. In a regulated environment, the Singleton provides a guaranteed, centralized point for safety logging and error handling, making it much easier to prove to auditors that the hardware is being accessed safely.</p><h3>The Flyweight Pattern: Memory Preservation</h3><p>Ultrasound generates a massive stream of high-resolution data — often 60+ frames per second. If you have multiple UI components (a main view, a thumbnail gallery, and an AI analysis window) all trying to hold that data, the system will run out of memory and crash.</p><p><strong>The Reality:</strong> We use the Flyweight pattern to share the “heavy” raw pixel data across the entire application while keeping the “light” metadata (like zoom levels or brightness settings) separate for each view. In a clinical setting, a memory leak or an “Out of Memory” error isn’t just a nuisance; it’s a system failure during a critical diagnostic moment. Flyweight ensures the image stays in RAM without duplicating the footprint.</p><h3><strong>Why Patterns Aren’t Optional in Regulated Med-Tech</strong></h3><p>In most industries, design patterns improve code quality. In medical systems, they provide <strong>Safety and Longevity.</strong></p><ul><li><strong>Validation:</strong> It is much easier to prove to a regulator that a specific “Strategy” is safe than to prove a monolithic block of code is safe.</li><li><strong>Evolution:</strong> Hardware evolves faster than software. Patterns like Facades and Adapters allow us to swap out a $5,000 transducer without rewriting the entire UI.</li></ul><h3><strong>Final Thought</strong></h3><p>Working on these systems changed my perspective. I still don’t care much for coffee shop decorators, but I’ve learned to love the <strong>Strategy Pattern</strong>. Not because it makes the code elegant, but because it ensures that when a doctor needs to see blood flow in a flickering heart, the system delivers — every single time.</p><p>Also, Design patterns aren’t academic tools to be used for “cleanliness.” They are the structural beams that keep a complex, high-stakes system from buckling under its own weight. <strong>In medical software, good design isn’t a luxury. It’s a Clinical Requirement.</strong></p><h4><strong><em>Appendix: A Mini-Glossary</em></strong></h4><ul><li><strong><em>B-Mode:</em></strong><em> The “default” 2D grayscale ultrasound view.</em></li><li><strong><em>Doppler Mode:</em></strong><em> Used to visualize blood flow velocity and direction.</em></li><li><strong><em>Gain:</em></strong><em> Electronic amplification of returning signals (brightness control).</em></li><li><strong><em>TGC (Time Gain Compensation):</em></strong><em> Specific gain adjustments for different depths.</em></li><li><strong><em>Cine-loop:</em></strong><em> A short, continuous loop of ultrasound frames (like a medical GIF).</em></li><li><strong><em>FDA Validation:</em></strong><em> The formal requirement to provide objective evidence that the software meets user needs and safety standards.</em></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a06c99dc5d7c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Where AI Hooks into an Ultrasound Machine (From an AI Integration Engineer’s View)]]></title>
            <link>https://medium.com/@arnabdas95/where-ai-hooks-into-an-ultrasound-machine-from-an-ai-integration-engineers-view-78fc3cd98fcb?source=rss-22dc36bb375b------2</link>
            <guid isPermaLink="false">https://medium.com/p/78fc3cd98fcb</guid>
            <dc:creator><![CDATA[Arnab Das]]></dc:creator>
            <pubDate>Wed, 04 Feb 2026 14:01:44 GMT</pubDate>
            <atom:updated>2026-02-04T14:01:44.174Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="AI Hook in Ultrasound Machine" src="https://cdn-images-1.medium.com/max/800/1*o2Ihe3AcZi9VfY5QzHoRdg.png" /></figure><p>When people imagine AI inside an ultrasound machine, they often picture a deep learning model replacing traditional imaging logic. In reality, modern ultrasound systems are far more conservative — and for good reason.</p><p>AI does not replace the core ultrasound pipeline. It <strong>hooks into it</strong>, carefully and deliberately.</p><p>As an AI Integration Engineer working with ultrasound systems, I learned that understanding <em>where</em> AI fits is far more important than understanding every detail of probe physics or signal processing.</p><h3>The Ultrasound Pipeline AI Does Not Touch</h3><p>To understand where AI fits, it helps to first clarify where it doesn’t.</p><p>The early stages of an ultrasound machine — probe transmission, echo reception, analog front-end processing, and beamforming — are tightly coupled to hardware and real-time constraints. These stages are deterministic, timing-critical, and heavily validated.</p><p>In my work, I never interact directly with these blocks, and that separation is intentional. AI is kept away from these stages not because it is incapable, but because any nondeterminism here would directly affect image formation itself.</p><h3>The First Safe Entry Point: Image-Level Data</h3><p>The earliest and most common hook for AI is <strong>after image formation</strong>.</p><p>At this point, the system has already produced a stable, beamformed image. The data is no longer raw signals, but structured image frames with well-defined spatial meaning.</p><p>This is where I typically receive the data for AI inference. From an integration perspective, this stage offers consistent formats, predictable timing, and insulation from hardware variability. It allows AI features to evolve without destabilising the core imaging pipeline.</p><h3>AI as an Observer in a Real-Time System</h3><p>One architectural principle I have seen consistently is that AI operates as an observer, not a controller.</p><p>AI consumes images and produces annotations, measurements, or guidance. It does not control acquisition and does not modify how images are formed. When I integrate features like segmentation or automated measurements, the AI output is always layered on top of the image, never altering the image itself.</p><p>This design simplifies validation and makes AI behaviour easier to reason about in clinical workflows. The AI explains what is already there; it does not rewrite reality.</p><p>This observer role becomes even more important because ultrasound is a real-time modality. Frames arrive continuously, and any delay is immediately visible to the user.</p><p>In practice, each frame is passed to the AI module as it becomes available. Inference runs asynchronously, usually through an optimized runtime. The result is then aligned back to the same frame and rendered as overlays or measurements during display.</p><p>If inference takes too long, the system does not wait. The imaging pipeline continues, and the AI output may be skipped or reused from a previous frame. I had to design AI features with this behaviour in mind from the beginning. This is why AI in ultrasound is treated as a real-time component, not a background process.</p><h3>Metadata, Isolation, and Why Most Failures Are Silent</h3><p>One thing I learned quickly is that image pixels alone are rarely enough.</p><p>AI modules depend heavily on metadata such as pixel spacing, orientation, acquisition mode, probe type, and frame timing. I have seen multiple cases where the model itself was correct, but subtle metadata mismatches caused spatial errors that were hard to detect.</p><p>From an integration standpoint, validating these assumptions became as important as validating the model. Many AI issues in ultrasound are not model failures at all — they are metadata alignment problems.</p><p>This is also why AI modules are isolated by design. If AI inference fails, times out, or produces invalid output, the core imaging pipeline continues uninterrupted. AI enhances the system, but it must never become a single point of failure.</p><p>Because AI outputs are assistive rather than controlling, validation focuses less on “perfect predictions” and more on consistency, transparency, and predictable failure handling. The shift is from model metrics to system behaviour.</p><h3>A Mental Model That Tied Everything Together</h3><p>The most useful mental model I adopted is this:</p><blockquote>The ultrasound pipeline produces truth.<br>AI produces interpretation.</blockquote><p>As long as that boundary is respected, AI integration remains safe, scalable, and understandable. Conceptually, the flow looks like this:</p><p><strong>Core Imaging → Image Processing → AI Module → Visualization &amp; Guidance</strong></p><p>In my experience, AI always sits beside the pipeline, never inside it.</p><h3>Final Thought</h3><p>AI in ultrasound is not about replacing imaging physics with neural networks. It is about augmenting human interpretation while preserving system reliability.</p><p>As an AI integration engineer, my responsibility is to respect the pipeline’s constraints and add value without breaking trust. Understanding where AI hooks in — and where it must stop — is what makes that possible.</p><p>In ultrasound systems, AI succeeds not by being powerful, but by being disciplined.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78fc3cd98fcb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[When a Model Leaves Python: Lessons from Deploying Medical AI to C++]]></title>
            <link>https://medium.com/@arnabdas95/when-a-model-leaves-python-lessons-from-deploying-medical-ai-to-c-a0846d8de6e1?source=rss-22dc36bb375b------2</link>
            <guid isPermaLink="false">https://medium.com/p/a0846d8de6e1</guid>
            <category><![CDATA[medical-ai]]></category>
            <category><![CDATA[ai-in-medical-imaging]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Arnab Das]]></dc:creator>
            <pubDate>Sat, 31 Jan 2026 18:46:52 GMT</pubDate>
            <atom:updated>2026-01-31T18:46:52.030Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Model’s journey from Python to C++" src="https://cdn-images-1.medium.com/max/800/1*KOCeP6Ibx9kiJhGaCS8dxQ.png" /></figure><p>Training a medical AI model in Python feels controlled. The environment is familiar, debugging is easy, and behaviour is largely predictable. You run inference, visualise outputs, compute metrics, and everything lines up.</p><p>Deployment is where that comfort ends.</p><p>Once a model leaves Python and enters a production pipeline — exported to ONNX and executed inside a C++ system — the rules quietly change.</p><h3>The Illusion of “Same Model, Same Behaviour”</h3><p>The most dangerous assumption during deployment is this:</p><p><em>“It’s the same model, just running somewhere else.”</em></p><p>Technically, the weights are the same. Practically, almost everything else is different. The runtime changes. The execution order changes. Precision handling changes. Memory layout changes. Even the way inputs are prepared and outputs are consumed changes.</p><p>The model does not fail. The <em>behaviour shifts</em>.</p><h3>Exporting to ONNX Is Not a Mechanical Step</h3><p>ONNX is often treated as a transport format — something you do after training, almost as an afterthought.</p><p>In reality, exporting to ONNX is the first point where model semantics can subtly change. Certain operations are rewritten. Some layers are fused. Others are approximated differently. Dynamic shapes may become static. Implicit assumptions in Python suddenly need to be explicit.</p><p>Most of the time, the model still runs. That’s what makes this stage deceptive.</p><h3>Where Numerical Differences Begin</h3><p>In Python, inference usually runs in a well-defined floating-point environment. In C++, inference is often optimised aggressively. Differences appear in:</p><ul><li>floating-point precision</li><li>accumulation order</li><li>fused operations</li><li>parallel execution paths</li></ul><p>None of these are “bugs.” They are valid optimisations. But in medical AI pipelines, small numeric differences can cross decision thresholds, especially when post-processing logic is sensitive to boundaries or probabilities.</p><h3>Preprocessing Is the Silent Risk Factor</h3><p>In most systems, preprocessing is re-implemented for production. Python utilities are replaced with C++ code for performance or integration reasons. This is where many assumptions break.</p><p>Interpolation methods, normalization constants, spacing interpretation, and data type conversions all matter.</p><p>Consider something as simple as image scaling and normalization in a medical imaging pipeline. In Python, you might resize using a specific interpolation method, normalize using floating-point arithmetic, and rely on library defaults for spacing or orientation. In C++, the same steps may use a different interpolation kernel, different rounding behaviour, or different handling of pixel spacing. Mathematically, both implementations look correct. Numerically, they are not identical.</p><p>The model will not complain. It will simply behave differently.</p><h3>Post-Processing Amplifies Small Errors</h3><p>Post-processing logic is often designed under the assumption that model outputs follow a specific distribution.</p><p>Thresholding, connected-component analysis, smoothing, and heuristics all magnify small deviations. A minor numeric difference at inference time can become a visible behavioural change at the final output.</p><p>This is why deployment bugs often look like logic bugs, even though the logic itself has not changed.</p><h3>Why Unit Tests Rarely Catch This</h3><p>Most unit tests validate individual components in isolation. Preprocessing passes. Inference passes. Post-processing passes.</p><p>The problem exists in the interaction.</p><p>Without end-to-end comparison across environments, these issues remain invisible. The system is correct locally and incorrect globally.</p><h3>Making Deployment Deterministic</h3><p>The first real improvement came from enforcing determinism.</p><p>Controlling execution paths, fixing random seeds where applicable, and avoiding non-deterministic optimizations made behaviour reproducible. Reproducibility turned deployment from guesswork into engineering.</p><p>Once results could be compared meaningfully, differences became explainable.</p><h3>Treating ONNX as a Contract, Not a File</h3><p>A key mindset shift was treating the ONNX model as a contract.</p><p>Input shapes, data ranges, preprocessing expectations, and output semantics had to be explicitly documented and enforced. Any deviation was treated as a breaking change, not an implementation detail.</p><p>This made integration safer and debugging faster.</p><h3>Why Deployment Needs Its Own Validation Strategy</h3><p>Model validation alone is not sufficient once deployment enters the picture.</p><p>Comparing Python outputs with ONNX outputs, and ONNX outputs with C++ outputs, became a standard step. Differences were expected — but they had to be understood.</p><p>Deployment validation is not about matching numbers exactly. It is about understanding <em>why</em> they differ and whether those differences are acceptable.</p><h3>The Engineering Lesson That Stuck</h3><p>Deployment is not the final step of machine learning. It is a second system design problem layered on top of the first.</p><p>Ignoring this reality does not break systems immediately. It creates silent, slow-moving failures that surface much later — often in the most inconvenient ways.</p><h3>Final Thought</h3><p>Python is where models are born. C++ is where assumptions are tested and output are judged.</p><p>Bridging that gap safely requires more than export scripts and runtime optimizations. It requires explicit contracts, deterministic execution, and system-level validation.</p><p>In medical AI, deployment is not a phase. It is part of the design.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a0846d8de6e1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Ghost in the Branches: Git Bisect, a Hidden Gem for Finding Bad Commit]]></title>
            <link>https://medium.com/@arnabdas95/the-ghost-in-the-branches-git-bisect-a-hidden-gem-for-finding-bad-commit-862d33f75358?source=rss-22dc36bb375b------2</link>
            <guid isPermaLink="false">https://medium.com/p/862d33f75358</guid>
            <category><![CDATA[writing]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Arnab Das]]></dc:creator>
            <pubDate>Sat, 31 Jan 2026 08:08:18 GMT</pubDate>
            <atom:updated>2026-01-31T08:10:12.136Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*LZG5KPcOwDVe6Knpkg2Wyg@2x.jpeg" /><figcaption>Git Bisect</figcaption></figure><h3>The Ghost in the Branches</h3><p>In one of my recent project, I hit a debugging wall. A feature started behaving incorrectly on <strong><em>master</em></strong> branch. It was not a “loud” bug- no crashes, no red error logs. It was subtle. For very specific use cases, the logic shifted slightly, producing the wrong output. In corporate environments, we usually call these edge cases. My task was to pin-point the problem, report it and later fix it.</p><h3><strong>My initial investigation</strong></h3><p>As I started digging, I found confusing pattern across the active branches:</p><p><em>In feature branches A,B,D,E… the bug was there.</em></p><p><em>In feature branches C,F… the bug was not there.</em></p><p><em>In master branch the bug was consistently broken.</em></p><p>Because it didn’t crash the system, it had been overlooked multiple times during the code reviews. It had effectively <em>“leaked” </em>into the ecosystem, hiding in some places and appearing in others.</p><p><strong>The first instinct — which turned out to be wrong — was simple: “W<em>ho Merged This?”</em></strong></p><p>My immediate thought which pull request broke this? So, I spent several hours reviewing merge commits. I pulled every recent merge into “<em>master”</em> within a two-month window (we were certain the bug was introduced in that timeframe). I tried to be clever—I performed a <strong>manual binary search</strong> on the merge commits.</p><p>If there were 10 merges between January and March, I’d check the 5th one. If it was “bad,” I’d look at the older ones; if it was “good,” I’d look at the newer ones. But I get some older merge with the bug and some newer merge without bug. <strong>So the approach failed horrifically.</strong></p><h3><strong>Why PR hunting haunts only not give the solution</strong></h3><p>The reason my manual search failed is that <strong>merges are not milestones; they are intersections.</strong></p><p>When you only check merge commits, you are assuming the bug was created <em>at the moment of integration</em>. In reality, a merge commit usually contains no new logic — it just points to a history of commits that were written weeks or months prior.</p><p>By searching only the merges, I was missing the “internal” commits within the branches. A developer might have written the bug in Branch A back in January, but Branch A didn’t get merged into Master until March. My timeline-based search was looking at the <em>delivery date</em>, not the <em>creation date</em>.</p><h3>The Realization: Git History is a Graph(DAG), Not a Timeline</h3><p>Git history is non-linear. Because we had so many feature branches living simultaneously, the “time” a commit was written didn’t necessarily match the “time” it arrived in <em>“master”</em>.</p><p>I realized I was asking the wrong question. I was asking, <em>“Which PR brought this to master?”</em> when I should have been asking, <em>“Which specific atomic change altered the behavior of the code?”</em></p><h3>Enter git bisect: The Scientific Approach</h3><p>Once I stopped hunting Pull Requests and started hunting <strong>commits</strong>, everything changed. I turned to git bisect.</p><p>Unlike my manual search, git bisect doesn&#39;t care about merges or timelines. It treats the entire tree of commits as a searchable graph. It automates the binary search, checking out specific points in history for you to test(here the bug). At the end, it returns the exact commit where the bug was first introduced .</p><h4>The Workflow:</h4><ol><li><strong>Start:</strong> git bisect start</li><li><strong>Mark the endpoints:</strong> * git bisect bad master (since we know it&#39;s broken there)</li><li>git bisect good &lt;old-hash&gt; (a point from 2–3 months ago where we know it worked)</li><li><strong>The Test:</strong> Git checks out a commit. I run the code.</li></ol><ul><li>Bug present? git bisect bad</li><li>Bug gone? git bisect good</li></ul><h3>The “Aha!” Moment</h3><p>After just a few steps, git bisect pointed to a tiny, three-line change in a utility function.</p><p>It wasn’t a merge conflict. It wasn’t a “bad integration.” It was a small logic error written long ago that only triggered the bug when certain data passed through it. Branches C and F didn’t have the bug simply because they hadn’t pulled that specific utility update yet, or they weren’t using that specific edge-case logic.</p><h3>Final Thought</h3><p>When a bug is “silent” and inconsistently spread across branches, stop looking at your Pull Request history. PRs tell you who talked to whom; git bisect tells you what actually happened to the code.</p><p>If you want to save your sanity, stop being a detective of “who merged what” and start being a scientist of “what changed when.”</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=862d33f75358" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[All about One-Hot-Encoding]]></title>
            <link>https://medium.com/@arnabdas95/all-about-one-hot-encoding-7a19c5abf2b1?source=rss-22dc36bb375b------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a19c5abf2b1</guid>
            <category><![CDATA[one-hot-encoder]]></category>
            <category><![CDATA[nlp]]></category>
            <category><![CDATA[one-hot-encoding]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Arnab Das]]></dc:creator>
            <pubDate>Wed, 11 May 2022 16:49:00 GMT</pubDate>
            <atom:updated>2022-05-11T16:49:00.861Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Most of the Machine Learning and Deep Learning algorithms do not understand the text data. So we need to convert this text data to another format. <strong>One hot encoding</strong> is one the method.</blockquote><p>Some algorithm can works with categorical data like Decision Tree. But most of them can’t. So this categorical data needs to be mapped to integers. One hot encoding is a method that maps this categorical data to integer. Each category is represented as a vector. The size of the vector will be the total number of unique categories in the dataset. And each category is represented as a vector of 0s and 1.</p><p><strong>Example:</strong> Let our dataset contains 3 categories of color — “red”, “green”, “blue”. The below table represents the one-hot encoding.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mhj86xFdognJB1aW_gF3sw.png" /><figcaption>one hot encoding</figcaption></figure><h4><strong>Advantages of One hot encoding :</strong></h4><p>The categorical data has no relationship among them. So after converting text to another map this should be intact. One hot encoding ensures this. Because each and every vector of the one hot encoding is orthogonal to each other. So the <strong><em>cosine similarity</em></strong> as well as <strong><em>distance</em></strong> between any two vectors are same. Thus it holds no relationship among them.</p><h4>Disadvantage of One hot encoding :</h4><p>After one hot encoding the data set becomes <strong><em>larger</em></strong> and introducing <strong><em>new</em></strong> <strong><em>features</em></strong>. It also create a <strong><em>sparse matrix</em></strong> which is not so much efficient.</p><p>Not only categorical data in dataset we can also use this method to convert any text to integer. But the disadvantage is we can not kept the <strong><em>semantic meaning</em></strong> between two words because the cosine distance is same for any two vectors.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a19c5abf2b1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Handwritten digit recognition using CNN]]></title>
            <link>https://medium.com/@arnabdas95/handwritten-digit-recognition-using-cnn-6af432c945cf?source=rss-22dc36bb375b------2</link>
            <guid isPermaLink="false">https://medium.com/p/6af432c945cf</guid>
            <category><![CDATA[cnn]]></category>
            <category><![CDATA[artificial-neural-network]]></category>
            <category><![CDATA[convolution-neural-net]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[mnist-dataset]]></category>
            <dc:creator><![CDATA[Arnab Das]]></dc:creator>
            <pubDate>Fri, 06 May 2022 20:11:26 GMT</pubDate>
            <atom:updated>2022-05-07T06:52:31.102Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yoQCQTTPukBrVzjGshfOuQ.jpeg" /><figcaption>Photographed by Arnab Das, Sikkim, India</figcaption></figure><p>Handwritten digit or MNIST digit recognition program is the ‘HELLO WORLD’ program of CNN. This is a very good start for CNN learning.</p><h4><strong>About the MNIST Dataset :</strong></h4><p>MNIST Dataset consists of 70,000 small images of digits handwritten by high school students and employees of the US Census Bureau. Among 70,000 images, there 60,000 training images and 10,000 testing images. All the images are28*28 pixels. This dataset is so much famous that when a new classification algorithm is invented then people applies it to see how the algorithm will perform on MNIST dataset.</p><h4>Objective :</h4><p>Our objective is to build a deep learning model using CNN to classify the handwritten digit. As it has 0 to 9 digits to predict so it is a multiclass classification problem.</p><h4>How it works :</h4><p>Deep Learning model does not understand images or text. It only understands numbers in form of vector/ matrix/tensor. So for making the model we just use the pixel values of the images. The pixel values are preprocessed in a certain form of nD vectors (later we will discuss).</p><p>The main motto is to extract the useful features or patterns from those images so that based on this features we can train our model and get the expected output. So how do we extract features? Well, here comes the role of CNN. To extract features (like vertical edges, horizontal edges and so on) we apply some filters a.k.a kernels on the images.</p><p>Now question arises how to apply filters? Actually filters or kernels are nothing but some n*n matrix with some distinct combination of numbers. This matrix is applied on the image pixels matrix and do some basic vector operations. That is all. The result is a new matrix with the useful information of the image. This type of layer is called <strong>Convo2D</strong>.</p><p>We use this <strong>kernels</strong> multiple time for extracting the features. As the images is combination of pixels it is very costly to train. So to reduce size of this matrix but keeping most of the information intact pooling is used. This is also a filter that reduces the size of matrix (image) keeping most of the information intact. This type of layer is called <strong>MaxPooling 2D/MinPooling2D</strong> and so on.</p><p>After that we can use some regularization so that the model does not overfitting. <strong>Dropout</strong> is one of the technique of this regularization. This is done in Dropout layer.</p><p>How many number of filters, pooling and regularization layers should be there and what will be the kernels size that is fixed by hyperparameter tuning.</p><p>That is all for CNN. Then this matrix is flatten and fed to multiple <strong>ANN</strong> layers for training. The last layer of ANN should be the softmax layer with 10 output as it classify 10 class of digits.</p><h4>Outline of this Project :</h4><ol><li>Import the necessary libraries</li><li>Load the dataset</li><li>Explore the dataset</li><li>Preprocess the data for CNN model</li><li>Create a CNN model architecture</li><li>Compile and fit the data to the model</li><li>Evaluate the model</li><li>Save the model and prediction</li></ol><h4>Importing the necessary Libraries :</h4><pre><em># importing python libraries</em><br><br><strong>import</strong> <strong>tensorflow</strong> <strong>as</strong> <strong>tf</strong><br><strong>import</strong> <strong>keras</strong><br><strong>from</strong> <strong>keras.models</strong> <strong>import</strong> Sequential<br><strong>from</strong> <strong>keras.layers</strong> <strong>import</strong> Dense<br><strong>from</strong> <strong>keras.layers</strong> <strong>import</strong> Dropout<br><strong>from</strong> <strong>keras.layers</strong> <strong>import</strong> Flatten<br><strong>from</strong> <strong>keras.layers.convolutional</strong> <strong>import</strong> Conv2D<br><strong>from</strong> <strong>keras.layers.convolutional</strong> <strong>import</strong> MaxPooling2D<br><strong>from</strong> <strong>keras.layers</strong> <strong>import</strong> BatchNormalization<br><br><strong>import</strong> <strong>numpy</strong> <strong>as</strong> <strong>np</strong><br><strong>import</strong> <strong>pandas</strong> <strong>as</strong> <strong>pd</strong><br><strong>import</strong> <strong>matplotlib.pyplot</strong> <strong>as</strong> <strong>plt</strong></pre><p><strong>Load the dataset :</strong></p><p>The dataset is available in keras. We can import it from there. As previously discussed the training and testing data is already devided.</p><pre><em># importing the MNIST data module from tensorflow.keras</em><br>mnist = tf.keras.datasets.mnist</pre><pre><em># Load data set</em><br>(X_train,y_train), (X_test,y_test) =  mnist.load_data()</pre><h4>Explore the dataset :</h4><p>Let check the size of dataset.</p><pre>print(f&quot;X_train_shape : <strong>{X_train.shape}</strong> <strong>\n</strong>y_train.shape <strong>{y_train.shape}</strong>&quot;)</pre><p><strong><em>Output :</em></strong></p><p><em>X_train_shape : (60000, 28, 28) <br>y_train.shape (60000,)</em></p><p>X_train_shape is (6000,28,28). It indicates that total 6000 training_instances and each instance is 20*28</p><p>Now try to plot a image from this dataset.</p><pre>plt.imshow(X_train[0])<br>print(&quot;label for oth item is &quot;,y_train[0])</pre><p><strong><em>Output :</em></strong></p><p><em>label for oth item is 5</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/1*CYIjKK-l8PZR7ez2BcT_Lg.png" /></figure><h4>Preprocess the data for CNN model :</h4><p>Unlike machine learning in CNN it is required to provide the color channel information. As these are greyscale images we reshape each images 28*28*1 because one color channel is required for grey scale image.</p><pre><em># reshape the dataset to row*col*1 because it is greyscale so only 1 channel is needed</em><br><br>X_train = X_train.reshape(X_train.shape[0], 28, 28, 1)<br>X_test = X_test.reshape(X_test.shape[0], 28, 28, 1)<br>print(f&quot;train-shape = <strong>{X_train.shape}\n</strong>test-shape = <strong>{X_test.shape}</strong>&quot;)</pre><p><em>Output :</em></p><p><em>train-shape = (60000, 28, 28, 1)<br>test-shape = (10000, 28, 28, 1)</em></p><p>It is preferable to convert all the values to float for better flexibilities. In deep learning it is very much essential to normalize the input value so that all the inputs are in a given ranges. Otherwise the performance of the model will be not preferable. So lets normalize it.</p><pre><em># convert int to float32</em><br>X_train = X_train.astype(&#39;float32&#39;)<br>X_test = X_test.astype(&#39;float32&#39;)</pre><pre><em># normalize the input to 0-1 </em><br>X_train = X_train/255.0<br>X_test = X_test/255.0</pre><p>This is a multiclass classification problem. So we have to do one_hot_encoding as followes.</p><pre><em># one-hot-encoding </em></pre><pre>y_train = tf.keras.utils.to_categorical(y_train)<br>y_test = tf.keras.utils.to_categorical(y_test)<br>y_train.shape</pre><p><em>Output :</em></p><p><em>(60000, 10)</em></p><h4>Create a CNN model architecture :</h4><p>Now the main part. Coding of creation of a model is very much easy. But also the most trickiest part. Because there is no distinct rule regarding the number of layers and number of neurons per layer, regularization. So we have to fine tune the hyperparameters using some techniques (like grid search).</p><p>Here Conv2D and Maxpooling2D is used for feature extraction. Dropout is used for regularization that restricts the overfitting of the model. Then flatten is used to reduce matrices to 1d array so that we can give this as a input to the dense layer . Relu activation function is used here. After that again batchnormalize it. At last next dense layer is the last layer. As total 10 digits have to classify so 10 neuron is selected and softmax activation function is used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/529/1*9JqUmcyHSDY8IiWOVDM8yQ.png" /><figcaption>Model block diagram</figcaption></figure><pre><em># create sequential cnn model</em><br><br>model = Sequential([<br>    Conv2D(32, (5,5), input_shape=(28,28,1), padding = &#39;same&#39;, activation = &#39;relu&#39;),<br>    MaxPooling2D(pool_size=(2,2),padding=&quot;SAME&quot;),<br>    Dropout(0.2),<br>    Flatten(),<br>    Dense(128,activation=&#39;relu&#39;),<br>    (BatchNormalization()),<br>    Dense(total_classes,activation=&#39;softmax&#39;)<br>])</pre><h4>Compile and fit the data to the model :</h4><p>Lets compile and fit the model. It is a time-consuming process and also computationally expensive and power hungry. As its a multiclass classification so, <strong><em>loss = categorical_crossentropy </em></strong>is used<em>. </em><strong><em>Adam optimizer </em></strong><em>and</em><strong><em> accuracy</em></strong><em> </em>metrics are used for optimization and measuring the accuracy respectively.</p><pre><em># compile the model</em><br><em># loss = categorical_crossentropy</em><br><em># optimization technique = adam</em><br><em># metrics = accuracy</em><br><br>model.compile(loss = &#39;categorical_crossentropy&#39;, optimizer = &#39;adam&#39;, metrics=[&#39;accuracy&#39;])<br>print(model.summary())</pre><p><em>Output :</em></p><pre>Model: &quot;sequential_26&quot;<br>_________________________________________________________________<br> Layer (type)                Output Shape              Param #   <br>=================================================================<br> conv2d_27 (Conv2D)          (None, 28, 28, 32)        832       <br>                                                                 <br> max_pooling2d_14 (MaxPoolin  (None, 14, 14, 32)       0         <br> g2D)                                                            <br>                                                                 <br> dropout_21 (Dropout)        (None, 14, 14, 32)        0         <br>                                                                 <br> flatten_21 (Flatten)        (None, 6272)              0         <br>                                                                 <br> dense_44 (Dense)            (None, 128)               802944    <br>                                                                 <br> batch_normalization_1 (Batc  (None, 128)              512       <br> hNormalization)                                                 <br>                                                                 <br> dense_45 (Dense)            (None, 10)                1290      <br>                                                                 <br>=================================================================<br>Total params: 805,578<br>Trainable params: 805,322<br>Non-trainable params: 256<br>_________________________________________________________________<br>None</pre><p>Fit the data after compiling.</p><pre><em># model fit</em><br><em>history = model.fit(X_train, y_train, epochs=10, batch_size=200,validation_data=(X_test, y_test)).history</em><br></pre><p><em>Output :</em></p><pre>Epoch 1/10<br>285/285 [==============================] - 24s 83ms/step - loss: 0.0043 - accuracy: 0.9987 - val_loss: 0.0392 - val_accuracy: 0.9913<br>Epoch 2/10<br>285/285 [==============================] - 24s 83ms/step - loss: 0.0035 - accuracy: 0.9990 - val_loss: 0.0513 - val_accuracy: 0.9907<br>Epoch 3/10<br>285/285 [==============================] - 42s 146ms/step - loss: 0.0038 - accuracy: 0.9988 - val_loss: 0.0445 - val_accuracy: 0.9920<br>Epoch 4/10<br>285/285 [==============================] - 44s 155ms/step - loss: 0.0025 - accuracy: 0.9994 - val_loss: 0.0454 - val_accuracy: 0.9913<br>Epoch 5/10<br>285/285 [==============================] - 41s 142ms/step - loss: 0.0025 - accuracy: 0.9992 - val_loss: 0.0494 - val_accuracy: 0.9900<br>Epoch 6/10<br>285/285 [==============================] - 52s 182ms/step - loss: 0.0028 - accuracy: 0.9992 - val_loss: 0.0517 - val_accuracy: 0.9893<br>Epoch 7/10<br>285/285 [==============================] - 27s 96ms/step - loss: 0.0030 - accuracy: 0.9991 - val_loss: 0.0475 - val_accuracy: 0.9897<br>Epoch 8/10<br>285/285 [==============================] - 47s 166ms/step - loss: 0.0032 - accuracy: 0.9990 - val_loss: 0.0482 - val_accuracy: 0.9923<br>Epoch 9/10<br>285/285 [==============================] - 45s 159ms/step - loss: 0.0036 - accuracy: 0.9992 - val_loss: 0.0454 - val_accuracy: 0.9987<br>Epoch 10/10<br>285/285 [==============================] - 24s 83ms/step - loss: 0.0028 - accuracy: 0.9994 - val_loss: 0.0393 - val_accuracy: 0.9989</pre><h4>Evaluate :</h4><p>As the validation and training accuracy is same so the model is not overfitting. The accuracy is above 99%. So the model is not underfitting. So no need to hyperparameter tuning. Lets see the accuracy and loss plot of training and validation set.</p><pre>plt.plot(history[&#39;accuracy&#39;])<br>plt.plot(history[&#39;val_accuracy&#39;])<br>plt.title(&#39;model accuracy&#39;)<br>plt.ylabel(&#39;accuracy&#39;)<br>plt.xlabel(&#39;epoch&#39;)<br>plt.legend([&#39;train&#39;, &#39;test&#39;], loc=&#39;upper left&#39;)</pre><p><em>Output :</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/499/1*4uUhzdy2vAQbvhg3hOU6tg.png" /></figure><h4>Save the model and prediction :</h4><p>The accuracy is good for both testing and training dataset . So we finalize this model and save it.</p><pre><em>#save the model</em><br>model.save(&#39;cnn_mnist_digit.h5&#39;)</pre><p>Now time to prediction.</p><pre><em># model predict</em><br><br>img = X_train[0]<br>img = img.reshape(1,28,28,1)<br><br>predict_value = model.predict(img)<br>np.argmax(predict_value)</pre><p><em>Output :</em></p><p><em>5</em></p><p>That is all. We can now predict the handwritten digit.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6af432c945cf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A useful Outline for Artificial Neural Network (ANN)]]></title>
            <link>https://medium.com/@arnabdas95/a-useful-outline-for-artificial-neural-network-ann-7f2497ee46fe?source=rss-22dc36bb375b------2</link>
            <guid isPermaLink="false">https://medium.com/p/7f2497ee46fe</guid>
            <category><![CDATA[artificial-neural-network]]></category>
            <category><![CDATA[activation-functions]]></category>
            <category><![CDATA[hyperparameter-tuning]]></category>
            <category><![CDATA[gradient-descent]]></category>
            <category><![CDATA[machinelerning]]></category>
            <dc:creator><![CDATA[Arnab Das]]></dc:creator>
            <pubDate>Sun, 27 Mar 2022 07:07:56 GMT</pubDate>
            <atom:updated>2022-03-27T07:19:19.735Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*biKAnpb2E9rH-tk0lLMaeQ.jpeg" /><figcaption>Photographed by Arnab Das, West Bengal, India</figcaption></figure><p>I hope you(the reader) is familiar with Machine Learning LINGO such as Gradient Descent, Loss and Cost functions. If not please learn it first and then comeback here.</p><p>In ANN we basically spend most of the time by playing with different values of hyperparameters. In this article I just give some outline (list) of different hyperparameters so that all the terms related to hyperparameters float on your mind.</p><p>We try to improve performance of the model by tweaking the followings-</p><ol><li>Activation Function</li><li>Loss Function</li><li>Weight Initialization</li><li>Optimization</li><li>Normalization</li><li>Regularization</li><li>Learning Rate Scheduling</li></ol><p>Different options of each hyperparameter category are listed below.</p><h3><strong>ACTIVATION FUNCTION:</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*p5TIryJ9psFZvihif3nsvQ.png" /></figure><ol><li>Binary — step function</li><li>Linear function</li><li>Sigmoid function</li><li>parabolic tan(tanH) function</li><li>Rectified Linear Unit function(ReLU) function</li><li>Leakey ReLU function</li><li>Randomized ReLU function</li><li>Parametric ReLU(PReLU) function</li><li>Exponential ReLU(ELU) function</li><li>Scaled ELU (SELU) function</li><li>Softplus function</li><li>Softmax function</li><li>Swish function</li><li>Gaussian Error Linear Unit(GELU) function</li></ol><h3><strong>LOSS FUNCTION:</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*y8lMdfrRxcE40ZxSVFthnA.png" /></figure><ol><li>Mean Absolute Error(MAE)</li><li>Mean Square Error(MSE)</li><li>Root Mean Square Error(RMSE)</li><li>Cross-Entropy or Log-loss</li></ol><h3><strong>WEIGHT INNITIALIZATION:</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*yxtarXPLSBJUDW5LhwlRig.png" /></figure><ol><li>RandomUniform initialization</li><li>RandomNormal initialization</li><li>TruncatedNormal initialization</li><li>Zero initialization</li><li>Constant initialization</li><li>HeUniform initialization</li><li>HeNormal initialization</li><li>GlorotNormal initialization</li><li>GlorotUniform initialization</li><li>LeCun initialization</li><li>Xavier initialization</li><li>Normalized Xavier initialization</li></ol><h3><strong>NORMALIZATION:</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/693/1*JjbirbVZHPn_tdI76T-M2g.png" /></figure><ol><li>Standardization</li><li>Batch normalization</li><li>Min-Max normalization</li><li>Mean normalization</li><li>Max- Absolute normalization</li></ol><h3><strong>OPTIMIZATION:</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*HQWKDGK6AgaQs7VyGLFhyA.png" /></figure><ol><li>Batch Gradient Descent Optimizer</li><li>2. Stochastic Gradient Descent optimizer</li><li>Mini Batch Gradient Descent optimizer</li><li>Momentum optimizer</li><li>Nesterov Accelerated Gradient optimizer</li><li>AdaGrad optimizer</li><li>RMSProp optimizer</li><li>Adam optimizer</li><li>AdaMax optimizer</li><li>Nadam optimizer</li></ol><h3><strong>REGULARIZATION:</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/683/1*djWcWE1YN8OCUXDGtdeDVA.png" /></figure><ol><li>l1 normalization</li><li>l2 normalization</li><li>Early stopping</li><li>Dropout</li><li>Monte Carlo(MC) Dropout</li><li>Max-Norm regularization</li></ol><h3><strong>LEARNING RATE SCHEDULING:</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/657/1*JjVkaBGNAwBV3eLoCxNuAg.png" /></figure><ol><li>Power scheduling</li><li>Exponential scheduling</li><li>Piecewise scheduling</li><li>Performance scheduling</li><li>Icycle scheduling</li></ol><p>I hope this will help you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7f2497ee46fe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[BEST BOOKS TO CRACK GATE-CSE]]></title>
            <link>https://medium.com/@arnabdas95/best-books-to-crack-gate-cse-69d2735ef4c5?source=rss-22dc36bb375b------2</link>
            <guid isPermaLink="false">https://medium.com/p/69d2735ef4c5</guid>
            <category><![CDATA[gate-exam]]></category>
            <category><![CDATA[iit]]></category>
            <category><![CDATA[gate]]></category>
            <category><![CDATA[gate-cse]]></category>
            <category><![CDATA[ec]]></category>
            <dc:creator><![CDATA[Arnab Das]]></dc:creator>
            <pubDate>Thu, 04 Nov 2021 09:12:07 GMT</pubDate>
            <atom:updated>2021-11-04T09:13:03.698Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tbLvZRkrY9out8Bup7h2OA.jpeg" /><figcaption>Ganga-sagar, West Bengal, India, by Arnab Das</figcaption></figure><p>GATE(Graduate Aptitude Test in Engineering) needs no introduction if one belongs to science and engineering field. For those who are not aware of this or not know the impact of this exam in career please first google it and then come back here.</p><p>Everybody&#39;s dormant dream is to be a part of prestigious institution of India — IIT or NIT or any well known institute like IISC,ISI. Many of them can not get chance to those Institutes after 10+2 . So GATE is the another key to flourish their dormant dream. Nobody wants to crack the GATE just clearing the cut-off, but wants to rank as top as possible to get good institute. For this the preparation must be in systematic, strategic, consistent and disciplined way. First of all your basic should be crystal clear. The main USP of this exam is, the authority hardly set repeated question. Rather they are focused to some particular topics and set questions with repeated concepts. So concept is the King of this exam. But King can not win the battle without commander and army. Accuracy is the Commander. Time management, persistence, practice, mock-test are the troops. There is also a X-factor. Though your troops commander as well as king do the perfect job done you might be defeated without this X-factor. And this is your ‘Nerve’ at the time of examination. If you hold your nerve steady in any situation then nobody can stop your victory chariot.</p><p>I am from Computer Science background and has experience of GATE. My humble request to all of the GATE aspirants that from the beginning of preparation, use only standard books. I list topic-wise some books below. There are some videos and websites that also provide a good grip to the subjects.</p><h3><strong>1. DATA STRUCTURES AND ALGORITHM (DS+ALGO):</strong></h3><p><strong>Introduction to Algorithms</strong> <em>by Cormen</em> ( this is treated as the Bible of Algorithm, Its is a bit hard but for gate only 30% of this book is enough)</p><p><strong>Data structures and algorithm made easy</strong><em> by Narasimha Karumanchi for data structure</em></p><h3><strong>2. PROGRAMMING WITH C:</strong></h3><p><strong>Let us C</strong><em> by Yasavant Kanetkar</em></p><p><strong>Let us Pointer</strong><em> by Yasavant Kanetakar (This is the must read book, as most of the GATE programming problem related with C pointer )</em></p><p><strong>The C programming Language </strong><em>by Dennis Ritchi</em></p><p><strong>Ansi C</strong><em> by Balaguruswami</em></p><h3><strong>3. OPERATING SYSTEM (OS)</strong></h3><p><strong>Operating System Concept<em> </em></strong><em>by Galvin (This is more than enough)</em></p><p><strong>Operating Systems Design and Implementation<em> </em></strong><em>by Tanenbaum</em></p><h3><strong>4. DATABSE MANAGEMENT SYSTEM(DBMS)</strong></h3><p><strong>Database System Concepts</strong><em> by Korth</em></p><p><strong>Fundamentals of Database Systems </strong><em>by Navathe</em></p><p><em>*(Both books are required because </em>t<em>ransactions and concurrency control, normal forms , SQL topics are good in Navate and some topics like ER diagram are good in Korth)</em></p><h3><strong>5. DATA COMMUNICATION AND NETWORKING (CN)</strong></h3><p><strong>Data Communications and Networking</strong> <em>by Forouzan (More than enough)</em></p><p><strong>Computer Networks</strong> <em>by Tanenboum</em></p><p><em>*(I do not recommend book of William Stallings, Do not get me wrong. That book is also a standard book. But the approach is different from above books so you may face some contradictions)</em></p><h3><strong>6.DIGITAL LOGIC (DL)</strong></h3><p><strong>Digital Logic and Computer Design</strong> <em>by Morris Mano</em></p><p><strong>Fundamentals of Digital Circuit</strong> <em>by Anand Kumar</em></p><h3><strong>7. COMPUTER ORGANIZATION AND ARCHITECTURE (COA)</strong></h3><p><strong>Computer system Architecture</strong> <em>by Morris Mano</em></p><p><strong>Computer Organization</strong> <em>by Hamacher</em></p><p><strong>Computer Organization and Architecture</strong> <em>by john Heys</em></p><p><em>* (But not all the syllabus are well covered by these books like Pipeline. And these are mostly focused on concept. Math-problem are hardly to find. In GATE more than 80% are math problems. Some online documents and YouTube video lectures are more than enough.)</em></p><h3><strong>8. THEORY OF COMPUTATIONS (TOC)</strong></h3><p><strong>An introduction to formal languages and automata</strong> <em>by Peter Linz</em></p><p><strong>Theory of Computation</strong> <em>by Adesh Kumar Paney</em></p><p><em>*(This topic also needs some online resources for good grip. YouTube video of Sanchit Jain and Ravindrababu Ravula are highly recommended)</em></p><h3><strong>9. COMPILER DESIGN (CD)</strong></h3><p><strong>Compilers: Principles Techniques and Tool</strong> <em>by Aho Ullman Sethi</em></p><h3><strong>10. DISCRETE MATHEMATICS</strong></h3><p><strong>Discrete Mathematics and its Applications </strong><em>by Kenneth H. Rosen</em></p><p><strong>Graph Theory </strong><em>by Narshing Deo (Only for graph )</em></p><h3><strong>11. ENGINEERING MATHEMATICS</strong></h3><p>Any mathematics book and previous year questions</p><p>** These books are based on theory. It helps you to build the concept. But GATE hardly ask theory questions. So along with, try to solve the previous year questions at least 4–5 times. If you are able to absorb all the concepts from the previous year questions, then 85%–90% of your preparation is done by you. Best of Luck.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=69d2735ef4c5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>