Directional Alignment Penalty: A Lightweight Localization Loss for Improved Bounding Box Regression in YOLOv8
Sonay Duman, Furkan Gözükara, Zeki Yetgin, Erdinç AvaroğluAccurate localization of bounding boxes is a prerequisite for enabling vision-driven precision agriculture pipelines, as downstream tasks such as morphological feature extraction, growth monitoring, and digital-twin synchronization depend directly on the geometric quality of the detected boxes. Distance-IoU (DIoU) and Complete-IoU (CIoU) improve upon simple overlap-based objectives by incorporating a normalized center-distance term into the regression loss, along with the overlap and, for CIoU, an aspect-ratio penalty, but that term remains embedded in a single composite formulation with an implicit, non-adjustable weight. We propose a Directional Alignment Penalty (DAP), an auxiliary localization regularizer that introduces an independently weighted normalized center-displacement term into the bounding-box regression objective without modifying the detector architecture. The proposed DAP-YOLOv8 increased mAP@0.5:0.95 from 51.69% to 53.76% and mAP@0.5 from 80.03% to 80.36% while preserving precision and recall; repeated-seed experiments further showed that the improvement in fine-grained localization was consistent across random initializations on a purpose-built oyster-mushroom (Pleurotus ostreatus) dataset collected from a real-world smart greenhouse. Results show that explicitly modeling the center-distance factor as an independent and tunable component can improve fine-grained localization without sacrificing the computational efficiency of the base detector, thereby providing a lightweight plug-in extension for agricultural detection and digital-twin applications.