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
A CNN slides a small window, called a filter, over the image to find patterns such as edges and shapes. It does not treat the image like one big flat spreadsheet of pixels.
Ravindra Bagale's Tip – मराठी
CNN image वर एक छोटी window, ज्याला filter म्हणतात, slide करतं आणि edges, shapes सारखे patterns शोधतं. ते image ला pixels ची एक मोठी सपाट spreadsheet म्हणून बघत नाही.
Ravindra Bagale's Tip – हिंदी
CNN image पर एक छोटी window, जिसे filter कहते हैं, slide करता है और edges, shapes जैसे patterns ढूँढता है. यह image को pixels की एक बड़ी सपाट spreadsheet की तरह नहीं देखता.