<?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 Serdar Dedebas on Medium]]></title>
        <description><![CDATA[Stories by Serdar Dedebas on Medium]]></description>
        <link>https://medium.com/@serdardedebas1?source=rss-3ba0faaf8c59------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*wvW0l6tBa1HZO3sfyEbAcQ.jpeg</url>
            <title>Stories by Serdar Dedebas on Medium</title>
            <link>https://medium.com/@serdardedebas1?source=rss-3ba0faaf8c59------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 14:17:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@serdardedebas1/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[DenseNet: The Network Where No Layer Forgets Another]]></title>
            <link>https://medium.com/@serdardedebas1/densenet-the-network-where-no-layer-forgets-another-e56904c02501?source=rss-3ba0faaf8c59------2</link>
            <guid isPermaLink="false">https://medium.com/p/e56904c02501</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[resnet]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[densenet]]></category>
            <dc:creator><![CDATA[Serdar Dedebas]]></dc:creator>
            <pubDate>Wed, 01 Jul 2026 10:59:57 GMT</pubDate>
            <atom:updated>2026-07-01T10:59:57.398Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vng4KBAoD-M1q2yJKNMMYA.png" /></figure><p>When I wrote about ResNet, one idea sat at the center of it: by adding a layer’s input back to its output (the residual connection), gradients flow far more easily and the network can go hundreds of layers deep. ResNet had largely solved the “depth problem.” But at the end of 2016, a group of researchers from Cornell and Tsinghua asked a far more radical question: <em>if shortcut connections work this well — why not take them all the way?</em></p><p>In ResNet, each layer talks directly only to the one before it. But what if every layer talked directly to <strong>all</strong> the layers before it? That is exactly the idea <strong>DenseNet</strong> (Densely Connected Convolutional Networks) is built on. And this deceptively simple idea won the <strong>Best Paper Award</strong> at CVPR 2017.</p><p>In this article I want to explain, without any code, what DenseNet <em>is</em>, how it <em>differs</em> from ResNet, and why it achieves so much with so few parameters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xsY3CsCFAv7VVXvUQ33utg.png" /><figcaption><em>Figure 1 — A 5-layer dense block with a growth rate of k = 4. Each layer takes all preceding feature-maps as input. Source: Huang et al. (2017).</em></figcaption></figure><h3>Background: The natural conclusion of the shortcut idea</h3><p>In earlier articles I described how <strong>ResNet</strong> made depth possible through residual connections. ResNet’s core equation was this: a block’s output is the <strong>sum</strong> of a learned transformation and its input — output = F(x) + x. That addition gave gradients a shortcut straight down to the deep layers.</p><p>DenseNet started from the same motivation but chose a different path. The goal here is also to maximize information flow, but the method is not summation — it is <strong>concatenation</strong>. A layer’s input is the side-by-side stacking of the feature maps of all preceding layers. In a traditional CNN with L layers there are L connections; in DenseNet there are <strong>L(L+1)/2</strong> direct connections.</p><p>This small-looking choice — concatenating instead of adding — defines DenseNet’s entire character.</p><h3>The core idea: Concatenation, not addition</h3><p>Because ResNet sums input and output, information is, in a sense, “overlaid.” In DenseNet, since feature maps are stacked rather than added, <strong>no information is lost</strong>. Every layer has direct access to all feature maps produced before it.</p><p>The authors describe this with a lovely analogy: you can think of the feature maps as the network’s <strong>collective knowledge</strong>. Each layer reads from this shared memory, adds its own contribution, and writes it back. Once written, that information remains accessible from everywhere in the network — there’s no need to recompute it from layer to layer as in traditional architectures.</p><p>This has three important consequences:</p><ol><li><strong>It alleviates the vanishing-gradient problem.</strong> Because each layer has a short path to both the output and the loss, gradients flow far more easily.</li><li><strong>It encourages feature reuse.</strong> Low-level features learned early (edges, textures) can be reused again and again by later layers; there’s no need to relearn the same feature.</li><li><strong>It dramatically reduces parameter count.</strong> Because no layer needs to be very wide — it only has to make a small contribution to the shared memory.</li></ol><h3>Growth rate: How much new information does each layer add?</h3><p>One of DenseNet’s most elegant concepts is the <strong>growth rate</strong>, usually denoted k. Each layer adds only k new feature maps to the collective knowledge. For DenseNet-121, 169, and 201 the growth rate is k = 32, and for DenseNet-161 it is k = 48.</p><p>What’s surprising is how <strong>small</strong> k can be. While traditional architectures have each layer produce hundreds of feature maps, in DenseNet a layer might add only 32 new channels. That&#39;s because it already has access to all the richness produced before it — it doesn&#39;t need to regenerate everything from scratch, only to make a small contribution to the shared memory. The growth rate acts like a faucet that regulates how much new information each layer adds to the network&#39;s global state.</p><p>There’s a cost, of course: as you move deeper inside a Dense Block, the number of input channels grows linearly (k₀ + k × (layer − 1)). DenseNet manages this with an architectural split — Dense Blocks and Transition Layers.</p><h3>Architecture: Dense Blocks and Transition Layers</h3><p>DenseNet can be broken into two fundamental building blocks:</p><p><strong>Dense Block.</strong> This is where the dense connectivity happens. Inside a Dense Block, all layers preserve the same feature-map size (spatial resolution) and each layer is concatenated with everything before it. The composite function at each layer is actually a sequence of three operations: <strong>BN → ReLU → Conv</strong> (pre-activation style). This is the expansion of every “conv” layer shown in Table 1 of the paper.</p><p><strong>Transition Layer.</strong> The bridge between Dense Blocks. It does two things: it reduces the number of feature maps with a 1×1 convolution (compression) and halves the spatial dimensions with 2×2 average pooling (downsampling). In other words, the Transition Layer reins in the otherwise unbounded growth of density.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jG-EB8ZwgQNMWP2J56fLLg.png" /><figcaption><em>Figure 2 — A deep DenseNet with three dense blocks. The layers between two adjacent blocks are referred to as transition layers and change feature-map sizes via convolution and pooling. Source: Huang et al. (2017).</em></figcaption></figure><p>In the DenseNet-121 case, a network starting with a growth rate of 32 reaches 1024 channels in its final layer — meaning that thanks to dense connectivity, the collective knowledge grows steadily richer as the network deepens.</p><p>The table below shows the four DenseNet variants designed for ImageNet side by side. All of them use a growth rate of k = 32, and every &quot;conv&quot; in the table actually denotes the BN-ReLU-Conv sequence. Notice that as depth increases (121 → 264), only the number of layers inside each Dense Block changes; the skeleton stays the same.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TN06bpLeoEaBSzgCeIg3sQ.png" /><figcaption><em>Table 1 — DenseNet architectures for ImageNet. The growth rate for all networks is k = 32. Each “conv” layer in the table corresponds to the BN-ReLU-Conv sequence. Source: Huang et al. (2017).</em></figcaption></figure><h3>DenseNet-B and DenseNet-C: Pushing efficiency one step further</h3><p>The beauty of concatenation is that no information is lost; the challenge is that input channels grow quickly. The paper balances this with two extra techniques:</p><ul><li><strong>Bottleneck layers (DenseNet-B):</strong> A 1×1 convolution is added before each 3×3 convolution. This 1×1 layer shrinks the number of input channels, reducing the computational load. So a large number of input channels gets compressed before entering the main convolution.</li><li><strong>Compression (DenseNet-C):</strong> In Transition Layers, the number of feature maps is reduced by a factor θ (theta). The paper uses θ = 0.5, so the channel count halves at every transition.</li></ul><p>A model applying both is called <strong>DenseNet-BC</strong>, and the paper’s most efficient results come from this variant. DenseNet-BC can match ResNet’s accuracy with far fewer parameters.</p><h3>Results: Few parameters, strong performance</h3><p>DenseNet’s most striking quality is its efficiency. On ImageNet (ILSVRC 2012), DenseNet reaches accuracy similar to ResNet while using <strong>less than half the parameters</strong> and roughly <strong>half the FLOPs</strong>. On smaller datasets like CIFAR-10, CIFAR-100, and SVHN it surpassed the state-of-the-art of its time.</p><p>The intuition behind this is, again, feature reuse: because the network doesn’t have to relearn the same features over and over, it can do more with fewer parameters. Another nice behavior the authors observed: as parameter count grows, DenseNet’s accuracy improves consistently, showing no signs of overfitting or performance degradation.</p><h3>The architectures side by side</h3><p>Architecture Year Core idea Connection type Defining feature LeNet-5 1998 First practical CNN Sequential Conv + pooling foundations AlexNet 2012 Deep CNN + GPU Sequential ReLU, dropout, large scale VGG 2014 Depth with small kernels Sequential Stacks of 3×3 conv ResNet 2015 Residual learning Addition (F(x)+x) Depth to hundreds of layers <strong>DenseNet</strong> <strong>2017</strong> <strong>Dense connectivity</strong> <strong>Concatenation</strong> <strong>Feature reuse, few parameters</strong></p><p>It’s more accurate to see DenseNet not as an alternative to ResNet, but as the same “shortcut” philosophy pushed to its extreme. ResNet sums information; DenseNet never loses it.</p><h3>Where it shows up in practice</h3><p>DenseNet is still a very strong backbone, especially in <strong>transfer learning</strong> scenarios. Its parameter efficiency and strong feature propagation make it appealing particularly in data-scarce domains — like medical imaging. DenseNet-121 and DenseNet-201 are among the go-to architectures in many medical studies, from disease classification on chest X-rays onward.</p><p>In my own project <strong>AllerView</strong>, working on wheal segmentation, I deal with challenges like limited data and extreme class imbalance. The feature-reuse logic of the DenseNet family makes it very clear in practice why learning strong representations from little data matters so much — being able to learn a feature once and reuse it everywhere is invaluable on small datasets.</p><h3>Conclusion: The network where no layer forgets another</h3><p>DenseNet always reminds me of this: sometimes a big leap doesn’t come from inventing a brand-new mechanism, but from taking an existing good idea all the way. ResNet said “let’s add the input back”; DenseNet said “in that case, let every layer see everyone” — and in doing so it used fewer parameters while delivering better results.</p><p>The difference between concatenation and addition isn’t just a technical detail — it’s a difference in philosophy. In DenseNet no information gets overlaid and lost; every layer’s contribution is preserved and remains accessible to the rest of the network. Maybe that’s the best part: when you design a network, <em>how</em> you let information flow matters as much as how deep you make it.</p><h3>References</h3><ul><li>Huang, G., Liu, Z., van der Maaten, L., &amp; Weinberger, K. Q. (2017). <em>Densely Connected Convolutional Networks.</em> CVPR 2017 (Best Paper Award). arXiv:1608.06993</li><li>He, K., Zhang, X., Ren, S., &amp; Sun, J. (2016). <em>Deep Residual Learning for Image Recognition.</em> CVPR 2016.</li><li>Official code and pretrained models: <a href="https://github.com/liuzhuang13/DenseNet">https://github.com/liuzhuang13/DenseNet</a></li></ul><p><em>Sometimes the road forward isn’t about going deeper, but about never forgetting the past.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e56904c02501" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ConvNeXt: A ConvNet Wakes Up in the 2020s]]></title>
            <link>https://medium.com/@serdardedebas1/convnext-a-convnet-wakes-up-in-the-2020s-788454a0580a?source=rss-3ba0faaf8c59------2</link>
            <guid isPermaLink="false">https://medium.com/p/788454a0580a</guid>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[convnext]]></category>
            <category><![CDATA[convnets]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Serdar Dedebas]]></dc:creator>
            <pubDate>Sat, 27 Jun 2026 06:33:25 GMT</pubDate>
            <atom:updated>2026-06-27T06:33:25.251Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RTVk08UfldUVK9conYkohA.png" /></figure><p>When Swin Transformer arrived, there was a feeling in the air: the future of computer vision belonged to attention, and convolutions were quietly heading for the history books. Vision Transformers were breaking records in classification, detection, and segmentation one after another, and “the CNN era is over” was a sentence you could hear almost everywhere.</p><p>Then, right at the start of 2022, a group of researchers at Facebook AI Research asked a simple but uncomfortable question: <em>Do these gains really come from attention — or from everything else around the Transformer?</em> The training recipe, the macro design decisions, the normalization choices… To answer it, they took a plain old <strong>ResNet-50</strong> and, without adding a single attention block, taught it step by step to behave like a Swin Transformer. The resulting pure ConvNet — <strong>ConvNeXt</strong> — outperformed the Swin Transformer.</p><p>This is a no-code tour of <em>what</em> ConvNeXt is, <em>why</em> it matters, and <em>what</em> this “modernization journey” teaches us about architecture design itself.</p><h3>The backdrop: from ResNet to Swin, then back again</h3><p>To follow ConvNeXt, two architectures are worth keeping in mind. <strong>ResNet</strong> made very deep networks trainable through residual connections. <strong>Swin Transformer</strong> closed ViT’s weak points with hierarchical feature maps and shifted-window attention, becoming a default Transformer backbone in computer vision. ConvNeXt sits right at the intersection of those two stories.</p><p>Here’s the thing: Swin Transformer wasn’t <em>only</em> attention. It carried a whole bundle of design decisions — long training schedules, the AdamW optimizer, GELU activations, LayerNorm, heavy data augmentation, a four-stage hierarchy, a particular stage compute ratio. People were crediting all of Swin’s success to attention, but it was unclear how much of it actually came from attention and how much came from these “surrounding” choices.</p><p>The genius of ConvNeXt is that it turns this question into an experiment. The authors fix a single training recipe and walk ResNet-50 step by step into Swin’s design world — measuring exactly how many points of ImageNet accuracy each change adds. So ConvNeXt is less an architecture than a <strong>controlled modernization process</strong>, and the final network is simply the product of that process.</p><h3>The modernization roadmap: from ResNet-50 to ConvNeXt</h3><p>The starting point is a classic ResNet-50: <strong>76.1%</strong> top-1 accuracy on ImageNet-1K. By the end of the journey, at the same FLOP budget, the network reaches <strong>82.0%</strong> — beating Swin-T’s 81.3%. Every step in between is measured. Here are those steps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*0Sz9_AqbhKqyp1l0yzNKLQ.png" /><figcaption><em>The modernization roadmap from ResNet-50 to ConvNeXt, with each step’s contribution to ImageNet-1K top-1 accuracy (Liu et al., 2022).</em></figcaption></figure><h3>1. The training recipe first (before touching the architecture)</h3><p>Without touching the architecture at all, they train ResNet-50 like a modern Transformer: <strong>300 epochs</strong> instead of 90, <strong>AdamW</strong> instead of SGD, plus data augmentations like Mixup, Cutmix, RandAugment, and Random Erasing, and regularization like Stochastic Depth and Label Smoothing. This recipe alone pushes ResNet-50 from <strong>76.1% to 78.8%</strong>. That’s an important warning: when we compare architectures, we’re often really comparing <em>training recipes</em>.</p><h3>2. Macro design</h3><p>Two structural decisions:</p><ul><li><strong>Stage compute ratio.</strong> ResNet-50’s four stages have block counts of (3, 4, 6, 3). Swin’s ratio is 1:1:3:1. Mimicking that by switching the blocks to <strong>(3, 3, 9, 3)</strong> raises accuracy from 78.8% to <strong>79.4%</strong>.</li><li><strong>The “patchify” stem.</strong> ResNet uses a 7×7 stride-2 convolution + max pooling at the input. They replace it with a <strong>4×4 stride-4</strong> non-overlapping convolution, echoing Swin’s patchifying logic — the image is processed in non-overlapping patches: <strong>79.5%</strong>.</li></ul><h3>3. ResNeXt-ifying</h3><p>They push ResNeXt’s “use more groups, expand width” idea to the extreme with <strong>depthwise convolution</strong> (each channel convolves on its own — much like self-attention performs a weighted sum per channel). Depthwise convolution lowers FLOPs, so to compensate they widen the network from 64 to <strong>96 channels</strong>. Result: <strong>80.5%</strong>.</p><h3>4. Inverted bottleneck</h3><p>A Transformer block has a hidden property: its MLP layer expands to four times the input width and then shrinks back. This “wide in the middle, narrow at the ends” shape is exactly the <strong>inverted bottleneck</strong> from MobileNetV2. ConvNeXt adopts that design: <strong>80.6%</strong>.</p><h3>5. Large kernel size</h3><p>CNNs stuck to 3×3 kernels for years. But Swin’s window attention looks at a 7×7 area. To match that, they first move the depthwise convolution up in the block — which on its own temporarily drops accuracy to <strong>79.9%</strong> — then grow the kernel size. Accuracy climbs to 80.4% at 5×5 and <strong>80.6% at 7×7</strong>; at 9×9 and 11×11 the gains saturate and start to fall, so 7×7 is chosen. The architecture now follows the Transformer rhythm of “look at a wide area, then process with an MLP.”</p><h3>6. Micro design (where the real surprise lands)</h3><p>The final touches look small, but together they make the biggest jump:</p><ul><li><strong>GELU instead of ReLU.</strong></li><li><strong>Fewer activations:</strong> only one activation is kept inside the block.</li><li><strong>Fewer normalization layers:</strong> a single one instead of many BatchNorms.</li><li><strong>LayerNorm instead of BatchNorm.</strong></li><li><strong>Separate downsampling layers:</strong> doing stage transitions with a LayerNorm + 2×2 stride-2 convolution, and adding a normalization wherever the spatial resolution changes, stabilizes training.</li></ul><p>These micro designs accumulate step by step: ReLU→GELU stays at 80.6%, but fewer activations reaches 81.3%, fewer norms 81.4%, BN→LN 81.5%, and separate downsampling layers push it to <strong>82.0%</strong> — clearly surpassing Swin-T’s 81.3%. This final network is what we call <strong>ConvNeXt</strong>.</p><h3>What a ConvNeXt block looks like</h3><p>In one sentence: a ConvNeXt block is like a Transformer block rewritten with convolutions. First a <strong>7×7 depthwise convolution</strong> that looks at a wide area (the counterpart of token mixing), then a <strong>LayerNorm</strong>, then an MLP built from 1×1 convolutions inside an <strong>inverted bottleneck</strong> with a single GELU (the counterpart of channel mixing). And a classic residual connection wraps around it all.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/956/1*wbWIXELQEf2gGCF6ojJzeg.png" /><figcaption><em>A comparison of Swin Transformer, ResNet, and ConvNeXt blocks (Liu et al., 2022). The ConvNeXt block: d7×7 depthwise conv → LN → 1×1 (96→384) → GELU → 1×1 (384→96), with a residual connection.</em></figcaption></figure><p>What’s striking is this: there’s not a single attention operation in this block. All “communication” between tokens is handled by the neighborhood window of the depthwise convolution. And yet the result competes with its attention-based counterpart.</p><h3>Variants: T / S / B / L / XL</h3><p>The ConvNeXt family is designed to match Swin’s T/S/B/L sizes in compute budget. The variants differ in only two things: the <strong>number of channels ©</strong> and the <strong>number of blocks (B)</strong> per stage.</p><p>Variant Channels © Blocks (B) ConvNeXt-T (96, 192, 384, 768) (3, 3, 9, 3) ConvNeXt-S (96, 192, 384, 768) (3, 3, 27, 3) ConvNeXt-B (128, 256, 512, 1024) (3, 3, 27, 3) ConvNeXt-L (192, 384, 768, 1536) (3, 3, 27, 3) ConvNeXt-XL (256, 512, 1024, 2048) (3, 3, 27, 3)</p><p>When pre-trained on ImageNet-22K and fine-tuned at 384×384 resolution, the largest variant reaches <strong>87.8%</strong> top-1 accuracy — meaning ConvNeXt scales just as well as Transformers not only at small scale, but also in the large-data, large-model regime.</p><h3>Where and how it’s used</h3><p>The best part of ConvNeXt is that it’s a plug-and-play <strong>backbone</strong>. Because it’s fully convolutional, both training and deployment are simple, and it doesn’t carry some of the input-resolution constraints that Transformers do.</p><ul><li><strong>Image classification:</strong> same or better accuracy than Swin, with a simpler architecture.</li><li><strong>Object detection / instance segmentation:</strong> as a backbone in frameworks like Mask R-CNN and Cascade Mask R-CNN, it beats Swin on COCO.</li><li><strong>Semantic segmentation:</strong> with UPerNet, it outperforms Swin on ADE20K.</li><li><strong>A solid base for transfer learning:</strong> in my own project (AllerView — wheal segmentation) I saw how much difference it makes to start from the pretrained weights of modern CNN backbones like these rather than training from scratch. ConvNeXt is tailor-made for exactly this “strong and adaptable backbone” role.</li></ul><h3>How it compares</h3><p>Architecture Core idea Hierarchical? Token mixing Typical role <strong>ResNet</strong> Residual connections Yes 3×3 convolution Classic CNN baseline <strong>ViT</strong> Pure Transformer, patch sequence No (single scale) Global self-attention Strong with large data <strong>Swin</strong> Hierarchical + shifted-window attention Yes Window-based attention General-purpose Transformer backbone <strong>ConvNeXt</strong> A ConvNet modernized toward Swin Yes 7×7 depthwise convolution General-purpose CNN backbone</p><h3>Takeaways</h3><ul><li>ConvNeXt’s real contribution isn’t a new block; it’s <strong>an argument</strong>. It says “the superiority of Transformers doesn’t come from attention alone,” and it demonstrates that with a controlled experiment.</li><li>A large share of the gains actually came from the “surrounding” decisions — <strong>the training recipe, the macro design, and the normalization choices</strong>. To compare fairly, you have to hold these constant.</li><li>ConvNets didn’t die — they were just waiting to be translated into the design language of the 2020s. ConvNeXt proved they can compete with attention-based models while keeping their simplicity and efficiency.</li><li>Practical message: before jumping to a new architecture, ask whether you’ve fed the one you already have a modern recipe. Sometimes the road to the future runs through redesigning the past.</li></ul><h3>References</h3><ol><li>Liu, Z., Mao, H., Wu, C.-Y., Feichtenhofer, C., Darrell, T., &amp; Xie, S. (2022). <em>A ConvNet for the 2020s.</em> CVPR 2022. arXiv:2201.03545. <a href="https://arxiv.org/abs/2201.03545">https://arxiv.org/abs/2201.03545</a></li><li>He, K., Zhang, X., Ren, S., &amp; Sun, J. (2016). <em>Deep Residual Learning for Image Recognition (ResNet).</em> CVPR 2016. arXiv:1512.03385. <a href="https://arxiv.org/abs/1512.03385">https://arxiv.org/abs/1512.03385</a></li><li>Liu, Z., Lin, Y., Cao, Y., et al. (2021). <em>Swin Transformer: Hierarchical Vision Transformer using Shifted Windows.</em> ICCV 2021. arXiv:2103.14030. <a href="https://arxiv.org/abs/2103.14030">https://arxiv.org/abs/2103.14030</a></li><li>Xie, S., Girshick, R., Dollár, P., Tu, Z., &amp; He, K. (2017). <em>Aggregated Residual Transformations for Deep Neural Networks (ResNeXt).</em> CVPR 2017. arXiv:1611.05431. <a href="https://arxiv.org/abs/1611.05431">https://arxiv.org/abs/1611.05431</a></li><li>Sandler, M., Howard, A., Zhu, M., Zhmoginov, A., &amp; Chen, L.-C. (2018). <em>MobileNetV2: Inverted Residuals and Linear Bottlenecks.</em> CVPR 2018. arXiv:1801.04381. <a href="https://arxiv.org/abs/1801.04381">https://arxiv.org/abs/1801.04381</a></li><li>Official code and models: <a href="https://github.com/facebookresearch/ConvNeXt">https://github.com/facebookresearch/ConvNeXt</a></li></ol><p><em>Figures referenced above are from the original ConvNeXt paper (Liu et al., 2022) and are credited to their authors.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=788454a0580a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AlexNet: The Architecture That Started the Deep Learning Revolution]]></title>
            <link>https://medium.com/@serdardedebas1/alexnet-the-architecture-that-started-the-deep-learning-revolution-08e5634985b1?source=rss-3ba0faaf8c59------2</link>
            <guid isPermaLink="false">https://medium.com/p/08e5634985b1</guid>
            <category><![CDATA[alexnet]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[computer-vision]]></category>
            <dc:creator><![CDATA[Serdar Dedebas]]></dc:creator>
            <pubDate>Fri, 26 Jun 2026 10:41:26 GMT</pubDate>
            <atom:updated>2026-06-26T10:41:26.925Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fwWERshEeTv2F6NZ55HX7Q.png" /></figure><p>Almost everything we talk about today — Vision Transformers, ResNet, YOLO, segmentation models, even the giant networks that generate images — traces back to a single moment in 2012. That year, <strong>AlexNet</strong> won the ImageNet competition by such a wide margin that the computer vision community changed direction almost overnight. People who had been calling deep learning “interesting but impractical” were training convolutional networks on GPUs a week later.</p><p>In this article I want to explain <em>what</em> AlexNet is, <em>why</em> it mattered so much, and <em>where and how</em> the ideas it introduced still live on today — without diving into code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BkZQ7FpCdrWp4roAoLFE8w.png" /><figcaption><em>AlexNet’s original architecture diagram: the network is split across two GPUs, each with 3 GB of memory (Krizhevsky et al., 2012).</em></figcaption></figure><h3>Background: what the world looked like before 2012</h3><p>Before AlexNet, image classification leaned heavily on <strong>hand-crafted features</strong>. People designed feature extractors like SIFT and HOG, then placed a classic classifier such as an SVM on top. A researcher decided what the features should be; the model only learned to discriminate using those features.</p><p>This approach had hit a ceiling. On a dataset like ImageNet — 1,000 classes and millions of images — guessing by hand which features mattered was hopeless. The convolutional neural network idea had existed since the 1980s (LeCun’s LeNet worked on digit recognition), but there was neither enough data nor enough compute to train them at scale.</p><p>In 2012, two things fell into place at once: <strong>ImageNet</strong> provided a massive labeled dataset, and <strong>GPUs</strong> parallelized matrix multiplication well enough to make deep networks trainable in a reasonable time. AlexNet was the first model to combine these two enablers with the right architecture.</p><h3>What AlexNet did: the ImageNet 2012 result</h3><p>AlexNet won the <strong>ILSVRC-2012</strong> challenge with a top-5 error rate of 15.3%. The runner-up, a classic feature-based system, came in at 26.2%. That gap of more than ten points was a shocking jump for a field used to incremental gains.</p><p>The striking part wasn’t just the number. AlexNet opened that gap <em>without any hand-engineered features</em>, learning the right representations directly from raw pixels. The message was clear: given enough data and compute, a deep network could learn something better than any feature engineering a human could design. The era of <strong>end-to-end learning</strong> had officially begun.</p><h3>The architecture as a whole</h3><p>AlexNet consists of eight learnable layers stacked on top of one another: <strong>five convolutional layers</strong> followed by <strong>three fully connected layers</strong>. In total it holds roughly <strong>60 million parameters</strong> and around 650,000 neurons — an enormous model for its day.</p><p>The flow goes roughly like this: the network takes a 224×224 RGB image; the first convolutional layer captures coarse edges and color patterns using large 11×11 filters with a stride of 4; later layers learn increasingly abstract and composite patterns (textures, parts, and eventually object-like structures). Max pooling layers interspersed between them shrink the spatial size. At the end, three fully connected layers map this rich learned representation to a 1,000-class softmax output.</p><p>That odd “two parallel lanes” look in the diagram has a story behind it: the model didn’t fit on the two GTX 580 GPUs, each with only 3 GB of memory. So Krizhevsky <em>deliberately</em> split the network across the two GPUs; the two lanes run independently in most layers and only communicate at certain points. That iconic diagram wasn’t an aesthetic choice — it was a clever workaround for a hardware constraint.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*V-bTN_lUBCxu0GGiFSy7_Q.png" /><figcaption><em>LeNet-5 (left) and AlexNet (right), layer by layer: note AlexNet’s deeper, wider structure that begins with an 11×11 conv.</em></figcaption></figure><h3>The ideas that made AlexNet work</h3><p>AlexNet’s real legacy is less about individual layers and more about the handful of ideas it brought together. Most of them are now defaults in every deep network.</p><p><strong>ReLU activation.</strong> Until then networks mostly used tanh or sigmoid, which squashed gradients and slowed training in deep networks. AlexNet was among the first to use <strong>ReLU</strong> — the simple max(0, x) — at scale, speeding up training several-fold. ReLU and its variants are still standard today.</p><p><strong>Dropout.</strong> The huge parameter count in the fully connected layers raised the risk of overfitting. AlexNet used <strong>dropout</strong>, which temporarily switches off a random subset of neurons during training; this keeps the network from depending on any single neuron and improves generalization. Dropout is still one of the most widely used regularization techniques.</p><p><strong>Data augmentation.</strong> To artificially expand the data, images were randomly cropped, horizontally flipped, and given small PCA-based shifts in their color channels. This made the model behave as if it had seen the same object in different positions, lighting, and orientations, so it learned to generalize rather than memorize.</p><p><strong>Overlapping max pooling and LRN.</strong> AlexNet got a small accuracy gain by slightly overlapping its pooling windows (overlapping pooling). It also used <strong>Local Response Normalization (LRN)</strong>, which normalizes neighboring neurons relative to one another. LRN has largely been replaced by methods like batch normalization, but it helped at the time.</p><p><strong>GPU training.</strong> Perhaps the most lasting contribution: AlexNet proved that training deep networks is, in practice, a <strong>GPU job</strong>. That idea underpins all of today’s deep learning infrastructure.</p><h3>Where and how AlexNet lives on today</h3><p>AlexNet itself is rarely used directly in production anymore — more efficient and accurate architectures like ResNet, EfficientNet, and Vision Transformers have long surpassed it. But its approach is everywhere.</p><p><strong>As an architectural template.</strong> The “convolution → nonlinearity → pooling → repeat going deeper → classifier at the end” pattern is the skeleton AlexNet popularized. Almost every CNN since is a variation on that idea.</p><p><strong>As an ancestor of transfer learning.</strong> AlexNet showed early on that features learned on a large dataset could be carried over to other tasks. Today, taking a backbone pretrained on ImageNet and fine-tuning it on your own problem is standard practice — I use this same logic in my <strong>AllerView</strong> project, where I segment wheals in medical images: instead of starting from scratch, I build on top of representations already learned.</p><p><strong>As a teaching and benchmarking reference.</strong> AlexNet is still taught in courses and tutorials as “the first complete example of a modern CNN.” If you want to understand what an architecture does and why, AlexNet is one of the cleanest starting points — because many of the ideas in today’s complex models first appeared here in their simplest form.</p><h3>Comparing AlexNet to its successors</h3><p>Architecture Year Key contribution Approx. depth LeNet-5 1998 First practical CNN (digit recognition) 7 layers <strong>AlexNet</strong> <strong>2012</strong> <strong>Deep CNN at scale + ReLU + dropout + GPU</strong> <strong>8 layers</strong> VGG 2014 Depth via small 3×3 filters 16–19 layers GoogLeNet 2014 Inception module, efficiency 22 layers ResNet 2015 Very deep networks via residual connections 50–152+ layers</p><p>AlexNet’s place in the table is symbolic: its depth is modest compared to what followed, but without <em>it</em>, most of the other rows would have a different history.</p><h3>Takeaways</h3><ul><li>AlexNet proved that a deep CNN <strong>learning from raw pixels</strong> could beat classic systems built on hand-crafted features by a wide margin, kicking off the deep learning era in computer vision.</li><li>Most of the ideas it introduced — <strong>ReLU, dropout, data augmentation, GPU training</strong> — are still part of the default toolkit today.</li><li>Although it is no longer a current model, it is the shared ancestor of every CNN architecture that followed and an early example of the <strong>transfer learning</strong> practice.</li><li>Understanding AlexNet is the shortest path to understanding why modern vision models are designed the way they are.</li></ul><h3>References</h3><ol><li>Krizhevsky, A., Sutskever, I., &amp; Hinton, G. E. (2012). <em>ImageNet Classification with Deep Convolutional Neural Networks.</em> NeurIPS 2012. <a href="https://papers.nips.cc/paper/2012/hash/c399862d3b9d6b76c8436e924a68c45b-Abstract.html">https://papers.nips.cc/paper/2012/hash/c399862d3b9d6b76c8436e924a68c45b-Abstract.html</a></li><li>Russakovsky, O., et al. (2015). <em>ImageNet Large Scale Visual Recognition Challenge (ILSVRC).</em> IJCV. arXiv:1409.0575. <a href="https://arxiv.org/abs/1409.0575">https://arxiv.org/abs/1409.0575</a></li><li>LeCun, Y., et al. (1998). <em>Gradient-Based Learning Applied to Document Recognition (LeNet).</em> Proceedings of the IEEE.</li><li>Simonyan, K., &amp; Zisserman, A. (2014). <em>Very Deep Convolutional Networks for Large-Scale Image Recognition (VGG).</em> arXiv:1409.1556. <a href="https://arxiv.org/abs/1409.1556">https://arxiv.org/abs/1409.1556</a></li><li>He, K., Zhang, X., Ren, S., &amp; Sun, J. (2015). <em>Deep Residual Learning for Image Recognition (ResNet).</em> arXiv:1512.03385. <a href="https://arxiv.org/abs/1512.03385">https://arxiv.org/abs/1512.03385</a></li></ol><p><em>Figures referenced above are from the original AlexNet paper (Krizhevsky et al., 2012) and are credited to their authors.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=08e5634985b1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ResNet and EfficientNet: Two Ideas That Shaped Modern Computer Vision]]></title>
            <link>https://medium.com/@serdardedebas1/resnet-and-efficientnet-two-ideas-that-shaped-modern-computer-vision-9defc57d4416?source=rss-3ba0faaf8c59------2</link>
            <guid isPermaLink="false">https://medium.com/p/9defc57d4416</guid>
            <category><![CDATA[resnet]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[efficientnet]]></category>
            <category><![CDATA[computer-vision]]></category>
            <dc:creator><![CDATA[Serdar Dedebas]]></dc:creator>
            <pubDate>Thu, 18 Jun 2026 09:01:20 GMT</pubDate>
            <atom:updated>2026-06-18T09:01:20.331Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4D7--kyjvAJgK7lHLIObgQ.png" /></figure><p>If you have ever fine-tuned a model for image classification, run an object detector, or pulled a “pretrained backbone” off the shelf, there is a good chance you were standing on the shoulders of two architectures: <strong>ResNet</strong> and <strong>EfficientNet</strong>. They were published four years apart, they solve very different problems, and yet they keep showing up together as the default starting points for real-world vision systems.</p><p>This article is a no-code tour of <em>what</em> these two architectures are, <em>why</em> they work, and — most importantly — <em>where and how</em> people actually use them.</p><h3>The backdrop: deeper isn’t automatically better</h3><p>By 2014, the field had learned a tempting lesson: deeper networks tend to be more powerful. So researchers kept stacking layers. But beyond a point, something strange happened — adding more layers made the network <em>worse</em>, even on the training set. This wasn’t ordinary overfitting; it was a genuine optimization failure that became known as the <strong>degradation problem</strong>.</p><p>A very deep “plain” network was actually harder to train than a shallower one. That single observation set the stage for ResNet.</p><h3>ResNet: let the network learn the difference</h3><p>ResNet (Residual Network) was introduced by Kaiming He and colleagues at Microsoft Research in 2015, and it won the ImageNet competition that year. Its insight is almost embarrassingly simple in hindsight.</p><p>Instead of asking a block of layers to learn a full transformation H(x), ResNet asks it to learn only the <strong>residual</strong> — the difference from the input, F(x) = H(x) − x — and then adds the original input back through a <strong>shortcut (skip) connection</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*wBYHxqUe-Qsd_tQSnks-Uw.png" /><figcaption><em>The residual learning building block. Source: He et al., “Deep Residual Learning for Image Recognition” (2015).</em></figcaption></figure><p>Why does this help? If the ideal thing for a block to do is “nothing” (pass the input through unchanged), a plain network has to laboriously learn the identity function. A residual block just has to push F(x) toward zero, which is far easier. The skip connection also gives gradients a clean highway to flow backward during training, which is what makes networks with 50, 101, or even 152 layers trainable in the first place.</p><p>Architecturally, a ResNet is a stem (an initial convolution), followed by several <strong>stages</strong> of stacked residual blocks, and finally a pooling layer and a classifier. Deeper variants such as ResNet-50, ResNet-101, and ResNet-152 are, conceptually, just “the same thing with more blocks.”</p><h3>Where and how ResNet is used</h3><p>ResNet earned its place as the <strong>default backbone</strong> of computer vision. You rarely see “a ResNet” as a finished product; you see it as the feature extractor underneath something larger.</p><ul><li><strong>Transfer learning and fine-tuning.</strong> A ResNet pretrained on ImageNet is the classic starting point when you have a modest, domain-specific dataset — medical scans, manufacturing defect photos, wildlife camera traps. You keep the learned visual features and retrain the final layers for your task.</li><li><strong>Object detection and segmentation backbones.</strong> Frameworks like Faster R-CNN, Mask R-CNN, and RetinaNet routinely use ResNet (often with a Feature Pyramid Network on top) as the part of the model that “sees” the image.</li><li><strong>A research and benchmarking baseline.</strong> Because it is so well understood, ResNet-50 is the yardstick new methods are measured against. If your new idea can’t beat a ResNet baseline, it probably isn’t ready.</li><li><strong>The residual idea itself, everywhere.</strong> This is ResNet’s quietest but biggest legacy. The skip-connection motif is now a structural ingredient inside Transformers, BERT, GPT-style models, AlphaFold, and countless others. ResNet didn’t just give us a network; it gave us a building block.</li></ul><p><strong>Practical rule of thumb:</strong> reach for ResNet when you want a dependable, well-documented, easy-to-debug backbone and you aren’t fighting for every last megabyte or millisecond.</p><h3>EfficientNet: scale the network the smart way</h3><p>By 2019, the question had shifted. We knew how to build accurate networks; the new problem was that they were getting enormous, and people scaled them up almost by gut feel — adding more layers (<strong>depth</strong>), more channels (<strong>width</strong>), or feeding in bigger images (<strong>resolution</strong>) — usually one dimension at a time.</p><p>Mingxing Tan and Quoc Le at Google asked a sharper question: <em>if you have a fixed budget of extra compute, how should you spend it?</em> Their answer was <strong>compound scaling</strong>.</p><p>The core finding is that depth, width, and resolution are not independent — they should grow <em>together</em>, in a balanced ratio. A deeper network benefits from more channels to carry information and a higher-resolution input to have detail worth learning. EfficientNet captures this with a single <strong>compound coefficient (φ)</strong>: pick how much extra compute you have, and a fixed set of ratios decides how to split it across all three dimensions at once.</p><p>Starting from an efficient base network (EfficientNet-B0, found via neural architecture search and built from mobile inverted bottleneck blocks), the authors scaled it up into a family — <strong>B0 through B7</strong> — each member a balanced step up in size and accuracy.</p><p>The payoff is the part everyone remembers: EfficientNet hit the accuracy of much larger, older networks while using <strong>far fewer parameters and far fewer computations</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5p6wo-CpeybTzvX0G8PBpw.png" /><figcaption><em>EfficientNet models reach higher ImageNet top-1 accuracy with far fewer parameters than earlier networks. Source: Tan &amp; Le, “EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks” (2019).</em></figcaption></figure><h3>Where and how EfficientNet is used</h3><p>If ResNet is the dependable workhorse, EfficientNet is what you reach for when <strong>resources matter</strong> and you still want strong accuracy.</p><ul><li><strong>Mobile, edge, and embedded deployment.</strong> When the model has to run on a phone, a microcontroller-class device, a drone, or in the browser, EfficientNet’s accuracy-per-parameter is a huge advantage. The smaller variants (B0–B2) are popular here.</li><li><strong>Cost-sensitive, large-scale inference.</strong> If you are classifying millions of images a day in the cloud, fewer FLOPs translates directly into a smaller bill and lower latency.</li><li><strong>A modern transfer-learning backbone.</strong> Just like ResNet, EfficientNet pretrained on ImageNet is widely used as a starting point for fine-tuning — and it has become especially common in domains like medical imaging (skin lesion, X-ray, and tumor classification) and scientific image analysis, where it often matches or beats older backbones at a fraction of the size.</li><li><strong>Detection at scale.</strong> The same scaling philosophy was extended to object detection with EfficientDet, and a refined successor, EfficientNetV2, improved training speed and added “fused” blocks for better hardware efficiency.</li></ul><p><strong>Practical rule of thumb:</strong> reach for EfficientNet when you have a deployment constraint — size, speed, energy, or cost — and you want the best accuracy you can squeeze into that budget. Pick the smallest B-variant that hits your accuracy target.</p><blockquote><strong><em>A hands-on example:</em></strong><em> for a practical look at EfficientNet in action, you can check out this dog breed classifier built with it — </em><a href="https://github.com/Serdar1048/EfficientNet-dog-breed-classifier-"><em>EfficientNet Dog Breed Classifier</em></a><em>.</em></blockquote><h3>Choosing between them</h3><p>Neither architecture is “better” in the abstract; they answer different questions.</p><p>If you care most about… Lean toward… A safe, battle-tested, easy-to-debug baseline <strong>ResNet</strong> (ResNet-50 is the classic) Maximum accuracy per parameter / per FLOP <strong>EfficientNet</strong> Running on phones, edge devices, or the browser <strong>EfficientNet</strong> (B0–B2) Plugging into mature detection/segmentation frameworks <strong>ResNet</strong> (broadest ecosystem support) A research baseline everyone will recognize <strong>ResNet</strong> Cutting cloud inference cost at large scale <strong>EfficientNet</strong></p><p>In practice, many teams <em>start</em> with a ResNet-50 to get a working pipeline quickly, then switch to an EfficientNet variant once they need to deploy under real constraints.</p><h3>Takeaways</h3><ul><li><strong>ResNet</strong> solved a <em>training</em> problem. By learning residuals and adding skip connections, it made very deep networks trainable — and handed the field a reusable building block that now lives inside almost every modern architecture.</li><li><strong>EfficientNet</strong> solved a <em>scaling</em> problem. By scaling depth, width, and resolution together with a single coefficient, it delivered state-of-the-art accuracy at a fraction of the size and cost.</li><li>They are not rivals so much as tools for different jobs: ResNet as the dependable default, EfficientNet as the efficiency-first choice. Knowing <em>why</em> each was designed makes it much easier to know <em>which one to pick</em>.</li></ul><h3>References</h3><ol><li>He, K., Zhang, X., Ren, S., &amp; Sun, J. (2015). <em>Deep Residual Learning for Image Recognition.</em> arXiv:1512.03385. <a href="https://arxiv.org/abs/1512.03385">https://arxiv.org/abs/1512.03385</a></li><li>Tan, M., &amp; Le, Q. V. (2019). <em>EfficientNet: Rethinking Model Scaling for Convolutional Neural Networks.</em> Proceedings of the 36th International Conference on Machine Learning (ICML), PMLR 97:6105–6114. <a href="https://proceedings.mlr.press/v97/tan19a.html">https://proceedings.mlr.press/v97/tan19a.html</a></li><li>Tan, M., &amp; Le, Q. V. (2021). <em>EfficientNetV2: Smaller Models and Faster Training.</em> arXiv:2104.00298. <a href="https://arxiv.org/abs/2104.00298">https://arxiv.org/abs/2104.00298</a></li><li>Wikipedia — <em>Residual neural network.</em> <a href="https://en.wikipedia.org/wiki/Residual_neural_network">https://en.wikipedia.org/wiki/Residual_neural_network</a></li><li>Wikipedia — <em>EfficientNet.</em> <a href="https://en.wikipedia.org/wiki/EfficientNet">https://en.wikipedia.org/wiki/EfficientNet</a></li><li>Tan, M., Pang, R., &amp; Le, Q. V. (2020). <em>EfficientDet: Scalable and Efficient Object Detection.</em> arXiv:1911.09070. <a href="https://arxiv.org/abs/1911.09070">https://arxiv.org/abs/1911.09070</a></li><li>Dedebaş, S. <em>EfficientNet Dog Breed Classifier</em> (example implementation). GitHub. <a href="https://github.com/Serdar1048/EfficientNet-dog-breed-classifier-">https://github.com/Serdar1048/EfficientNet-dog-breed-classifier-</a></li></ol><p><em>Figures are reproduced from the original ResNet (He et al., 2015) and EfficientNet (Tan &amp; Le, 2019) papers and are credited to their respective authors.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9defc57d4416" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[You Only Look Once: How One Idea Taught Machines to See in Real Time]]></title>
            <link>https://medium.com/@serdardedebas1/you-only-look-once-how-one-idea-taught-machines-to-see-in-real-time-7f0cf05bd70e?source=rss-3ba0faaf8c59------2</link>
            <guid isPermaLink="false">https://medium.com/p/7f0cf05bd70e</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[yolo]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[object-detection]]></category>
            <dc:creator><![CDATA[Serdar Dedebas]]></dc:creator>
            <pubDate>Wed, 17 Jun 2026 08:24:16 GMT</pubDate>
            <atom:updated>2026-06-17T08:24:16.959Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AjsDZNNydfmH_U6UpNKwCA.png" /></figure><p><em>A friendly tour of YOLO — what it is, how it works, and why it quietly powers everything from self-driving cars to the camera that counts people walking into a store.</em></p><p>Stop for a second and think about how effortlessly you read a room. You walk into a café and, without trying, you know there are people at the tables, cups on the counter, a dog by the door, a laptop open in the corner. You don’t scan the scene inch by inch. You take it in all at once.</p><p>For decades, getting a computer to do the same thing was painfully slow. Then a deceptively simple idea changed everything — and it’s hiding right there in the name: <strong>You Only Look Once</strong>, or <strong>YOLO</strong>.</p><h3>The problem with how machines used to look</h3><p>Before YOLO, the dominant approach to object detection worked a bit like a nervous detective. First, the system would generate thousands of candidate regions in an image — “maybe there’s something here… or here… or here.” Then it would inspect each candidate one by one, asking “is this a car? a person? nothing at all?” Only after all that would it stitch the answers together.</p><p>This worked, but it was <em>slow</em>. Running a separate classification step on thousands of proposed regions per image meant you could analyze a photo, sure — but a live video at 30 frames per second? Forget it. The detective was too thorough to keep up with the world moving in front of it.</p><p>The whole pipeline was built on an assumption: that finding <em>where</em> things are and figuring out <em>what</em> they are had to be two separate jobs.</p><h3>The idea: just look once</h3><p>In 2016, a researcher named Joseph Redmon questioned that assumption. What if a single neural network could look at an entire image one time and, in that same glance, predict both the boxes around every object <em>and</em> what each object is?</p><p>That’s the core of YOLO. Instead of proposing regions and then classifying them, YOLO treats detection as one unified problem. It mentally divides the image into a grid, and for every part of that grid the network simultaneously predicts: is there an object centered here, where exactly are its edges, and what is it likely to be — along with a confidence score saying how sure it is.</p><p>Everything happens in a <strong>single forward pass</strong> through the network. One look, all the answers. That’s why it’s fast enough to run on live video, and that’s the entire reason the field changed.</p><p>The output, in plain terms, is three things for everything the model sees:</p><ul><li><strong>Where</strong> it is — a rectangular box drawn around the object.</li><li><strong>What</strong> it is — a label, like <em>person</em>, <em>car</em>, <em>dog</em>, or <em>traffic light</em>.</li><li><strong>How sure</strong> the model is — a number between 0 and 1.</li></ul><p>You set a confidence threshold (say, 0.5), and anything the model is less sure about gets quietly dropped, so the picture doesn’t fill up with shaky guesses.</p><h3>A family that grew up fast</h3><p>YOLO didn’t stay still. What started as one model in 2016 became a whole lineage, each version sharpening the trade-off between speed and accuracy.</p><p>The early versions (v2, v3) made YOLO smarter about detecting objects at different sizes. YOLOv4 and the wildly popular YOLOv5 made it easier to train and deploy in the real world. Later versions kept pushing — better backbones, attention mechanisms borrowed from the transformer world, and clever tricks to detect small or distant objects. <strong>YOLO11</strong>, released by Ultralytics in late 2024, brought refined building blocks and strong performance across not just detection but also segmentation, pose estimation, and tracking. By early 2026 the newest member, <strong>YOLO26</strong>, was optimized to run efficiently on tiny edge devices — the kind of low-power chips inside cameras and sensors.</p><p>The pace tells you something: in the years since 2020 alone, the family has produced version after version. Real-time vision is one of the fastest-moving corners of AI, precisely because the demand for it is everywhere.</p><h3>Where YOLO actually lives</h3><p>This is the part people underestimate. YOLO isn’t an academic curiosity — it’s running, right now, in places you pass every day.</p><p><strong>On the road.</strong> Self-driving and driver-assistance systems lean heavily on real-time detection to spot pedestrians, cyclists, other cars, and traffic signs fast enough to react. When latency is measured against human safety, “fast enough” isn’t a nice-to-have — it’s the whole point.</p><p><strong>In hospitals.</strong> Radiologists use detection models to flag suspicious regions in X-rays, CT scans, and MRIs — a tumor, a fracture, an anomaly — acting as a tireless second pair of eyes that never gets tired at the end of a long shift.</p><p><strong>On farms.</strong> Agriculture has quietly become one of YOLO’s biggest playgrounds: counting fruit on trees, spotting diseased crops from drone footage, monitoring livestock, guiding robots that pull weeds without herbicides.</p><p><strong>In stores and stadiums.</strong> Retailers count foot traffic and watch shelf stock. Sports analysts track players and the ball across the pitch to generate the statistics that now flood every broadcast.</p><p><strong>In security and safety.</strong> Surveillance systems detect intrusions or count crowds. Factories use it to check whether workers are wearing safety gear, or whether a production line has a defect.</p><p><strong>In the wild.</strong> Conservationists use camera traps with detection models to count endangered animals and catch poachers — turning a tool built for traffic into a guardian for wildlife.</p><p>The common thread is always the same: somewhere, something needs to be noticed <em>the moment it appears</em>, not minutes later. That instantaneous quality is YOLO’s gift.</p><h3>The quiet revolution: it’s also accessible</h3><p>Here’s the part that genuinely surprises people. Detecting objects in a live video used to require a research lab. Today, a working real-time detector fits in a handful of lines of Python:</p><pre>from ultralytics import YOLO<br>model = YOLO(&quot;yolo11n.pt&quot;)   # load a pretrained model<br>model.predict(source=0, show=True)  # run it on your webcam</pre><p>That’s essentially it. The model comes pre-trained on 80 common object categories, downloads itself the first time you run it, and starts naming the things in front of your camera. I put together a small webcam example along these lines that you’re welcome to poke at: <a href="https://github.com/Serdar1048/YOLO-">github.com/Serdar1048/YOLO-</a>.</p><p>The lesson buried in that brevity is bigger than the code. The hard part of computer vision — the part that used to consume PhDs and GPU clusters — has been packaged up and handed to anyone with a laptop. What used to be the <em>whole project</em> is now a single line. The interesting work has moved up the stack: deciding <em>what</em> to detect, <em>why</em>, and <em>what to do</em> with the answer.</p><h3>References</h3><ol><li>Redmon, J., Divvala, S., Girshick, R., &amp; Farhadi, A. (2016). <em>You Only Look Once: Unified, Real-Time Object Detection.</em> CVPR 2016. arXiv:1506.02640 — <a href="https://arxiv.org/abs/1506.02640">https://arxiv.org/abs/1506.02640</a></li><li>Ultralytics. <em>Ultralytics YOLO Documentation</em> (YOLO11, YOLO26). — <a href="https://docs.ultralytics.com/">https://docs.ultralytics.com</a></li><li>Kotthapalli, M., Ravipati, D., &amp; Bhatia, R. (2025). <em>YOLOv1 to YOLOv11: A Comprehensive Survey of Real-Time Object Detection Innovations and Challenges.</em> arXiv:2508.02067 — <a href="https://arxiv.org/abs/2508.02067">https://arxiv.org/abs/2508.02067</a></li><li>Roboflow. <em>What is YOLO? The Ultimate Guide.</em> — <a href="https://blog.roboflow.com/guide-to-yolo-models/">https://blog.roboflow.com/guide-to-yolo-models/</a></li><li>DataCamp. <em>YOLO Object Detection Explained: A Beginner’s Guide.</em> — <a href="https://www.datacamp.com/blog/yolo-object-detection-explained">https://www.datacamp.com/blog/yolo-object-detection-explained</a></li><li>Example usage (YOLO11 real-time webcam detection) — <a href="https://github.com/Serdar1048/YOLO-">https://github.com/Serdar1048/YOLO-</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7f0cf05bd70e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Visualizing Model Training in PyTorch with TensorBoard]]></title>
            <link>https://medium.com/@serdardedebas1/visualizing-model-training-in-pytorch-with-tensorboard-6378e642659a?source=rss-3ba0faaf8c59------2</link>
            <guid isPermaLink="false">https://medium.com/p/6378e642659a</guid>
            <category><![CDATA[pytorch]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[tensorboard]]></category>
            <dc:creator><![CDATA[Serdar Dedebas]]></dc:creator>
            <pubDate>Sun, 14 Jun 2026 13:38:19 GMT</pubDate>
            <atom:updated>2026-06-14T13:38:19.097Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iYy2zl76dXS7IQvf8LaDCw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/1*j61Ruc4KCXP5ginM1fqIHg.png" /></figure><p><em>Accuracy and Loss curves for train and test in the TensorBoard dashboard.</em></p><blockquote><em>At some point I got tired of tracking my training loop with </em><em>print() statements, switched to TensorBoard, and never looked back. In this article I walk through </em>why<em>, </em>how<em>, and </em>the most common ways<em> I use TensorBoard with PyTorch — referencing the official PyTorch documentation along the way.</em></blockquote><h3>What is TensorBoard?</h3><p>TensorBoard is a visualization toolkit originally built for TensorFlow, but today it’s a first-class citizen in PyTorch too. It lets me interactively monitor — in a web UI — the metrics my model produces during training (loss, accuracy, learning rate, etc.), weight distributions, images, and even the model’s computational graph.</p><p>On the PyTorch side, everything revolves around a single class: torch.utils.tensorboard.SummaryWriter. The official docs describe it as &quot;your main entry to log data for consumption and visualization by TensorBoard.&quot; In other words, I write data to disk with the writer, and TensorBoard reads that data and turns it into charts.</p><h3>Why I use it</h3><p>Why isn’t print(loss) enough for me? These are the core reasons:</p><ul><li><strong>Seeing trends:</strong> Is loss decreasing, plateauing, or exploding? A chart tells me this far faster than hundreds of lines of console output.</li><li><strong>Diagnosing overfitting/underfitting:</strong> When I plot train and validation loss on the same chart, the moment my model starts memorizing becomes immediately obvious.</li><li><strong>Comparing experiments:</strong> I can put runs with different learning rates, batch sizes, or architectures side by side on one screen.</li><li><strong>Debugging:</strong> By watching weight and gradient distributions as histograms, I catch issues like vanishing/exploding gradients early.</li><li><strong>It doesn’t slow me down:</strong> The docs emphasize this too; since SummaryWriter updates file contents asynchronously, writing data from my training loop doesn&#39;t slow training down.</li><li><strong>Visual validation:</strong> For vision models, I can view inputs, predictions, or generated samples directly in the UI.</li></ul><p>In short, TensorBoard is my “training dashboard.” It doesn’t train my model; it shows me what my training is doing.</p><h3>Installation</h3><p>There’s a commonly confused point here, so let me clarify it. We’re really talking about two separate things:</p><ul><li><strong>The integration module </strong><strong>torch.utils.tensorboard:</strong> This module — which contains the SummaryWriter API — comes bundled with PyTorch. It has since PyTorch 1.1, so I no longer need a third-party package like tensorboardX that used to be required.</li><li><strong>TensorBoard itself:</strong> The dashboard app that visualizes my logs does not ship with torch; I have to install it separately.</li></ul><pre>pip install tensorboard</pre><p>So the line from torch.utils.tensorboard import SummaryWriter works without any extra install, because it comes with torch. But to actually open the dashboard with tensorboard --logdir=runs, the pip install tensorboard step above is required. The official PyTorch tutorial also lists installation as pip install torch torchvision matplotlib tensorboard, listing tensorboard separately.</p><h3>The most basic usage: 3 steps</h3><p>For me, adding TensorBoard to a project comes down to three simple steps:</p><ol><li>I create a SummaryWriter instance.</li><li>I write data inside my training loop using the relevant add_* methods.</li><li>I call writer.close() when I&#39;m done.</li></ol><pre>import torch<br>from torch.utils.tensorboard import SummaryWriter</pre><pre># Writes to the ./runs/ directory by default<br>writer = SummaryWriter()</pre><pre>for n_iter in range(100):<br>    writer.add_scalar(&quot;Loss/train&quot;, torch.rand(1).item(), n_iter)<br>    writer.add_scalar(&quot;Loss/test&quot;,  torch.rand(1).item(), n_iter)</pre><pre>writer.close()</pre><p>If I call SummaryWriter() with no arguments, it puts logs automatically under runs/&lt;date_time_hostname&gt;/. When I want to set my own folder name, I use SummaryWriter(&quot;runs/experiment1&quot;) or SummaryWriter(comment=&quot;LR_0.1_BS_16&quot;).</p><h3>Launching TensorBoard</h3><p>Once logs are written, I start the dashboard from the terminal:</p><pre>tensorboard --logdir=runs</pre><p>Then I open <a href="http://localhost:6006/"><strong>http://localhost:6006</strong></a> in my browser. Inside Jupyter/Colab I use:</p><pre>%load_ext tensorboard<br>%tensorboard --logdir runs</pre><h3>The add_* methods I use most</h3><p>Below are the methods I reach for most often, with what they do and example usage.</p><h3>1. add_scalar — Track a single value over time</h3><p>This is the method I use most. It records one number per step or epoch (loss, accuracy, learning rate…) and produces a line chart.</p><pre>writer.add_scalar(tag=&quot;Loss/train&quot;, scalar_value=loss.item(), global_step=epoch)</pre><ul><li>tag: The chart&#39;s name. When I use / (e.g. Loss/train), TensorBoard groups them.</li><li>scalar_value: The numeric value I want to log.</li><li>global_step: The X axis, usually epoch or iteration number.</li></ul><p>The most common thing I do is log train and validation loss with add_scalar at the end of each epoch.</p><h3>2. add_scalars — Multiple related values on one chart</h3><p>When I want train and validation loss overlaid on the same chart, I use this.</p><pre>writer.add_scalars(&quot;Loss&quot;, {<br>    &quot;train&quot;: train_loss,<br>    &quot;val&quot;:   val_loss,<br>}, global_step=epoch)</pre><p>This is ideal for catching overfitting at a glance; if val loss curves upward while train loss keeps dropping, that’s my alarm bell.</p><h3>3. add_image / add_images — Logging images</h3><p>In vision projects, I use this to view my input samples, augmentation results, or model predictions in the dashboard. When I want to see a whole batch in one frame, I combine it with torchvision.utils.make_grid.</p><pre>import torchvision</pre><pre>grid = torchvision.utils.make_grid(images)   # arrange a batch into a grid<br>writer.add_image(&quot;sample_batch&quot;, grid, global_step=0)</pre><ul><li>add_image: A single image, expects a C×H×W tensor.</li><li>add_images: A batch of images, N×C×H×W.</li></ul><h3>4. add_histogram — Weight and gradient distributions</h3><p>I track how a layer’s weights or gradients change over time as histograms. It’s invaluable to me for diagnosing vanishing/exploding gradients.</p><pre>for name, param in model.named_parameters():<br>    writer.add_histogram(name, param, global_step=epoch)<br>    if param.grad is not None:<br>        writer.add_histogram(f&quot;{name}.grad&quot;, param.grad, global_step=epoch)</pre><p>This way I catch early whether weights are collapsing to a single value or gradients are going to zero.</p><h3>5. add_graph — The model&#39;s computational graph</h3><p>I render my model’s architecture and data flow as a visual diagram.</p><pre>images, _ = next(iter(trainloader))<br>writer.add_graph(model, images)   # needs a sample input too</pre><h3>6. add_embedding — Visualizing high-dimensional embeddings</h3><p>I send high-dimensional vectors (e.g. learned features) to the Projector tab, where I can reduce them to 3D via PCA/t-SNE and explore them interactively.</p><pre>writer.add_embedding(features, metadata=class_labels, label_img=images)</pre><h3>7. add_hparams — Hyperparameter comparison</h3><p>I use this to compare different hyperparameter combinations and their resulting metrics in a table.</p><pre>writer.add_hparams(<br>    {&quot;lr&quot;: 0.01, &quot;batch_size&quot;: 32},<br>    {&quot;hparam/accuracy&quot;: acc, &quot;hparam/loss&quot;: loss},<br>)</pre><h3>8. add_pr_curve — Precision-Recall curve</h3><p>For classification models, I visualize the precision-recall trade-off across thresholds.</p><pre>writer.add_pr_curve(&quot;pr_curve&quot;, labels, predictions, global_step=epoch)</pre><h3>9. add_text — Logging text / notes</h3><p>I write my experiment notes and config summaries to the dashboard.</p><pre>writer.add_text(&quot;config&quot;, &quot;lr=0.01, optimizer=Adam, epochs=50&quot;, global_step=0)</pre><h3>10. flush() and close() — Writing to disk and closing</h3><ul><li>writer.flush(): Immediately writes pending data to disk; I prefer to call it periodically during long runs.</li><li>writer.close(): Closes the writer; I always call it when I&#39;m done.</li></ul><h3>A realistic training loop example</h3><p>Here’s an example close to what I actually use, tying the above together in one flow:</p><pre>import torch<br>from torch.utils.tensorboard import SummaryWriter</pre><pre>writer = SummaryWriter(&quot;runs/experiment1&quot;)</pre><pre>for epoch in range(num_epochs):<br>    # --- TRAIN ---<br>    model.train()<br>    train_loss = 0.0<br>    for images, labels in train_loader:<br>        optimizer.zero_grad()<br>        outputs = model(images)<br>        loss = criterion(outputs, labels)<br>        loss.backward()<br>        optimizer.step()<br>        train_loss += loss.item()<br>    train_loss /= len(train_loader)</pre><pre>    # --- VALIDATION ---<br>    model.eval()<br>    val_loss = 0.0<br>    with torch.no_grad():<br>        for images, labels in val_loader:<br>            outputs = model(images)<br>            val_loss += criterion(outputs, labels).item()<br>    val_loss /= len(val_loader)</pre><pre>    # --- WRITE TO TENSORBOARD ---<br>    writer.add_scalars(&quot;Loss&quot;, {&quot;train&quot;: train_loss, &quot;val&quot;: val_loss}, epoch)<br>    writer.add_scalar(&quot;LR&quot;, optimizer.param_groups[0][&quot;lr&quot;], epoch)<br>    for name, param in model.named_parameters():<br>        writer.add_histogram(name, param, epoch)</pre><pre>writer.close()</pre><h3>Example project: Desert-101</h3><p>I applied the approach above in my own project. If you’d like to take a look:</p><p><strong>🔗 GitHub: </strong><a href="https://github.com/Serdar1048/Desert-101"><strong>Serdar1048/Desert-101</strong></a></p><h3>Practical tips</h3><p>A few habits that have worked well for me over time:</p><ul><li><strong>I use meaningful tag names:</strong> Grouping with /, like Loss/train, Loss/val, Accuracy/train, keeps the dashboard much cleaner.</li><li><strong>I keep </strong><strong>global_step consistent:</strong> I use either epoch or iteration everywhere and don&#39;t mix them.</li><li><strong>I open one folder per experiment:</strong> e.g. SummaryWriter(&quot;runs/lr001_bs32&quot;). This lets me compare runs side by side in the dashboard.</li><li><strong>I leverage the </strong><strong>comment parameter:</strong> SummaryWriter(comment=&quot;_adam_lr001&quot;) auto-appends a label to the folder name.</li><li><strong>I always call </strong><strong>close() at the end:</strong> Otherwise some data may never get flushed to disk.</li></ul><h3>References</h3><ul><li>PyTorch official docs: torch.utils.tensorboard — <a href="https://docs.pytorch.org/docs/stable/tensorboard.html">https://docs.pytorch.org/docs/stable/tensorboard.html</a></li><li>PyTorch Tutorial: <em>How to use TensorBoard with PyTorch</em> — <a href="https://docs.pytorch.org/tutorials/recipes/recipes/tensorboard_with_pytorch.html">https://docs.pytorch.org/tutorials/recipes/recipes/tensorboard_with_pytorch.html</a></li><li>Example project: <a href="https://github.com/Serdar1048/Desert-101">https://github.com/Serdar1048/Desert-101</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6378e642659a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deep Learning’s DNA: Understanding CNNs Through the Lens of VGG]]></title>
            <link>https://medium.com/@serdardedebas1/deep-learnings-dna-understanding-cnns-through-the-lens-of-vgg-5d2d8294a15a?source=rss-3ba0faaf8c59------2</link>
            <guid isPermaLink="false">https://medium.com/p/5d2d8294a15a</guid>
            <category><![CDATA[cnn]]></category>
            <category><![CDATA[vgg]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[computer-vision]]></category>
            <dc:creator><![CDATA[Serdar Dedebas]]></dc:creator>
            <pubDate>Mon, 11 May 2026 11:28:17 GMT</pubDate>
            <atom:updated>2026-05-11T11:28:17.084Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Se15nQpNXU1NOEQ7ikqRw.png" /></figure><blockquote>“Less is more.”</blockquote><h3>Part 1: Do Computers Really “See”? 🕵️‍♂️</h3><p>Computers are actually a bit “obsessed with numbers.” When we look at a cat photo, we see soft fur and innocent eyes; however, a computer sees nothing but an endless grid of numbers (a matrix) ranging from 0 to 255. So, how do they look at this pile of digits and conclude, “Aha! That’s a cat!”?</p><p>This is where <strong>CNNs (Convolutional Neural Networks)</strong> step onto the stage. You can think of a CNN as a <strong>detective</strong> who meticulously examines every square inch of a photograph through three critical lenses:</p><ul><li>🔎 <strong>Convolution (Gathering Clues):</strong> Our detective picks up a magnifying glass (a filter) and starts scanning. Each filter is sensitive to specific features: one looks for vertical edges, another for curves. As it slides over the pixels, it creates a “Feature Map.” Our detective is essentially taking notes: <em>“I found a sharp ear-tip here, and a whisker-line over there!”</em></li><li>📏 <strong>Padding (Leave No Pixel Behind):</strong> To ensure the pixels at the very edges aren’t ignored, we add an imaginary border around the photo. This way, our detective doesn’t miss even the tiniest cat claw tucked away in the corner.</li><li>📉 <strong>Pooling (Focus on the Big Picture):</strong> After gathering too many clues, the detective needs to discard redundant details. Pooling divides the image into sections and keeps only the most vital information. This lightens the workload and helps the computer recognize the cat whether it’s in the center or hiding in the corner.</li></ul><p><strong>But as the world of AI evolved, “just seeing” wasn’t enough. We needed a detective who could see deeper…</strong></p><h3>Part 2: “We Had to Go Deeper!” (The Birth of VGG) 🏗️</h3><p>When CNNs first arrived, everyone was fascinated — computers could finally “see.” But after a while, researchers started asking a critical question: “Okay, they can see, but how do we capture even sharper and more complex details?” The answer came in 2014 from the <strong>Visual Geometry Group (VGG)</strong> team at the University of Oxford: <strong>Simplicity and more depth!</strong></p><p>The revolutionary idea behind VGG was actually quite surprising. Back then, it was trendy to use large, clunky filters like 5 X 5 or 7 X 7. The VGG team stepped in and essentially said:</p><blockquote>“Stop overcomplicating things with massive filters. Let’s do everything with tiny 3 X 3 pieces, but stack them much deeper!”</blockquote><h4>🧱 The Lego Philosophy: Why Small Filters?</h4><p>Think of this like a Lego set. You can’t build a highly detailed statue with one single, giant block. However, by stacking thousands of tiny 3 X 3 Lego bricks, you can construct an incredibly detailed castle. By using small filters stacked on top of each other instead of one large filter, VGG not only made the computation more efficient but also increased the model’s “imagination” (or learning capacity).</p><h4>🔢 VGG-16 and VGG-19: Decoding the Numbers</h4><p>The names you often hear in the AI world aren’t mysterious codes. These numbers simply represent the number of “weight layers” inside the model.</p><ul><li><strong>VGG-16:</strong> A disciplined architecture with 16 layers.</li><li><strong>VGG-19:</strong> A bit more ambitious, featuring 19 layers.</li></ul><p>In our detective story, instead of giving our detective one giant magnifying glass, VGG set up 16 or 19 different inspection stations in a row. Each station takes the clue found by the previous one and investigates it a little bit deeper.</p><h4>✔️VGG Architecture with Code</h4><pre>import torch<br>import torch.nn as nn<br><br>class VGG16(nn.Module):<br>    def __init__(self, num_classes=1000):<br>        super(VGG16, self).__init__()<br>        <br>        # 1. Feature Extractor: The &quot;Lego&quot; blocks of the architecture<br>        self.features = nn.Sequential(<br>            # Block 1: Input 224x224x3 -&gt; Output 112x112x64<br>            nn.Conv2d(3, 64, kernel_size=3, padding=1),<br>            nn.ReLU(inplace=True),<br>            nn.Conv2d(64, 64, kernel_size=3, padding=1),<br>            nn.ReLU(inplace=True),<br>            nn.MaxPool2d(kernel_size=2, stride=2),<br><br>            # Block 2: Input 112x112x64 -&gt; Output 56x56x128<br>            nn.Conv2d(64, 128, kernel_size=3, padding=1),<br>            nn.ReLU(inplace=True),<br>            nn.Conv2d(128, 128, kernel_size=3, padding=1),<br>            nn.ReLU(inplace=True),<br>            nn.MaxPool2d(kernel_size=2, stride=2),<br><br>            # Block 3: Input 56x56x128 -&gt; Output 28x28x256<br>            nn.Conv2d(128, 256, kernel_size=3, padding=1),<br>            nn.ReLU(inplace=True),<br>            nn.Conv2d(256, 256, kernel_size=3, padding=1),<br>            nn.ReLU(inplace=True),<br>            nn.Conv2d(256, 256, kernel_size=3, padding=1),<br>            nn.ReLU(inplace=True),<br>            nn.MaxPool2d(kernel_size=2, stride=2),<br><br>            # Block 4: Input 28x28x256 -&gt; Output 14x14x512<br>            nn.Conv2d(256, 512, kernel_size=3, padding=1),<br>            nn.ReLU(inplace=True),<br>            nn.Conv2d(512, 512, kernel_size=3, padding=1),<br>            # VGG-16 uses 3 conv layers in the later blocks<br>            nn.ReLU(inplace=True),<br>            nn.Conv2d(512, 512, kernel_size=3, padding=1),<br>            nn.ReLU(inplace=True),<br>            nn.MaxPool2d(kernel_size=2, stride=2),<br><br>            # Block 5: Input 14x14x512 -&gt; Output 7x7x512<br>            nn.Conv2d(512, 512, kernel_size=3, padding=1),<br>            nn.ReLU(inplace=True),<br>            nn.Conv2d(512, 512, kernel_size=3, padding=1),<br>            nn.ReLU(inplace=True),<br>            nn.Conv2d(512, 512, kernel_size=3, padding=1),<br>            nn.ReLU(inplace=True),<br>            nn.MaxPool2d(kernel_size=2, stride=2),<br>        )<br><br>        # 2. Classifier: The decision-making head<br>        self.classifier = nn.Sequential(<br>            nn.Flatten(),<br>            nn.Linear(512 * 7 * 7, 4096),<br>            nn.ReLU(inplace=True),<br>            nn.Dropout(p=0.5), # Regularization to prevent overfitting<br>            nn.Linear(4096, 4096),<br>            nn.ReLU(inplace=True),<br>            nn.Dropout(p=0.5),<br>            nn.Linear(4096, num_classes)<br>        )<br><br>    def forward(self, x):<br>        x = self.features(x)<br>        x = self.classifier(x)<br>        return x<br><br># Instantiate the model<br>device = torch.device(&quot;cuda&quot; if torch.cuda.is_available() else &quot;cpu&quot;)<br>model = VGG16(num_classes=1000).to(device)<br><br># Verify with a sample input (Batch Size=1, 3 Channels, 224x224)<br>sample_input = torch.randn(1, 3, 224, 224).to(device)<br>output = model(sample_input)<br>print(f&quot;Output Shape: {output.shape}&quot;) # Expected: torch.Size([1, 1000])</pre><h3>Part 3: The “3 X 3” Obsession (The Technical, but Fun, Part) 🔬</h3><p>If you take a peek under the hood of a VGG architecture, one thing immediately stands out: <strong>3 X 3</strong> filters are everywhere. Why did the Oxford team ditch the “flashier,” larger filters like 5 X 5 or 7 X 7 and become so obsessed with these tiny squares?</p><p>Actually, this is where the “less is more” philosophy meets pure mathematics. Here are the three golden reasons behind this obsession:</p><h4>1. The Parameter Diet (Lightening the Load) 🏋️‍♂️</h4><p>Math doesn’t lie: If you use a single 7 X 7 filter, the computer has to learn <strong>49</strong> parameters. However, if you stack three 3 X 3 filters on top of each other (which covers the same area), you only deal with <strong>27</strong> (3 * 9) parameters.</p><ul><li><strong>The Result:</strong> Almost 45% less weight for the computer to carry, leading to faster learning!</li></ul><h4>2. More “Decision Moments” (Non-linearity) 🧠</h4><p>After every layer, we add an activation function (usually ReLU). In a single 7 X 7 layer, the computer only gets one chance to ask, “Is there something important here?” But with three 3 X 3 layers, the computer has <strong>three different chances</strong> to refine its decision. This allows the model to learn much more complex and subtle features — like the specific curve of a cat’s whisker.</p><h4>3. The Lego Strategy: Flexibility 🧱</h4><p>Think of it as building a <strong>Lego castle</strong>. If you only have one giant, solid block, you can only build a rough, boxy shape. But if you have many small 3 X 3 Lego bricks, you can construct much more elegant towers, windows, and intricate details. VGG created that famous “depth” and elegance by stacking these small pieces with precision.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ecwilTtbNwEqND-NBh_oVg.png" /></figure><h3>Part 4: Where is VGG Today? (A Legend’s Legacy) 🏛️</h3><p>Time flies in the world of technology. These days, “young and agile” models like <strong>ResNet</strong>, <strong>EfficientNet</strong>, or <strong>Vision Transformers</strong> are the stars of the show, achieving massive results with fewer parameters. Let’s be honest: VGG is no longer the fastest runner on the track; in fact, with its massive body of 138 million parameters, it might even be considered a bit “heavyweight” by today’s standards.</p><p>So, why are we still talking about it? Because VGG is one of the greatest <strong>teachers</strong> in the history of deep learning.</p><h4>🎓 Transfer Learning: No Need to Reinvent the Wheel!</h4><p>The greatest legacy of VGG is a concept called <strong>Transfer Learning</strong>. Having analyzed millions of photos in the ImageNet dataset, VGG has already “graduated” with honors in understanding what a line, a texture, or a specific shape looks like.</p><p>Instead of training a model from scratch, we can take VGG’s “wisdom” and inject it into entirely different fields:</p><ul><li><strong>Satellite Imagery &amp; Agriculture:</strong> If you want to teach an AI to look down from space and identify which crops are planted in a field or assess forest fire risks, VGG’s general “shape recognition” ability is a fantastic starting point.</li><li><strong>Artistic Style Transfer:</strong> Those famous apps that turn your ordinary vacation photos into a Van Gogh masterpiece? They often have VGG running behind the scenes. VGG’s layers are still remarkably successful at separating the “content” of an image from its “artistic style.”</li></ul><h4>🏗️ Why Still VGG?</h4><p>VGG’s architecture is so transparent, linear, and well-organized that it remains the most reliable <strong>“reference point”</strong> for researchers who don’t want to get lost in complex, branching networks. If you want to see the power of depth in its purest form, VGG still holds its place among the classics.</p><h3>Part 5: Final Thoughts — A Story of Pure Discipline 🏁</h3><p>In the world of deep learning, a new star is born almost every day. Every week, we are introduced to models that are more complex, “smarter,” and faster than the last. However, in this great marathon of artificial intelligence, VGG will always hold a special place.</p><p>We shouldn’t compare VGG to a modern, flashy athlete covered in high-tech gadgets; instead, think of it as a <strong>purebred and disciplined athlete</strong> who never skips the basic drills. Its success didn’t come from complicated tricks or shortcuts, but from an unwavering commitment to the principle of “depth through simplicity.”</p><p><strong>To sum it all up:</strong></p><ul><li><strong>CNNs</strong> taught us the art of “gathering clues” from pixels.</li><li><strong>VGG</strong> gave us the masterclass in how to follow those clues deeper, proving that a massive and flawless architecture can be built using nothing but tiny, 3 X 3 pieces.</li></ul><p>You can find the genetic traces of VGG’s disciplined filters in nearly every state-of-the-art model we use today. If you are looking to extract meaningful stories from a sea of pixels, following the path paved by this legendary athlete is a fantastic place to start.</p><h3>References / Sources</h3><ul><li><strong>Original Paper:</strong> Simonyan, K., &amp; Zisserman, A. (2015). Very Deep Convolutional Networks for Large-Scale Image Recognition. <em>International Conference on Learning Representations (ICLR)</em>.</li><li><strong>Deep Dive Guide:</strong> Vishnoi, P. (2023). <a href="https://premvishnoi.medium.com/understanding-vgg-networks-a-guide-for-ml-engineers-in-retail-computer-vision-d700fbcb253f">Understanding VGG Networks: A Guide for ML Engineers in Retail Computer Vision</a>. <em>Medium</em>.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5d2d8294a15a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>