العد التلقائي للأقراص باستخدام YOLOv8 لتحسين دقة توزيع الأدوية Automatic Pill Counting Using YOLOv8 to Improve Medication Distribution Accuracy

شارك:
المجلة: International Journal of Public Health Excellence (IJPHE)، المجلد: 5، العدد: 2
DOI: https://doi.org/10.55299/ijphe.v5i2.1724
تاريخ النشر: 2026-01-23
المؤلف: Dinial Utami Nurul Qomariah وآخرون
الموضوع الرئيسي: تطبيقات الشبكات العصبية المتقدمة

نظرة عامة

تبحث ورقة البحث في تنفيذ وتقييم نموذج YOLOv8 لاكتشاف الأجسام، خاصة في التطبيقات مثل الرعاية الصحية وأتمتة الصناعة. تتناول الدراسة التحدي المتمثل في تحقيق دقة عالية وتعميم تحت ظروف الصورة المتغيرة. تم تدريب نموذج YOLOv8 تحت سيناريوهين—10 دورات تدريبية و50 دورة تدريبية—لتقييم تأثير مدة التدريب على الأداء. أشارت النتائج إلى أن التدريب لمدة 10 دورات تدريبية أسفر عن دقة قدرها 0.98، واسترجاع قدره 0.94، ومتوسط دقة متوسط (mAP) قدره 0.98، بينما أدى تمديد التدريب إلى 50 دورة تدريبية إلى تحسين هذه المقاييس إلى دقة قدرها 0.99، واسترجاع قدره 1.00، وmAP قدره 0.99. تشير هذه النتائج إلى أن YOLOv8 مناسب تمامًا لتطبيقات الكشف في الوقت الحقيقي التي تتطلب دقة عالية.

في الخاتمة، تسلط الدراسة الضوء على فعالية نظام عد الحبوب التلقائي القائم على YOLOv8، مما يظهر قدرته على التعرف الدقيق على الحبوب وعدها باستخدام مجموعة بيانات PillBox (متقاعد) المتنوعة. تعلم النموذج بنجاح الميزات الحرجة مثل الشكل واللون والملمس، محققًا قيم mAP تصل إلى 0.99 عبر كلا سيناريوهين التدريب. تصميم الهيكل، بما في ذلك الآليات الخالية من المراسي والشبكات الهرمية المتقدمة، يمكّن من الكشف الفعال عن الأجسام الصغيرة مثل الحبوب تحت ظروف متنوعة. تشير قدرة النموذج القوية على التعميم ومستويات الثقة العالية في التعرف على أشكال الأدوية المختلفة إلى إمكانيات كبيرة لتطبيقات الصيدلة في العالم الحقيقي، بما في ذلك التوزيع وإدارة المخزون ومراقبة الجودة. تشمل اتجاهات البحث المستقبلية اختبار النموذج تحت ظروف غير خاضعة للرقابة ودمج التعرف على النقوش لتعزيز أنظمة التعرف على الأدوية.

مقدمة

تتناول مقدمة ورقة البحث القضية الحرجة المتعلقة بالأخطاء في عد الحبوب وتوزيع الأدوية، والتي تشكل مخاطر على سلامة المرضى وكفاءة الرعاية الصحية. يبرز المؤلفون الفوائد المحتملة لأتمتة عملية عد الحبوب باستخدام تقنيات الرؤية الحاسوبية، وخاصة نماذج اكتشاف الأجسام ذات المرحلة الواحدة مثل عائلة You Only Look Once (YOLO)، المعروفة بقدراتها على الاستدلال في الوقت الحقيقي. تشمل التحديات الرئيسية في هذا المجال اكتشاف الحبوب الصغيرة والمتداخلة تحت ظروف إضاءة متغيرة، مما قد يؤدي إلى إيجابيات وسلبيات كاذبة. تشير الأدبيات إلى استراتيجيات عدة للتخفيف من هذه التحديات، مثل دمج الميزات متعددة المقاييس وزيادة البيانات الخاصة بالمجال، مما يعزز متانة أنظمة الكشف.

تؤكد الورقة على فعالية دمج تقنيات التعلم العميق لتحديد الحبوب، محققة دقة عملية وتقليل الأخطاء في الأدوية. تشير الدراسات المقارنة إلى أن نماذج YOLO، وخاصة YOLOv3، توفر توازنًا جيدًا بين السرعة والدقة للتطبيقات في الوقت الحقيقي في بيئات الصيدلة. يقترح المؤلفون نظام عد الحبوب التلقائي القائم على YOLOv8 الذي يهدف إلى معالجة الفجوات البحثية الحالية من خلال التركيز على سيناريوهات الحبوب المتعددة. سيتضمن هذا النظام جمع وزيادة مجموعات البيانات الواقعية، وتكييف YOLOv8 لاكتشاف الأجسام الصغيرة، وتقييم مقاييس الكشف والعد، وتحسينه لتنفيذه على الأجهزة الطرفية. الهدف النهائي هو إنشاء خط أنابيب يقلل من أخطاء توزيع الأدوية ويتكامل بسلاسة في أنظمة إدارة الصيدلة.

الطرق

في هذه الدراسة، استخدم الباحثون مجموعة بيانات PillBox (متقاعد)، التي تتكون من حوالي 8,000 صورة دواء موصوفة قياسية، لتدريب نموذج اكتشاف الأجسام، وتحديدًا YOLOv8. تجعل التنوع البصري العالي لمجموعة البيانات، المميز بتنوعات في الشكل واللون والحجم والنقش، مناسبًا لتعزيز قدرات تعميم النموذج. لتعزيز مجموعة البيانات ومنع الإفراط في التكيف، تم تطبيق تقنيات متنوعة، بما في ذلك التدوير العشوائي، وتعديلات السطوع والتباين، وإضافة ضوضاء غاوسية. تم تقسيم مجموعة البيانات بعد ذلك إلى مجموعات تدريب (80%)، والتحقق (10%)، والاختبار (10%)، مما أسفر عن حوالي 6,400 صورة للتدريب، و800 للتحقق، و800 للاختبار.

تم اختيار متغير YOLOv8-s بسبب هيكله الفعال، الذي يتضمن رأس كشف خالي من المراسي وآليات توقع محسّنة، مما يجعله فعالًا بشكل خاص في اكتشاف الأجسام الصغيرة مثل الحبوب. استخدم عملية التدريب إطار العمل ultralytics مع معلمات فرعية قياسية، بما في ذلك معدل التعلم وحجم الدفعة، على مدى 300 دورة تدريبية. تم تفعيل تقنيات زيادة البيانات المدمجة الإضافية لتعزيز تنوع البيانات. تم مراقبة مقاييس التقييم مثل الدقة، والاسترجاع، ومعدل F1، والدقة طوال فترة التدريب، مع تنفيذ التوقف المبكر وتسجيل نقاط النموذج لتحسين الأداء ومنع الإفراط في التكيف. أظهرت النتائج أن نموذج YOLOv8 حقق دقة عالية في التعرف على الحبوب، حيث وصلت معدلات الدقة والاسترجاع إلى 0.99 و1.00، على التوالي، مما يدل على أداء قوي على كل من بيانات التدريب والبيانات غير المرئية.

المناقشة

تسلط قسم المناقشة الضوء على استخدام مجموعة بيانات PillBox (المتقاعد)، التي تتكون من صور عالية الدقة وبيانات وصفية مفصلة للأدوية الصلبة الفموية، كمورد أساسي لتدريب نموذج اكتشاف الأجسام YOLOv8. تمكّن صور مجموعة البيانات، المميزة بجودتها العالية وبياناتها الوصفية الشاملة، من تدريب فعال لمهام اكتشاف الحبوب. لتعزيز متانة النموذج، تم استخدام تقنيات متنوعة لزيادة الصور—مثل التدوير العشوائي، وتعديلات السطوع والتباين، وإضافة ضوضاء غاوسية. تحاكي هذه التقنيات الظروف الواقعية، مما يسمح للنموذج بالتعميم بشكل أفضل عبر سيناريوهات متنوعة.

تظهر نتائج التقييم أن نموذج YOLOv8 يحقق مقاييس أداء مثيرة للإعجاب، حيث تصل الدقة إلى 0.98 ويتحسن الاسترجاع إلى 1.00 بعد 50 دورة تدريبية. تؤكد قدرة النموذج على اكتشاف أشكال الأقراص والكبسولات بدقة، مع مستويات ثقة عالية، فعاليته في التعرف على الميزات البصرية الدقيقة. تشير النتائج إلى أن YOLOv8 ليس فقط قادرًا على اكتشاف الأجسام بدقة عالية، ولكن أيضًا قابل للتكيف مع الظروف المتغيرة، مما يجعله أداة واعدة للتطبيقات في بيئات الصيدلة، مثل عد الأدوية ومراقبة الجودة. يُقترح أن تستكشف الأعمال المستقبلية أداء النموذج في البيئات غير الخاضعة للرقابة ودمجه مع أنظمة التعرف على النقوش من أجل تحديد شامل للأدوية.

Journal: International Journal of Public Health Excellence (IJPHE), Volume: 5, Issue: 2
DOI: https://doi.org/10.55299/ijphe.v5i2.1724
Publication Date: 2026-01-23
Author(s): Dinial Utami Nurul Qomariah et al.
Primary Topic: Advanced Neural Network Applications

Overview

The research paper investigates the implementation and evaluation of the YOLOv8 model for object detection, particularly in applications such as healthcare and industrial automation. The study addresses the challenge of achieving high accuracy and generalization under varying image conditions. The YOLOv8 model was trained under two scenarios—10 epochs and 50 epochs—to assess the impact of training duration on performance. Results indicated that training for 10 epochs yielded a precision of 0.98, recall of 0.94, and mean Average Precision (mAP) of 0.98, while extending training to 50 epochs improved these metrics to a precision of 0.99, recall of 1.00, and mAP of 0.99. These findings suggest that YOLOv8 is well-suited for real-time detection applications requiring high accuracy.

In the conclusion, the study highlights the effectiveness of a YOLOv8-based Automatic Pill Counting system, demonstrating its capability for accurate pill identification and counting using the diverse PillBox (Retired) dataset. The model successfully learned critical features such as shape, color, and texture, achieving mAP values of up to 0.99 across both training scenarios. The architecture’s design, including anchor-free mechanisms and advanced feature pyramid networks, enables effective detection of small objects like pills under various conditions. The model’s strong generalization ability and high confidence levels in recognizing different medication shapes suggest significant potential for real-world pharmacy applications, including dispensing, inventory management, and quality control. Future research directions include testing under uncontrolled conditions and integrating imprint recognition to enhance drug identification systems.

Introduction

The introduction of the research paper addresses the critical issue of errors in pill counting and medication distribution, which pose risks to patient safety and healthcare efficiency. The authors highlight the potential benefits of automating the pill counting process using computer vision technologies, particularly one-stage object detection models like the You Only Look Once (YOLO) family, known for their real-time inference capabilities. Key challenges in this domain include the detection of small, overlapping pills under varying lighting conditions, which can lead to false positives and negatives. The literature suggests several strategies to mitigate these challenges, such as multi-scale feature fusion and domain-specific augmentation, which enhance the robustness of detection systems.

The paper emphasizes the effectiveness of combining deep learning techniques for pill identification, achieving practical accuracy and reducing medication errors. Comparative studies indicate that YOLO models, particularly YOLOv3, provide a favorable balance between speed and accuracy for real-time applications in pharmacy settings. The authors propose a YOLOv8-based Automatic Pill Counting system that aims to address existing research gaps by focusing on multi-pill scenarios. This system will involve the collection and augmentation of realistic datasets, adaptation of YOLOv8 for small object detection, evaluation of detection and counting metrics, and optimization for edge device implementation. The ultimate goal is to create a pipeline that minimizes medication distribution errors and integrates seamlessly into pharmacy management systems.

Methods

In this study, the researchers utilized the PillBox (Retired) dataset, which comprises approximately 8,000 standardized prescription drug images, to train an object detection model, specifically YOLOv8. The dataset’s high visual diversity, characterized by variations in shape, color, size, and imprint, makes it suitable for enhancing the model’s generalization capabilities. To augment the dataset and prevent overfitting, various techniques were applied, including random rotation, brightness and contrast adjustments, and Gaussian noise addition. The dataset was subsequently divided into training (80%), validation (10%), and testing (10%) subsets, resulting in approximately 6,400 images for training, 800 for validation, and 800 for testing.

The YOLOv8-s variant was selected for its efficient architecture, which includes an anchor-free detection head and improved prediction mechanisms, making it particularly effective for detecting small objects like pills. The training process employed the ultralytics framework with standard hyperparameters, including a learning rate and batch size, over 300 epochs. Additional built-in augmentation techniques were activated to further enhance data diversity. Evaluation metrics such as precision, recall, F1-score, and accuracy were monitored throughout training, with early stopping and model checkpointing implemented to optimize performance and prevent overfitting. The results demonstrated that the YOLOv8 model achieved high accuracy in recognizing pills, with precision and recall rates reaching up to 0.99 and 1.00, respectively, indicating robust performance on both training and unseen data.

Discussion

The discussion section highlights the utilization of the PillBox (retired) dataset, which comprises high-resolution images and detailed metadata of solid oral medications, as a foundational resource for training the YOLOv8 object detection model. The dataset’s images, characterized by their high quality and comprehensive metadata, enable effective training for pill detection tasks. To enhance the model’s robustness, various image augmentation techniques—such as random rotation, brightness and contrast adjustments, and the addition of Gaussian noise—were employed. These techniques simulate real-world conditions, allowing the model to generalize better across diverse scenarios.

The evaluation results demonstrate that the YOLOv8 model achieves impressive performance metrics, with precision reaching 0.98 and recall improving to 1.00 after 50 epochs of training. The model’s ability to accurately detect both tablet and capsule shapes, with high confidence levels, underscores its effectiveness in recognizing subtle visual features. The findings indicate that YOLOv8 is not only capable of high-precision object detection but also adaptable to varying conditions, making it a promising tool for applications in pharmacy settings, such as medication counting and quality control. Future work is suggested to explore the model’s performance in uncontrolled environments and its integration with imprint recognition systems for comprehensive drug identification.