An intelligent garbage classification method and system based on multi-attention mechanism

By introducing a multi-attention mechanism into the YOLOv8n model, the problems of high model complexity and large calculation volume in the existing garbage classification technology are solved, and efficient and accurate garbage classification effect is achieved, which is suitable for practical applications.

CN119762873APending Publication Date: 2025-04-04Shanxi Taihang Laboratory Co., Ltd.
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411919853.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

The existing garbage classification technology has the problems of high complexity of the model, long training time, and large calculation amount, making it difficult to apply to actual garbage classification work.

Method used

The intelligent garbage classification method based on multi-attention mechanism is adopted, and the performance of the YOLOv8n model is enhanced, especially garbage classification in complex contexts by introducing spatial block attention modules, channel attention mechanism modules and effective channel attention mechanism modules.

Benefits of technology

It significantly improves the accuracy and detection efficiency of garbage classification, reduces the misclassification rate, reduces the computational complexity, and is suitable for resource allocation equipment and real-time garbage classification applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119762873A_ABST
    Figure CN119762873A_ABST
Patent Text Reader

Abstract

The present invention discloses an intelligent garbage classification method and system based on a multi-attention mechanism, and relates to the field of artificial intelligence and computer vision technology. The method comprises: obtaining garbage data; preprocessing the obtained garbage data; dividing the preprocessed garbage data into a training set, a verification set and a test set; inputting the training set into a YOLOv8n model, training the parameters in the YOLOv8n model, and obtaining a trained YOLOv8n model after several trainings; inputting the test set into the trained YOLOv8n model to obtain a garbage classification result, and using the verification set to verify the garbage classification result to realize intelligent garbage classification. The present invention effectively enhances the performance of the YOLOv8n model in garbage classification by introducing an attention mechanism, and significantly improves the classification accuracy and detection efficiency, especially in scenes with complex backgrounds.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence and computer vision technology, and in particular to an intelligent garbage classification method and system based on a multi-attention mechanism. Background Art

[0002] With the continuous growth of the country's population and the rapid development of the economy, the living standards of residents have significantly improved, and the production of domestic garbage has increased dramatically. Domestic garbage, as a common waste in daily life, will cause serious pollution to the environment and lead to a huge waste of resources if it is not handled properly. At present, the main method of garbage classification and recycling in my country still relies on manual sorting. Manual sorting has problems such as long time consumption, low efficiency, poor working environment and low accuracy. At the same time, some toxic and hazardous garbage also poses potential risks to the health and safety of workers. With the continuous development of deep learning technology, the use of deep learning algorithms for intelligent classification and identification of garbage has become a new research direction. ZHANG et al. proposed a garbage classification model (CTR) based on ResNet18. By adding a self-monitoring module to the residual network, the features of each channel mapping are effectively integrated, the compression of spatial dimension features is realized, and the representation ability of the feature map is improved. However, the model complexity is high, resulting in a long training time. Kumsetty et al. created a new dataset to address the lack of medical waste and electronic waste categories in the existing dataset, and proposed a garbage detection and classification method based on incremental transfer learning. However, incremental transfer learning may cause conflicts between new and old data, affecting the stability and accuracy of the model. Li et al. proposed a multimodal cascade convolutional neural network (MCCNN) specifically for the detection and classification of domestic waste images, and developed a smart waste bin (STC) system based on this model, but the complexity of the multimodal cascade network increases the computational and resource consumption. NOWAKOWSKI et al. used a convolutional neural network (CNN) to classify waste types and detected waste through a regional convolutional neural network (R-CNN), and these methods performed well in recognition efficiency. However, the high computational complexity and slow detection of R-CNN limit its feasibility in real-time applications. Wu et al. constructed a detection model based on YOLOV3-MobileNetV3_Lite, providing an efficient solution for the waste detection system and successfully deployed it on the NVIDIA JetsonNano platform. Liu et al. proposed a lightweight YOLOX domestic waste detection model i-YOLOX. However, the detection accuracy of the lightweight model may be affected when dealing with complex scenes. The YOLOv7 target detection model proposed by Wang et al. shows higher detection accuracy and faster detection speed in comparison with previous models, bringing new breakthroughs in the field of real-time target detection.

[0003] Combined with previous research, it is found that most garbage classification data sets have relatively few categories, while the number of basic domestic waste types is large, and most studies focus on improving accuracy but ignore model complexity and computational complexity, resulting in some models with high computational complexity and long training time, making them difficult to apply to actual garbage classification work.

[0004] Therefore, it is an urgent problem for technical personnel in this field to propose an intelligent garbage classification method and system based on a multi-attention mechanism to solve the difficulties existing in the prior art. Summary of the invention

[0005] In view of this, the present invention provides an intelligent garbage classification method and system based on a multi-attention mechanism. By introducing the attention mechanism, the performance of the YOLOv8n model in garbage classification is effectively enhanced, especially in scenes with complex backgrounds, which significantly improves the classification accuracy and detection efficiency.

[0006] In order to achieve the above object, the present invention adopts the following technical solution:

[0007] An intelligent garbage classification method based on a multi-attention mechanism comprises the following steps:

[0008] S1. Get data: Get junk data;

[0009] S2. Data preprocessing: preprocess the acquired garbage data;

[0010] S3. Data division: divide the preprocessed garbage data into training set, validation set and test set;

[0011] S4. Network training: Input the training set into the YOLOv8n model, train the parameters in the YOLOv8n model, and obtain the trained YOLOv8n model after several trainings;

[0012] S5. Classification and recognition: Input the test set into the trained YOLOv8n model to obtain the garbage classification results, and use the validation set to verify the garbage classification results to achieve intelligent garbage classification.

[0013] In the above method, optionally, in S1, garbage image data is collected from the intelligent classification garbage dump.

[0014] In the above method, optionally, S3 divides the preprocessed garbage data into a training set, a validation set, and a test set in a ratio of 7:2:1.

[0015] In the above method, optionally, S4 uses YOLOv8n as the basic network structure, and combines the spatial block attention module, the channel attention mechanism module and the effective channel attention mechanism module to construct the YOLOv8n model; wherein,

[0016] Spatial block attention module, which is used to combine spatial and channel attention to enhance classification ability;

[0017] Channel attention mechanism module, used to dynamically adjust the feature weights between channels;

[0018] An effective channel attention mechanism module is used for cross-channel interaction to achieve feature extraction.

[0019] The above method optionally introduces a spatial block attention module, a channel attention mechanism module and an effective channel attention mechanism module on the Backbone network, Neck network and Head network of the YOLOv8n model.

[0020] An intelligent garbage classification system based on a multi-attention mechanism, applying any of the above-mentioned intelligent garbage classification methods based on a multi-attention mechanism, comprising: a data acquisition module, a data preprocessing module, a data partitioning module, a network training module and a classification recognition module;

[0021] A data acquisition module is connected to the input end of the data preprocessing module and is used to acquire garbage data;

[0022] A data preprocessing module, connected to the input end of the data partitioning module, for preprocessing the acquired garbage data;

[0023] A data partitioning module, connected to the input end of the network training module, is used to partition the pre-processed garbage data into a training set, a validation set, and a test set;

[0024] The network training module is connected to the input end of the classification and recognition module, and is used to input the training set into the YOLOv8n model, train the parameters in the YOLOv8n model, and obtain the trained YOLOv8n model after several trainings;

[0025] The classification recognition module is connected to the output end of the network training module and is used to input the test set into the trained YOLOv8n model to obtain the garbage classification result, and use the verification set to verify the garbage classification result to realize intelligent garbage classification.

[0026] It can be seen from the above technical solutions that, compared with the prior art, the present invention provides an intelligent garbage classification method and system based on a multi-attention mechanism, which has the following beneficial effects:

[0027] (1) The present invention effectively enhances the performance of the YOLOv8n model in garbage classification by introducing the attention mechanism, especially in scenes with complex backgrounds, significantly improving the classification accuracy and detection efficiency;

[0028] (2) The present invention introduces multiple attention mechanisms to enable the model to better capture key information and reduce the misclassification rate;

[0029] (3) The present invention adopts a lightweight YOLOv8n structure and combines it with an efficient attention mechanism to significantly reduce the computational complexity while ensuring classification performance. It is suitable for resource allocation equipment and real-time garbage classification applications.

[0030] (4) The YOLOv8n model of the present invention performs well in different types of garbage and complex backgrounds, has perfect generalization capabilities, and is suitable for application in intelligent garbage sorting equipment and actual environments. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0032] Figure 1 A flow chart of an intelligent garbage classification method based on a multi-attention mechanism provided by the present invention;

[0033] Figure 2 The data distribution diagram provided by the present invention, wherein 2a is the garbage classification data set, 2b is the length and width of each box after all boxes are fixed at the coordinates [1000,1000], 2c is the distribution of the center point of the detection target, and 2d is the distribution of the length and width of the detection target;

[0034] Figure 3 A schematic diagram of the location of the attention mechanism added to the YOLOv8n structure provided by the present invention;

[0035] Figure 4 This is a schematic diagram of the CSPLayer_2Conv module structure provided by the present invention. DETAILED DESCRIPTION

[0036] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0037] Reference Figure 1 As shown, the present invention discloses an intelligent garbage classification method based on a multi-attention mechanism, comprising the following steps:

[0038] S1. Get data: Get junk data;

[0039] S2. Data preprocessing: preprocess the acquired garbage data;

[0040] S3. Data division: divide the preprocessed garbage data into training set, validation set and test set;

[0041] S4. Network training: Input the training set into the YOLOv8n model, train the parameters in the YOLOv8n model, and obtain the trained YOLOv8n model after several trainings;

[0042] S5. Classification and recognition: Input the test set into the trained YOLOv8n model to obtain the garbage classification results, and use the validation set to verify the garbage classification results to achieve intelligent garbage classification.

[0043] Furthermore, garbage image data is collected from the intelligent classification garbage dump in S1.

[0044] Furthermore, in S3, the preprocessed garbage data is divided into a training set, a validation set, and a test set in a ratio of 7:2:1.

[0045] Furthermore, S4 uses YOLOv8n as the basic network structure, and combines the spatial block attention module, channel attention mechanism module and effective channel attention mechanism module to build the YOLOv8n model;

[0046] in,

[0047] Spatial block attention module, which is used to combine spatial and channel attention to enhance classification ability;

[0048] Channel attention mechanism module, used to dynamically adjust the feature weights between channels;

[0049] An effective channel attention mechanism module is used for cross-channel interaction to achieve feature extraction.

[0050] Furthermore, the spatial block attention module, channel attention mechanism module and effective channel attention mechanism module are introduced on the Backbone network, Neck network and Head network of the YOLOv8n model.

[0051] In a specific embodiment, the following are included

[0052] The data set used in this paper comes from an intelligent classification garbage dump, covering 24 garbage categories and a total of 7667 images. The distribution of the data is as follows Figure 2 As shown in the figure, 2a is the garbage classification dataset, 2b is the length and width of each box after all boxes are fixed at the coordinates [1000,1000], 2c is the distribution of the center points of the detection targets, and 2d is the distribution of the length and width of the detection targets. To ensure the scientific nature of the experiment and the reliability of the results, the dataset is divided into training set, validation set and test set in a ratio of about 7:2:1. Specifically, the training set contains 5330 pictures, the validation set contains 1587 pictures, and the test set contains 750 pictures. This division method ensures that the model can obtain sufficient and balanced data support in each stage of training, validation and testing, thereby improving the credibility of the experimental results.

[0053] In order to evaluate the impact of different attention mechanisms on the performance of the YOLOv8n model, a series of comparative experiments were designed:

[0054] (1) Single attention mechanism experiment: Different types of attention mechanisms are introduced on the basic YOLOv8n model to compare their performance on the validation set and the test set. The introduction of the single attention mechanism aims to evaluate the impact of each mechanism on the model performance. Figure 3 shown.

[0055] (2) Experiments to improve the CSPLayer_2Conv module: Introduce the attention mechanism into the CSPLayer_2Conv module. The specific experiments are as follows: Figure 4 As shown, the performance changes before and after the improvement are verified and its impact on the model performance is analyzed.

[0056] (3) Combined attention mechanism experiment: Combine multiple attention mechanisms to evaluate their synergistic effect on model performance. Through different combinations, we explore the interaction between attention mechanisms and their comprehensive impact on model performance. Table 1 shows the specific improvements made on the YOLOv8n model by introducing different attention mechanisms and their combinations.

[0057] Table 1 Experimental design of different attention mechanism combinations of YOLOv8n model

[0058]

[0059] Each experiment corresponds to a specific attention mechanism combination and introduction position to systematically evaluate its impact on the performance of the YOLOv8n model. Figure 3 and Figure 4 As shown, a1, b1 and c1 correspond to Figure 3 Position ① in the figure means that the attention mechanism is added to the front of the CSPLayer_2Conv module in Backbone; a2, b2 and c2 correspond to Figure 3 Attention mechanism is added to the three outputs of Backbone in position ②; a3, b3 and c3 correspond to Figure 3 Position ③ in the figure, the attention mechanism is added after the concat structure; a4, b4 and c4 correspond to Figure 3 Position ④ in the figure means adding an attention mechanism in front of the head; a5, b5 and c5 correspond to Figure 4 Position ⑤ in , that is, the attention mechanism is introduced in the CSPLayer_2Conv module.

[0060] To ensure the scientificity and repeatability of the experiment, the model training was carried out in a unified hardware and software environment. The hardware environment includes 8 V100S graphics cards, each with 32GB of video memory. The software environment uses CUDA 11.4 and PyTorch 1.12.1.

[0061] The training settings are: training image size is 640, batch size is 512, Adam is selected as the optimizer, initial learning rate is 4e-3, final learning rate is adjusted to 1e-4, and the number of training rounds is 300. Other parameters use the default YOLOv8 version. Through debugging and verification, these training parameters ensure that the model can converge stably and achieve good classification results under different experimental conditions.

[0062] and Figure 1 Corresponding to the method described above, an embodiment of the present invention further provides an intelligent garbage classification system based on a multi-attention mechanism, including: a data acquisition module, a data preprocessing module, a data partitioning module, a network training module and a classification recognition module;

[0063] A data acquisition module is connected to the input end of the data preprocessing module and is used to acquire garbage data;

[0064] A data preprocessing module, connected to the input end of the data partitioning module, for preprocessing the acquired garbage data;

[0065] A data partitioning module, connected to the input end of the network training module, is used to partition the pre-processed garbage data into a training set, a validation set, and a test set;

[0066] The network training module is connected to the input end of the classification and recognition module, and is used to input the training set into the YOLOv8n model, train the parameters in the YOLOv8n model, and obtain the trained YOLOv8n model after several trainings;

[0067] The classification recognition module is connected to the output end of the network training module and is used to input the test set into the trained YOLOv8n model to obtain the garbage classification result, and use the verification set to verify the garbage classification result to realize intelligent garbage classification.

[0068] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.

[0069] The above description of the disclosed embodiments enables one skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to one skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. An intelligent garbage classification method based on multi-attention mechanism, characterized in that: The following steps are involved: S1. Get data: Get junk data; S2. Data preprocessing: preprocess the acquired garbage data; S3. Data division: divide the preprocessed garbage data into training set, validation set and test set; S4. Network training: Input the training set into the YOLOv8n model, train the parameters in the YOLOv8n model, and obtain the trained YOLOv8n model after several trainings; S5. Classification and recognition: Input the test set into the trained YOLOv8n model to obtain the garbage classification results, and use the validation set to verify the garbage classification results to achieve intelligent garbage classification.

2. According to claim 1, the intelligent garbage classification method based on multi-attention mechanism is characterized in that: In S1, garbage image data is collected from the smart classification garbage dump.

3. The intelligent garbage classification method based on multi-attention mechanism according to claim 1 is characterized in that: In S3, the preprocessed garbage data is divided into training set, validation set and test set in the ratio of 7:2:

1.

4. The intelligent garbage classification method based on multi-attention mechanism according to claim 1 is characterized in that: S4 uses YOLOv8n as the basic network structure, and combines the spatial block attention module, channel attention mechanism module and effective channel attention mechanism module to build the YOLOv8n model; Spatial block attention module, which is used to combine spatial and channel attention to enhance classification ability; Channel attention mechanism module, used to dynamically adjust the feature weights between channels; An effective channel attention mechanism module is used for cross-channel interaction to achieve feature extraction.

5. The intelligent garbage classification method based on multi-attention mechanism according to claim 4 is characterized in that: The spatial block attention module, channel attention mechanism module and effective channel attention mechanism module are introduced on the Backbone network, Neck network and Head network of the YOLOv8n model.

6. An intelligent garbage classification method based on multi-attention mechanism, characterized in that: An intelligent garbage classification system based on a multi-attention mechanism according to any one of claims 1 to 5 is applied, comprising: a data acquisition module, a data preprocessing module, a data partitioning module, a network training module and a classification recognition module; A data acquisition module is connected to the input end of the data preprocessing module and is used to acquire garbage data; A data preprocessing module, connected to the input end of the data partitioning module, for preprocessing the acquired garbage data; A data partitioning module, connected to the input end of the network training module, is used to partition the pre-processed garbage data into a training set, a validation set, and a test set; The network training module is connected to the input end of the classification and recognition module, and is used to input the training set into the YOLOv8n model, train the parameters in the YOLOv8n model, and obtain the trained YOLOv8n model after several trainings; The classification recognition module is connected to the output end of the network training module and is used to input the test set into the trained YOLOv8n model to obtain the garbage classification result, and use the verification set to verify the garbage classification result to realize intelligent garbage classification.