انهيار الأنماط وحيل التثبيت
شخّص تدريب GAN غير المستقر وأصلحه
انهيار الأنماط وحيل التثبيت درس مجاني في Deep Learning Academy على CoddyKit. هذا هو الدرس 4 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Deep Learning Academy، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Deep Learning Academy 4 دروس في المجموع.
بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.
GANs Are Hard to Train
GANs are powerful but notoriously fragile. Two networks chasing each other can swing, stall, or collapse. Knowing the failure modes saves you hours. 🧯
What Is Mode Collapse
Mode collapse happens when the generator produces only a few outputs that reliably fool the judge, ignoring the full variety of the real data.
Spotting the Collapse
You spot it when generated samples all look nearly identical, even though your real dataset is rich and diverse. Variety has vanished.
When the Judge Wins Too Fast
If the discriminator gets too strong too quickly, its gradients dry up and the generator stops learning. Balance between the two is everything.
Trick: Label Smoothing
Label smoothing softens the real target from 1.0 to about 0.9. This keeps the discriminator humble and its gradients useful.
real_label = 0.9Trick: Add Input Noise
Adding a little noise to the discriminator's inputs makes its job slightly harder, which steadies the training game and reduces collapse.
noisy = real + 0.05 * torch.randn_like(real)Trick: Tune the Optimizer
The DCGAN paper uses Adam with a low learning rate and beta1 set to 0.5. These settings are a reliable starting point.
Adam(params, lr=2e-4, betas=(0.5, 0.999))Trick: Minibatch Diversity
Minibatch features let the discriminator compare samples within a batch. If they all look the same, it notices, punishing collapse directly.
Trick: Wasserstein Loss
The Wasserstein loss with gradient penalty gives smoother signals than plain cross-entropy, making notoriously unstable GANs far easier to train.
Keep the Two Balanced
Aim for a fair fight. If one network dominates, slow it down or update the other more often. Balance beats any single trick.
Judge by Diversity Too
A healthy GAN makes images that are both sharp and varied. Always check that different latent vectors give genuinely different outputs.
Quick Check
Recognizing the symptom is half the cure.
Recap: Stabilizing GANs
You learned to spot mode collapse and to fight it with label smoothing, input noise, tuned Adam, and a balanced generator-discriminator duo. 💪
الأسئلة الشائعة
هل درس «انهيار الأنماط وحيل التثبيت» مجاني؟
نعم — نص درس «انهيار الأنماط وحيل التثبيت» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Deep Learning Academy، انتقل إلى CoddyKit PRO. تتضمن دورة Deep Learning Academy 4 دروس في المجموع.
ماذا ستتعلم في «انهيار الأنماط وحيل التثبيت»؟
شخّص تدريب GAN غير المستقر وأصلحه تتمرن على Deep Learning Academy مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.
هل أحتاج إلى خبرة سابقة لأبدأ Deep Learning Academy؟
لا تُشترط خبرة سابقة. Deep Learning Academy على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 4 من أصل 4.
كم من الوقت يستغرق درس «انهيار الأنماط وحيل التثبيت»؟
معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.
هل يمكنني كتابة وتشغيل أكواد في درس Deep Learning Academy هذا؟
نعم. كل درس في Deep Learning Academy يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.
جميع الدروس في هذه الدورة
- Generator مقابل Discriminator: اللعبة
- الخسارة التنافسية
- بناء DCGAN
- انهيار الأنماط وحيل التثبيت