Water garbage detection method and system
Through the improved YOLOv7 model, the problems of high labor costs and inaccurate detection in the existing technology are solved, efficient and accurate identification of water garbage, and the efficiency of water environmental protection is improved.
Patent Information
- Application Number
- CN202410991609.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-23
- Publication Date
- 2024-12-06
AI Technical Summary
The existing water waste detection methods rely on human resources, are inefficient and inaccurate in detection, and cannot effectively deal with garbage in urban waters.
The improved YOLOv7 model is adopted, including the backbone network, the neck network and the head network. Through feature extraction and fusion, accurate identification and detection of real-time water surface pictures can be achieved, reducing labor costs and improving detection efficiency.
It significantly improves the accuracy and work efficiency of garbage identification, reduces the misidentification rate, and provides more reliable technical support for water environmental protection.
Smart Images

Figure CN119091182A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of garbage detection, and in particular to a method and system for detecting garbage on water. Background Art
[0002] With the increase of human activities and the advancement of urbanization, a large amount of garbage is discharged into the rivers, lakes and oceans of cities. These urban water garbage include plastic products, glass bottles, metal waste, chemical containers, etc. They not only come from the domestic waste of urban residents, but also from industrial production, shipping, municipal facilities and other fields. These urban waters not only directly damage the stability and diversity of urban water ecosystems, but also affect the cleanliness of water quality. In addition, urban water garbage may also block waterways, affect shipping safety, increase urban maintenance and cleaning costs, and have an adverse impact on urban economic development.
[0003] At present, most methods of dealing with urban water garbage in my country still rely on manual garbage recycling, which wastes a lot of human resources and is inefficient; a small part uses self-priming water garbage cans plus manpower for treatment. Although this reduces the waste of human resources, the scope of self-priming water garbage cans is limited, and a lot of manpower is still wasted for garbage recycling. Summary of the invention
[0004] The purpose of this section is to summarize some aspects of embodiments of the present invention and briefly introduce some preferred embodiments. Some simplifications or omissions may be made in this section and the specification abstract and the invention title of this application to avoid blurring the purpose of this section, the specification abstract and the invention title, and such simplifications or omissions cannot be used to limit the scope of the present invention.
[0005] In view of the above existing problems, the present invention is proposed. Therefore, the present invention provides a method for detecting water garbage to solve the problems of high labor costs of traditional detection methods and inaccurate detection of existing detection models.
[0006] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0007] In a first aspect, the present invention provides a method for detecting water garbage, comprising:
[0008] Obtaining a real-time water surface image, and inputting the real-time water surface image into an improved YOLOv7 model for recognition and detection;
[0009] The improved YOLOv7 model includes a backbone network, a neck network and a head network;
[0010] The real-time water surface image is subjected to feature extraction through the backbone network to obtain deep feature maps of different sizes, the deep feature maps are transmitted to the neck network for further feature extraction and fusion to obtain deep feature maps of different sizes, and the deep feature maps are input into the head network for result prediction to obtain the detection result.
[0011] As a preferred solution of the method for detecting water garbage in the present invention, the improved YOLOv7 model includes:
[0012] The backbone network of the improved YOLOv7 model includes a CBS module, an ELAN module, an MP-S module and an ELAN-W module;
[0013] The neck network of the improved YOLOv7 model includes a CA-M module, a SPPCSPC module, a UP module, a Concat module and an ELAN-W module.
[0014] As a preferred solution of the method for detecting water garbage in the present invention, the backbone network of the improved YOLOv7 model includes:
[0015] In the first stage of backbone network feature extraction, the real-time water surface image is input into the CBS module for convolution, normalization and activation to obtain a preliminary feature map, and the preliminary feature map is transmitted to the ELAN module, and the ELAN module further extracts features by gradient to obtain an aggregated feature map;
[0016] In the second stage of backbone network feature extraction, the aggregated feature map is transmitted to the MP-S module to perform downsampling to obtain a downsampled feature map, and the downsampled feature map is transmitted to the ELAN-W module to extract features of various scales to obtain deep feature maps of different sizes.
[0017] As a preferred solution of the method for detecting water garbage of the present invention, the ELAN-W module and the MP-S module include:
[0018] The MP-S module first performs parallel processing of maximum pooling and average pooling, then performs Concat splicing, and finally obtains the downsampled feature map through the CBS module;
[0019] The ELAN-W module includes three CBS modules;
[0020] The ELAN-W module adds a maximum pooling module and an average pooling module in parallel with the CBS module;
[0021] The downsampled feature maps processed by the CBS module, the maximum pooling module, and the average pooling module are concatenated and then transmitted to the CBS module to obtain deep feature maps of different sizes.
[0022] As a preferred solution of the method for detecting water garbage of the present invention, the neck network of the improved YOLOv7 model includes:
[0023] In the first stage of neck network feature extraction, the deep feature map is input into the CA-M module to generate an attention weight map, which is then processed by the CBS module;
[0024] In the second stage of neck network feature extraction, the attention weight map processed by the CBS module is transmitted to the SPPCSPC module and the deep feature extraction module, and the features of different depths are extracted by the SPPCSPC module and the deep feature extraction module to obtain a fused feature map;
[0025] The fused feature map is downsampled and features of different scales are extracted through the MP-S module and the ELAN-W module to obtain a deep feature map.
[0026] As a preferred solution of the method for detecting water garbage of the present invention, the SPPCSPC module includes:
[0027] The deep feature extraction module includes a fusion first module, a fusion second module and a fusion third module;
[0028] The fusion first module includes a CBS module, a UP module, a CA-M module, a Concat module and an ELAN-W module;
[0029] The fused second module and the third module both include a CBS module, a UP module, a CA-M module, and a Concat module.
[0030] As a preferred solution of the method for detecting water garbage of the present invention, the CA-M module includes:
[0031] The CA-M module includes the attention first module and the second module;
[0032] The first attention module includes a CBS module, a maximum pooling module, a convolution module and an average pooling module;
[0033] The first attention module includes a CBS module, a maximum pooling module, an activation module, a convolution module and an average pooling module;
[0034] The downsampled feature maps processed by the first attention module and the second attention module are spliced to obtain an attention weight map.
[0035] In a second aspect, the present invention provides a system for detecting garbage on water, comprising:
[0036] A data acquisition module is used to obtain a real-time picture of the water surface;
[0037] The image detection module is used to input the real-time water surface image into an improved YOLOv7 model for recognition and detection; the improved YOLOv7 model includes a backbone network, a neck network and a head network; the real-time water surface image is subjected to feature extraction through the backbone network to obtain deep feature maps of different sizes, the deep feature maps are transmitted to the neck network for further feature extraction and fusion to obtain deep feature maps of different sizes, and the deep feature maps are input into the head network for result prediction to obtain detection results.
[0038] In a third aspect, the present invention provides a computing device, comprising:
[0039] Memory and processor;
[0040] The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, the steps of the water garbage detection method are implemented.
[0041] In a fourth aspect, the present invention provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the steps of the water garbage detection method.
[0042] Compared with the prior art, the present invention has the following beneficial effects: the present invention utilizes the improved YOLOv7 model, and the innovative design of the model in the backbone network, neck network and head network effectively enhances the feature extraction and fusion capabilities, ensuring accurate capture and identification of garbage of different sizes and types from the image. Compared with the traditional manual detection method, the present invention not only greatly saves labor costs, but also achieves rapid response to garbage disposal, effectively improving work efficiency. At the same time, through technical upgrades, the robustness and recognition accuracy of the model have been significantly improved, reducing the misrecognition rate, and providing more reliable technical support for aquatic environmental protection. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor. Among them:
[0044] Figure 1 A schematic diagram of the overall process of a method for detecting water garbage according to an embodiment of the present invention;
[0045] Figure 2A schematic diagram of a traditional YOLOv7 model of a method for detecting water garbage according to an embodiment of the present invention;
[0046] Figure 3 A schematic diagram of an improved YOLOv7 model of a method for detecting water garbage according to an embodiment of the present invention;
[0047] Figure 4 A schematic diagram of the structure of some small modules in a traditional YOLOv7 model of a method for detecting water garbage according to an embodiment of the present invention;
[0048] Figure 5 A schematic diagram of improvements between the backbone network and the neck network of the method for detecting garbage on water according to an embodiment of the present invention;
[0049] Figure 6 Schematic diagram of the MP module before and after improvement of the method for detecting garbage on water according to an embodiment of the present invention;
[0050] Figure 7 Schematic diagram of the ELAN module and the ELAN-H module before and after improvement of the method for detecting garbage on water according to an embodiment of the present invention;
[0051] Figure 8 A schematic diagram of CA results of a method for detecting water garbage according to an embodiment of the present invention;
[0052] Fig. 9 A schematic diagram of an improved CA-M module of a method for detecting water garbage according to an embodiment of the present invention;
[0053] Fig.10 A schematic diagram of detection results of a method for detecting water garbage according to an embodiment of the present invention. DETAILED DESCRIPTION
[0054] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the drawings of the specification. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary persons in the art without creative work should fall within the scope of protection of the present invention.
[0055] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0056] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.
[0057] The present invention is described in detail with reference to schematic diagrams. When describing the embodiments of the present invention, for the sake of convenience, the cross-sectional diagrams showing the device structure will not be partially enlarged according to the general scale, and the schematic diagrams are only examples, which should not limit the scope of protection of the present invention. In addition, in actual production, the three-dimensional dimensions of length, width and depth should be included.
[0058] At the same time, in the description of the present invention, it should be noted that the orientations or positional relationships indicated by the terms "upper, lower, inner and outer" are based on the orientations or positional relationships shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the system or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first, second or third" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance.
[0059] In the present invention, unless otherwise clearly specified and limited, the terms "install, connect, connect" should be understood in a broad sense, for example: it can be a fixed connection, a detachable connection or an integral connection; it can also be a mechanical connection, an electrical connection or a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0060] Example 1
[0061] Reference Figure 1-10 , as an embodiment of the present invention, provides a method for detecting garbage on water, comprising:
[0062] S100: Obtaining a real-time picture of the water surface;
[0063] Specifically, shooting is carried out by deploying cameras near the water area. These cameras can be fixed or mounted on mobile platforms such as drones, unmanned boats or water robots, so as to capture the real-time dynamics of the water surface from different angles and positions; after obtaining these real-time pictures, the pictures are subjected to a series of preprocessing steps; the preprocessing includes: resizing the image to ensure that the image size input to the improved YOLOv7 model meets the requirements and avoid unnecessary waste of computing resources, denoising the image to eliminate possible noise or interference in the image and improve the image quality, and then performing image enhancement processing such as color correction and contrast enhancement to highlight useful information in the image, such as floating garbage, water quality changes, etc.; the preprocessing steps provide a clearer and more accurate image basis for subsequent surface garbage detection and identification.
[0064] S102: inputting the real-time water surface image into the improved YOLOv7 model for recognition and detection; the improved YOLOv7 model includes a backbone network, a neck network and a head network; extracting features of the real-time water surface image through the backbone network to obtain deep feature maps of different sizes;
[0065] The traditional YOLOv7 model structure is as follows Figure 2 As shown, the improved YOLOv7 model of the present invention is as follows Figure 3 As shown;
[0066] Specifically, in the traditional YOLOv7 model, the CBS module is composed of convolution, normalization and activation functions; the ELAN and ELAN-H modules extract features by gradient, which can enable the model to extract more different features; the SPPCSPC module extracts features of different depths by superimposing multiple modules, and the receptive fields of features of different depths are different; the main functions of the MP module and the UPSample module are to perform downsampling and upsampling operations so that features of different sizes can be better superimposed together; the RepConv module is used to adjust the number of channels of three different scale features; some small module structures in the traditional YOLOv7 are as follows: Figure 4 As shown;
[0067] It should be noted that the receptive field of the feature layer transmitted at the junction of the backbone network (Backbone) and the neck network (Neck) of the traditional YOLOv7 is large, and many detail features are missing, resulting in insufficient accuracy of small targets detected by the model. In order to solve such problems, the present invention adds a smaller feature layer output to the backbone network (Backbone), redesigns the four-output feature pyramid, adds a smaller feature layer to perform the feature fusion process, so that the model can better utilize the detail features, which is more beneficial for small targets. The improved model is as follows Figure 5 As shown;
[0068] Preferably, the backbone network of the improved YOLOv7 model includes a CBS module, an ELAN module, an MP-S module and an ELAN-W module;
[0069] Preferably, the neck network of the improved YOLOv7 model includes a CA-M module, a SPPCSPC module, a UP module, a Concat module and an ELAN-W module;
[0070] Preferably, in the first stage of feature extraction of the backbone network, the real-time water surface image is input into the CBS module for convolution, normalization and activation to obtain a preliminary feature map, and the preliminary feature map is transmitted to the ELAN module, and the ELAN module further extracts features by gradient to obtain an aggregated feature map;
[0071] Preferably, in the second stage of feature extraction of the backbone network, the aggregated feature map is transmitted to the MP-S module to perform downsampling to obtain a downsampled feature map, and the downsampled feature map is transmitted to the ELAN-W module to extract features of multiple scales to obtain deep feature maps of different sizes.
[0072] Preferably, the MP-S module first performs parallel processing of maximum pooling and average pooling, then performs Concat splicing, and finally obtains the downsampled feature map through CBS module processing;
[0073] Preferably, the downsampled feature maps processed by the CBS module, the maximum pooling module and the average pooling module are concatenated and then transmitted to the CBS module to obtain deep feature maps of different sizes;
[0074] It should be noted that the MP structure of the original structure is composed of two parts concat spliced together, one part is the superposition of two CBS modules, and the other part is the superposition of the maximum pooling and a CBS module. The function of this structure is to perform downsampling operations. By using two different branches, the input feature map is processed at different scales, and then feature fusion is performed, which helps to capture multi-scale target information. However, its maximum pooling operation will cause information loss, especially for small targets, some key information may be lost, affecting the accuracy of detection. Therefore, the structure is improved. The comparison before and after the improvement is as follows: Figure 6 As shown;
[0075] In an embodiment of the present application, the MP-S module first performs parallel processing of maximum pooling and average pooling, then performs Concat splicing, and finally passes through a CBS module; the added average pooling operation helps to extract global features, which can enable the model to better understand the contextual information of the overall scene, and is conducive to the recognition and positioning of small targets; multimodal feature fusion, which fuses the features of maximum pooling and average pooling, can improve the robustness and generalization ability of the model and reduce the possibility of information loss caused by maximum pooling operations; the purpose of moving the CBS module after Concat is to further extract richer information from the fused features, and promote the interaction and fusion between features of different scales, while reducing the number of parameters of the model.
[0076] Preferably, the ELAN-W module includes three CBS modules;
[0077] Preferably, the ELAN-W module adds a maximum pooling module and an average pooling module in parallel with the CBS module;
[0078] It should be noted that the original ELAN and ELAN-H modules first use a gradient method to extract features, which is a method of superimposing five CBS modules to extract features. This method can extract more features of different scales, expand the receptive field and increase the depth of the model, and then concatenate with a parallel CBS module, and finally output after passing through another CBS module; however, due to the large receptive field and depth (the receptive field is larger than the detected object), the model calculation amount is greatly increased while the effective small target information cannot be extracted. The effect of this module on small targets is too small, so the present invention improves the structure, and the comparison before and after the improvement is as follows: Figure 7 As shown;
[0079] In the embodiment of the present application, in the depth direction, the improved ELAN-W reduces 2 CBS modules, the purpose of which is to make the model pay more attention to shallow information, increase the extraction of small target information, and reduce the number of model parameters; in parallel, maximum pooling and average pooling are added to process the input. Maximum pooling can extract the most significant feature value of the local area, which helps to highlight the significant features such as the boundary and texture of the object, and is helpful for the positioning of small targets. At the same time, it can suppress background interference and emphasize the significance of the target object. Average pooling can smooth the input feature map, reduce the impact of noise, and help improve the stability and robustness of the model for small targets.
[0080] S104: transmitting the deep feature map to the neck network for further feature extraction and fusion to obtain deep feature maps of different sizes;
[0081] Preferably, in the first stage of neck network feature extraction, the deep feature map is input into the CA-M module to generate an attention weight map, and the attention weight map is then processed by the CBS module;
[0082] Preferably, the CA-M module includes a first attention module and a second attention module;
[0083] Preferably, the first attention module includes a CBS module, a maximum pooling module, a convolution module and an average pooling module;
[0084] Preferably, the first attention module includes a CBS module, a maximum pooling module, an activation module, a convolution module and an average pooling module;
[0085] Preferably, the downsampled feature maps processed by the first attention module and the second attention module are concatenated to obtain an attention weight map;
[0086] It should be noted that the CA attention mechanism is a neural network component that simulates the attention mechanism in the human visual system. It is used to enhance the model's attention to the input data, thereby improving the model's performance when processing complex tasks such as sequence data or images. Its main function is to enable the model to automatically learn the weights of different positions or features so as to focus on important parts in a targeted manner and ignore unimportant parts. This mechanism allows the model to focus more on information related to the current task, thereby more effectively extracting features. The CA structure is as follows: Figure 8 As shown;
[0087] The CA module adds the channel attention mechanism to it, but does not make any adjustments in the spatial attention mechanism. This will result in the model being unable to fully utilize the position information when processing spatial data such as images, and unable to make more fine-grained feature adjustments in the spatial dimension. Therefore, the present invention adjusts the spatial attention mechanism based on the CA module, while controlling the increase in the number of parameters. The improved CA-M is as follows: Fig. 9 As shown;
[0088] In the embodiment of the present application, the structural feature of the CA-M module is that a Conv2d operation is added at the CA input to control the parameter amount of CA-M. The structure on the right is consistent with the CA module, and two modules (CBS+max pooling+convolution and CBS+average pooling+convolution) are added to the left operation performed in parallel. The addition of these two modules not only adds the spatial attention mechanism, but also enriches the target features extracted by the model; finally, the four parts are concat spliced using the residual structure;
[0089] Overall, CA-M combines the channel attention mechanism and the spatial attention mechanism, making full use of the position information and channel information, and can adjust the features more comprehensively. By comprehensively utilizing multiple attention mechanisms, CA-M can improve the model's ability to express features of different positions and channels, which helps to improve model performance.
[0090] Preferably, in the second stage of neck network feature extraction, the attention weight map processed by the CBS module is transmitted to the SPPCSPC module and the deep feature extraction module, and the features of different depths are extracted by the SPPCSPC module and the deep feature extraction module to obtain a fused feature map;
[0091] Preferably, the deep feature extraction module includes a fusion first module, a fusion second module and a fusion third module;
[0092] Preferably, the fusion first module includes a CBS module, a UP module, a CA-M module, a Concat module and an ELAN-W module;
[0093] Preferably, the fused feature map is downsampled and features of different scales are extracted through the MP-S module and the ELAN-W module to obtain a deep feature map;
[0094] Preferably, the fused second module and the third module both include a CBS module, a UP module, a CA-M module, and a Concat module.
[0095] S106: Input the deep feature map into the head network for result prediction and obtain the detection result; the detection result is as follows: Fig.10 As shown;
[0096] Specifically, the head network predicts a series of bounding boxes for each grid on each deep feature map. Each bounding box contains information about the location, size, and confidence level of the garbage on the surface of the water. At the same time, it classifies the objects within these bounding boxes and predicts the probability that the objects belong to each preset category.
[0097] During the detection process, the improved YOLOv7 model uses technical means such as non-maximum suppression to filter and merge multiple predicted bounding boxes to remove redundant and overlapping detection results and retain the most accurate and reliable prediction results; each result includes the category of the target object, its precise location in the image, and the improved YOLOv7 model's confidence in the prediction result.
[0098] The above is a schematic scheme of a method for detecting garbage on water in this embodiment. It should be noted that the technical scheme of the system for detecting garbage on water and the technical scheme of the above-mentioned method for detecting garbage on water are of the same concept, and the details of the technical scheme of the system for detecting garbage on water in this embodiment that are not described in detail can be referred to the description of the technical scheme of the above-mentioned method for detecting garbage on water.
[0099] In this embodiment, the water garbage detection system includes:
[0100] A data acquisition module is used to obtain a real-time picture of the water surface;
[0101] The image detection module is used to input the real-time water surface image into the improved YOLOv7 model for recognition and detection; the improved YOLOv7 model includes a backbone network, a neck network and a head network; the real-time water surface image is subjected to feature extraction through the backbone network to obtain deep feature maps of different sizes, the deep feature maps are transmitted to the neck network for further feature extraction and fusion to obtain deep feature maps of different sizes, and the deep feature maps are input into the head network for result prediction to obtain the detection results.
[0102] This embodiment further provides a computing device, which is applicable to the case of detecting garbage on water, and includes:
[0103] Memory and processor; the memory is used to store computer executable instructions, and the processor is used to execute computer executable instructions to implement the method for detecting water garbage as proposed in the above embodiment.
[0104] This embodiment also provides a storage medium on which a computer program is stored. When the program is executed by a processor, the method for detecting water garbage as proposed in the above embodiment is implemented.
[0105] The storage medium proposed in this embodiment and the method for realizing water garbage detection proposed in the above embodiment belong to the same inventive concept. The technical details not fully described in this embodiment can be referred to the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.
[0106] Through the above description of the implementation methods, the technicians in the relevant field can clearly understand that the present invention can be implemented by means of software and necessary general hardware, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ReadOnly, Memory, ROM), random access memory (RandomAccess Memory, RAM), flash memory (FLASH), hard disk or optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform the methods of various embodiments of the present invention.
[0107] Example 2
[0108] Referring to Table 1, an embodiment of the present invention provides a method for detecting garbage on water. In order to verify its beneficial effects, comparison results of several solutions are provided.
[0109] Deploy water robots and use their high-definition cameras to capture water surface images in real time;
[0110] The captured video stream is decomposed into continuous image frames, and the images are preprocessed, including resizing to the fixed input size required by the improved YOLOv7 model and performing necessary image enhancement to improve the model generalization ability.
[0111] YOLOv7 is chosen as the base model because it strikes a good balance between speed and accuracy.
[0112] Targeted improvements are made to YOLOv7, optimizing the CBS module, ELAN module and MP module in the backbone network, as well as the CA-M module, CBS module, ELAN module and MP module in the neck network, to enhance the model's adaptability to complex water surface environments.
[0113] A large number of annotated water surface image datasets are used to train the improved YOLOv7 model to ensure that the model can learn the characteristics of water surface targets. Through multiple rounds of iterative training, the hyperparameters are continuously adjusted to optimize the model performance.
[0114] The trained improved YOLOv7 model is deployed to the computing unit of the aquatic robot, which receives image frames transmitted by the camera in real time, performs target detection through the model, and quickly identifies various targets on the water surface.
[0115] In order to fully verify the effectiveness and superiority of the method of the present invention, this example compares the relevant data of the method of the present invention with those of other methods, as shown in Table 1;
[0116] Table 1 Comparison of detection results of different methods
[0117]
[0118]
[0119] Through comparative experiments, as shown in Table 1, it can be seen that the improved YOLOv7 model of the present invention has significant improvements in various performance indicators, especially in the comprehensive evaluation indicator mAP@0.5:0.95, which is improved from 0.299 of the original version to 0.350, indicating that the model has a qualitative leap in recognition accuracy and generalization ability; at the same time, the number of model parameters and the amount of calculation are also reduced, further improving the efficiency of real-time detection. The present invention successfully applies the improved YOLOv7 model to real-time target detection of aquatic robots, and realizes rapid and accurate recognition of surface targets.
[0120] 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 the present invention. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. A method for detecting water garbage, characterized in that: include: Obtaining a real-time water surface image, and inputting the real-time water surface image into an improved YOLOv7 model for recognition and detection; The improved YOLOv7 model includes a backbone network, a neck network and a head network; The real-time water surface image is subjected to feature extraction through the backbone network to obtain deep feature maps of different sizes, the deep feature maps are transmitted to the neck network for further feature extraction and fusion to obtain deep feature maps of different sizes, and the deep feature maps are input into the head network for result prediction to obtain the detection result.
2. The method for detecting water garbage according to claim 1, characterized in that: The improved YOLOv7 model includes, The backbone network of the improved YOLOv7 model includes a CBS module, an ELAN module, an MP-S module and an ELAN-W module; The neck network of the improved YOLOv7 model includes a CA-M module, a SPPCSPC module, a UP module, a Concat module and an ELAN-W module.
3. The method for detecting water garbage as claimed in claim 2, characterized in that: The backbone network of the improved YOLOv7 model includes: In the first stage of backbone network feature extraction, the real-time water surface image is input into the CBS module for convolution, normalization and activation to obtain a preliminary feature map, and the preliminary feature map is transmitted to the ELAN module, and the ELAN module further extracts features by gradient to obtain an aggregated feature map; In the second stage of backbone network feature extraction, the aggregated feature map is transmitted to the MP-S module to perform downsampling to obtain a downsampled feature map, and the downsampled feature map is transmitted to the ELAN-W module to extract features of various scales to obtain deep feature maps of different sizes.
4. The method for detecting water garbage as claimed in claim 2, characterized in that: ELAN-W modules and MP-S modules include, The MP-S module first performs parallel processing of maximum pooling and average pooling, then performs Concat splicing, and finally obtains the downsampled feature map through the CBS module; The ELAN-W module includes three CBS modules; The ELAN-W module adds a maximum pooling module and an average pooling module in parallel with the CBS module; The downsampled feature maps processed by the CBS module, the maximum pooling module, and the average pooling module are concatenated and then transmitted to the CBS module to obtain deep feature maps of different sizes.
5. The method for detecting water garbage as claimed in claim 4, characterized in that: The neck network of the improved YOLOv7 model includes, In the first stage of neck network feature extraction, the deep feature map is input into the CA-M module to generate an attention weight map, which is then processed by the CBS module; In the second stage of neck network feature extraction, the attention weight map processed by the CBS module is transmitted to the SPPCSPC module and the deep feature extraction module, and the features of different depths are extracted by the SPPCSPC module and the deep feature extraction module to obtain a fused feature map; The fused feature map is downsampled and features of different scales are extracted through the MP-S module and the ELAN-W module to obtain a deep feature map.
6. The method for detecting water garbage as claimed in claim 5, characterized in that: The SPPCSPC module includes: The deep feature extraction module includes a fusion first module, a fusion second module and a fusion third module; The fusion first module includes a CBS module, a UP module, a CA-M module, a Concat module and an ELAN-W module; The fused second module and the third module both include a CBS module, a UP module, a CA-M module, and a Concat module.
7. The method for detecting water garbage as claimed in claim 5, characterized in that: CA-M modules include: The CA-M module includes the attention first module and the second module; The first attention module includes a CBS module, a maximum pooling module, a convolution module and an average pooling module; The first attention module includes a CBS module, a maximum pooling module, an activation module, a convolution module and an average pooling module; The downsampled feature maps processed by the first attention module and the second attention module are spliced to obtain an attention weight map.
8. A system for detecting water garbage, characterized in that: include, A data acquisition module is used to obtain a real-time picture of the water surface; The image detection module is used to input the real-time water surface image into an improved YOLOv7 model for recognition and detection; the improved YOLOv7 model includes a backbone network, a neck network and a head network; the real-time water surface image is subjected to feature extraction through the backbone network to obtain deep feature maps of different sizes, the deep feature maps are transmitted to the neck network for further feature extraction and fusion to obtain deep feature maps of different sizes, and the deep feature maps are input into the head network for result prediction to obtain detection results.
9. An electronic device, comprising: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, the steps of the water garbage detection method described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the steps of the method for detecting water garbage as claimed in any one of claims 1 to 7.
Citation Information
Patent Citations
Marine target detection method under visible light based on improved YOLOv7 algorithm
CN116863293A
Small target pest detection method based on YOLOv7-tiny improvement
CN117422868A
Water surface floating garbage identification method and system based on deep learning
CN117576478A
Improved YOLOv7-tiny water surface floating garbage detection method
CN118154852A
Lightweight fire smoke detection method, terminal device, and storage medium
US20240005759A1
