Recyclable garbage classification and identification method based on deep learning
By using the EfficientNetV1-B0 network model in recyclable garbage classification identification, combined with STN and CBAM modules, the problem of insufficient identification accuracy and speed in the prior art is solved, and efficient and accurate garbage classification is achieved.
Patent Information
- Application Number
- CN202411489848.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-24
- Publication Date
- 2025-03-14
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the classification and identification of recyclable garbage, it is difficult to ensure high accuracy while improving the computing detection speed.
A deep learning-based method is adopted, and an EfficientNetV1-B0 network model is used, and an STN module is added before the feature extraction module and a CBAM module is added in the middle. Through data augmentation and optimizer adjustment, the recognition accuracy of the model is improved.
It realizes accurate and rapid classification of recyclable garbage, improves identification accuracy, and reduces the demand for computing resources, and is suitable for intelligent garbage recycling devices.
Smart Images

Figure CN119625482A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image recognition technology, and in particular to a recyclable garbage image classification and recognition method based on a deep convolutional neural network. Background Art
[0002] With the rapid development of cities, economic development and population growth, the amount of domestic waste generated in countries around the world has increased, and many cities in the world are facing a waste disposal crisis. The task of waste sorting and recycling is the right way to reduce waste generation, alleviate the environment and improve the economy of the entire country.
[0003] At present, we classify domestic waste into four categories: recyclable waste, other waste, hazardous waste, and kitchen waste. Among them, recyclable waste has a higher value and can be recycled through classified recycling. Traditional methods of waste sorting can only be done by manual sorting and mechanical sorting. Manual sorting requires memorizing complex waste sorting rules, which requires a lot of learning costs for many people and has poor results. These methods are time-consuming and labor-intensive, and the cost is relatively high, and the sorting efficiency is low. Computer vision and deep learning technology are of great help in the task of classifying and identifying garbage. Only a simple RGB camera is needed to collect garbage images, and the task of garbage classification and identification can be completed through the algorithm of neural network. However, some common network models currently do not achieve good results in the application of garbage classification and identification tasks. In view of this, it is urgent to study a method that can improve the efficiency of garbage classification and identification while improving the accuracy. Summary of the invention
[0004] The technical problem to be solved by the present invention is to provide a recyclable waste classification and identification method based on deep learning, which can improve the calculation and detection speed while ensuring high accuracy.
[0005] The problem of the present invention is achieved as follows: A method for classifying and identifying recyclable waste based on deep learning comprises the following steps:
[0006] Step S1, obtaining a recyclable garbage image dataset, using data enhancement technology to fill the dataset and then dividing it into a training set and a test set;
[0007] Step S2, establishing a recyclable waste classification and recognition model based on EfficientNetV1-B0, adding an STN module before the feature extraction module of the model, and adding a CBAM module to the feature extraction module of the model to obtain an improved recyclable waste classification and recognition model;
[0008] Step S3, pre-processing the data set and inputting it into the improved recyclable waste classification and recognition model for training to obtain a trained model;
[0009] Step S4: input the test set into the trained model to verify the recyclable garbage and obtain the best model;
[0010] Step S5, deriving the best model for recyclable waste classification detection and further optimizing the recognition accuracy, to obtain the final recyclable waste classification recognition model for the waste classification system to call, to recognize and classify the waste images taken by the system.
[0011] Furthermore, the step S1 specifically includes:
[0012] S11, obtaining a dataset of recyclable garbage, the recyclable garbage including: plastic bottles, glass bottles, cardboard, waste paper and metal cans, and dividing them into different folders according to their categories and recording the category names and digital labels using txt files;
[0013] S12, use horizontal flipping and vertical flipping data enhancement methods to fill the dataset, and randomly divide it into training set and test set using a ratio of 8:2. Use normalization to process the image and resize it.
[0014] Furthermore, the step S2 specifically includes:
[0015] S21, the deep convolutional neural network used is the EfficientNetV1-B0 network model, which consists of multiple MBConv blocks, and also includes SE modules, average pooling layers, random dropout layers, and fully connected layers;
[0016] S22, first pass the STN module to correct the position of the main objects in the input image, then pass the obtained image through the MBConv block for feature extraction, and improve the MBConv block using the CBAM module. After passing through several MBConv blocks, use the average pooling layer to downsample the feature map to reduce the dimensional size, and then use the flattening layer to concatenate the feature maps of all channels into one-dimensional data, and finally output the classification result through the fully connected layer.
[0017] Furthermore, the STN module consists of three basic parts: a positioning function network, a grid generator and a sampler. The positioning function network consists of two sets of convolutional layers, a pooling layer, a Relu activation function and a fully connected layer, which is used to generate the spatial transformation parameters needed by the next part of the grid generator. The grid generator is composed of an affine transformation and is used to find the mapping between the output and input images. The sampler uses different sampling methods to correctly re-output the previous part of the output image.
[0018] Furthermore, the CBAM module is integrated in series by two basic parts: channel attention and spatial attention; the channel attention is composed of an average pooling layer, a maximum pooling layer, a multi-layer perceptron and a Sigmoid activation function, which is used to extract feature information in the channel dimension, and the spatial attention is composed of an average pooling layer, a maximum pooling layer, a convolutional layer and a Sigmoid activation function, which is used to extract feature information in the spatial dimension;
[0019] Specifically, in the channel attention module, two intermediate feature maps are generated using the average pooling layer and the maximum pooling layer respectively, and then the two feature maps are forwarded to the shared multi-layer perceptron, and the two feature maps are added element by element for feature fusion and then passed through the Sigmoid activation function to obtain the final channel attention feature vector; the operation of the channel attention module is expressed as follows:
[0020]
[0021] Where σ represents the Sigmoid function, MLP is a multi-layer perceptron, W0 and W1 are the weights of the perceptron, and It is the result of the input feature map of the channel attention module passing through the average pooling layer and the maximum pooling layer;
[0022] Forward the output of channel attention to the spatial attention module;
[0023] In the spatial attention module, the maximum pooling layer and the average pooling layer are first used to fuse the feature information on the channel and generate two feature maps, which are then concatenated in the channel dimension and then convolved using the convolution layer to generate a 2D spatial attention map; the operation of the spatial attention module is expressed as follows:
[0024]
[0025] Among them, σ represents the sigmoid function, f 7×7 represents a convolution operation with a convolution kernel size of 7. and It is the result of the input feature map of the spatial attention module passing through the average pooling layer and the maximum pooling layer.
[0026] Furthermore, the step S3 specifically includes:
[0027] S31, preprocessing the data set in step S1, including normalizing the image and resizing it, and converting it into a tensor for input into the model;
[0028] S32, input the training set processed by S31 into the recyclable waste classification and recognition model based on EfficientNetV1-B0, and calculate the loss function value by using the digital labels corresponding to the different category names in the txt file in S11 and the label prediction value output by the model;
[0029] S33. Use the loss function value to update the parameters of the model until the loss function result of the convolutional neural network converges, and the training is completed.
[0030] Furthermore, the step S4 specifically includes:
[0031] The test set is substituted into the garbage classification recognition model based on EfficientNetV1 for detection to obtain the detection result. The current accuracy is obtained according to the detection result, and it is determined whether the current accuracy reaches the preset accuracy. If so, step S5 is entered, otherwise, the optimizer or batch size is modified for retraining. The optimizer uses the Adam optimization algorithm, and the Adam optimizer is used to adjust the parameters during the back propagation process using the loss value calculated by the loss function to update the model until the detection accuracy is higher than the preset accuracy. The training is stopped to obtain the best model.
[0032] Furthermore, the Cross Entropy loss function is used as the loss function of the model to calculate the loss value between the predicted value and the true value, so as to evaluate the training process. The specific formula of the loss function is as follows:
[0033]
[0034] Among them, N represents the number of samples, M represents the number of categories, and y ic represents the sign function, which takes 1 if the true category of sample i is equal to c, otherwise it takes 0, p ic It represents the predicted probability that the observed sample i belongs to category c.
[0035] Furthermore, the step S5 specifically includes: after using the test set to detect the pros and cons of the model and optimizing it, exporting the best model, obtaining several pictures outside the data set to test the exported model, and if the recognition accuracy is lower than the preset value, re-modifying the learning rate and training rounds to continue training and optimization, so as to obtain the final recyclable waste classification and recognition model for the waste classification system to call and use for identifying and classifying the waste pictures taken by the system.
[0036] The advantages of the present invention are as follows: the present invention utilizes deep learning convolutional neural network technology, uses the lightweight network EfficientNetV1 as the network backbone, combines the STN module to perform spatial transformation on the input, and uses the CBAM module to improve the MBConv block in the model, uses the channel and spatial attention mechanism to extract the dual features of the channel and space, enhances the feature extraction capability, realizes accurate and rapid classification of recyclable garbage, and improves the recognition accuracy of the classification of recyclable garbage. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] The present invention will be further described below in conjunction with embodiments with reference to the accompanying drawings.
[0038] Figure 1 This is an execution flow chart of a recyclable waste classification and identification method based on deep learning in the present invention.
[0039] Figure 2 This is a schematic diagram of the improved EfficientNetV1-B0 network structure of the present invention, in which the feature extraction module consists of 7 improved MBConv blocks.
[0040] Figure 3 The structural diagram of the MBConv block after the CBAM attention mechanism is improved in this invention.
[0041] Figure 4 This figure shows the change in loss values of the improved EfficientNetV1-B0 network and other networks in the training set.
[0042] Figure 5 This figure shows the change in accuracy of recyclable garbage image classification prediction in the test set between the improved EfficientNetV1-B0 network of the present invention and other networks. DETAILED DESCRIPTION
[0043] The technical solution in the embodiment of the present application has the following overall idea: using deep learning convolutional neural network technology and low-cost cameras to realize the classification of recyclable garbage, it can solve the problem of low recognition rate of traditional recyclable garbage classification and identification requiring manual operation. In order to improve the accuracy of classification and identification of recyclable garbage, and to be able to be deployed on some intelligent devices with low storage performance. We use EfficientNetV1-B0 to reduce the amount of calculation and model size, and at the same time improve the recognition accuracy of recyclable garbage by improving the model, ensuring high accuracy while improving the calculation and detection speed, providing a more efficient recognition method for automated and intelligent garbage recycling bins or garbage sorting devices.
[0044] The whole process is as follows: first, the network model required by the present invention is built, and normal training is performed. Then, the test set of the data set is used to detect the pros and cons of the model. When the test set is used for detection, some underfitting, overfitting, local optimality, etc. of the model during training can be detected. However, the test set and the training set are derived from the same data set, because they are similar. Therefore, when there is no problem with the model after the test set is detected, some temporary photos or pictures not in the data set are used for detection. The selected photos and the photos taken also meet most of the features in the data set, which are basically pictures of single items under a simple background. Two-level optimization is used during optimization. If the model result is not good in the previous test set detection process, the optimizer or batch size is mainly modified. If the test result does not meet expectations during the detection after the model is exported, the learning rate and the number of training rounds will be modified. After two optimizations, the recognition accuracy of the model for recyclable garbage can be effectively improved.
[0045] In order to make the present invention more clearly understood, a preferred embodiment is now described in detail with reference to the accompanying drawings.
[0046] like Figure 1 As shown, a recyclable waste classification and identification method based on deep learning of the present invention comprises the following steps:
[0047] Step S1, obtaining a recyclable garbage image dataset, using data enhancement technology to fill the dataset and then dividing it into a training set and a test set;
[0048] Step S2, establishing a recyclable waste classification and recognition model based on EfficientNetV1-B0, adding an STN module before the feature extraction module of the model, and adding a CBAM module to the feature extraction module of the model to obtain an improved recyclable waste classification and recognition model;
[0049] Step S3, pre-processing the data set and inputting it into the improved recyclable waste classification and recognition model for training to obtain a trained model;
[0050] Step S4: input the test set into the trained model to verify the recyclable garbage and obtain the best model;
[0051] Step S5, deriving the best model for recyclable waste classification detection and further optimizing the recognition accuracy, to obtain the final recyclable waste classification recognition model for the waste classification system to call, to recognize and classify the waste images taken by the system.
[0052] Preferably, the step S1 specifically includes:
[0053] S11, obtain a recyclable garbage dataset, which can be obtained by obtaining photos of various categories of recyclable garbage through relevant public datasets or web crawlers or mobile phone photography, and classify the collected photos. The recyclable garbage includes: plastic bottles, glass bottles, cardboard, waste paper and metal cans, and is divided into different folders according to its category. The category name and digital label are recorded in a txt file and used as the target for neural network training. The digital label here can be specified at will, but it must be guaranteed that it cannot be repeated;
[0054] S12, use horizontal flipping and vertical flipping data augmentation methods to fill the dataset, and use a ratio of 8:2 to randomly divide it into independent and non-repetitive training sets and test sets. Use normalization to process the images and resize them, and resize all images to 224×224 to meet the input image format of the model.
[0055] Preferably, the step S2 specifically includes:
[0056] S21, the deep convolutional neural network used is the EfficientNetV1-B0 network model, which consists of multiple MBConv blocks, and also includes SE modules, average pooling layers, random dropout layers, and fully connected layers;
[0057] S22, firstly, the position of the main object in the input image is corrected by the STN module, and then the obtained image is extracted by the MBConv block, and the MBConv block is improved by the CBAM module. After passing through several MBConv blocks, the feature map is downsampled using the average pooling layer to reduce the dimension size, and then the feature maps of all channels are concatenated into one-dimensional data using the flattening layer, and finally the classification result is output through the fully connected layer. The improved model structure is as follows: Figure 2 As shown, the STN module is used before the feature extraction module to correct the image body.
[0058] The improved MBConv block is as follows Figure 3As shown in the figure, the CBAM attention mechanism is added after the SE module. Specifically, the improved MBConv block includes Expand Conv, DW Conv, SE, CBAM, Project Conv and Dropout modules connected in sequence, where Expand Conv is an extended convolution, which is a key module of EfficientNetV1 and is mainly used to expand the number of channels of the input feature map. Through 1x1 convolution, the number of input channels is expanded to provide more feature dimensions for subsequent deep convolution. When the input image passes through this layer, the number of channels increases and the feature representation capability is enhanced. DW Conv (Depthwise Convolution) is used to perform deep convolution, which convolves each input channel independently with its corresponding convolution kernel, thereby greatly reducing the amount of calculation. In this way, spatial information can be retained and the model complexity can be reduced. Each channel is processed independently, the spatial structure of the input is maintained, and the calculation efficiency is high. SE (Squeeze and Excitation) is used to adaptively assign weights to each channel, "compress" the feature map (global pooling) through global information, then calculate the importance of each channel through the fully connected layer, and finally re-weight each channel (excitation). After the feature map is globally averaged pooled, a set of weights representing the importance of the channel is generated, and then multiplied element by element with the input feature. CBAM (Convolutional Block Attention Module) combines channel and spatial attention mechanisms to enhance the network's capture of key features. The channel attention module assigns weights according to the channel dimension, while the spatial attention module highlights important areas according to the spatial dimension. In this module, the channels in the feature map are first weighted by the channel attention module, and then the representation of the key areas is further improved in the spatial dimension by the spatial attention module. Project Conv (projection convolution) is used to project high-dimensional features back to lower dimensions through 1x1 convolution, reduce computational overhead, and ensure that redundant information is reduced while maintaining the main features. After the input high-dimensional feature map passes through this layer, the number of channels is reduced, so that subsequent processing is more lightweight.
[0059] The data flow processing between each module in the improved MBConv block is as follows:
[0060] 1. The input data first passes through the Expand Conv module to expand the number of channels and provide more feature information for subsequent processing.
[0061] 2. The expanded data enters the DW Conv module for deep convolution. Each channel is processed independently, which effectively preserves the spatial features while significantly reducing the amount of calculation.
[0062] 3. The SE module then compresses and excites the features, calculates the importance weight of each channel through global pooling, and then weights each channel to highlight the key channels.
[0063] 4. In some improved models, the feature map passes through the CBAM module, which first uses channel attention (enhancing important channels) and then uses spatial attention (enhancing spatial features) to further optimize the feature extraction effect.
[0064] 5. The feature map then passes through the Project Conv module to reproject the high-dimensional features into lower dimensions, reducing computational overhead and reducing redundant information.
[0065] 6. After being processed by the Dropout module, some neurons are randomly inactivated to avoid overfitting.
[0066] 7. Finally, the feature map is added element by element (⊕) to fuse different features between multiple paths and complete the final feature extraction.
[0067] The STN module consists of three basic parts: a positioning function network, a grid generator and a sampler. The positioning function network consists of two groups of convolutional layers, a pooling layer, a Relu activation function and a fully connected layer, which is used to generate the spatial transformation parameters needed by the next part of the grid generator. The grid generator consists of an affine transformation, which is used to find the mapping between the output and input images. The sampler uses different sampling methods to correctly re-output the previous part of the output image. Specifically, in the STN module, the image is first input into two groups of convolutional layers, a maximum pooling layer and a Relu activation function through a positioning function network, and then the above output is reduced in dimension. To one dimension, two fully connected layers are used to obtain the parameters needed for subsequent use. The number of parameters, that is, the output of the last fully connected layer, depends on the affine transformation method used by the grid generator. The grid generator uses affine transformation on the original input according to the parameters of the previous step. Finally, the sampler processes the image after affine transformation to ensure that it can be differentiable during network training. According to the size of the model input image, it is necessary to modify the parameters of the fully connected layer in the positioning function network in the STN module, and place this module before the feature extraction part of the EfficientNetV1-B0 model. Image correction can improve the ability to extract feature information.
[0068] The CBAM module is composed of two basic parts integrated in series: channel attention and spatial attention; the channel attention consists of an average pooling layer, a maximum pooling layer, a multi-layer perceptron and a Sigmoid activation function, which is used to extract feature information in the channel dimension, and the spatial attention consists of an average pooling layer, a maximum pooling layer, a convolutional layer and a Sigmoid activation function, which is used to extract feature information in the spatial dimension.
[0069] In the channel attention module, two intermediate feature maps are generated using the average pooling layer and the maximum pooling layer respectively, and then the two feature maps are forwarded to the shared multi-layer perceptron. The two feature maps are added element by element for feature fusion and then passed through the Sigmoid activation function to obtain the final channel attention feature vector; the operation process of the channel attention module is as follows:
[0070]
[0071] Where σ represents the Sigmoid function, MLP is a multi-layer perceptron, W0 and W1 are the weights of the perceptron, and It is the result of the input feature map of the channel attention module passing through the average pooling layer and the maximum pooling layer;
[0072] Forward the output of channel attention to the spatial attention module;
[0073] In the spatial attention module, the maximum pooling layer and the average pooling layer are first used to fuse the feature information on the channel and generate two feature maps, which are then concatenated in the channel dimension and convolved using the convolution layer to generate a 2D spatial attention map. The operation of the spatial attention module can be summarized as follows:
[0074]
[0075] Among them, σ represents the sigmoid function, f 7×7 represents a convolution operation with a convolution kernel size of 7. and It is the result of the input feature map of the spatial attention module passing through the average pooling layer and the maximum pooling layer.
[0076] Preferably, the step S3 specifically includes:
[0077] S31, preprocessing the data set in step S1, including normalizing the image and resizing it, and converting it into a tensor for input into the model;
[0078] S32. Input the training set processed by S31 into the recyclable waste classification and recognition model based on EfficientNetV1-B0, and use the digital labels corresponding to the different category names in the txt file in S11 and the label prediction values output by the model to calculate the loss function value; EfficientNetV1-B0 is a lightweight deep learning model with high recognition accuracy and fast computing speed, which is very suitable for recyclable waste classification and recognition tasks. We input the image data of the training set and the corresponding label data (i.e., the digital labels corresponding to the different category names in the txt file in S11) into the model, and the model will output the predicted label value based on the input image data.
[0079] S33. Update the parameters of the model using the loss function value until the loss function result of the convolutional neural network converges and the training is completed. Specifically, compare the label prediction value output by the model with the true label value, calculate the difference between the two using the cross entropy loss function, and obtain the loss function value. Cross Entropy Loss can be used to calculate the loss function value for model training. During the training process, the parameters of the model are continuously iterated and updated to minimize the loss function value.
[0080] Preferably, the step S4 specifically includes:
[0081] When the loss function result of the convolutional neural network converges, the test set is substituted into the garbage classification recognition model based on EfficientNetV1 for detection to obtain the detection result. The current accuracy is obtained according to the detection result, and it is determined whether the current accuracy reaches the preset accuracy. If so, step S5 is entered, otherwise, the optimizer or batch size is modified for retraining. The optimizer uses the Adam optimization algorithm, and the Adam optimizer is used to adjust the parameters during the back propagation process using the loss value calculated by the loss function to update the model until the detection accuracy is higher than the preset accuracy, and the training is stopped to obtain the best model.
[0082] Preferably, the Cross Entropy loss function is used as the loss function of the model to calculate the loss value between the predicted value and the true value, so as to evaluate the training process. The specific formula of the loss function is as follows:
[0083]
[0084] Among them, N represents the number of samples, M represents the number of categories, and y ic represents the sign function, which takes 1 if the true category of sample i is equal to c, otherwise it takes 0, p ic It represents the predicted probability that the observed sample i belongs to category c.
[0085] Preferably, step S5 specifically includes: after using the test set to detect the quality of the model and optimizing it, deriving the best model, obtaining several pictures outside the data set to detect the derived model, and if the recognition accuracy is lower than the preset value, re-modifying the learning rate and training rounds to continue training and optimization, and obtaining the final recyclable garbage classification recognition model for the garbage classification system to call, and to identify and classify the garbage pictures taken by the system. Specifically, the garbage classification system obtains the garbage location through image processing and controls the robot arm to grab and place the classified garbage, so as to achieve the sorting task for different recyclable garbage.
[0086] In order to verify the reliability of the method of the present invention, the network model constructed by the present invention is compared with other typical networks for experiments. Figure 4 , Figure 5 The figure shows the changes in the accuracy and loss rate of image classification prediction of the EfficientNetV1-B0 network and other typical networks in the test set (where EffV1-stn-cbam is the abbreviation of the method of the present invention). Obviously, the classification accuracy of the EfficientNetV1-B0 network model is better than that of other networks.
[0087] In summary, the advantages of the present invention are as follows:
[0088] The recyclable garbage classification and identification method based on deep learning provided by the present invention performs garbage classification and identification through camera captured images, has high detection speed and accuracy, and automatically identifies recyclable garbage in garbage images by using deep learning models, providing algorithm support for intelligent and automated garbage recycling devices. The use of EfficientNetV1-B0 can reduce the amount of calculation and model size, and at the same time, the STN module is used before the model feature extraction part to correct the image main body position, and the CBAM attention mechanism is integrated into the MBCo-nv block of the model to fuse the feature information in the spatial and channel dimensions, thereby improving the accuracy of recyclable garbage identification.
[0089] Although the specific implementation modes of the present invention are described above, those skilled in the art should understand that the specific implementation modes described are only illustrative and are not intended to limit the scope of the present invention. Equivalent modifications and changes made by those skilled in the art in accordance with the spirit of the present invention should be included in the scope of protection of the claims of the present invention.
Claims
1. A method for classifying and identifying recyclable waste based on deep learning, characterized in that: The steps include: Step S1, obtaining a recyclable garbage image dataset, using data enhancement technology to fill the dataset and then dividing it into a training set and a test set; Step S2, establishing a recyclable waste classification and recognition model based on EfficientNetV1-B0, adding an STN module before the feature extraction module of the model, and adding a CBAM module to the feature extraction module of the model to obtain an improved recyclable waste classification and recognition model; Step S3, pre-processing the data set and inputting it into the improved recyclable waste classification and recognition model for training to obtain a trained model; Step S4: input the test set into the trained model to verify the recyclable garbage and obtain the best model; Step S5, deriving the best model for recyclable waste classification detection and further optimizing the recognition accuracy, to obtain the final recyclable waste classification recognition model for the waste classification system to call, to recognize and classify the waste images taken by the system.
2. The method for classifying and identifying recyclable waste based on deep learning according to claim 1, characterized in that: The step S1 specifically includes: S11, obtaining a dataset of recyclable garbage, the recyclable garbage including: plastic bottles, glass bottles, cardboard, waste paper and metal cans, and dividing them into different folders according to their categories and recording the category names and digital labels using txt files; S12, use horizontal flipping and vertical flipping data enhancement methods to fill the dataset, and randomly divide it into training set and test set using a ratio of 8:
2. Use normalization to process the image and resize it.
3. The method for classifying and identifying recyclable waste based on deep learning as claimed in claim 1, characterized in that: The step S2 specifically includes: S21, the deep convolutional neural network used is the EfficientNetV1-B0 network model, which consists of multiple MBConv blocks, and also includes SE modules, average pooling layers, random dropout layers, and fully connected layers; S22, first pass the STN module to correct the position of the main objects in the input image, then pass the obtained image through the MBConv block for feature extraction, and improve the MBConv block using the CBAM module. After passing through several MBConv blocks, use the average pooling layer to downsample the feature map to reduce the dimensional size, and then use the flattening layer to concatenate the feature maps of all channels into one-dimensional data, and finally output the classification result through the fully connected layer.
4. The method for classifying and identifying recyclable waste based on deep learning according to claim 1, characterized in that: The STN module consists of three basic parts: a positioning function network, a grid generator and a sampler. The positioning function network consists of two sets of convolutional layers, a pooling layer, a Relu activation function and a fully connected layer, which is used to generate the spatial transformation parameters needed by the next part of the grid generator. The grid generator consists of an affine transformation and is used to find the mapping between the output and input images. The sampler uses different sampling methods to correctly re-output the previous part of the output image.
5. The method for classifying and identifying recyclable waste based on deep learning according to claim 1, characterized in that: The CBAM module is integrated in series by two basic parts: channel attention and spatial attention; the channel attention is composed of an average pooling layer, a maximum pooling layer, a multi-layer perceptron and a Sigmoid activation function, which is used to extract feature information in the channel dimension; the spatial attention is composed of an average pooling layer, a maximum pooling layer, a convolutional layer and a Sigmoid activation function, which is used to extract feature information in the spatial dimension; Specifically, in the channel attention module, two intermediate feature maps are generated using the average pooling layer and the maximum pooling layer respectively, and then the two feature maps are forwarded to the shared multi-layer perceptron, and the two feature maps are added element by element for feature fusion and then passed through the Sigmoid activation function to obtain the final channel attention feature vector; the operation of the channel attention module is expressed as follows: Where σ represents the Sigmoid function, MLP is a multi-layer perceptron, W0 and W1 are the weights of the perceptron, and It is the result of the input feature map of the channel attention module passing through the average pooling layer and the maximum pooling layer; Forward the output of channel attention to the spatial attention module; In the spatial attention module, the maximum pooling layer and the average pooling layer are first used to fuse the feature information on the channel and generate two feature maps, which are then concatenated in the channel dimension and then convolved using the convolution layer to generate a 2D spatial attention map; the operation of the spatial attention module is expressed as follows: Among them, σ represents the sigmoid function, f 7×7 represents a convolution operation with a convolution kernel size of 7. and It is the result of the input feature map of the spatial attention module passing through the average pooling layer and the maximum pooling layer.
6. The method for classifying and identifying recyclable waste based on deep learning as claimed in claim 2, characterized in that: The step S3 specifically includes: S31, preprocessing the data set in step S1, including normalizing the image and resizing it, and converting it into a tensor for input into the model; S32, input the training set processed by S31 into the recyclable waste classification and recognition model based on EfficientNetV1-B0, and calculate the loss function value by using the digital labels corresponding to the different category names in the txt file in S11 and the label prediction value output by the model; S33. Use the loss function value to update the parameters of the model until the loss function result of the convolutional neural network converges, and the training is completed.
7. The method for classifying and identifying recyclable waste based on deep learning according to claim 1, characterized in that: The step S4 specifically includes: The test set is substituted into the garbage classification recognition model based on EfficientNetV1 for detection to obtain the detection result. The current accuracy is obtained according to the detection result, and it is determined whether the current accuracy reaches the preset accuracy. If so, step S5 is entered, otherwise, the optimizer or batch size is modified for retraining. The optimizer uses the Adam optimization algorithm, and the Adam optimizer is used to adjust the parameters during the back propagation process using the loss value calculated by the loss function to update the model until the detection accuracy is higher than the preset accuracy. The training is stopped to obtain the best model.
8. The method for classifying and identifying recyclable waste based on deep learning according to claim 1, characterized in that: The Cross Entropy loss function is used as the loss function of the model to calculate the loss value between the predicted value and the true value, so as to evaluate the training process. The specific formula of the loss function is as follows: Among them, N represents the number of samples, M represents the number of categories, and y ic represents the sign function, which takes 1 if the true category of sample i is equal to c, otherwise it takes 0, p ic It represents the predicted probability that the observed sample i belongs to category c.
9. The method for classifying and identifying recyclable waste based on deep learning according to claim 1, characterized in that: The step S5 specifically includes: after using the test set to verify the quality of the model and optimize it, deriving the best model, obtaining several pictures outside the data set to test the derived model, and if the recognition accuracy is lower than the preset value, re-modifying the learning rate and training rounds to continue training and optimization, so as to obtain the final recyclable waste classification and recognition model for the waste classification system to call and use for identifying and classifying the waste pictures taken by the system.
Citation Information
Patent Citations
Garbage classification and identification method and system based on deep learning
CN116416476A
Deep learning-based junk image classification and identification method
CN116434061A
Quick and intelligent IR7-EC network based classification method for concrete image crack type
US20240029402A1