สร้าง DCGAN
GAN แบบคอนโวลูชันสำหรับสร้างภาพ
สร้าง DCGAN เป็นบทเรียน Deep Learning Academy ฟรีบน CoddyKit นี่คือบทเรียนที่ 3 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Deep Learning Academy และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Deep Learning Academy มีบทเรียนทั้งหมด 4 บทเรียน
บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ
What DCGAN Adds
A DCGAN is a GAN built from convolutional layers. It swaps dense layers for convolutions, which makes it great at generating realistic images. 🖼️
Generator Grows the Image
The generator uses transposed convolutions to upsample a tiny latent vector step by step into a full-size image.
nn.ConvTranspose2d(100, 256, 4, 1, 0)Discriminator Shrinks the Image
The discriminator does the reverse: strided convolutions shrink the image down to a single real-or-fake score.
nn.Conv2d(3, 64, 4, 2, 1)Batch Norm Stabilizes
DCGAN puts batch normalization between layers in both networks. It keeps activations healthy and makes training far more stable.
nn.BatchNorm2d(256)ReLU in the Generator
The generator uses ReLU activations on its hidden layers to keep gradients flowing as the image is built up.
nn.ReLU(True)LeakyReLU in the Discriminator
The discriminator prefers LeakyReLU, which lets a small signal through for negative values and avoids dead neurons.
nn.LeakyReLU(0.2, inplace=True)Tanh on the Output
The generator ends with Tanh, squeezing pixels into the range minus one to one to match normalized training images.
nn.Tanh()Sigmoid for the Verdict
The discriminator finishes with a sigmoid, turning its final feature into a probability between zero and one.
nn.Sigmoid()Weight Initialization
DCGAN starts weights from a small normal distribution centered near zero. Good init helps both networks train smoothly from the first step.
nn.init.normal_(m.weight, 0.0, 0.02)Pick the Latent Size
The latent dimension, often 100, sets how many random numbers seed each image. Larger latents give the generator more room to vary.
nz = 100Watch Samples as You Train
Save a grid of generated images every few epochs. Watching them get sharper is how you confirm a DCGAN is actually learning.
Quick Check
Which activation belongs at the very end of the generator?
Recap: Building a DCGAN
You assembled a DCGAN: transposed convolutions grow images, strided convolutions judge them, and batch norm keeps it all stable. 🛠️
คำถามที่พบบ่อย
บทเรียน “สร้าง DCGAN” ฟรีหรือไม่
ใช่ — ข้อความเต็มของ “สร้าง DCGAN” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Deep Learning Academy ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Deep Learning Academy มีบทเรียนทั้งหมด 4 บทเรียน
คุณจะเรียนรู้อะไรในบทเรียน “สร้าง DCGAN”
GAN แบบคอนโวลูชันสำหรับสร้างภาพ คุณปฏิบัติ Deep Learning Academy ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน
คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Deep Learning Academy หรือไม่
ไม่จำเป็นต้องมีประสบการณ์มาก่อน Deep Learning Academy บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 3 จากทั้งหมด 4 บทเรียน
บทเรียน “สร้าง DCGAN” ใช้เวลานานแค่ไหน
บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย
ฉันเขียนและรันโค้ดในบทเรียน Deep Learning Academy นี้ได้ไหม
ได้ บทเรียน Deep Learning Academy ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ
บทเรียนทั้งหมดในหลักสูตรนี้
- ตัวสร้างกับตัวจำแนก: เกมการแข่งขัน
- ค่าความสูญเสียแบบปฏิปักษ์
- สร้าง DCGAN
- การยุบโหมดและเทคนิคทำให้เสถียร