Ravindra BagaleCourses & study guides English Track your progress

47. Convolutional Neural Networks (CNNs) for Images

Data Science

47.4 CNN Stack Overview

47.4 CNN stack overview

Real CNNs: conv → activation → pool (repeat), मग classifier head.

हे का शिकायचं?

Why. Real CNNs stack करतात: conv → activation → pool (पुन्हा पुन्हा), मग flatten करून छोटा classifier head.

हे काय आहे?

What. Pattern: conv blocks ने features काढा, मग class scores साठी Linear layers (fictional shelf वर pedha vs chips).

कसं करायचं?

How.

Stack sketch

  1. Conv + ReLU + Pool
  2. Conv + ReLU + Pool
  3. Flatten
  4. Linear → class logits
import torch.nn as nn

class TinyCNN(nn.Module):
    def __init__(self):
        super().__init__()
        self.features = nn.Sequential(
            nn.Conv2d(1, 8, 3, padding=1), nn.ReLU(), nn.MaxPool2d(2),
            nn.Conv2d(8, 16, 3, padding=1), nn.ReLU(), nn.MaxPool2d(2),
        )
        self.head = nn.Linear(16 * 7 * 7, 2) # for 28x28 input
    def forward(self, x):
        x = self.features(x)
        x = x.view(x.size(0), -1)
        return self.head(x)

print(TinyCNN())

Next chapter. Chapter 48 fake tensors वर similarly tiny CNN train करते (मोठा ImageNet download नाही).

Chapter 48 trains a similarly tiny CNN on fake tensors (not a huge ImageNet download).