BiAF: بحث حول الكشف وتتبع قطعان الماعز الديناميكية استنادًا إلى رؤية الآلة
BiAF: research on dynamic goat herd detection and tracking based on machine vision

المجلة: Scientific Reports، المجلد: 15، العدد: 1
DOI: https://doi.org/10.1038/s41598-025-89231-6
PMID: https://pubmed.ncbi.nlm.nih.gov/39922902
تاريخ النشر: 2025-02-08
المؤلف: Yun Hou وآخرون
الموضوع الرئيسي: دراسات سلوك الحيوان ورفاهيته

نظرة عامة

تتناول ورقة البحث التقدم في مراقبة رعي الماشية من خلال تطوير خوارزمية تعتمد على رؤية الآلة، BiAF-YOLOv7، التي تعزز نموذج YOLOv7-tiny. disrupt طرق المراقبة التقليدية سلوك الماشية، مما يستلزم حلولًا مبتكرة. تدمج الخوارزمية المقترحة وحدة ELAN مبسطة، وآلية انتباه CBAM محسّنة، ووحدة SPPCSPC مصقولة لتحسين دقة الكشف مع تقليل عدد المعلمات. تحقق خوارزمية BiAF-YOLOv7 مقاييس أداء مثيرة للإعجاب، بما في ذلك الدقة، والاسترجاع، ودرجة F1، ومتوسط قيم الدقة (mAP) بنسبة 94.5%، 96.7%، 94.8%، و96.0%، على مجموعة بيانات قطيع الماعز.

توضح الورقة أيضًا التحسينات التي تم إجراؤها على نموذج YOLOv7-tiny، بما في ذلك استبدال شبكة ELAN بشبكة تجميع طبقات فعالة ودمج هرم ميزات ثنائي الاتجاه مرجح. هذه التعديلات، جنبًا إلى جنب مع دمج آلية انتباه AF-CBAM وصناديق الأنكور المحدثة عبر تجميع K-Means، تحسن بشكل كبير من متانة النموذج ضد التحديات مثل تشوه الماعز وظروف الإضاءة المتغيرة. تكشف التحليلات المقارنة أن خوارزمية BiAF-YOLOv7 تتفوق على نماذج الكشف السائدة الأخرى، محققة معدل دقة بنسبة 94.5%، مما يثبت فعاليتها في مراقبة رعي الماشية ويبرز إمكانيات رؤية الآلة في التطبيقات الزراعية على نطاق واسع.

مقدمة

تقدم المقدمة نسخة محسّنة من وحدة انتباه الكتل التلافيفية (CBAM)، المشار إليها باسم AF-CBAM، والتي تهدف إلى تحسين أداء الشبكات العصبية التلافيفية من خلال تحسين تمثيلات الميزات. يدمج AF-CBAM نهج دمج ميزات جديد، يُشار إليه باسم AFF، والذي يجمع بين ميزتين، $X$ و $Y$، باستخدام المعادلة:

\[
Z = M(X \oplus Y) \otimes X + (1 – M(X \oplus Y)) \otimes Y
\]

تدمج هذه الآلية بشكل فعال وحدات انتباه القناة والمكان، مما يسمح للنموذج بالتأكيد على ميزات الهدف الرئيسية مع تقليل الضوضاء الخلفية. إن تنفيذ AF-CBAM بعد كل ELAN محسّنة (شبكة انتباه الطبقات المحسّنة) يحسن بشكل كبير من التوزيع المكاني لخرائط الميزات ويعزز تمثيل الميزات متعددة المقاييس، مما يزيد من متانة النموذج بشكل عام.

طرق

في هذه الدراسة، استخدم المؤلفون نموذج You Only Look Once (YOLO)، مستفيدين من المعلمات المدربة مسبقًا من مجموعة بيانات VOC وتنفيذ تقدير الزخم التكيفي (Adam) بمعدل تعلم أولي قدره 0.01 وزخم قدره 0.937. تضمنت عملية التدريب تجميد طبقة الميزات الأساسية لمدة 50 دورة قبل فك تجميدها لمزيد من التدريب. ركز التقييم التجريبي على خوارزمية الكشف BiAF-YOLOv7، التي تم مقارنتها مع خمس خوارزميات رئيسية للكشف عن الأهداف: SSD، Faster R-CNN، YOLOv5l، YOLOv7، وYOLOv8، باستخدام مجموعة بيانات الكشف عن أهداف الماعز.

أشارت النتائج إلى أن خوارزمية BiAF-YOLOv7 حققت دقة بنسبة 94.5% واسترجاع بنسبة 96.7%، متفوقة على الخوارزميات الأخرى بفروق كبيرة. على وجه التحديد، تجاوز الاسترجاع ذلك الخاص بـ SSD، Faster R-CNN، YOLOv5l، YOLOv7، وYOLOv8 بنسبة تتراوح بين 5.7% إلى 7.2%. كانت درجة F1 لـ BiAF-YOLOv7 94.8%، مع قيم متوسط الدقة (mAP) بنسبة 96.0% عند IoU=0.5 و59.7% عند IoU=0.5:0.95، متجاوزة النموذج الأصلي YOLOv7-tiny وخوارزميات YOLOv7 السائدة بنسب ملحوظة. على الرغم من أن سرعة الكشف لـ BiAF-YOLOv7 كانت أبطأ قليلاً من YOLOv7-tiny عند 42.3 مللي ثانية، إلا أنها أظهرت دقة متفوقة في السيناريوهات الحرة. أظهرت منحنيات P-R أن BiAF-YOLOv7 تفوقت باستمرار على الخوارزميات الأخرى، مما يؤكد فعاليتها في مهام الكشف عن الأهداف.

نتائج

تظهر نتائج التجارب التجريبية التي أجريت على خوارزمية الكشف BiAF-YOLOv7 تحسينات كبيرة في أداء الكشف عبر مقاييس مختلفة. تلخص التجارب، الموضحة في الجدول 4، أن نموذج BiAF-YOLOv7 يحقق دقة بنسبة 94.5%، واسترجاع بنسبة 96.7%، ودرجة F1 بنسبة 94.8%، ومتوسط دقة (mAP) بنسبة 96.0% عند عتبة IoU 0.5، متفوقًا على خوارزميات الكشف السائدة الأخرى مثل SSD، Faster R-CNN، ونسخ YOLO. من الجدير بالذكر أن التحسينات تنبع من سلسلة من التعديلات، بما في ذلك تقديم شبكة تجميع الطبقات الفعالة ثنائية الاتجاه (Bi-ELAN) ووحدة الانتباه AF-CBAM، التي تعمل معًا على تحسين التعرف على الميزات والتوزيع المكاني.

تشير التحليلات الإضافية إلى أن خوارزمية BiAF-YOLOv7-DeepSORT تظهر قدرات تتبع قوية، خاصة في الظروف الصعبة مثل الإضاءة المنخفضة والاحتجاب. تحافظ الخوارزمية على دقة كشف عالية تبلغ 94.6%، متجاوزة YOLOv7-tiny-DeepSORT بنسبة 2.2%. بالإضافة إلى ذلك، تقلل من التعريفات الخاطئة وتخطي الهوية، مما يظهر استقرارًا محسنًا في تتبع هويات الأهداف. تسلط الأداء المقارن في سيناريوهات الاحتجاب الضوء على قدرة BiAF-YOLOv7-DeepSORT المتفوقة في الحفاظ على معرفات تتبع متسقة، مما يؤكد موثوقيتها ومتانتها في الكشف عن الأهداف وتتبعها بفعالية. بشكل عام، تؤكد هذه النتائج فعالية التحسينات المقترحة على بنية YOLOv7.

مناقشة

تسلط قسم المناقشة في الورقة الضوء على تنفيذ وتقييم خوارزمية BiAF-YOLOv7 للكشف عن قطيع الماعز في سيناريوهات الرعي الحر. أجريت الدراسة في مزرعة إيتوقي الفرعية، حيث تم استخدام 14 كاميرا مراقبة لالتقاط أنشطة تغذية الماعز، مما أسفر عن مجموعة بيانات تتكون من 2800 صورة عالية الجودة، والتي تم تعزيزها لاحقًا إلى 14,000 عينة من خلال تقنيات تعزيز البيانات المختلفة. يتضمن نموذج BiAF-YOLOv7، الذي يمثل تحسينًا على بنية YOLOv7-tiny، شبكة ميزات تجميع ثنائية الاتجاه وآلية دمج انتباه لتعزيز استخراج الميزات ومتانة النموذج ضد التحديات مثل الاحتجاب وظروف الإضاءة المتغيرة. تظهر النتائج التجريبية تحسينات كبيرة في الدقة (5.8%)، والاسترجاع (4.5%)، ودرجة F1 (5.7%)، ومتوسط دقة (mAP) (6.1%) مقارنة بالنموذج الأساسي، مما يبرز فعالية النموذج في المراقبة في الوقت الحقيقي لسلوك الماعز وموقعه.

تتناقش الورقة أيضًا في خوارزمية BiAF-YOLOv7 مقارنة بالمنهجيات السابقة، مشيرة إلى أدائها المتفوق في البيئات المعقدة. بينما تعترف بحدود الدراسة الحالية، خاصة في ظل الظروف الجوية القاسية، يقترح المؤلفون العمل المستقبلي لتوسيع قدرات المراقبة وتحليل سلوك الماعز بشكل أكثر شمولاً. تؤكد النتائج على إمكانيات خوارزميات الكشف المتقدمة في تربية الحيوانات الدقيقة، مما يسهل تحسين ممارسات الإدارة وتحقيق توازن مستدام بين الماشية والمراعي. بشكل عام، يعرض نموذج BiAF-YOLOv7 تقدمًا واعدًا في مجال مراقبة الماشية، محققًا معدل دقة يبلغ 94.5%، مما يتجاوز نماذج الكشف السائدة الأخرى.

Journal: Scientific Reports, Volume: 15, Issue: 1
DOI: https://doi.org/10.1038/s41598-025-89231-6
PMID: https://pubmed.ncbi.nlm.nih.gov/39922902
Publication Date: 2025-02-08
Author(s): Yun Hou et al.
Primary Topic: Animal Behavior and Welfare Studies

Overview

The research paper discusses advancements in livestock grazing monitoring through the development of a machine vision-based algorithm, BiAF-YOLOv7, which enhances the YOLOv7-tiny model. Traditional monitoring methods disrupt livestock behavior, necessitating innovative solutions. The proposed algorithm integrates a streamlined ELAN module, an optimized CBAM attention mechanism, and a refined SPPCSPC module to improve detection accuracy while reducing parameter counts. The BiAF-YOLOv7 algorithm achieves impressive performance metrics, including precision, recall, F1 score, and mean Average Precision (mAP) values of 94.5%, 96.7%, 94.8%, and 96.0%, respectively, on a goat herd dataset.

The paper further elaborates on the enhancements made to the YOLOv7-tiny model, including the substitution of the ELAN network with an efficient layer aggregation network and the integration of a weighted bidirectional feature pyramid. These modifications, along with the incorporation of the AF-CBAM attention mechanism and updated anchor boxes via K-Means clustering, significantly improve the model’s robustness against challenges such as goat deformation and varying light conditions. Comparative analyses reveal that the BiAF-YOLOv7 algorithm outperforms other mainstream detection models, achieving a precision rate of 94.5%, thereby validating its effectiveness for livestock grazing monitoring and highlighting the potential of machine vision in large-scale agricultural applications.

Introduction

The introduction presents an enhanced version of the Convolutional Block Attention Module (CBAM), referred to as AF-CBAM, which aims to improve the performance of convolutional neural networks by refining feature representations. The AF-CBAM integrates a novel feature fusion approach, denoted as AFF, which combines two features, $X$ and $Y$, using the formula:

\[
Z = M(X \oplus Y) \otimes X + (1 – M(X \oplus Y)) \otimes Y
\]

This mechanism effectively fuses the channel and spatial attention modules, allowing the model to emphasize key target features while minimizing background noise. The implementation of AF-CBAM after each enhanced ELAN (Enhanced Layer Attention Network) significantly improves the spatial distribution of feature maps and bolsters multi-scale feature representation, thereby increasing the overall robustness of the model.

Methods

In this study, the authors employed the You Only Look Once (YOLO) model, utilizing pretrained parameters from the VOC dataset and implementing Adaptive Moment Estimation (Adam) with an initial learning rate of 0.01 and momentum of 0.937. The training process involved freezing the backbone feature layer for the first 50 epochs before unfreezing it for further training. The experimental evaluation focused on the BiAF-YOLOv7 detection algorithm, which was compared against five mainstream target detection algorithms: SSD, Faster R-CNN, YOLOv5l, YOLOv7, and YOLOv8, using a goat target detection dataset.

The results indicated that the BiAF-YOLOv7 algorithm achieved a precision of 94.5% and a recall of 96.7%, outperforming the other algorithms by significant margins. Specifically, the recall exceeded that of SSD, Faster R-CNN, YOLOv5l, YOLOv7, and YOLOv8 by 5.7% to 7.2%. The F1 score for BiAF-YOLOv7 was 94.8%, with mean Average Precision (mAP) values of 96.0% at IoU=0.5 and 59.7% at IoU=0.5:0.95, surpassing the original YOLOv7-tiny and mainstream YOLOv7 algorithms by notable percentages. Although the detection speed of BiAF-YOLOv7 was slightly slower than YOLOv7-tiny at 42.3 ms, it demonstrated superior accuracy in free-range scenarios. The P-R curves illustrated that BiAF-YOLOv7 consistently outperformed the other algorithms, confirming its efficacy in target detection tasks.

Results

The results of the ablation experiments conducted on the BiAF-YOLOv7 detection algorithm demonstrate significant improvements in detection performance across various metrics. The experiments, summarized in Table 4, reveal that the BiAF-YOLOv7 model achieves a precision of 94.5%, recall of 96.7%, F1 score of 94.8%, and mean Average Precision (mAP) of 96.0% at IoU threshold 0.5, outperforming other mainstream detection algorithms such as SSD, Faster R-CNN, and YOLO variants. Notably, the enhancements stem from a series of modifications, including the introduction of the bi-directional efficient layer aggregation network (Bi-ELAN) and the attention module AF-CBAM, which collectively optimize feature recognition and spatial distribution.

Further analysis indicates that the BiAF-YOLOv7-DeepSORT algorithm exhibits robust tracking capabilities, particularly under challenging conditions such as low light and occlusion. The algorithm maintains a high detection accuracy of 94.6%, surpassing the YOLOv7-tiny-DeepSORT by 2.2%. Additionally, it reduces false identifications and ID skips, demonstrating improved stability in tracking target identities. The comparative performance under occlusion scenarios highlights the BiAF-YOLOv7-DeepSORT’s superior ability to maintain consistent tracking IDs, thereby confirming its reliability and robustness in detecting and tracking targets effectively. Overall, these findings validate the efficacy of the proposed enhancements to the YOLOv7 architecture.

Discussion

The discussion section of the paper highlights the implementation and evaluation of the BiAF-YOLOv7 algorithm for goat herd detection in free grazing scenarios. Conducted at the Etoqqi subfarm ranch, the study utilized 14 surveillance cameras to capture goat feeding activities, resulting in a dataset of 2800 high-quality images, which was subsequently augmented to 14,000 samples through various data enhancement techniques. The BiAF-YOLOv7 model, an improvement over the YOLOv7-tiny architecture, incorporates a Bi-directional Aggregation Feature Network and an Attentional Fusion mechanism to enhance feature extraction and robustness against challenges such as occlusion and varying light conditions. The experimental results demonstrate significant improvements in precision (5.8%), recall (4.5%), F1 score (5.7%), and mean Average Precision (mAP) (6.1%) compared to the base model, underscoring the model’s effectiveness in real-time monitoring of goat behavior and location.

The paper also contrasts the BiAF-YOLOv7 algorithm with previous methodologies, noting its superior performance in complex environments. While acknowledging the limitations of the current study, particularly under extreme weather conditions, the authors propose future work to expand surveillance capabilities and analyze goat behavior more comprehensively. The findings emphasize the potential of advanced target detection algorithms in precision animal husbandry, facilitating improved management practices and sustainable livestock-pasture balance. Overall, the BiAF-YOLOv7 model showcases a promising advancement in the field of livestock monitoring, achieving a precision rate of 94.5%, which surpasses other mainstream detection models.