0Pricing
Deep Learning Academy · درس

Stride وPadding وPooling

تحكّم في حجم الخرج وقلّص العينة

Stride وPadding وPooling درس مجاني في Deep Learning Academy على CoddyKit. هذا هو الدرس 2 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Deep Learning Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Deep Learning Academy 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

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. 🎯

الأسئلة الشائعة

هل درس «Stride وPadding وPooling» مجاني؟

نعم — نص درس «Stride وPadding وPooling» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Deep Learning Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Deep Learning Academy 4 دروس في المجموع.

ماذا ستتعلم في «Stride وPadding وPooling»؟

تحكّم في حجم الخرج وقلّص العينة تتمرن على Deep Learning Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ Deep Learning Academy؟

لا تُشترط خبرة سابقة. Deep Learning Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 2 من أصل 4.

كم من الوقت يستغرق درس «Stride وPadding وPooling»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس Deep Learning Academy هذا؟

نعم. كل درس في Deep Learning Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. الالتفاف: تنزلق Kernels فوق البكسلات
  2. Stride وPadding وPooling
  3. القنوات وخرائط الميزات ومجالات الاستقبال
  4. تجميع مصنّف صور CNN
← العودة إلى Deep Learning Academy