Learn how to use a [dropout layer](https://www.ultralytics.com/glossary/dropout-layer) to prevent overfitting. Discover how to train [YOLO26](https://docs.ultralytics.com/models/yolo26/) for more robust AI models.
طبقة التسرب هي تقنية أساسية للتنظيم تستخدم في الشبكات العصبية (NN) لمكافحة مشكلة الإفراط في التكيف. عندما يتم تدريب نموذج على مجموعة محدودة من الأمثلة، غالبًا ما يتعلم حفظ الضوضاء والتفاصيل المحددة لبيانات التدريب بدلاً من تمييز الأنماط العامة الأساسية. يؤدي هذا الحفظ إلى دقة عالية أثناء التطوير ولكن أداءً ضعيفًا على المدخلات الجديدة غير المرئية. يعالج التسرب هذه المشكلة عن طريق تعطيل جزء من الخلايا العصبية بشكل عشوائي — أو "تسربها" — في طبقة خلال كل خطوة من خطوات عملية التدريب. هذه الاستراتيجية البسيطة والفعالة، التي تم تقديمها في ورقة بحثية رائدة من قبل Srivastava et al.، قد طورت بشكل كبير استقرار وأداء بنى التعلم العميق (DL).
The mechanism behind a dropout layer is intuitively similar to removing players from a sports team during practice to force the remaining players to work harder and not rely on a single star athlete. During the model training phase, the layer generates a probabilistic mask of zeros and ones. If the dropout rate is set to 0.5, approximately 50% of the neurons are temporarily ignored during that specific forward and backward pass. This process forces the remaining active neurons to learn robust features independently, preventing the network from relying too heavily on any single neuron—a phenomenon known in machine learning (ML) as feature co-adaptation.
أثناء الاستدلال في الوقت الفعلي، أو مرحلة الاختبار ، عادةً ما يتم تعطيل طبقة التسرب. تظل جميع الخلايا العصبية نشطة للاستفادة من القدرة التنبؤية الكاملة للنموذج المدرب. لضمان بقاء قيم التنشيط الإجمالية متسقة مع مرحلة التدريب، غالبًا ما يتم قياس الأوزان تلقائيًا بواسطة إطار العمل. المكتبات الحديثة مثل PyTorch تتعامل مع عمليات القياس الرياضي هذه بسلاسة، مما يسمح للمطورين بالتركيز على الهندسة بدلاً من الحساب.
بالنسبة لمستخدمي ultralytics حزمة، وتطبيق التسرب على نموذج متطور مثل
يولو26 is as simple as adjusting a training argument. This
is particularly useful when working with smaller datasets where the risk of overfitting is higher. By introducing
randomness, you can encourage the model to generalize better across diverse environments.
from ultralytics import YOLO
# Load the latest YOLO26 model (recommended for new projects)
model = YOLO("yolo26n.pt")
# Train the model with a custom dropout rate of 0.1 (10%)
# This encourages the model to learn more generalized features
results = model.train(data="coco8.yaml", epochs=50, dropout=0.1)
يعد التخلي عن البيانات أمرًا لا غنى عنه في مختلف مجالات الذكاء الاصطناعي (AI) حيث تستخدم النماذج أعدادًا كبيرة من المعلمات المتعلقة بالبيانات المتاحة.
While dropout is highly effective, it is often used alongside other techniques. It is distinct from data augmentation, which modifies the input images (e.g., flipping or rotating) rather than the network architecture itself. Similarly, it differs from batch normalization, which normalizes layer inputs to stabilize learning but does not explicitly deactivate neurons.
For complex projects, managing these hyperparameters can be challenging. The Ultralytics Platform simplifies this by providing tools to visualize training metrics, helping users determine if their dropout rates are effectively reducing validation loss. Whether you are building a custom image classification system or a sophisticated segmentation pipeline, understanding dropout is key to building resilient AI systems.