Garbage detection method and system based on improved YOLOv11

By improving the YOLOv11 model and introducing the ADF, C3k2_wConv, and C2PSA_EDFFN modules, the problem of insufficient detection accuracy of the model in complex backgrounds and small target recognition was solved, and efficient garbage detection results were achieved.

CN120997647APending Publication Date: 2025-11-21CHONGQING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202511174479.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-21
Publication Date
2025-11-21

AI Technical Summary

Technical Problem

The existing YOLOv11 model suffers from problems such as limited receptive field, insufficient attention, and inadequate feature fusion in garbage detection, resulting in insufficient detection accuracy in complex backgrounds and small target recognition.

Method used

We introduce a downsampling attention enhancement module (ADF), a weighted convolutional feature extraction module (C3k2_wConv), and an enhanced attention feedforward network module (C2PSA_EDFFN) to optimize the backbone network and the detection head, thereby improving the multi-scale feature extraction and fusion capabilities.

Benefits of technology

It significantly improves the accuracy and efficiency of garbage detection, especially in the recognition of complex backgrounds and small targets. The overall accuracy is improved by 10.2%, the recall rate is improved by 3.5%, the F1-score is improved by 6.7%, the inference speed is improved by 72.8%, and the number of model parameters and size are kept within a lightweight range.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120997647A_ABST
    Figure CN120997647A_ABST
Patent Text Reader

Abstract

The invention relates to a garbage detection method and system based on improved YOLOv11, belongs to the field of computer vision and artificial intelligence application, and aims at solving the problems that in existing garbage detection, the small target recognition rate is low, the complex background adaptability is poor, and the reasoning efficiency is insufficient. According to the method, on the basis of an improved YOLOv11 framework, a down-sampling attention enhancement module, a weighted convolution feature extraction module and an enhanced attention feedforward network module are introduced, a multi-scale feature extraction and fusion mechanism is constructed, and accurate classification and positioning of garbage targets are achieved. The system is composed of a backbone network and a detection head which are responsible for feature extraction and fusion decoding respectively, and has the advantages of being high in context modeling capacity, accurate in feature expression and efficient in calculation. According to the method, the detection precision and speed are remarkably improved while the light weight of the model is kept, and the method is suitable for real-time deployment scenes such as intelligent garbage classification and environment monitoring.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of computer vision and artificial intelligence applications, specifically relating to a deep learning-based object detection method and system, and more particularly to a garbage detection method and system based on an improved YOLOv11. Background Technology

[0002] In the process of modern urbanization, waste sorting and intelligent treatment have become important components of environmental governance. Traditional waste disposal methods rely heavily on manual sorting, which is not only inefficient and costly but also highly susceptible to human error, leading to inconsistent sorting accuracy. To achieve intelligent and automated waste disposal, researchers have begun to leverage artificial intelligence, particularly computer vision technology, to achieve automatic identification and sorting of waste. In recent years, the rapid development of deep learning technology has provided entirely new solutions for waste detection, with object detection algorithms based on Convolutional Neural Networks (CNNs) becoming a research hotspot.

[0003] The YOLO (You Only Look Once) family of object detection frameworks has seen rapid development and widespread application in engineering deployments in recent years. By cleverly transforming the object detection problem into a regression problem, the YOLO model possesses significant advantages such as end-to-end, one-stage processing, and fast detection speed, making it ideal for deployment on resource-constrained edge computing devices. In the evolution from YOLOv1 to YOLOv8, the model has continuously improved in terms of detection accuracy, speed, and lightweight design. As a further iteration of the YOLO family, YOLOv11 incorporates more advanced technologies, such as CSP structure optimization, enhanced attention mechanisms, RepConv fusion, and improved anchor strategies. These improvements further enhance its ability to detect small objects and the model's robustness.

[0004] Although YOLOv11, as a new generation detection framework, has superior performance, it still suffers from inherent problems such as limited receptive field, insufficient attention, and inadequate feature fusion when facing challenging garbage detection application scenarios such as small targets, complex backgrounds, and mixed categories. These issues limit further improvements in its detection accuracy. Summary of the Invention

[0005] In view of this, the purpose of this invention is to overcome the above-mentioned defects of the prior art and provide a garbage detection method and system based on improved YOLOv11, aiming to systematically improve the detection accuracy and efficiency of the model in complex garbage detection scenarios.

[0006] To achieve the above objectives, the present invention provides the following technical solution:

[0007] This invention provides a garbage detection method based on an improved YOLOv11 model. This method structurally improves the existing YOLOv11 model by introducing three key innovative modules: a downsampling attention enhancement module (ADF), a weighted convolutional feature extraction module (C3k2_wConv), and an enhanced attention feedforward network module (C2PSA_EDFFN). The method first acquires the image to be detected, and then uses a backbone network optimized by the aforementioned innovative modules to extract multi-scale features from the image. Specifically, the backbone network uses the ADF module for efficient downsampling and enhanced context awareness, the C3k2_wConv module for feature extraction with spatial response differences, and the C2PSA_EDFFN module for refining high-level semantic features at a deeper network layer. Subsequently, a detection head, also enhanced by the ADF and C3k2_wConv modules, performs deep fusion and decoding of these multi-scale features, ultimately outputting the precise category and bounding box location information of the garbage target.

[0008] This invention also provides a garbage detection system based on an improved YOLOv11, comprising a backbone network and a detection head. The backbone network is configured to receive images to be detected and extract multi-scale features using integrated ADF, C3k2_wConv, and C2PSA_EDFFN modules. The detection head is connected to the backbone network, and its internal structure is also optimized by the ADF and C3k2_wConv modules. It is responsible for fusing, refining, and decoding the features output by the backbone network to generate the final garbage detection result.

[0009] The beneficial effects of this invention are as follows:

[0010] (1) Compared to the baseline model, the method proposed in this invention shows significant improvements in all accuracy metrics. Overall precision is improved by approximately 10.2%, recall by approximately 3.5%, and overall F1-score by approximately 6.7%. Significant increases of 7.75% and 7.97% are achieved on the more stringent mAP@0.5 and mAP@50-95 metrics, respectively, demonstrating comprehensive progress in the model's accuracy and stability in localization quality and class classification.

[0011] (2) This invention is particularly effective in identifying small-sized, irregularly shaped, and similarly shaped waste categories (such as "ointment," "eggshells," and "plugs and wires"), with the mAP50-95 index generally improved by 5% to 8% or more. This is due to the introduced module, which effectively enhances the model's ability to model and discriminate against low-texture, complex-structure targets within a specific context.

[0012] (3) Despite a slight increase in the number of model parameters, the overall inference speed (FPS) improved from 132.27 to 228.5, representing a significant improvement of 72.8%. In particular, the post-processing time was reduced by 73%, indicating that the optimized model structure is more efficient and well-suited for real-time deployment scenarios requiring rapid response.

[0013] (4) While significantly improving performance, this invention controls the growth of model parameters and volume within a reasonable range. The increase in GFLOPs is limited, and the overall model still falls into the category of lightweight models, achieving an excellent balance between accuracy, speed and model complexity.

[0014] Other advantages, objectives, and features of the invention will be set forth in part in the description which follows, and in part will be apparent to those skilled in the art from the following examination, or may be learned from practice of the invention. The objectives and other advantages of the invention can be realized and obtained through the following description. Attached Figure Description

[0015] To make the objectives, technical solutions, and advantages of the present invention clearer, the preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings, wherein:

[0016] Figure 1 This is a flowchart of a garbage detection method based on an improved YOLOv11 in an embodiment of the present invention.

[0017] Figure 2 This is a schematic diagram of the improved YOLOv11 network structure in an embodiment of the present invention.

[0018] Figure 3 This is a schematic diagram of the ADF module as shown in an embodiment of the present invention.

[0019] Figure 4 This is a schematic diagram of the structure of the wConv2d module given in an embodiment of the present invention.

[0020] Figure 5 This is a schematic diagram of the structure of the Bottleneck_wConv module given in an embodiment of the present invention.

[0021] Figure 6 This is a schematic diagram of the structure of the C3k_wConv module given in an embodiment of the present invention.

[0022] Figure 7 This is a schematic diagram of the structure of the C3k2_wConv module given in an embodiment of the present invention.

[0023] Figure 8This is a schematic diagram of the EDFFN module as shown in an embodiment of the present invention.

[0024] Figure 9 This is a schematic diagram of the PSABlock_EDFFN module as given in an embodiment of the present invention.

[0025] Figure 10 This is a schematic diagram of the structure of the C2PSA_EDFFN module given in an embodiment of the present invention.

[0026] Figure 11 This is a partial detection effect diagram of the improved model in an embodiment of the present invention. Detailed Implementation

[0027] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Unless otherwise specified, the following embodiments and features can be combined with each other.

[0028] The accompanying drawings are for illustrative purposes only and are schematic diagrams, not actual pictures. They should not be construed as limiting the invention. To better illustrate the embodiments of the invention, some parts in the drawings may be omitted, enlarged, or reduced, and do not represent the actual product dimensions. It is understandable to those skilled in the art that some well-known structures and their descriptions may be omitted in the drawings.

[0029] In the accompanying drawings of the embodiments of the present invention, the same or similar reference numerals correspond to the same or similar components. In the description of the present invention, it should be understood that if terms such as "upper," "lower," "left," "right," "front," and "rear" indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, they are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation. Therefore, the terms used to describe positional relationships in the drawings are only for illustrative purposes and should not be construed as limiting the present invention. For those skilled in the art, the specific meaning of the above terms can be understood according to the specific circumstances.

[0030] This invention proposes an improved YOLOv11 detection model. By introducing three key improvement modules—ADF, C3k2_wConv, and C2PSA_EDFFN—the model's performance is systematically enhanced from three perspectives: downsampling receptive field enhancement, feature fusion optimization, and multi-scale attention modeling. Details are as follows:

[0031] 1. ADF module

[0032] The ADF module proposed in this invention aims to improve the performance of object detection models in complex backgrounds and multi-scale targets, especially for the detection of litter objects. This module enhances the model's attention to detail by combining local features with surrounding contextual information, thereby improving the accuracy of litter detection, particularly in tasks involving complex backgrounds or small objects.

[0033] Technical Implementation:

[0034] (1) Combination of local convolution and dilated convolution:

[0035] The ADF module employs a design that combines local convolution with dilated convolution. Local convolution focuses on extracting features within specific regions, while dilated convolution increases the receptive field, enabling the model to capture broader contextual information. Through this combination, the module effectively fuses local information and global context, thereby improving its accuracy in identifying litter objects.

[0036] (2) Downsampling operation:

[0037] In ADF, downsampling is performed using convolutions with a stride of 2 to reduce the size of the feature map, thereby reducing computational cost and memory usage. Simultaneously, the downsampled feature map retains sufficient spatial information to support subsequent object detection and classification.

[0038] (3) Fusion of contextual features:

[0039] The key to this module lies in how to efficiently fuse local features and contextual information. By concatenating features obtained from local convolutions and dilated convolutions, and then further fusing them through convolutional layers, the network can find the most useful contextual information among multi-scale features. This feature fusion strategy improves the detection accuracy of small objects and targets in complex backgrounds.

[0040] (4) Dynamic feature selection:

[0041] The ADF module introduces a dynamic feature selection mechanism that automatically adjusts the focus on local and contextual features based on the input features. This mechanism enables the network to adaptively select important features for processing, thereby improving the model's accuracy and robustness.

[0042] In summary, ADF is a downsampling attention enhancement module, primarily used to increase channel dimensionality and enhance feature representation capabilities while halving the spatial size. Specific functions include... Figure 3 As shown: During the forward propagation, the input feature map is first spatially downsampled and its channel count doubled by a convolutional layer with a stride of 2 (Conv(nIn,2nIn,3×3,stride=2)). Subsequently, local context extraction (F_loc) and peripheral context extraction (F_sur) are applied to the feature map, both being depthwise separable convolutions, but the latter uses dilated convolutions to capture a larger receptive field. The two context features are concatenated along the channel dimension and then fused using the BatchNorm+ activation function, with the channel count reduced from 4nIn to 2nIn by a 1×1 convolutional layer. Finally, the fused features are fed into the FGlo module (global attention mechanism) for channel-dimensional feature recalibration to further improve the responsiveness of key regions. The final output feature map has a spatial size half that of the input, twice the number of channels, and possesses richer local, peripheral, and global contextual information.

[0043] Technical advantages: 1) Enhanced background adaptability: By combining dilated convolution and local convolution, the module can capture a wider range of contextual information, improving the model's adaptability to complex backgrounds; 2) Optimized computational efficiency: Downsampling operations reduce the size of feature maps, lowering computational load and GPU memory consumption, and improving inference speed; 3) Multi-scale object detection: Through the fusion of contextual features, the module can better handle multi-scale targets, especially showing significant advantages when dealing with small objects.

[0044] 2. C3k2_wConv module

[0045] The C3k2_wConv module incorporates multi-level structural innovations, such as... Figure 7As shown, this is mainly reflected in the introduction of the wConv2d weighted convolution mechanism. This module modulates the standard convolution kernel element-wise by constructing a two-dimensional prior weighting matrix Φ (generated by the outer product of the one-dimensional vector alfa = [den, 1.0, denT]), enabling the convolution kernel to have spatial response differences, emphasizing central features and suppressing edge noise, thereby improving the model's perception and representation capabilities of the target. In terms of module structure, C3k2_wConv uses deeply stacked Bottleneck_wConv or C3k_wConv sub-modules as the backbone path, introducing efficient designs such as grouped convolution and dilated convolution, further balancing receptive field expansion and computational efficiency. It inherits the branch fusion idea of ​​the C3 series, improving feature representation capabilities through multi-path extraction and channel concatenation, while possessing good adjustability and compatibility, and can be flexibly replaced in the YOLO network, demonstrating excellent adaptability and structural innovation value.

[0046] Technical Implementation:

[0047] (1) Weighted convolution (wConv2d):

[0048] The wConv2d module is an improved convolutional structure that introduces a prior weighting mechanism, primarily used to enhance the focus on specific regions in spatial convolution. Its overall structure is based on standard 2D convolution, and a fixed weighting matrix Φ is introduced into the convolution kernel parameters to achieve prior structural enhancement. Specific functions include... Figure 4As shown, firstly, after the input feature map (size B×C_in×H×W) enters the module, the standard convolutional kernel weights W are initialized, with a size of C_out×(C_in / groups)×K×K. Then, based on the set weight vector den, a symmetric one-dimensional vector alfa is constructed, with the format [den, 1.0, reversed(den)], for example [0.2, 0.5, 1.0, 0.5, 0.2]. By performing an outer product operation on this vector, a two-dimensional prior weighting matrix Φ is generated, with a shape consistent with the size of the convolutional kernel (e.g., 5×5). Next, Φ, as a structural prior, is used to modulate the convolutional kernel weights W element-wise through multiplication, generating a modulated convolutional kernel W_mod with spatial attention weights. This modulation mechanism essentially assigns different response intensities to different spatial locations of the convolutional kernel, thereby achieving guided learning of local structures. Finally, W_mod is used to replace the original convolutional kernel to perform standard 2D convolution operations, including specified stride, padding, dilation, and groups settings, generating an output feature map (size B×C_out×H_out×W_out). Through this mechanism, the wConv2d module introduces structure-aware spatial weighting without introducing additional parameters. This helps the model better focus on regions with spatial distribution characteristics during the feature extraction stage, improving the network's ability to model local structures, and is particularly suitable for visual tasks with complex textures or those sensitive to spatial patterns.

[0049] (2)Bottleneck_wConv:

[0050] The innovations of the Bottleneck_wConv module include: Figure 5 As shown, a weighted convolutional unit wConv2d is introduced. By multiplying the standard convolutional kernel with a weighted matrix Φ (obtained by the outer product of a one-dimensional vector alpha) generated based on the prior distribution, it enhances the response to the central region and attenuates the response at the edges, thereby improving spatial perception. Furthermore, Φ can be flexibly controlled by the vector den, making the receptive field distribution adjustable to adapt to different task requirements. Meanwhile, the module maintains consistency with the original Conv2d interface, supporting parameters such as groups, stride, and dilation, exhibiting good compatibility and scalability, and can seamlessly replace the standard convolutional modules in the YOLO series networks.

[0051] (3)C3k_wConv:

[0052] The C3k_wConv module, for example Figure 6As shown, this is an innovative fusion based on the CSP (Cross Stage Partial) structure, integrating two key improvements. First, it inherits from the C3k module, allowing users to customize the size of the convolutional kernels in the Bottleneck (e.g., 3×3, 5×5, etc.), enhancing the scale adaptability of feature extraction. Second, this module replaces the standard Bottleneck with a custom Bottleneck_wConv, the core of which is the weighted convolutional unit wConv2d.

[0053] (4) Depthwise separable convolution:

[0054] This module employs depthwise separable convolution, utilizing two independent operations: depthwise convolution and pointwise convolution. Depthwise convolution performs convolution on each input channel independently, while pointwise convolution combines across channels. This approach significantly reduces computation and the number of parameters, allowing the model to maintain high efficiency when processing large-scale data.

[0055] (5) Adaptive spatial attention:

[0056] The C3k2_wConv module incorporates an adaptive spatial attention mechanism, enabling the network to dynamically adjust attention weights based on different regions of the image. In this way, the model can focus on important regions and reduce redundant computations when processing features from different areas, thus improving the model's efficiency and accuracy.

[0057] (6) Adaptive adjustment of channel count:

[0058] The module reduces redundant computation by adaptively adjusting the number of input channels and exhibits strong adaptability to different input data. This dynamic adjustment effectively addresses variations in different tasks, improving the model's generalization ability.

[0059] Technical Advantages: 1) Reduced computation: Through depthwise separable convolution and weighted convolution, the module significantly reduces the computational cost and number of parameters in convolution operations, enabling the model to run efficiently in environments with limited GPU memory and computing resources. 2) Adaptive feature focusing: The adaptive spatial attention mechanism helps the model dynamically focus on key regions in the image, which is particularly advantageous in tasks such as detecting and classifying litter objects. 3) Balancing efficiency and accuracy: While reducing computational cost, the module's weighted convolution and depthwise separable convolution ensure improved detection accuracy, especially in complex scenes.

[0060] 3. C2PSA_EDFFN module

[0061] C2PSA_EDFFN is a deeply enhanced structure based on the C2PSA module, and its innovations include... Figure 10The diagram shows how multiple internal PSABlocks are replaced with PSABlock_EDFFN, achieving a stacked attention structure with frequency domain enhancement. This module introduces path diversity through channel partitioning and integrates local convolution, GELU nonlinearity, and learnable frequency domain filtering in each attention block, effectively expanding the model's receptive field and multi-scale feature modeling capabilities. It is particularly suitable for representing complex textures and long-distance dependencies in images.

[0062] Technical Implementation:

[0063] (1) Spatial Adaptive Attention (PSA):

[0064] The PSA mechanism enables the network to dynamically assign attention weights to different regions in an image. By adjusting the importance of each region, the model can better focus its attention on the areas where trash objects are located. This is particularly important for multi-scale trash object detection, effectively improving detection accuracy.

[0065] (2) Enhanced Deep Feedforward Network (EDFFN):

[0066] The EDFFN module integrates deep convolution, nonlinear gating, and frequency domain enhancement techniques, enhancing feature representation capabilities through channel branching structures and spectral modulation mechanisms. Its innovation lies in introducing learnable frequency domain parameters into patch-level processing, improving the model's ability to perceive periodic and textured targets. It is a lightweight and efficient feedforward network structure that combines local modeling and frequency domain enhancement. This allows the network to more effectively handle complex features, especially detailed features, thereby improving the classification and localization capabilities of litter objects.

[0067] Specific implementation as follows Figure 8 As shown, the input features are first mapped to a double-expanded high-dimensional space through a 1×1 convolution and divided into two branches. Then, they are respectively processed through depthwise separable convolutions and fused element-wise by GELU activation, forming a hybrid feature with non-linear enhancement capabilities. Next, the dimensionality is restored through a 1×1 convolution. To further enhance the frequency domain representation of the features, the module divides the output into 8×8 blocks for FFT transformation, and performs weighted modulation of the spectrum using learnable parameters. Then, inverse FFT is used to restore the image blocks and reconstruct the entire image, effectively enhancing the model's texture modeling and local structure perception capabilities. This structure integrates spatial and frequency domain information processing mechanisms, representing an improvement and extension of the traditional FFN.

[0068] (3) PSABlock_EDFFN:

[0069] like Figure 9As shown, PSABlock_EDFFN, based on the original PSABlock, replaces the traditional feedforward network (FFN) with an enhanced dual-branch feedforward module (EDFFN), introducing a structure that combines local spatial convolution with frequency domain modeling. This module extracts fine-grained local features through DWConv and uses learnable frequency domain filters to perform spectral enhancement on each patch, thereby significantly improving feature representation capabilities and long-range dependency modeling efficiency. Simultaneously, it retains residual connections and multi-head attention mechanisms, achieving an effective fusion of spatial attention and frequency domain awareness.

[0070] (4) Adaptive adjustment of the number of attention heads:

[0071] The module dynamically calculates the number of attention heads based on the number of channels, allowing each layer to flexibly adjust the attention heads according to the features of the input data, thereby improving feature extraction capabilities while maintaining computational efficiency.

[0072] (5) Combination of feedforward and self-attention:

[0073] C2PSA_EDFFN enhances the model's ability to capture long-range dependencies in images by combining a feedforward network with a self-attention mechanism. This allows the network to better capture key features when dealing with complex backgrounds and detailed junk objects.

[0074] Technical advantages: Balancing accuracy and efficiency, the module maintains high computational efficiency while improving accuracy through adaptive adjustment of the attention mechanism and enhanced feedforward network; Strong adaptability to complex backgrounds, the module can effectively handle junk objects in complex backgrounds, especially excelling in small objects and multi-scale tasks; Dynamic adaptability, adaptive adjustment of the number of attention heads and enhanced deep feedforward network enable the module to dynamically adapt to different input images, improving the robustness of the model.

[0075] By introducing the ADF, C3k2_wConv, and C2PSA_EDFFN modules, this invention significantly improves the performance of YOLOv11 in garbage detection tasks, especially in tasks involving complex backgrounds and small objects. The design of each module effectively enhances the model's detection accuracy while reducing computational load and GPU memory consumption, providing an efficient and accurate solution.

[0076] The specific implementation process is as follows: Figure 1 As shown.

[0077] 1. Dataset preparation and annotation:

[0078] (1) Dataset Collection and Preparation: This implementation uses a customized waste detection dataset for waste classification detection. The dataset contains 36 types of waste, such as cigarette butts, fruit peels and pulp, disposable fast food containers, and metal items. Images were collected under different environmental and lighting conditions to ensure the diversity of the dataset. (2) Image Preprocessing: The image size was adjusted to 640x640, which is consistent with the input size of the YOLOv11 model. Each image was standardized, and the pixel values ​​were normalized to [0,1]. Image Enhancement: Random rotation, flipping, cropping, and color transformation were performed to increase the diversity of the data and avoid overfitting. (3) Labeling and Segmentation: Each image was labeled using the LabelImg tool to record the bounding box and category information of each waste object, ensuring that each object was accurately labeled. The dataset is divided into training set, validation set, and test set, and the data path and category information are configured in the data.yaml configuration file.

[0079] 2. Improve the YOLOv11 model architecture:

[0080] (1) Model architecture as follows Figure 2 As shown: This invention adopts an architecture based on YOLOv11 and improves the accuracy and efficiency of garbage detection by introducing three major improvement modules: ADF, C3k2_wConv and C2PSA_EDFFN. The specific functions of the improvement modules are as follows: ADF combines local features with dilated convolution, and captures a wider range of contextual information through dilated convolution, enhancing the adaptability to complex backgrounds and small objects; C3k2_wConv reduces the amount of computation through weighted convolution and depthwise separable convolution, and at the same time enables the model to dynamically focus on important regions in the image through an adaptive spatial attention mechanism; C2PSA_EDFFN combines adaptive spatial attention and enhanced deep feedforward network to improve the model's ability to represent details of garbage objects, especially the detection accuracy of small objects and complex backgrounds. (2) Model input and output: The input is a 640x640 image containing multiple garbage objects; the output is the category, bounding box position and confidence of each object, and finally the non-maximum suppression (NMS) is used for box filtering and deduplication.

[0081] 3. Model Training:

[0082] (1) Configuration file: Using the yolo11-C3k2-wConv-ADF-C2PSA-EDFFN.yaml configuration file, an improved version of the YOLOv11 network model is defined, mainly for garbage object detection tasks. Based on the original YOLO architecture, it introduces three improved modules: ADF improved feature downsampling and context enhancement module, C3k2_wConv integrated weighted convolution and residual connection feature extraction module, and C2PSA_EDFFN combined attention mechanism and feedforward network advanced feature enhancement module. The structure and function are analyzed in detail from the two parts of Backbone and Head: (1) Backbone network analysis: used to extract semantic features from the input image layer by layer, and perform feature compression and semantic aggregation. The input image undergoes initial convolution (Conv(3x3, stride=2)), downsampling to P1 / 2, increasing the number of channels to 64; it is then downsampled to P2 / 4 using ADF to enhance contextual modeling capabilities; shallow features are extracted using C3k2_wConv, with an output of 256 channels, a residual structure, and weighted convolution; downsampled to P3 / 8 using ADF; mid-level semantic information is extracted using C3k2_wConv, with an output of 512 channels; downsampled to P4 / 16 using ADF; P4 features are further extracted using C3k2_wConv with residual connections; downsampled to P5 / 32 using ADF; deep features are extracted using C3k2_wConv, with an output of 1024 channels; multi-scale contextual information is extracted using SPPF spatial pyramid pooling; and an attention + multi-head feedforward module is added to the deepest layer of C2PSA_EDFFN to enhance high-level expressive capabilities. Key improvements: ADF is repeatedly used to replace the traditional Conv+BN+ReLU downsampling method, so that each feature layer can not only downsample, but also integrate the remote context; C3k2_wConv is used in many places to replace the original C3K2 module, improving the channel attention capability and integrating spatial weighting; C2PSA_EDFFN is added at the end of the backbone to further refine the deep semantic features. (2) Analysis of the Head decoding and detection part: responsible for multi-scale feature fusion and detection box regression.Upsample P5 (32→16); Concat merges the upsampled output of P5 with P4 (index=6) in the Backbone; C3k2_wConv performs deep feature fusion and purification; Upsamples the fused feature map again (16→8); Concat merges the upper layer output with P3 (index=4) to form the P3 feature; C3k2_wConv obtains the final small target feature map P3; ADF downsamples back to the P4 / 16 spatial scale; Concat merges the upper layer output with the mid-target layer features; C3k2_wConv obtains the final mid-target feature map P4; ADF downsamples back to the P5 / 32 spatial scale; Concat merges the upper layer output with the deep semantic enhancement feature map (index=10); C3k2_wConv obtains the final large target feature map P5; Finally, the data is sent to the Detect head for target bounding box prediction and classification prediction of P3, P4, and P5, respectively. Key improvements: ADF was still used in the decoding process, so that the upsampled feature map was restructured and enhanced before fusion; C3k2_wConv was used in all decoded feature maps, which not only reduced the computational complexity, but also improved the ability to model channel importance. The data.yaml configuration file specifies the path of the dataset, category information, and the division of training and validation data. (2) Training process: SGD optimizer was used, the initial learning rate was set to 0.01, and the learning rate was dynamically adjusted by combining Cosine learning rate scheduling. During training, cross-entropy loss and IOU loss were used to optimize the classification and regression tasks of the model. Number of training rounds: set to 400 rounds, and the model performance was evaluated on the validation set after each round of training to ensure the stability of training. (3) Data augmentation and regularization: Data augmentation techniques include random rotation, cropping, flipping, brightness / contrast adjustment, etc., with the aim of enhancing the robustness of the model. Dropout and data augmentation techniques were used to prevent overfitting, especially when dealing with complex backgrounds and small objects, to help the model generalize better.

[0083] 4. Model Evaluation and Validation:

[0084] (1) mAP (Mean Average Precision) is used as the main evaluation metric for the model, especially in the application of waste detection tasks. Precision-Recall curves and IOU metrics are used to further evaluate the model's precision and recall on different types of waste. (2) Test set evaluation: Multiple evaluations are performed on the test set to ensure that the model can accurately detect waste objects in different environments and backgrounds. By comparing with the original YOLOv11 model, the performance improvement of the ADF, C3k2_wConv, and C2PSA_EDFFN modules on waste detection is verified.

[0085] 5. Analysis of Experimental Results

[0086] Detection results are as follows Figure 11 As shown, the improved YOLOv11 model demonstrates excellent performance in actual image detection, primarily in the following aspects: (1) it can identify complex backgrounds and diverse categories; (2) it can detect small targets and occluded targets; (3) classification accuracy and localization accuracy are improved simultaneously; and (4) multiple labels can be identified simultaneously without conflict. The overall detection performance verifies the comprehensive enhancement of the model's discriminative power by the ADF, C3k2_wConv, and PSA-EDFFN structures. It is suitable for real-time deployment scenarios such as household waste classification and multi-target object detection.

[0087] The model information data is shown in Table 1, the baseline model data is shown in Table 2, and the improved model data is shown in Table 3.

[0088] Table 1

[0089]

[0090] Table 2

[0091]

[0092]

[0093] Table 3

[0094]

[0095]

[0096] The following is a detailed analysis:

[0097] 1) Overall improvement in accuracy indicators

[0098] The overall accuracy improved from 0.7453 to 0.8473, an improvement of 10.2%, indicating that the model more effectively reduced false positives and could more accurately identify targets without misclassifying them as other categories.

[0099] The recall rate increased from 0.6513 to 0.6862, a 3.5% improvement, indicating that the model is more sensitive to positive sample identification and the false negative rate has decreased significantly, making it suitable for scenarios with low fault tolerance, such as spam identification.

[0100] The F1-score improved from 0.6852 to 0.7524, a 6.7% increase. This improvement, which takes into account both precision and recall, validates the balanced improvement in the model's overall recognition capability.

[0101] mAP@0.5 (average accuracy) increased from 70.37% to 78.12%, a rise of 7.75%. This is a comprehensive indicator that measures the accuracy of detection box positioning and category determination.

[0102] mAP75 improved from 0.6409 to 0.7223, an improvement of 8.14%. mAP50-95 improved from 0.6088 to 0.6885, an improvement of 7.97%, indicating that the model maintains stronger stability and accuracy under different IoU thresholds, reflecting the overall improvement in localization quality and discrimination ability.

[0103] 2) Significantly improved accuracy for both minor and complex sample categories.

[0104] In multi-class recognition, the improved model performed particularly well for complex structures, small-sized targets, and categories with similar appearances: the mAP50-95 for the "ointment" category increased from 76.97% to 88.01%, and the F1-score increased from 81.54% to 89.10%, indicating a significant improvement in the model's edge detection and discrimination capabilities on irregular, gelatinous packaging. For "power bank," the mAP50 increased from 78.21% to 86.79%, and the F1-score improved to 81.37%, demonstrating the model's enhanced ability to model the contours and material information of electronic devices. The mAP50-95 for "old clothes" improved by over 5.6% (from 80.71% to 86.32%), showing greater robustness to wrinkled, soft, and textured targets. Categories that were originally easily confused, such as "eggshells," "batteries," and "plugs and wires," generally saw an improvement of 5-8% in mAP50-95, especially in Recall, indicating that the EDFFN+PSA structure significantly enhanced the ability to model the context of low-texture or irregular targets. In addition, most categories achieved improvements in both Precision and Recall, showing that the model's judgment is no longer "unbalanced."

[0105] 3) Inference speed is significantly faster, and deployment efficiency is higher.

[0106] Although the number of parameters in the new model has increased, it has achieved a significant improvement in inference efficiency and is more practical: inference time has decreased from 0.00335s to 0.00313s, a small but stable increase; post-processing time has decreased from 0.00394s to 0.00106s, a significant reduction of 73%; the overall processing frame rate (FPS) has increased from 132.27FPS to 228.50FPS, almost doubling, an improvement of 72.8%; and the pure model inference speed (excluding pre- and post-processing) has also increased from 298.72FPS to 319.92FPS, validating the efficiency of the computation graph structure optimization and channel attention mechanism. These benefits are attributed to: EDFFN's introduction of lightweight convolution (DWConv) + frequency domain modeling, achieving a balance between parameters and efficiency; the PSA module's channel decoupling and attention enhancement while controlling complexity; and the accelerated post-processing, indicating that the selection and decoding process of detection boxes is more efficient, making it suitable for deployment in response latency-sensitive scenarios.

[0107] 4) The number of model parameters and size have increased slightly, but it is still considered lightweight.

[0108] The cost of introducing structural improvements is a moderate increase in model size: the number of model parameters increased from 2.59M to 3.57M, a growth of 38%; the model file size increased from 5.2MB to 7.2MB; and GFLOPs increased from 6.4 to 8.2. The floating-point computation increased slightly, but this is still within the category of lightweight models.

[0109] This invention significantly improves the performance of YOLOv11 in waste detection by introducing the ADF, C3k2_wConv, and C2PSA_EDFFN modules, especially in small object detection and waste object detection in complex backgrounds. By optimizing computational load and memory consumption, this method ensures efficient operation in practical applications and is suitable for multiple fields such as intelligent waste sorting and environmental monitoring.

[0110] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.

Claims

1. A garbage detection method based on improved YOLOv11, characterized in that: The method comprises the following steps: obtaining an image to be detected; inputting the image to be detected into a target detection model, wherein the target detection model comprises a backbone network and a detection head, the backbone network adopts an attention enhanced down-sampling module (ADF) for down-sampling, adopts a weighted convolution feature extraction module (C3k2_wConv) for feature extraction, and adopts an enhanced attention feedforward network module (C2PSA_EDFFN) for refining deep features, so as to extract a multi-scale feature map containing a garbage target; inputting the multi-scale feature map into the detection head, wherein the detection head fuses and decodes the multi-scale feature map to obtain category and position information of the garbage target, and the detection head adopts the ADF module and the C3k2_wConv module for feature fusion and enhancement.

2. The improved YOLOv11-based garbage detection method according to claim 1, characterized in that: The feature processing procedure of the ADF module comprises: down-sampling and lifting a channel dimension of an input feature map through a first convolution layer; processing the output of the first convolution layer in parallel through a local context extraction branch and a surrounding context extraction branch, wherein the surrounding context extraction branch adopts a dilated convolution to obtain a larger receptive field; splicing output features of the local context extraction branch and the surrounding context extraction branch in a channel dimension; dimension-reducing and fusing the spliced features through a second convolution layer; rescaling the channel dimension of the fused features through a global attention module.

3. The improved YOLOv11-based garbage detection method of claim 1, wherein: The C3k2_wConv module comprises a weighted convolution unit (wConv2d), and the wConv2d unit weights the spatial response of a convolution kernel by performing element-wise multiplication modulation on the convolution kernel and a preset two-dimensional prior weighting matrix Φ.

4. The improved YOLOv11-based garbage detection method according to claim 3, characterized in that: The two-dimensional prior weighting matrix Φ is generated by an outer product operation of a one-dimensional vector α, and the one-dimensional vector α is constructed by a preset weight vector den, and has the following format: a = [den, 1.0, den T ] wherein den T is the inverse sequence vector of the weight vector den.

5. The improved yolov11-based garbage detection method of claim 1, wherein: The C2PSA_EDFFN module comprises a spatial self-adaptive attention mechanism (PSA) and an enhanced deep feedforward network (EDFFN), and the EDFFN module replaces a standard feedforward network and is used for deep enhancement of features processed by attention.

6. The improved YOLOv11-based garbage detection method according to claim 5, characterized in that: The feature processing procedure of the EDFFN module comprises: extracting spatial features through a depthwise separable convolution; dividing a feature map into a plurality of image blocks, and performing fast Fourier transform (FFT) on each image block to convert to a frequency domain; weighting and modulating a frequency spectrum in the frequency domain by using a learnable parameter; restoring the modulated frequency spectrum into an enhanced feature map through inverse fast Fourier transform.

7. The improved YOLOv11-based garbage detection method according to claim 1, characterized in that: The backbone network alternately uses the ADF module and the C3k2_wConv module for down-sampling and extraction of features, and uses the C2PSA_EDFFN module at the deepest layer to strengthen high-level semantic expression; and the detection head performs multi-scale feature fusion through up-sampling operation and feature splicing operation, and uses the C3k2_wConv module to purify the fused features.

8. A garbage detection system based on improved YOLOv11, characterized in that: The method comprises the following steps: The backbone network is configured to employ a down-sampling attention enhancement module (ADF) for down-sampling, employ a weighted convolution feature extraction module C3k2_wConv for feature extraction, and employ an enhanced attention feed-forward network module (C2PSA_EDFFN) for refining deep features. The detection head is connected to the backbone network and is configured to employ the ADF module and the C3k2_wConv module for feature fusion and enhancement.

9. The improved YOLOv11-based garbage detection system according to claim 8, characterized in that: The ADF module comprises: A first convolutional layer for down-sampling input feature maps and increasing channel dimension; A local context extraction branch and a peripheral context extraction branch for parallel processing of the output of the first convolutional layer, wherein the peripheral context extraction branch employs a dilated convolution to obtain a larger receptive field; A concatenation component for concatenating the output features of the local context extraction branch and the peripheral context extraction branch in the channel dimension; A second convolutional layer for dimension reduction fusion of the concatenated features; A global attention module for channel dimension feature recalibration of the fused features.

10. The improved YOLOv11-based garbage detection system according to claim 8, characterized in that: The C3k2_wConv module comprises a weighted convolution unit wConv2d, which weights the spatial response of the convolution kernel by performing element-wise multiplication modulation of the standard convolution kernel and a preset two-dimensional prior weighting matrix Φ, and the two-dimensional prior weighting matrix Φ is generated by an outer product operation of a one-dimensional vector α, which is constructed from a preset weight vector den, and has the format: a = [den, 1.0, den T ] where den T is the inverse sequence vector of the weight vector den.

Citation Information

Cited By

  • Visual intelligent detection method for accurately identifying stomach polyp

    CN121639690A