47. Convolutional Neural Networks (CNNs) for Images
47.1 Why Images Need Special Layers
Why. A 224×224 colour photo is tens of thousands of pixels. Flattening into one giant vector ignores that nearby pixels form edges. CNNs respect local structure.
What. A Convolutional Neural Network uses small filters that slide over the image, detecting patterns like edges and textures, then deeper layers combine them into object-ish features.
How.
Why not plain Linear on pixels?
- Too many weights.
- Shift a cat two pixels — a flat net may panic; conv filters share weights across positions.
- CNNs = weight sharing + local connectivity.
print("Image tensor shape often: (batch, channels, height, width)")
print("Example: (16, 3, 64, 64) = 16 RGB 64x64 images")
Ravindra Bagale's Tip
CNN = chhoti window image var slide — pattern shodhne. Full spreadsheet nahi.