Intelligent curtain wall cleaning unmanned aerial vehicle glass pollution degree distinguishing and stain detection method
By improving the drone pollution level classification and stain detection model, the shortcomings of pollution level classification and stain detection in drone curtain wall cleaning have been solved, realizing a precise cleaning strategy and efficient cleaning effect, and improving the applicability and safety of drone cleaning technology.
Patent Information
- Application Number
- CN202611231440.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-14
- Publication Date
- 2026-11-27
AI Technical Summary
Existing drone-based curtain wall cleaning technology lacks the ability to accurately classify the degree of glass contamination, has insufficient stain detection accuracy, and is easily affected by lighting and background interference, leading to inappropriate or insufficient cleaning strategies, which affects cleaning efficiency and safety.
By employing a pollution level classification model and a stain detection model, and through improvements using ResNet-50 and YOLOv1n, combined with the CBAM attention module and DIoUv3 loss function, we can achieve accurate classification of glass pollution levels and efficient stain detection, thereby generating differentiated cleaning strategies.
It achieves precise classification of glass contamination levels, improves stain detection accuracy, adapts to complex lighting conditions, reduces false judgment rate, and improves cleaning efficiency and safety.
Smart Images

Figure CN123181902A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of drone curtain wall cleaning technology, and particularly relates to a method for distinguishing the degree of glass contamination and detecting stains using an intelligent curtain wall cleaning drone. Background Technology
[0002] With the deepening of urbanization, the proportion of high-rise buildings in urban spatial structures is increasing year by year. Glass curtain walls, with their advantages of aesthetics, transparency, and excellent lighting, are widely used in various types of buildings. Large areas of glass curtain walls are exposed to the natural environment for extended periods, easily absorbing pollutants such as dust, industrial emissions, vehicle exhaust particles, and bird droppings. This not only seriously affects the aesthetic appeal of the urban landscape but also reduces the light transmittance and heat insulation performance of the glass, increasing building lighting energy consumption and air conditioning load. Therefore, regular professional cleaning and maintenance of glass curtain walls is an important measure to ensure both the aesthetics and energy efficiency of buildings. Currently, glass curtain wall cleaning mainly relies on two methods: high-altitude manual cleaning by "spider-men" and rooftop track-mounted window cleaning machines. While manual cleaning offers flexibility and adaptability, it carries extremely high safety risks due to high-altitude operations, is significantly hampered by weather conditions such as wind, rain, and snow, and suffers from low efficiency. Furthermore, labor costs account for over 60% of the total cleaning cost. Track-mounted window cleaning machines, while improving safety, are expensive to install, require pre-planning for track space during the building design phase, and struggle to adapt to increasingly complex building facades, including irregular curved surfaces and terraced designs. With the deep integration of drone technology and artificial intelligence, drones equipped with intelligent cleaning systems are beginning to challenge traditional operating methods, achieving cleaning efficiency up to 20 times that of traditional manual labor and reducing costs by nearly 50%.
[0003] However, existing drone-based curtain wall cleaning technologies primarily focus on the mechanical structure design or flight path planning of the cleaning device, exhibiting significant shortcomings in the visual perception aspect. Firstly, current technologies lack the ability to accurately classify the degree of glass contamination, making it difficult to develop differentiated cleaning strategies based on the severity of contamination, leading to over- or under-cleaning. Secondly, existing stain detection methods lack sufficient accuracy in locating glass stains with diverse shapes, significant scale differences, and blurred boundaries, particularly exhibiting a low detection rate for tiny stains (only a few pixels). Thirdly, the transparency and reflectivity of glass itself cause reflections of the interior background, background objects, and surrounding buildings to overlap and mix with surface stains, making existing detection algorithms prone to misidentifying virtual images as stains, resulting in insufficient anti-interference capabilities. Fourthly, the constantly changing lighting angle, flight altitude, and attitude under drone aerial photography perspective cause existing models to lack perspective invariance and lighting robustness, leading to unstable detection accuracy. These problems prevent drones from achieving intelligent autonomous cleaning—"cleaning only where dirty, and using appropriate force based on the degree of dirt"—thus hindering the further promotion and application of drone-based curtain wall cleaning technology. Summary of the Invention
[0004] To address the aforementioned technical problems, this invention provides a method for differentiating the degree of glass contamination and detecting stains using an intelligent curtain wall cleaning drone, comprising: Acquire images of curtain wall glass captured by drones; Based on the curtain wall glass image, glass area detection and segmentation are performed to obtain a glass area image; Based on the image of the glass area, the degree of pollution is determined by a pollution level classification model to obtain the pollution level determination result. Based on the pollution level assessment results, determine whether to locate the stain; When stain location is determined, stain detection is performed using a stain detection model based on the glass area image to obtain stain location detection results.
[0005] Preferably, the process of obtaining the pollution level determination result includes: The image of the glass region is input into a pollution level classification model, which uses ResNet-50 as the baseline model and extracts deep features through residual block stacking. During the training phase of ResNet-50, cross-entropy loss and ranking loss are calculated simultaneously, and the weighted sum of the cross-entropy loss and ranking loss is used as the total loss for end-to-end joint optimization to obtain the pollution level classification result. The ranking loss is used to constrain the order consistency of the predicted probabilities.
[0006] Preferably, the ranking loss is constructed as follows: For each sample, construct probability order inequality constraints based on the true labels: If the true label is mild, then the probability of predicting mild is greater than the probability of predicting moderate, and the probability of predicting moderate is greater than the probability of predicting severe. If the true label is severe, then the probability of predicting severe is greater than the probability of predicting moderate, and the probability of predicting moderate is greater than the probability of predicting mild. If the true label is moderate, then the probability of predicting moderate is greater than the probability of predicting mild, and the probability of predicting moderate is greater than the probability of predicting severe. The ordering loss is defined as the sum of the hinge losses of each constraint violation.
[0007] Preferably, the pollution level classification model further includes: Embed a CBAM attention module after each residual block of ResNet-50; The CBAM attention module includes a channel attention branch and a spatial attention branch; The channel attention branch is used to perform global max pooling and global average pooling on each channel of the input feature map, and the resulting one-dimensional vector is passed through a shared fully connected layer and a sigmoid activation function to generate channel attention weights. The channel attention weights are then multiplied with the input feature map channel by channel to obtain a channel attention weighted feature map. The spatial attention branch is used to perform global average pooling and global max pooling on each pixel of the input feature map in the channel dimension. The two feature maps are concatenated and then passed through a convolutional layer and a sigmoid activation function to generate a spatial attention map. The spatial attention map is multiplied pixel by pixel with the input feature map to obtain a spatial attention weighted feature map.
[0008] Preferably, the process of obtaining stain location detection results includes: The glass area image is input into the stain detection model, which uses YOLOv11n as the baseline model and performs feature extraction through the Backbone network to obtain the Backbone output feature map. The Backbone output feature map is input into the small target stain enhancement module embedded after the Backbone network to obtain the enhanced feature map; Target detection is performed based on the enhanced feature map to obtain stain location detection results.
[0009] Preferably, the small target stain enhancement module performs the following operations on the input feature map in sequence: The number of channels in the input feature map is halved by using a 1×1 convolution; The resolution of the feature map is increased by a factor of 2 through pixel rearrangement. Detail enhancement is achieved by combining 3×3 convolutions with an attention mechanism; The enhanced feature map is fused with the original input feature map through residual connections, and the enhanced feature map is output.
[0010] Preferably, the stain detection model uses an improved DIoUv3 loss function instead of the original CIoU loss function of YOLOv11n for bounding box regression; The improved DIoUv3 loss function constructs a loss value based on the intersection-union ratio of the predicted box and the ground truth box, the center point distance, the shape loss, and the outlier penalty.
[0011] Preferably, the shape loss is constructed based on the width and height differences between the predicted bounding box and the true bounding box; The outlier penalty is determined based on the comparison between the cross-union ratio (CUN) of the predicted bounding box and the ground truth bounding box and a preset outlier threshold: when the CUN is less than the outlier threshold, an additional penalty is applied to the current predicted bounding box.
[0012] Preferably, after obtaining the stain location detection results, the method further includes: A cleaning strategy is generated based on the pollution level determination result and the stain location detection result. The cleaning strategy includes: When the pollution level is light, a full cleaning command is generated; When the level of contamination is moderate, a fixed-point cleaning instruction is generated based on the stain location detection results; When the pollution level is severe, a full flush command is generated.
[0013] Preferably, the pollution level classification model outputs the following pollution level determination results: Slight contamination indicates that there are some minor stains on the glass surface and that the light transmittance is good. Moderate contamination indicates that there are obvious stains on the glass surface and the stains do not cover a large area. Severe pollution indicates that the glass surface is densely covered with stains and its light transmittance is severely reduced.
[0014] Compared with the prior art, the present invention has the following advantages and technical effects: This invention introduces a pollution level classification model with ranking loss constraints, which fully utilizes the sequential relationship between light, moderate and heavy pollution levels, effectively reduces misjudgments between adjacent pollution levels, and achieves accurate classification of glass pollution levels, providing a reliable basis for formulating differentiated cleaning strategies.
[0015] This invention designs a small target stain enhancement module, which uses pixel rearrangement operation to enlarge the resolution of the feature map and combines attention mechanism to enhance detailed features, significantly improving the detection rate of tiny stains and effectively solving the problem of serious missed detection of small target stains.
[0016] This invention embeds a CBAM dual attention module, which utilizes channel attention and spatial attention to enhance the features of the stained area and suppress background interference such as glass reflection and window frame, effectively reducing the false image misjudgment caused by the transparent reflective properties of glass.
[0017] This invention improves the localization accuracy of irregular stains and the convergence stability of the model under complex lighting conditions by adopting an improved DIoUv3 bounding box regression loss function and introducing shape similarity constraints and outlier penalty mechanisms, thus adapting to the needs of changing operating environments under UAV aerial photography perspective. Attached Figure Description
[0018] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings: Figure 1 This is a schematic diagram of the method flow according to an embodiment of the present invention; Figure 2 This is a diagram of the ResNet architecture according to an embodiment of the present invention; Figure 3 This is a CBAM architecture diagram according to an embodiment of the present invention; Figure 4 This is a schematic diagram illustrating the process of enhancing key channels and suppressing irrelevant channels through adaptive learning of channel-level attention weights in an embodiment of the present invention. Figure 5 This is a diagram of the YOLO-SD architecture according to an embodiment of the present invention; Figure 6 This is a schematic diagram of the improved DIoUv3 loss function workflow according to an embodiment of the present invention. Detailed Implementation
[0019] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.
[0020] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0021] like Figure 1 As shown, this embodiment provides a method for differentiating the degree of glass contamination and detecting stains using an intelligent curtain wall cleaning drone, including: Acquire images of curtain wall glass captured by drones; Based on the curtain wall glass image, glass area detection and segmentation are performed to obtain the glass area image; Based on the images of the glass area, the degree of pollution is determined using a pollution level classification model to obtain the pollution level determination result. Based on the results of the pollution level assessment, determine whether stain localization is necessary; When stain location is determined, stain detection is performed using a stain detection model based on the glass area image to obtain stain location detection results.
[0022] Furthermore, the process of obtaining the pollution level determination results includes: The glass region image is input into the pollution level classification model, which uses ResNet-50 as the baseline model and extracts deep features through residual block stacking. During the training phase of ResNet-50, cross-entropy loss and ranking loss are calculated simultaneously, and the weighted sum of cross-entropy loss and ranking loss is used as the total loss for end-to-end joint optimization to obtain the pollution level classification result. Among them, the ranking loss is used to constrain the order consistency of the predicted probabilities.
[0023] Furthermore, accurately determining the degree of glass contamination is a prerequisite for implementing differentiated cleaning strategies, directly determining the rationality of cleaning intensity and cleaning path planning. Currently, the task of distinguishing contamination levels faces three core challenges: First, the visual boundaries between light, moderate, and heavy contamination are blurred and easily affected by environmental factors such as light intensity and shadow occlusion, making it difficult for models to capture effective discriminative features; second, stains are diverse in shape and scale, and often mixed with glass reflections, window frames, background buildings, and other elements, further interfering with feature extraction; third, the limited image resolution under drone aerial photography makes it difficult to capture fine-grained stain features, increasing the difficulty of level classification.
[0024] To address the aforementioned issues, this embodiment proposes an improved pollution level classification model, PD-ResNet, using ResNet-50 as the baseline model. By designing a pollution feature enhancement module and a multi-scale residual fusion module, and introducing an improved ordered loss function, the accuracy and robustness of pollution level classification are enhanced, making it suitable for deployment requirements on drones.
[0025] The degree of glass contamination is usually a continuous concept, but for ease of cleaning decisions, this embodiment discretizes it into three levels: Slight contamination: The glass surface has only a small amount of dust or scattered stains, and the light transmittance is good. Generally, it only requires simple cleaning.
[0026] Moderate pollution: There are obvious stains (such as bird droppings, mud spots, etc.), but the stains do not cover a large area and require targeted cleaning.
[0027] Severely contaminated: The glass is covered with dense stains, and its light transmittance is severely reduced, usually requiring a thorough cleaning.
[0028] Specifically, this embodiment uses ResNet-50 as the baseline model and improves it for the pollution level classification task. ResNet-50 consists of 5 stages, including 49 convolutional layers and 1 fully connected layer, and achieves deep feature extraction through residual block stacking. Its core structure is as follows: Figure 2 As shown, the input image, after preprocessing, sequentially passes through convolutional layers, batch normalization, ReLU activation, and max pooling, then enters four groups of residual blocks, and finally outputs the classification result through global average pooling and a fully connected layer. This is tailored to the characteristics of the pollution level classification task. More specifically, this embodiment makes the following improvements based on ResNet-50. First, a ranking loss is introduced: utilizing the order of contamination severity (mild < moderate < severe), a ranking constraint is added to the traditional cross-entropy loss to reduce misclassification between adjacent levels. Second, a CBAM attention module is introduced: embedded in the residual block, channel attention and spatial attention are used to collaboratively enhance the features of the stained area and suppress background interference such as glass reflections and window frames.
[0029] Furthermore, the ranking loss is constructed as follows: For each sample, construct probability order inequality constraints based on the true labels: If the true label is mild, then the probability of predicting mild is greater than the probability of predicting moderate, and the probability of predicting moderate is greater than the probability of predicting severe. If the true label is severe, then the probability of predicting severe is greater than the probability of predicting moderate, and the probability of predicting moderate is greater than the probability of predicting mild. If the true label is moderate, then the probability of predicting moderate is greater than the probability of predicting mild, and the probability of predicting moderate is greater than the probability of predicting severe. The ordering loss is defined as the sum of the hinge losses of each constraint violation.
[0030] Furthermore, pollution level classification is essentially an ordered classification problem, meaning there is a natural order relationship between categories. Traditional cross-entropy loss treats each category as independent, ignoring this order information, which can easily lead to neighbor errors such as misclassifying mild as moderate and moderate as severe. To address this issue, this embodiment introduces ranking loss on top of cross-entropy loss, improving classification accuracy by constraining the order consistency of predicted probabilities.
[0031] The basic idea of ranking loss is that for a sample whose true label is "mild," the probability of predicting it as "mild" should be greater than the probability of predicting it as "medium," and the probability of predicting it as "medium" should be greater than the probability of predicting it as "severe." Similarly, for a sample whose true label is "severe," the probability of predicting it as "severe" should be greater than the probability of predicting it as "medium," and the probability of predicting it as "medium" should be greater than the probability of predicting it as "mild." Based on this, ranking loss is defined as follows: Where, p i light, p i mid p i heavy Let y represent the probabilities that the model predicts the i-th sample as mild, moderate, or severe, respectively. i The true labels are defined. For samples with moderate true labels, their order is also constrained: The total loss function is a weighted sum of the cross-entropy loss and the ranking loss: ( Where λ is the balance coefficient, set to 0.1 in the experiment. This design allows the model to simultaneously focus on classification accuracy and hierarchical order during the optimization process, effectively reducing misclassification of neighboring categories.
[0032] The specific steps of incorporating ranking loss into ResNet are as follows: First, keep the original ResNet classification network structure unchanged (i.e., the last fully connected layer outputs a 3-dimensional vector, corresponding to the logits of three contamination levels: mild, moderate, and severe). During the training phase, calculate both the cross-entropy loss and the ranking loss due to the ordered probability constraint. For each sample, construct a probability order inequality constraint based on its true label (mild / moderate / severe)—if the true label is mild, then the model's predicted mild probability > moderate probability > severe probability; if it is severe, then the severe probability > moderate probability > mild probability; if it is moderate, then both moderate probability > mild probability and moderate probability > severe probability are required. Then, define the ranking loss as the sum of the hinge losses of each constraint violation. Finally, perform end-to-end joint optimization of the cross-entropy loss and ranking loss in the form of a weighted sum (λ is set to 0.1), so that while improving classification accuracy, the model forces the maintenance of the predicted probability order, thereby effectively reducing misclassification between adjacent contamination levels.
[0033] Furthermore, the pollution level classification model also includes: Embed a CBAM attention module after each residual block of ResNet-50; The CBAM attention module includes channel attention branch and spatial attention branch; The channel attention branch is used to perform global max pooling and global average pooling on each channel of the input feature map. The resulting one-dimensional vector is passed through a shared fully connected layer and a sigmoid activation function to generate channel attention weights. The channel attention weights are then multiplied with the input feature map channel by channel to obtain the channel attention weighted feature map. The spatial attention branch performs global average pooling and global max pooling on each pixel of the input feature map in the channel dimension. The two feature maps are concatenated and then passed through a convolutional layer and a sigmoid activation function to generate a spatial attention map. The spatial attention map is then multiplied pixel by pixel with the input feature map to obtain a spatial attention weighted feature map.
[0034] Furthermore, in the task of stain detection in drone aerial images, features from non-target areas such as glass surface reflections, window frame occlusions, and background buildings are easily confused with stain features, severely interfering with the accurate judgment of the degree of stain contamination. To address this issue, this embodiment introduces a Convolutional Block Attention Module (CBAM), which is embedded into the residual blocks of ResNet. This module enhances the convolutional neural network's ability to perceive key features by simultaneously introducing channel attention and spatial attention, thereby improving model performance without significantly increasing network complexity.
[0035] The core design goal of CBAM is to overcome the limitations of traditional convolutional neural networks in processing features of different scales, shapes, and orientations. Through the synergistic effect of two attention branches, it accurately selects effective features and suppresses irrelevant interference. Specifically, the channel attention branch is used to enhance the representational ability of different feature channels and highlight channel features related to stains; the spatial attention branch focuses on extracting key information at different locations in the image space, accurately locating stain areas, and reducing interference from non-target areas.
[0036] like Figure 3 As shown, the channel attention branch consists of three parts: Sequeeze, Excitation, and Scale. In the sequeeze stage, a parallel approach of global average pooling and global max pooling is used to aggregate global information from the input feature map, fully capturing global features across the channel dimensions. In the excitation stage, the traditional fully connected layer design is abandoned in favor of convolutional layers for feature transformation. The first convolutional layer reduces the channel dimension by a factor of 16 and introduces non-linearity through the ReLU activation function. The second convolutional layer restores the channel dimension to its original dimension, and then generates channel attention weights through the Sigmoid activation function. Finally, through a scaling operation, the attention weights are multiplied channel-by-channel with the original channel features to complete channel-level feature enhancement.
[0037] The spatial attention branch first performs global average pooling and global max pooling on each pixel of the input feature map along the channel dimension, resulting in two feature maps of size H×W×1. These two feature maps are then concatenated to obtain a fused feature map of size H×W×2. Next, a 7×7 or 3×3 convolutional layer is used to reduce the dimensionality of the fused feature map, resulting in an H×W×1 feature map. Finally, a spatial attention map is generated using the Sigmoid activation function, and this map is multiplied pixel-by-pixel with the original input feature map to achieve key feature enhancement and interference suppression at the spatial level.
[0038] like Figure 4As shown, the core objective of the channel attention module is to enhance the feature representation capability of each channel in the feature map. It strengthens key channels and suppresses irrelevant channels by adaptively learning channel-level attention weights. The specific implementation steps are as follows: The first step is global max pooling and global average pooling. For the input feature map, global max pooling and global average pooling operations are performed on each channel to calculate the maximum and average eigenvalues of each channel. This operation compresses the two-dimensional feature map into a one-dimensional vector, ultimately generating two one-dimensional vectors with the same number of input channels, corresponding to the global maximum and global average feature information of each channel, respectively.
[0039] The second step involves a shared fully connected layer. The global max-pooling feature vector and the global average-pooling feature vector obtained above are input together into a shared fully connected layer. The core function of this fully connected layer is to adaptively learn the attention weights for each channel, allowing the network to autonomously determine the importance of different channels to the current task through training. Subsequently, the two feature vectors are added together and fused to obtain the final channel attention weight vector.
[0040] The third step is Sigmoid activation. To ensure that the attention weights are within a reasonable range of 0 to 1, the Sigmoid activation function is applied to the fused attention weight vector to generate normalized channel attention weights, ensuring that the weights can be directly used for channel weighting of the feature map.
[0041] The fourth step is attention weighting. The obtained normalized channel attention weights are multiplied channel by channel with the corresponding channels of the original input feature map to obtain the attention-weighted channel feature map. This process can emphasize the channel features that are beneficial to the current task, while suppressing the interference of irrelevant channels, thus improving the effectiveness of feature representation.
[0042] The CBAM module involved in this embodiment enhances the feature extraction capability by being inserted after each residual block of ResNet.
[0043] Furthermore, the process of obtaining stain location detection results includes: The glass area image is input into the stain detection model, which uses YOLOv11n as the baseline model and extracts features through the Backbone network to obtain the Backbone output feature map. The Backbone output feature map is input into the small target stain enhancement module embedded after the Backbone network to obtain the enhanced feature map; Target detection is performed based on the enhanced feature map to obtain stain location detection results.
[0044] Furthermore, in the intelligent autonomous cleaning process of curtain wall cleaning drones, accurately detecting the location of stains on the glass surface is a key prerequisite for achieving targeted cleaning. However, glass stain detection faces multiple challenges: First, stains are diverse in form, including dots, strips, and patches, with blurred boundaries, making them difficult to pinpoint precisely using regular bounding boxes; second, stains vary significantly in size, ranging from tiny specks (only a few pixels) to large areas, requiring high multi-scale detection capabilities; in addition, interference factors such as reflections on the glass surface, window frame shadows, and background buildings can easily lead to false detections, and the contrast between stains and the glass background is often low, especially in cases of light contamination, further increasing the difficulty of detection.
[0045] To address the aforementioned issues, this embodiment proposes a stain detection model based on the improved YOLOv11—YOLO-SD. By designing a small target enhancement detection layer, introducing an irregular stain feature extraction module, constructing a dual attention anti-interference mechanism, and optimizing the bounding box regression loss function, the accuracy and robustness of stain detection are improved.
[0046] YOLOv11n, as the model with the fewest parameters and fastest inference speed in the YOLOv11 series, adopts the C3K2, SPFF, and C2PSA modules as its core structure, possessing strong feature extraction capabilities and real-time inference performance, making it very suitable for deployment on UAV embedded platforms. Addressing the core requirement of stain detection by curtain wall cleaning UAVs, this embodiment makes three targeted improvements to YOLOv11n, proposing the YOLO-SD model, whose network structure is as follows: Figure 5 As shown: First, a small-target stain enhancement module is designed. After embedding the SPFF module of Backbone, the feature representation of small stains is enhanced, improving the detection rate of small-target stains. Second, the bounding box regression loss function is optimized by adopting an improved DIoUv3 loss function to improve the localization accuracy of irregular stains. The improved model significantly improves the accuracy and robustness of stain detection while maintaining lightweight design, making it suitable for stain localization scenarios from the perspective of UAVs.
[0047] Furthermore, the small target stain enhancement module performs the following operations on the input feature map in sequence: The number of channels in the input feature map is halved by using 1×1 convolution; The resolution of the feature map is increased by a factor of 2 through pixel rearrangement. Detail enhancement is achieved by combining 3×3 convolutions with an attention mechanism; The enhanced feature map is fused with the original input feature map through residual connections, and the enhanced feature map is output.
[0048] Furthermore, from the perspective of drone aerial photography, tiny stains on the glass surface (such as bird droppings and fine dust) occupy only a few pixels. Their feature signals are weak and easily masked by background noise and glass reflection, resulting in a low detection rate of small target stains by the traditional YOLOv11n model and serious missed detection.
[0049] To address this issue, this embodiment designs a small target stain enhancement module. After embedding the SPFF module of YOLOv11n Backbone, it enhances the feature representation of small stains through the process of "feature amplification - detail enhancement - noise suppression", improves the detection rate of small target stains, and the number of parameters increases only slightly, without affecting the real-time inference performance of the model.
[0050] The SSE module employs a three-level enhancement structure, specifically designed as follows: First, it receives the feature map F (with dimensions C×H×W) output from the SPFF module and adjusts the channel dimensions through a 1×1 convolution, halving the number of channels and reducing computational cost. Then, it uses a pixel shuffle operation to double the resolution of the feature map, amplifying the features of small targets and facilitating the model's capture of minute details of dirt. Next, it uses a 3×3 convolution combined with an attention mechanism to enhance the details of the amplified feature map, strengthening the dirt features. Finally, it fuses the enhanced feature map with the original feature map through residual connections, outputting the enhanced feature map while ensuring no loss of original feature information.
[0051] The mathematical expression for the SSE module is as follows: In the formula, pixel shuffle represents the pixel rearrangement operation, scale=2 indicates that the resolution is magnified by a factor of 2, A represents the attention weight matrix (generated through global average pooling and 1×1 convolution), and Upsample represents bilinear interpolation upsampling to ensure that the original feature map and the enhanced feature map have the same scale. This module amplifies the features of small targets through pixel rearrangement and strengthens the details through the attention mechanism, effectively improving the model's detection rate of small stains and solving the problem of missed detection of stains on small targets.
[0052] The SSE module involved in this embodiment enhances the feature extraction capability by being inserted after the SPPF module of Backbone.
[0053] Furthermore, the stain detection model uses the improved DIoUv3 loss function instead of the original CIoU loss function of YOLOv11n for bounding box regression; The improved DIoUv3 loss function constructs loss values based on the intersection-union ratio of the predicted box and the ground truth box, the center point distance, the shape loss, and the outlier penalty.
[0054] Furthermore, YOLOv11n employs the CIoU loss function in bounding box regression tasks. Its core is to combine the distance between the center points of the ground truth box and the predicted box, the aspect ratio, and the IoU value to calculate the loss. However, CIoU loss has two obvious drawbacks: First, it has poor adaptability to irregularly shaped targets, and glass stains are mostly irregular in shape, resulting in low accuracy of bounding box regression; second, gradient calculation is complex, and gradient vanishing is prone to occur during training, affecting the convergence speed of the model.
[0055] like Figure 6 As shown, to address the above issues, this embodiment uses an improved DIoUv3 loss function to replace the original CIoU loss function, thereby improving the localization accuracy of irregular stains and the convergence speed of the model.
[0056] Specifically, the DIoUv3 loss function, based on the DIoU loss, introduces shape similarity constraints and gradient enhancement mechanisms. Its core advantages are: first, it considers the shape similarity between the predicted box and the ground truth box, and improves the localization accuracy of irregular targets by penalizing the difference in aspect ratio between the predicted box and the ground truth box; second, it optimizes the gradient calculation method to avoid gradient vanishing and accelerate model convergence; and third, it introduces a non-monotonic focusing mechanism, which improves the training weight of difficult-to-localize samples by evaluating the outlierness of the predicted box, thereby further improving the localization accuracy.
[0057] The improved DIoUv3 loss function is calculated as follows: In the formula, IoU is the intersection-union ratio of the predicted bounding box and the ground truth bounding box, and ρ(b, b) is the intersection-union ratio of the predicted bounding box and the ground truth bounding box. gt ) represents the Euclidean distance between the center point of the predicted bounding box and the center point of the ground truth bounding box, c represents the diagonal length of the smallest bounding rectangle containing both the predicted and ground truth bounding boxes, α represents the shape loss weight (set to 0.5 in the experiment), and β represents the outlier penalty weight (set to 0.1 in the experiment).
[0058] The formula for calculating shape loss is as follows: In the formula, w and h are the width and height of the prediction box, respectively. gt h gt , where represents the width and height of the actual bounding box, and ꝩ is the shape penalty coefficient (set to 2 in the experiment).
[0059] The formula for calculating the outlier penalty (Routlier) is: (27) In the formula, θ is the outlier threshold (set to 0.5 in the experiment). When the IoU is less than θ, the predicted box is considered an outlier box, and an additional penalty is applied to increase the training weight of hard-to-locate samples.
[0060] The improved DIoUv3 loss function enhances the localization accuracy of irregular stains through shape constraints, accelerates model convergence through gradient enhancement mechanism, and improves the detection rate of difficult-to-locate samples through outlier penalty, effectively solving the defects of CIoU loss and adapting to the characteristics of irregular and difficult-to-locate glass stains.
[0061] This embodiment replaces the original CIoU loss function of the model with the improved DIoUv3 loss function.
[0062] Furthermore, the shape loss is constructed based on the width and height differences between the predicted bounding box and the ground truth bounding box; The outlier penalty is determined by comparing the cross-union ratio (CUR) of the predicted bounding box and the ground truth bounding box with a preset outlier threshold: when the CUR is less than the outlier threshold, an additional penalty is applied to the current predicted bounding box.
[0063] Furthermore, after obtaining the stain location detection results, the process also includes: Based on the pollution level assessment and stain location detection results, a cleaning strategy is generated; Cleaning strategies include: When the pollution level is light, a full cleaning command is generated; When the level of contamination is moderate, a targeted cleaning instruction is generated based on the stain location detection results; When the pollution level is severe, a full flush command is generated.
[0064] Furthermore, the pollution level classification model outputs the following pollution level determination results: Slight contamination indicates that there are some minor stains on the glass surface and that the light transmittance is good. Moderate contamination indicates that there are obvious stains on the glass surface and the stains do not cover a large area. Severe pollution indicates that the glass surface is densely covered with stains and its light transmittance is severely reduced.
[0065] The above are merely preferred embodiments of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for differentiating the degree of glass contamination and detecting stains using an intelligent curtain wall cleaning drone, characterized in that, include: Acquire images of the curtain wall glass captured by a drone; Based on the curtain wall glass image, glass area detection and segmentation are performed to obtain a glass area image; Based on the image of the glass area, the degree of pollution is determined by a pollution level classification model to obtain the pollution level determination result. Based on the pollution level assessment results, determine whether to locate the stain; When stain location is determined, stain detection is performed using a stain detection model based on the glass area image to obtain stain location detection results.
2. The method according to claim 1, characterized in that, The process of obtaining the pollution level determination results includes: The image of the glass region is input into a pollution level classification model, which uses ResNet-50 as the baseline model and extracts deep features through residual block stacking. During the training phase of ResNet-50, cross-entropy loss and ranking loss are calculated simultaneously, and the weighted sum of the cross-entropy loss and ranking loss is used as the total loss for end-to-end joint optimization to obtain the pollution level classification result. The ranking loss is used to constrain the order consistency of the predicted probabilities.
3. The method according to claim 2, characterized in that, The ranking loss is constructed as follows: For each sample, construct probability order inequality constraints based on the true labels: If the true label is mild, then the probability of predicting mild is greater than the probability of predicting moderate, and the probability of predicting moderate is greater than the probability of predicting severe. If the true label is severe, then the probability of predicting severe is greater than the probability of predicting moderate, and the probability of predicting moderate is greater than the probability of predicting mild. If the true label is moderate, then the probability of predicting moderate is greater than the probability of predicting mild, and the probability of predicting moderate is greater than the probability of predicting severe. The ordering loss is defined as the sum of the hinge losses of each constraint violation.
4. The method according to claim 1, characterized in that, The pollution level classification model also includes: Embed a CBAM attention module after each residual block of ResNet-50; The CBAM attention module includes a channel attention branch and a spatial attention branch; The channel attention branch is used to perform global max pooling and global average pooling on each channel of the input feature map, and the resulting one-dimensional vector is passed through a shared fully connected layer and a sigmoid activation function to generate channel attention weights. The channel attention weights are then multiplied with the input feature map channel by channel to obtain a channel attention weighted feature map. The spatial attention branch is used to perform global average pooling and global max pooling on each pixel of the input feature map in the channel dimension. The two feature maps are concatenated and then passed through a convolutional layer and a sigmoid activation function to generate a spatial attention map. The spatial attention map is multiplied pixel by pixel with the input feature map to obtain a spatial attention weighted feature map.
5. The method according to claim 1, characterized in that, The process of obtaining stain location detection results includes: The glass area image is input into the stain detection model, which uses YOLOv11n as the baseline model and performs feature extraction through the Backbone network to obtain the Backbone output feature map. The Backbone output feature map is input into the small target stain enhancement module embedded after the Backbone network to obtain the enhanced feature map; Target detection is performed based on the enhanced feature map to obtain stain location detection results.
6. The method according to claim 5, characterized in that, The small target stain enhancement module performs the following operations on the input feature map in sequence: The number of channels in the input feature map is halved by using a 1×1 convolution; The resolution of the feature map is increased by a factor of 2 through pixel rearrangement. Detail enhancement is achieved by combining 3×3 convolutions with an attention mechanism; The enhanced feature map is fused with the original input feature map through residual connections, and the enhanced feature map is output.
7. The method according to claim 1, characterized in that, The stain detection model uses the improved DIoUv3 loss function instead of the original CIoU loss function of YOLOv11n for bounding box regression; The improved DIoUv3 loss function constructs a loss value based on the intersection-union ratio of the predicted box and the ground truth box, the center point distance, the shape loss, and the outlier penalty.
8. The method according to claim 7, characterized in that, The shape loss is constructed based on the difference in width and height between the predicted bounding box and the true bounding box; The outlier penalty is determined based on the comparison between the cross-union ratio (CUN) of the predicted bounding box and the ground truth bounding box and a preset outlier threshold: when the CUN is less than the outlier threshold, an additional penalty is applied to the current predicted bounding box.
9. The method according to claim 1, characterized in that, After obtaining the stain location detection results, the following is also included: A cleaning strategy is generated based on the pollution level determination result and the stain location detection result. The cleaning strategy includes: When the pollution level is light, a full cleaning command is generated; When the level of contamination is moderate, a fixed-point cleaning instruction is generated based on the stain location detection results; When the pollution level is severe, a full flush command is generated.
10. The method according to claim 1, characterized in that, The pollution level classification model outputs the following pollution level determination results: Slight contamination indicates that there are some minor stains on the glass surface and that the light transmittance is good. Moderate contamination indicates that there are obvious stains on the glass surface and the stains do not cover a large area. Severe pollution indicates that the glass surface is densely covered with stains and its light transmittance is severely reduced.
