Stride, Padding und Pooling
Kontrollieren Sie die Ausgabegröße und führen Sie Downsampling durch.
Stride, Padding und Pooling ist eine kostenlose Deep Learning Academy-Lektion auf CoddyKit. Dies ist Lektion 2 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Deep Learning Academy-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Deep Learning Academy-Kurs umfasst insgesamt 4 Lektionen.
Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.
Output Shrinks by Default
When a 3x3 kernel slides over an image, the edges have no room. So the output feature map comes out a little smaller than the input.
Padding Adds a Border
Padding wraps the image in a ring of zeros so the kernel can reach the corners. Now the output can stay the same size as the input.
Same Padding in Code
For a 3x3 kernel, padding of 1 keeps the spatial size unchanged. People call this same padding.
conv = nn.Conv2d(3, 16, kernel_size=3, padding=1)Stride Sets the Step Size
Stride is how far the kernel jumps each move. A stride of 1 visits every position; a larger stride skips ahead.
Stride 2 Halves the Map
With stride 2 the kernel hops two pixels at a time, so the output is roughly half the width and height. It is a cheap way to downsample. ⬇️
Stride and Padding Together
Combine them to control the exact output size. Here stride 2 with padding 1 downsamples while keeping the corners covered.
conv = nn.Conv2d(16, 32, 3, stride=2, padding=1)Why Downsample at All?
Shrinking the maps cuts computation and lets later layers see a wider region of the original image with each kernel.
Pooling: Another Way to Shrink
Pooling downsamples too, but with no learned weights. It just summarizes each small patch into a single value.
Max Pooling Keeps the Strongest
Max pooling takes the largest value in each 2x2 patch. It keeps the strongest signal and quietly drops the rest.
pool = nn.MaxPool2d(kernel_size=2)Average Pooling Smooths
Average pooling takes the mean of each patch instead of the max, giving a smoother, gentler summary of the region.
pool = nn.AvgPool2d(kernel_size=2)Pooling Adds Small Invariance
Because pooling summarizes a patch, a tiny shift in the input barely changes the output. This gives a touch of translation invariance.
Quick Check
Let us test what padding actually does for a convolution.
Recap: Control the Shape
You learned that padding preserves size, stride sets the step and downsamples, and pooling shrinks maps while adding a little shift tolerance. 🎯
Häufig gestellte Fragen
Ist die Lektion „Stride, Padding und Pooling“ kostenlos?
Ja — der vollständige Text von „Stride, Padding und Pooling“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Deep Learning Academy-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Deep Learning Academy-Kurs umfasst insgesamt 4 Lektionen.
Was lerne ich in „Stride, Padding und Pooling“?
Kontrollieren Sie die Ausgabegröße und führen Sie Downsampling durch. Du übst Deep Learning Academy mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.
Brauche ich Erfahrung, um Deep Learning Academy zu starten?
Keine Vorkenntnisse erforderlich. Deep Learning Academy auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 2 von 4.
Wie lange dauert die Lektion „Stride, Padding und Pooling“?
Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.
Kann ich in dieser Deep Learning Academy-Lektion Code schreiben und ausführen?
Ja. Jede Deep Learning Academy-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.
Alle Lektionen in diesem Kurs
- Konvolution: Kernel gleiten über Pixel
- Stride, Padding und Pooling
- Channels, Feature Maps und rezeptive Felder
- Einen CNN-Bildklassifikator zusammensetzen