Garbage Overflow Detection Algorithm Based on Improved YOLOv8n

Feiyang Liu, Ruiqi ZhouResearch Square 2024

Abstract

Unprecedented urbanization and population growth have led to an increasing amount of domestic waste, posing significant challenges to urban environments and aesthetics worldwide. This paper proposes an improved garbage detection system based on YOLOv8n. The system uses target detection algorithms to identify garbage and trash cans in road images, determining if trash cans are overflowing and need cleaning. Firstly, a Deformable Attention Mechanism (DAT) is introduced into the backbone network, incorporating dynamic sampling points. Secondly, an auxiliary head is integrated into the model's head for training, providing deep supervision. Finally, a novel Inner-MPDIoU loss function is proposed to offer more precise evaluation results and enhance generalization ability. Comparative experiments show that the algorithm achieves a mean Average Precision (mAP) of 94.0%, significantly improving feature extraction and detection accuracy.

Introduction

As global urbanization accelerates, managing municipal solid waste has become a critical component of "Smart City" initiatives. Overflowing trash bins are not merely aesthetic issues; they represent public health risks and environmental pollutants. Automated monitoring using computer vision offers a scalable solution, yet garbage detection presents unique challenges. Unlike vehicles or pedestrians, garbage is inherently irregular in shape, color, and texture. Standard object detection models often struggle to distinguish loose waste from complex urban backgrounds or to identify bins that are partially obscured or damaged.

To address these challenges, this research introduces a specialized deep learning approach based on the YOLOv8n (Nano) architecture, optimized for real-time deployment on edge devices while maintaining high detection accuracy for chaotic and irregular objects.

Methodology

The proposed model enhances the baseline YOLOv8n architecture through three primary innovations: the integration of a Deformable Attention Mechanism (DAT), the addition of an auxiliary training head, and the implementation of a novel Inner-MPDIoU loss function.

The improved YOLOv8n architecture featuring the DATtention module and auxiliary detection heads (DetectAux).

Deformable Attention Mechanism (DAT)

Standard self-attention mechanisms often rely on fixed grids, which can be inefficient when dealing with the irregular geometries of garbage piles. The DAT module introduces learnable offsets, allowing the network to dynamically shift its sampling points toward the most informative regions of the image. This flexibility enables the model to capture the "chaotic" features of overflowing waste more effectively than rigid convolutional structures.

The Deformable Attention (DAT) mechanism, illustrating how sampling points are adjusted via learnable offsets to focus on relevant features.

Auxiliary Training Head and Deep Supervision

To improve the learning process, the researchers integrated auxiliary detection heads into the intermediate layers of the network. These heads provide "deep supervision" during the training phase, helping to mitigate the vanishing gradient problem and ensuring that middle layers extract meaningful features. Crucially, these auxiliary heads are only utilized during training and are discarded during inference, ensuring that the model remains lightweight and fast for real-world deployment.

Inner-MPDIoU Loss Function

Bounding box regression is a cornerstone of object detection. The authors proposed the Inner-MPDIoU loss function, which combines the benefits of MPDIoU (minimizing the distance between box corners) with Inner-IoU (using a scaled inner box for calculation). This hybrid approach allows for more precise localization, particularly for objects with irregular boundaries where standard IoU metrics might fail to provide a tight fit.

Experimental Results

The study utilized a dataset of 3,349 images sourced from Baidu AI Studio, categorized into overflowing bins, non-overflowing bins, and loose garbage. The improved YOLOv8n model demonstrated significant performance gains over the baseline:

  • Mean Average Precision (mAP): Increased from 91.2% to 94.0%.
  • Precision: Improved dramatically from 0.897 to 0.985.
  • F1-Score: Rose from 0.860 to 0.900.

Ablation studies confirmed that the auxiliary head was particularly effective, contributing a 0.073 increase in precision. Qualitative analysis showed the model was significantly better at identifying overflow in scenarios where the original YOLOv8n failed to distinguish between a full and a standard bin.

Conclusion

By refining the YOLOv8n architecture with deformable attention and deep supervision, this research provides a robust tool for automated urban waste management. The improved model balances the need for high-speed inference with the accuracy required to detect irregular, real-world objects. Future work will focus on deploying the system in live environments to test its resilience against varying weather and lighting conditions, as well as expanding the detection categories to include industrial waste and illegal dumping sites.

Summary updated

BibTeX
@inproceedings{liu2024garbage,
  author = {Feiyang Liu and Ruiqi Zhou},
  title = {{Garbage Overflow Detection Algorithm Based on Improved YOLOv8n}},
  booktitle = {Research Square},
  year = {2024},
  doi = {10.21203/rs.3.rs-4691427/v1},
}
Figure