Water area bank identification method for water surface decontamination robot and decontamination method
Through the improved U-Net network and GAB fusion module, combined with Fourier transform and Focal Loss loss function, it solves the problem of water and shore identification in complex water environments, improves garbage processing efficiency and accuracy, and adapts to harsh weather conditions.
Patent Information
- Application Number
- CN202410669917.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-28
- Publication Date
- 2024-09-17
AI Technical Summary
Existing technology is difficult to accurately identify water areas and shore areas in complex water environments, resulting in low water surface garbage treatment efficiency and greater risks, especially in bad weather.
An improved U-Net network is designed, which combines the GAB fusion module and the boundary enhancement module, and uses Fourier transform and Focal Loss loss function to improve the segmentation accuracy of water shore images, enhance boundary information processing, and balance sample weights.
It improves the segmentation accuracy and identification capabilities of water and shore areas, reduces information loss, enhances the adaptability to complex water surface scenes, and achieves more efficient water surface garbage identification and cleaning.
Smart Images

Figure CN118657939A
Abstract
Description
Technical Field
[0001] The invention relates to the field of image segmentation, and in particular to a water area shore recognition method and a pollution cleaning method for a water surface pollution cleaning robot. Background Art
[0002] Fresh water has a significant impact on human life and social activities. Currently, a large part of fresh water resources are facing the problem of garbage pollution.
[0003] At present, the treatment of garbage on the water surface is still mainly based on manual salvage, which has many problems. On the one hand, floating objects on the water surface are widely distributed, making it difficult for management personnel to discover and deal with them in time, and real-time inspection is impossible; on the other hand, the water surface conditions are complex, there are certain risks, and operations cannot be carried out in bad weather. With the continuous development of robotics technology and computer vision in image processing, the feasibility of combining the two to solve the problem of floating objects on the water surface is becoming increasingly high. However, water application scenarios such as rivers and lakes are different from those on the ground, and have higher requirements for the accuracy and real-time performance of garbage identification, which is a great challenge for pollution-cleaning robots.
[0004] Water shore segmentation helps the water pollution cleaning robot to separate the water surface area from the land, assists the pollution cleaning robot in positioning and obstacle avoidance, and has stronger adaptability when dealing with complex water surface scenes. Therefore, it is urgent to design a water shore recognition method for water surface pollution cleaning robots. Summary of the invention
[0005] The technical problem to be solved by the present invention is to overcome the defects of the prior art and provide a water area and shore identification method for a water surface pollution cleaning robot, which can accurately segment the water area and the shore area.
[0006] In order to solve the above technical problems, the technical solution of the present invention is: a method for identifying the shore of a water area for a water surface pollution cleaning robot, the method comprising:
[0007] Build and improve the U-Net network, train it, and save the best model;
[0008] The trained improved U-Net network is used to identify the water area and shore area in the water shore image;
[0009] The improved U-Net network includes an encoder, a skip connection layer and a decoder. The skip connection layer is added with a GAB fusion module. The GAB fusion module is used to fuse low-level features and high-level features from the output of adjacent layers of the encoder and corresponding masks from the training set to obtain the output of the skip connection layer. The output of the skip connection layer is connected to the corresponding layer of the decoder.
[0010] In order to further solve the problem of low segmentation accuracy caused by reflections and blurred edges in water shore images, a boundary enhancement module is set at the initial point of the improved U-Net network to enhance the boundary detail information of the water shore images input into the improved U-Net network.
[0011] Furthermore, the boundary detail information of the water shore image is enhanced, including:
[0012] Perform Fourier transform on the water shore image to obtain the frequency domain corresponding to the image;
[0013] Extract high-frequency information in the frequency domain corresponding to the image;
[0014] Perform inverse Fourier transform on high-frequency information to obtain boundary information in the spatial domain;
[0015] The spatial domain boundary information is superimposed on the original image to enhance the boundary information.
[0016] Furthermore, the specific working process of the GAB fusion module is as follows:
[0017] Step A: Use depthwise separable convolution and bilinear interpolation to adjust the high-level feature fh to match the adjacent low-level feature fh. l size;
[0018] f h = interpolate(DW(f h ),f l )
[0019] DW represents depthwise separable convolution, and interpolate(·) is the interpolation function;
[0020] Step B, dividing two adjacent features into four groups along the channel dimension;
[0021] f h1 ,f h2 ,f h3 ,f h4 =chunk(LN(f h ),4,dim=1)
[0022] f l1 ,f l2 ,f l3 ,f l4 =chunk(LN(f l ),4,dim=1)
[0023] Where chunk(·) is the block function; LN(·) represents Layer Normalization.
[0024] In step C, the corresponding groups in the low-level features are connected with the corresponding groups in the high-level features along the channel dimension to obtain four groups of fused features.
[0025] f li '=DC 3×3 (concat((f hi ,f li ,mask),dim=1))
[0026] i takes values of 1, 2, 3, 4, DC 3×3 is dilated convolution, the corresponding i value dilation rates are 1, 2, 5, and 7 respectively, concat(·) means concatenation; mask means mask;
[0027] Step D: splice the obtained four sets of fusion features along the channel dimension so that adjacent feature information of different scales can interact;
[0028] f l '=concat(f l1 ',f l2 ',f l3 ',f l4 '), dim=1)
[0029] l ranges from 1 to n, where n is the number of decoder layers; f l ' represents the skip connection output of the lth layer,
[0030] Furthermore, the encoder has a five-layer structure, which consists of a layer of Res module and four layers of DSC modules. The input water shore picture first passes through the Res module and then through the four layers of DSC modules. The decoder has a four-layer structure, which consists of a layer of Res module and three layers of DSC modules. The decoding features first pass through the three layers of DSC modules and then through a layer of Res module. The specific formula for connecting each layer of jump connection output with the corresponding layer of the decoder is:
[0031] f4"=DSC(f5)+f4')
[0032] f3”=DSC((f4”)+f3')
[0033] f2”=DSC((f3”)+f2')
[0034] f1"=Conv 1×1 (Res((f2”)+f1’))
[0035] Where f l ” and f l '(l=1,2,3,4) are the outputs of different layers of the decoder and the skip connection outputs of different layers; Conv 1×1(·) is a 1×1 convolution, and f5 is the fifth layer output of the encoder.
[0036] Furthermore, the DSC module contains two 3×3 depthwise separable convolutions and two 1×1 convolutions, and the formula is:
[0037] DSC(f)=Conv 1×1 (DW(Conv 1×1 (DW(f))))
[0038] The Res module consists of two 3×3 convolutions and residual connections, and the formula is:
[0039] Res(f)=Conv 1×1 (f)+Conv 3×3 (Conv 3×3 (f))
[0040] Where DW(·) is the depth convolution, Conv 1×1 (·) is point-by-point convolution, f is the feature map, Conv 3×3 (·) is a 3×3 convolution.
[0041] In order to better balance the weight ratio of difficult and easy samples in the samples and make the model converge better during training, a loss function based on Focal Loss is introduced during training. The formula is:
[0042]
[0043] Where γ is the adjustment factor that controls the loss weights of simple samples and difficult samples; a is the balance factor that adjusts the imbalance between minority class samples and majority class samples; y is the sample label, y = 1 means it is predicted as a positive class, i.e. foreground, and y = 0 means it is predicted as a negative class, i.e. background; p in the two formulas represents the probability of being predicted as a positive class and a negative class, respectively.
[0044] The present invention also provides a surface robot pollution cleaning method, the method includes: after the robot goes into the water and starts working, it first cruises along the path, the long-range camera collects images and uploads them to the deep learning processor, the processor uses the water area and shore recognition method for the surface pollution cleaning robot to segment the water area and shore area of the image, if there is floating garbage in the water area, the robot moves to the garbage location and executes the garbage salvage program, the close-range camera will determine whether the water area is completely cleaned, and after completion it will return to the original planned path for inspection, and if the garbage bin is full, it will return to the shore for processing.
[0045] After adopting the above technical solution, the present invention has the following beneficial effects:
[0046] 1. The present invention uses the GAB fusion module to extract image features from different scales, enrich the feature information of the shallow network, reduce information loss, and thus improve the ability to segment waters and shores;
[0047] 2. The present invention enhances the boundary information of the water area and the shore image, which can better capture the boundary information of the water area and the shore, thereby improving the segmentation accuracy of the water area and the shore;
[0048] 3. Use the residual module to appropriately reduce the number of model parameters;
[0049] 4. During the training phase, a Focal Loss loss function was introduced to balance the ratio of difficult and simple samples, so that the model can converge better. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 It is a flow chart of the method for identifying the water area and shore for the water surface pollution cleaning robot of the present invention;
[0051] Figure 2 The framework diagram of the improved U-Net network of the present invention;
[0052] Figure 3 It is a framework diagram of the GAB fusion module of the present invention;
[0053] Figure 4 is a structural diagram of the Res module of the present invention;
[0054] Figure 5 Schematic diagram of the DSC module of the present invention. DETAILED DESCRIPTION
[0055] In order to make the contents of the present invention more clearly understood, the present invention is further described in detail below based on specific embodiments in conjunction with the accompanying drawings.
[0056] like Figure 1-5 As shown, a method for identifying a water area shore for a surface pollution cleaning robot comprises:
[0057] In the first step, the prepared water shore dataset is divided into training set, validation set and test set in a ratio of 7:1:2, and the training set is preprocessed;
[0058] Step 2: Build the U-Net network. The encoder part extracts features by downsampling to increase the receptive field, and the decoder part performs upsampling. The feature maps of the downsampling layer and the upsampling layer are fused through skip connections to output the final feature map.
[0059] In this embodiment, if Figure 2 , Figure 4 , Figure 5As shown, in the U-Net network constructed in the second step, both the encoder and the decoder are lightweight structures, both including a DSC module and a Res module.
[0060] More specifically, if Figure 1 As shown in the figure, the encoder has a five-layer structure, including one Res module and four DSC modules. The input water shore picture first passes through the Res module and then through the four DSC modules. During the process, the resolution decreases continuously and the number of channels increases continuously, and then reaches the bottleneck layer, which is the skip connection layer.
[0061] The decoder has a four-layer structure, consisting of a layer of Res modules and three layers of DSC modules. The decoded features first pass through the three-layer DSC module and then through a layer of Res module. The resolution is restored to the original size, and finally the number of channels is reduced through 1×1 convolution.
[0062] The DSC module contains two 3×3 depthwise separable convolutions and two 1×1 convolutions. The depthwise separable convolutions are used to calculate semantic information and segment the object, and then the 1×1 convolutions are used to obtain the pixel classification results. The depthwise separable convolutions can significantly reduce the number of training parameters.
[0063] like Figure 4 , Figure 5 As shown, the formulas of the DSC module and the Res module are:
[0064] DSC(f)=Conv 1×1 (DW(Conv 1×1 (DW(f))))
[0065] Res(f)=Conv 1×1 (f)+Conv 3×3 (Conv 3×3 (f))
[0066] Where DW(·) is the depth convolution, Conv 1×1 (·) is point-by-point convolution, f is the feature map, Conv 3×3 (·) is a 3×3 convolution. The convolutions used in the DSC module and the Res module both include Batch Normalization and ReLU activation functions.
[0067] The third step is to improve the U-Net network. In order to solve the problem that the difference between the edge and background of the target in the water bank image segmentation is small, a high-pass filter module is designed to reduce the impact of boundary blur. In order to reduce the problem of information loss, a multi-scale feature fusion (GAB fusion module) is designed in the jump connection to obtain multi-scale information, integrating high-level and low-level features of different sizes, and additionally introducing mask information to assist feature fusion. The residual module is used to appropriately reduce the amount of model calculation. Finally, the FocalLoss loss function is introduced to increase the attention to difficult samples and improve the overall segmentation accuracy.
[0068] In this embodiment, considering that the boundary between the water area and the shore in the image is similar, it is easy to identify the shore as the water area. This incorrect segmentation may cause problems such as the device being out of the water area in actual applications. The low-frequency part of the image generally changes slowly, such as the sky and the water surface; the high-frequency part changes more dramatically, and generally contains the contour and boundary information of the image, such as the boundary between the water surface and the shore and the sky. Therefore, in this embodiment, a high-pass filter module is added to implement the boundary detail information enhancement processing step, which helps to accurately segment the water and the shore. The boundary detail information enhancement processing step specifically includes:
[0069] First, Fourier transform the water shore image to obtain the frequency domain corresponding to the image;
[0070]
[0071] Where H is the image height, W is the image width, F(u,v) represents the frequency domain image, (u,v) is the frequency point; f(x,y) represents the spatial domain image, (x,y) is the spatial coordinate, indicating the pixel position in the image.
[0072] Then, high-pass filtering is used to extract high-frequency information;
[0073]
[0074] Where D0 is the cutoff frequency of the high-pass filter;
[0075] The high-pass filter allows frequency information above a certain threshold to pass, that is, the boundary information. After extracting this part of information, it performs an inverse Fourier transform and finally superimposes the spatial domain boundary information obtained after the conversion with the original image, thereby ultimately achieving the effect of strengthening the boundary information.
[0076]
[0077] Where F(x,y) represents the spatial domain image, the range of u is [0,H-1], and the range of v is [0,W-1].
[0078] like Figure 2 , Figure 3 As shown in the figure, the specific working process of the GAB fusion module is as follows:
[0079] Step A: Use depthwise separable convolution and bilinear interpolation to extract high-level features f h Adjust to match adjacent low-level features f l size;
[0080] f h ′=interpolate(DW(f h ),f l )
[0081] DW represents depthwise separable convolution, and interpolate(·) is the interpolation function;
[0082] Step B, dividing two adjacent features into four groups along the channel dimension;
[0083] f h1 ,f h2 ,f h3 ,f h4 =chunk(LN(f h ),4,dim=1)
[0084] f l1 ,f l2 ,f l3 ,f l4 =chunk(LN(f l ),4,dim=1)
[0085] Where chunk(·) is the block function; LN(·) represents Layer Normalization.
[0086] In step C, the corresponding groups in the low-level features are connected with the corresponding groups in the high-level features along the channel dimension to obtain four groups of fused features.
[0087] f li '=DC 3×3 (concat((f hi ,f li ,maks),dim=1))
[0088] i takes values of 1, 2, 3, 4, DC 3×3 It is a dilated convolution, and the corresponding i value expansion rates are 1, 2, 5, and 7 respectively. concat(·) represents concatenation; mask represents masking.
[0089] Step D: splice the obtained four sets of fusion features along the channel dimension so that adjacent feature information of different scales can interact;
[0090] f l '=concat(f l1 ',f l2 ',f l3 ',f l4 '), dim=1)
[0091] l ranges from 1 to n, where n is the number of decoder layers; f l ' represents the skip connection output of layer l.
[0092] Specifically, in image segmentation tasks, feature maps of different scales usually contain information at different levels. Figure 1 Generally, the feature maps contain more detailed information, while the deep feature maps contain more semantic information. Dividing the feature maps of different scales into multiple groups along the channel can process and fuse the feature information more flexibly. In addition, feature maps of different scales may have similar feature representations. By grouping the feature maps, the model is prompted to share parameters at each scale, thereby reducing the number of model parameters and improving the training efficiency and generalization ability of the model.
[0093] Among them, the specific formula for connecting each layer of skip connection output with the corresponding layer of the decoder is:
[0094] f4"=DSC(f5)+f4')
[0095] f3”=DSC((f4”)+f3')
[0096] f2”=DSC((f3”)+f2')
[0097] f1"=Conv 1×1 (Res((f2”)+f1’))
[0098] Where f l ” and f l '(l=1,2,3,4) are the outputs of different layers of the decoder and the skip connection outputs of different layers; Conv 1×1 (·) is a 1×1 convolution, and f5 is the fifth layer output of the encoder.
[0099] Step 4: Load the training set and validation set images of the two water shore datasets of normal view and remote sensing into the improved U-Net network for training and validation, and save the model with the best effect;
[0100] The experiment is based on Python 3.7 and Pytorch 1.9.0, and the GPU used for training is NVIDIA GeForce GTX3090. All comparative experiments are conducted under the same parameter settings. The parameters that need to be set are the optimizer used in training, Batch Size, iterative Epoch, and the loss function based on Focal Loss, the formula is:
[0101]
[0102] Where γ is the adjustment factor that controls the loss weights of simple samples and difficult samples; a is the balance factor that adjusts the imbalance between minority class samples and majority class samples; y is the sample label, y = 1 means it is predicted as a positive class, i.e. foreground, and y = 0 means it is predicted as a negative class, i.e. background; p in the two formulas represents the probability of being predicted as a positive class and a negative class, respectively.
[0103] Step 5: Use the saved result model to test the images in the test set, obtain the test results, and complete the semantic segmentation of the water shore.
[0104] After the robot is launched into the water and starts working, it first cruises along the path. The long-range camera collects images and uploads them to the deep learning processor. The processor first uses the method in the above embodiment to segment the water area and the shore area of the image. If there is floating garbage in the water area, the robot moves to the garbage location and executes the garbage salvage procedure. The close-range camera will determine whether the water area is completely cleaned. After completion, it will return to the original planned path for inspection. If the garbage bin is full, it will return to the shore for processing.
[0105] In order to evaluate the effectiveness of the method proposed in the above embodiment for water and shore segmentation, the experiment uses F1 score (F1score), pixel accuracy (PA), overlap (IoU) and area under the ROC curve (AUC) to measure the effectiveness of the method. The verification results are as follows:
[0106] Table 1 Experiments on natural image water dataset
[0107]
[0108] Table 2 Experiments on remote sensing image water area dataset
[0109]
[0110] It can be seen from Table 1 and Table 2 that the recognition effect of the method in this embodiment is better than that of the existing method.
[0111] Based on the above ideal embodiments of the present invention, the relevant staff can make various changes and modifications without departing from the technical concept of the present invention through the above description. The technical scope of the present invention is not limited to the contents of the specification, and its technical scope must be determined according to the scope of the claims.
Claims
1. A method for identifying the shore of a water area for a surface pollution cleaning robot, characterized in that: Methods include: The trained improved U-Net network is used to identify the water area and shore area in the water shore image; The improved U-Net network includes an encoder, a skip connection layer and a decoder. The skip connection layer is added with a GAB fusion module. The GAB fusion module is used to fuse low-level features and high-level features from the output of adjacent layers of the encoder and corresponding masks from the training set to obtain the output of the skip connection layer. The output of the skip connection layer is connected to the corresponding layer of the decoder.
2. The method for identifying the water shore for a water surface pollution cleaning robot according to claim 1, characterized in that: A boundary enhancement module is set at the initial stage of the improved U-Net network to enhance the boundary detail information of the water shore image input into the improved U-Net network.
3. The method for identifying the water shore for a water surface pollution cleaning robot according to claim 2, characterized in that: Enhance the boundary details of the water shore image, including: Perform Fourier transform on the water shore image to obtain the frequency domain corresponding to the image; Extract high-frequency information in the frequency domain corresponding to the image; Perform inverse Fourier transform on high-frequency information to obtain boundary information in the spatial domain; The spatial domain boundary information is superimposed on the original image to enhance the boundary information.
4. The method for identifying the water area and shore for a water surface pollution cleaning robot according to claim 1, characterized in that: The specific working process of the GAB fusion module is as follows: Step A: Use depthwise separable convolution and bilinear interpolation to adjust the high-level feature fh to match the adjacent low-level feature fh. l size; f h =interpolate(DW(f h ),f l ) DW represents depthwise separable convolution, and interpolate(·) is the interpolation function; Step B, dividing two adjacent features into four groups along the channel dimension; f h1 ,f h2 ,f h3 ,f h4 =chunk(LN(f′ h ),4,dim=1) f l1 ,f l2 ,f l3 ,f l4 =chunk(LN(f l ),4,dim=1) Where chunk(·) is the block function; LN(·) represents Layer Normalization. In step C, the corresponding groups in the low-level features are connected with the corresponding groups in the high-level features along the channel dimension to obtain four groups of fused features. f li '=DC 3×3 (concat((f hi ,f li ,maks),dim=1)) i takes values of 1, 2, 3, 4, DC 3×3 is dilated convolution, the corresponding i value dilation rates are 1, 2, 5, and 7 respectively, concat(·) means concatenation; mask means mask; Step D: splice the obtained four sets of fusion features along the channel dimension so that adjacent feature information of different scales can interact; f l '=concat(f l1 ',f l2 ',f l3 ',f l4 '),dim=1) l ranges from 1 to n, where n is the number of decoder layers; f l ' represents the skip connection output of layer l.
5. The method for identifying the water shore for a water surface pollution cleaning robot according to claim 1, characterized in that: The encoder has a five-layer structure, which consists of a layer of Res module and four layers of DSC modules. The input water shore picture first passes through the Res module and then through the four layers of DSC modules. The decoder has a four-layer structure, which consists of a layer of Res module and three layers of DSC modules. The decoding features first pass through the three layers of DSC modules and then through a layer of Res module. The specific formula for connecting each layer of jump connection output to the corresponding layer of the decoder is: f4"=DSC(f5)+f4') f3”=DSC((f4”)+f3') f2”=DSC((f3”)+f2') f1”=Conv 1×1 (Res((f2”)+f1')) Where f l ” and f l '(l=1,2,3,4) are the outputs of different layers of the decoder and the skip connection outputs of different layers; Conv 1×1 (·) is a 1×1 convolution, and f5 is the fifth layer output of the encoder.
6. The method for identifying the water area and shore for a water surface pollution cleaning robot according to claim 5, characterized in that: The DSC module contains two 3×3 depth-wise separable convolutions and two 1×1 convolutions, and the formula is: DSC(f)=Conv 1×1 (DW(Conv 1×1 (DW(f)))) The Res module consists of two 3×3 convolutions and residual connections, and the formula is: Res(f)=Conv 1×1 (f)+Conv 3×3 (Conv 3×3 (f)) Where DW(·) is the depth convolution, Conv 1×1 (·) is point-by-point convolution, f is the feature map, Conv 3×3 (·) is a 3×3 convolution.
7. The method for identifying the water area and shore for a water surface pollution cleaning robot according to claim 1, characterized in that: During the training process, a loss function based on Focal Loss is introduced, and the formula is: Where γ is the adjustment factor that controls the loss weights of simple samples and difficult samples; a is the balance factor that adjusts the imbalance between minority class samples and majority class samples; y is the sample label, y = 1 means it is predicted as a positive class, i.e. foreground, and y = 0 means it is predicted as a negative class, i.e. background; p in the two formulas represents the probability of being predicted as a positive class and a negative class, respectively.
8. A method for cleaning pollution using a water surface robot, characterized in that: include: After the robot is launched into the water and starts working, it first cruises along the path, and the perspective camera collects images and uploads them to the deep learning processor; The processor uses the method of any one of claims 1 to 7 to segment the water area and the shore area of the image; If there is floating garbage in the water area, the robot will move to the garbage location and execute the garbage salvage procedure. The close-up camera will determine whether the water area is completely cleaned. After completion, it will return to the original planned path for inspection. If the garbage bin is full, it will return to the shore for processing.
