สไตรด์ แพดดิง และพูลลิง
ควบคุมขนาดเอาต์พุตและลดขนาดข้อมูล
สไตรด์ แพดดิง และพูลลิง เป็นบทเรียน Deep Learning Academy ฟรีบน CoddyKit นี่คือบทเรียนที่ 2 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 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. 🎯
คำถามที่พบบ่อย
บทเรียน “สไตรด์ แพดดิง และพูลลิง” ฟรีหรือไม่
ใช่ — ข้อความเต็มของ “สไตรด์ แพดดิง และพูลลิง” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Deep Learning Academy ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Deep Learning Academy มีบทเรียนทั้งหมด 4 บทเรียน
คุณจะเรียนรู้อะไรในบทเรียน “สไตรด์ แพดดิง และพูลลิง”
ควบคุมขนาดเอาต์พุตและลดขนาดข้อมูล คุณปฏิบัติ Deep Learning Academy ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน
คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Deep Learning Academy หรือไม่
ไม่จำเป็นต้องมีประสบการณ์มาก่อน Deep Learning Academy บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 2 จากทั้งหมด 4 บทเรียน
บทเรียน “สไตรด์ แพดดิง และพูลลิง” ใช้เวลานานแค่ไหน
บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย
ฉันเขียนและรันโค้ดในบทเรียน Deep Learning Academy นี้ได้ไหม
ได้ บทเรียน Deep Learning Academy ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ
บทเรียนทั้งหมดในหลักสูตรนี้
- คอนโวลูชัน: เคอร์เนลเลื่อนไปบนพิกเซล
- สไตรด์ แพดดิง และพูลลิง
- ช่อง แผนที่คุณลักษณะ และขอบเขตรับข้อมูล
- ประกอบตัวจำแนกภาพด้วย CNN