<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Janani</title>
    <description>The latest articles on DEV Community by Janani (@hellooo_all).</description>
    <link>https://dev.to/hellooo_all</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4104384%2F7a8bd8f2-b51d-4eb6-baa1-d55e9ad1a6bb.png</url>
      <title>DEV Community: Janani</title>
      <link>https://dev.to/hellooo_all</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/hellooo_all"/>
    <language>en</language>
    <item>
      <title>How Machines Learned to See 👀: From CNNs to Vision Transformers</title>
      <dc:creator>Janani</dc:creator>
      <pubDate>Tue, 01 Sep 2026 12:50:22 +0000</pubDate>
      <link>https://dev.to/hellooo_all/how-machines-learned-to-see-from-cnns-to-vision-transformers-162m</link>
      <guid>https://dev.to/hellooo_all/how-machines-learned-to-see-from-cnns-to-vision-transformers-162m</guid>
      <description>&lt;p&gt;Imagine showing a computer a picture of a dog.&lt;/p&gt;

&lt;p&gt;You see a dog.&lt;/p&gt;

&lt;p&gt;The computer sees thousands or even millions of numbers representing pixels.&lt;/p&gt;

&lt;p&gt;So how does it go from &lt;strong&gt;pixels → patterns → “that's a dog!”&lt;/strong&gt;?&lt;/p&gt;

&lt;p&gt;That's the fascinating story of &lt;strong&gt;Computer Vision&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  👁️ Teaching Machines to See
&lt;/h2&gt;

&lt;p&gt;Computer Vision is a branch of Artificial Intelligence that enables machines to understand images and videos.&lt;/p&gt;

&lt;p&gt;But computers don't naturally understand objects the way humans do. They need to learn visual patterns such as edges, textures, shapes, and eventually entire objects.&lt;/p&gt;

&lt;p&gt;Early computer vision systems relied heavily on &lt;strong&gt;handcrafted features&lt;/strong&gt;. Humans had to decide what features the machine should look for.&lt;/p&gt;

&lt;p&gt;Then came a game-changing idea:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;What if the machine could learn the features by itself?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Enter &lt;strong&gt;Convolutional Neural Networks (CNNs).&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 The CNN Revolution
&lt;/h2&gt;

&lt;p&gt;CNNs became one of the most important architectures in Computer Vision because they could automatically learn visual features directly from images.&lt;/p&gt;

&lt;p&gt;And CNNs didn't become powerful overnight.&lt;/p&gt;

&lt;p&gt;They evolved.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Year&lt;/th&gt;
&lt;th&gt;Architecture&lt;/th&gt;
&lt;th&gt;Big Idea&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1998&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;LeNet-5&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Early successful CNN&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2012&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;AlexNet&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Deep learning breakthrough&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2014&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;VGGNet&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Deeper networks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2014&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;GoogLeNet&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Multi-scale feature extraction&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2015&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;ResNet&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Skip connections&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2017&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;MobileNet&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Efficient CNNs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2019&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;EfficientNet&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Accuracy-efficiency scaling&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2022&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;ConvNeXt&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Modern CNN design&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The journey looked like:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;LeNet → AlexNet → VGG → GoogLeNet → ResNet → Modern CNNs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;CNNs became exceptionally good at recognizing local patterns.&lt;/p&gt;

&lt;p&gt;But that raised another question...&lt;/p&gt;




&lt;h2&gt;
  
  
  🤔 Can CNNs See the Bigger Picture?
&lt;/h2&gt;

&lt;p&gt;Imagine an image of someone riding a bicycle.&lt;/p&gt;

&lt;p&gt;A CNN can learn:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Edges → wheels → body parts → bicycle → person&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;But understanding the complete scene requires connecting information from different regions of the image.&lt;/p&gt;

&lt;p&gt;A face might be in one part.&lt;/p&gt;

&lt;p&gt;A hand might be somewhere else.&lt;/p&gt;

&lt;p&gt;The bicycle could occupy another region.&lt;/p&gt;

&lt;p&gt;CNNs can learn these relationships through deeper layers, but researchers wanted a mechanism that could directly model relationships between different parts of an image.&lt;/p&gt;

&lt;p&gt;And that's where &lt;strong&gt;Transformers&lt;/strong&gt; entered Computer Vision.&lt;/p&gt;




&lt;h2&gt;
  
  
  🤖 From Words to Images
&lt;/h2&gt;

&lt;p&gt;Transformers originally became famous in Natural Language Processing.&lt;/p&gt;

&lt;p&gt;Their secret weapon?&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Self-attention.&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Attention allows a model to determine which parts of an input are important to one another.&lt;/p&gt;

&lt;p&gt;Researchers asked:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;If attention works for words, could it work for image patches too?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The answer was &lt;strong&gt;yes&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In 2020, researchers introduced the &lt;strong&gt;Vision Transformer (ViT)&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;And the idea was surprisingly simple:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Turn an image into a sequence.&lt;/strong&gt;
&lt;/h3&gt;




&lt;h2&gt;
  
  
  🧩 An Image Becomes a Sentence
&lt;/h2&gt;

&lt;p&gt;A Vision Transformer divides an image into small patches.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;224 × 224 image&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;with&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;16 × 16 patches&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;produces:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;196 image patches&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Each patch is converted into a numerical representation called an &lt;strong&gt;embedding&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The model then adds positional information so it knows where each patch belongs.&lt;/p&gt;

&lt;p&gt;The patches can now be processed like a sequence of tokens.&lt;/p&gt;

&lt;p&gt;Think of it as:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Image → Patches → Embeddings → Transformer → Prediction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Pretty clever, right? 👀&lt;/p&gt;




&lt;h2&gt;
  
  
  🔎 The Magic: Self-Attention
&lt;/h2&gt;

&lt;p&gt;Here's where ViT becomes really interesting.&lt;/p&gt;

&lt;p&gt;Instead of only asking:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“What's happening around this pixel?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;self-attention allows the model to ask:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;“Which other parts of this image are important to understanding this part?”&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A patch containing a person's face can relate to patches containing their body.&lt;/p&gt;

&lt;p&gt;A wheel can relate to the bicycle frame.&lt;/p&gt;

&lt;p&gt;A person can relate to the object they're holding.&lt;/p&gt;

&lt;p&gt;The model learns these relationships using three components:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Query (Q)&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Key (K)&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Value (V)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Together, they allow the Transformer to determine where attention should be focused.&lt;/p&gt;

&lt;p&gt;This gives Vision Transformers a powerful ability to capture &lt;strong&gt;global context&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  ⚔️ CNN vs Vision Transformer
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;CNN&lt;/th&gt;
&lt;th&gt;Vision Transformer&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Uses convolution&lt;/td&gt;
&lt;td&gt;Uses self-attention&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Strong at local features&lt;/td&gt;
&lt;td&gt;Strong at global relationships&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Processes feature maps&lt;/td&gt;
&lt;td&gt;Processes image patches&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Spatial structure is built into convolution&lt;/td&gt;
&lt;td&gt;Uses positional information&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Generally computationally efficient&lt;/td&gt;
&lt;td&gt;Can be computationally expensive&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Often works well with less data&lt;/td&gt;
&lt;td&gt;Benefits from large-scale pretraining&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;So...&lt;/p&gt;

&lt;h3&gt;
  
  
  Is ViT replacing CNN?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Not exactly.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;And that's actually the most interesting part.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔥 The Best of Both Worlds?
&lt;/h2&gt;

&lt;p&gt;CNNs are excellent at extracting &lt;strong&gt;local features&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Transformers are excellent at modeling &lt;strong&gt;relationships between distant regions&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;So researchers started asking:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Why choose one when we can combine both?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This led to &lt;strong&gt;CNN–Transformer hybrid architectures&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Other important developments followed.&lt;/p&gt;

&lt;h3&gt;
  
  
  🎓 DeiT
&lt;/h3&gt;

&lt;p&gt;Data-efficient Image Transformers explored ways to train Vision Transformers more efficiently using knowledge distillation.&lt;/p&gt;

&lt;h3&gt;
  
  
  🪟 Swin Transformer
&lt;/h3&gt;

&lt;p&gt;Swin Transformer introduced &lt;strong&gt;shifted-window attention&lt;/strong&gt;, allowing attention to be calculated within smaller windows instead of across the entire image at once.&lt;/p&gt;

&lt;p&gt;This made Transformers more practical for tasks such as object detection and image segmentation.&lt;/p&gt;




&lt;h2&gt;
  
  
  🌍 Where Can We Use Vision Transformers?
&lt;/h2&gt;

&lt;p&gt;Vision Transformers are being explored across many areas:&lt;/p&gt;

&lt;p&gt;🏥 &lt;strong&gt;Medical Imaging&lt;/strong&gt;&lt;br&gt;
Analyzing medical scans and detecting visual patterns.&lt;/p&gt;

&lt;p&gt;🚗 &lt;strong&gt;Autonomous Vehicles&lt;/strong&gt;&lt;br&gt;
Understanding roads, vehicles, pedestrians, and surroundings.&lt;/p&gt;

&lt;p&gt;🛰️ &lt;strong&gt;Satellite Imaging&lt;/strong&gt;&lt;br&gt;
Analyzing large geographical regions.&lt;/p&gt;

&lt;p&gt;🎯 &lt;strong&gt;Object Detection&lt;/strong&gt;&lt;br&gt;
Finding and identifying objects in complex scenes.&lt;/p&gt;

&lt;p&gt;🎥 &lt;strong&gt;Video Understanding&lt;/strong&gt;&lt;br&gt;
Learning relationships across both space and time.&lt;/p&gt;

&lt;p&gt;🤖 &lt;strong&gt;Robotics&lt;/strong&gt;&lt;br&gt;
Helping robots understand their visual environment.&lt;/p&gt;




&lt;h2&gt;
  
  
  🚀 Where Are We Going Next?
&lt;/h2&gt;

&lt;p&gt;The future of Computer Vision isn't simply:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;CNN ❌ → Transformer ✅&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It's moving toward:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;CNN + Transformer + Vision-Language Models + Multimodal AI&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Imagine an AI system that can:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;See an image → understand it → read a question → reason about it → explain its answer.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That's a much bigger goal than simply recognizing an object.&lt;/p&gt;




&lt;h2&gt;
  
  
  💡 The Bigger Picture
&lt;/h2&gt;

&lt;p&gt;The evolution of Computer Vision can be summarized in one journey:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Handcrafted Features&lt;/strong&gt;&lt;br&gt;
↓&lt;br&gt;
&lt;strong&gt;CNNs&lt;/strong&gt; — learn visual features&lt;br&gt;
↓&lt;br&gt;
&lt;strong&gt;Deep CNNs&lt;/strong&gt; — learn increasingly complex representations&lt;br&gt;
↓&lt;br&gt;
&lt;strong&gt;Vision Transformers&lt;/strong&gt; — model relationships between image patches&lt;br&gt;
↓&lt;br&gt;
&lt;strong&gt;Hybrid &amp;amp; Multimodal Models&lt;/strong&gt; — combine different forms of intelligence&lt;/p&gt;

&lt;p&gt;The biggest change isn't just a new architecture.&lt;/p&gt;

&lt;p&gt;It's a change in how we think about images.&lt;/p&gt;

&lt;p&gt;CNNs taught machines to recognize &lt;strong&gt;patterns&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Transformers taught them to focus on &lt;strong&gt;relationships&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;And the next generation of AI aims to understand the &lt;strong&gt;whole picture&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  👁️ From pixels to patterns.
&lt;/h3&gt;

&lt;h3&gt;
  
  
  🧠 From patterns to relationships.
&lt;/h3&gt;

&lt;h3&gt;
  
  
  🤖 From relationships to understanding.
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;That's how machines are learning to see.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  🔗 Want to Go Deeper?
&lt;/h2&gt;

&lt;p&gt;The original Vision Transformer paper is a great place to start:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;An Image is Worth 16×16 Words: Transformers for Image Recognition at Scale&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://arxiv.org/abs/2010.11929?utm_source=chatgpt.com" rel="noopener noreferrer"&gt;Read the original ViT paper on arXiv&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For another major development in Vision Transformers:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://openaccess.thecvf.com/content/ICCV2021/html/Liu_Swin_Transformer_Hierarchical_Vision_Transformer_Using_Shifted_Windows_ICCV_2021_paper.html?utm_source=chatgpt.com" rel="noopener noreferrer"&gt;Read the Swin Transformer paper&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  💬 What do you think?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Will Transformers completely replace CNNs someday or will the future belong to hybrid models?&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>computervision</category>
      <category>ai</category>
      <category>machinelearning</category>
      <category>deeplearning</category>
    </item>
  </channel>
</rss>
