A river anomaly remote sensing image detection method based on YOLO
By using a YOLO-based remote sensing image detection method for river anomalies, combined with multi-task loss function, concentration gradient inverse calculation, and shoreline semantic segmentation, the problem of difficulty in identifying hidden sewage outlets in traditional methods is solved, and high-precision identification and accurate positioning of anomaly targets in river channels are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SICHUAN PASTEUR ENVIRONMENTAL PROTECTION TECH CO LTD
- Filing Date
- 2026-05-06
- Publication Date
- 2026-06-02
AI Technical Summary
Existing technologies struggle to accurately identify hidden sewage outlets in waterways, and traditional visual algorithms are easily affected by the water surface environment and have a high false alarm rate, failing to meet the needs of precise environmental law enforcement.
A YOLO-based remote sensing image detection method for river anomalies was adopted. The YOLO network was optimized by combining a multi-task loss function to identify anomalies. A bank weight map was generated by inverse inference of concentration gradient and semantic segmentation of bank physical material to determine the location of hidden sewage outlets.
It achieves high-precision identification of abnormal targets in the river channel, accurately locates the position of hidden sewage outlets, overcomes the visual blind spots of traditional algorithms, and improves the accuracy and efficiency of monitoring.
Smart Images

Figure CN122135235A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of remote sensing image processing technology, and specifically relates to a method for detecting river channel anomalies in remote sensing images based on YOLO. Background Technology
[0002] With the continuous advancement of ecological civilization construction, the protection and refined management of river water environment has become an important part of urban governance. Anomalies in rivers, such as water pollution, illegal sewage discharge, unauthorized construction along the shoreline, and garbage accumulation, directly threaten the safety of the aquatic ecosystem. In recent years, with the rapid development of UAV remote sensing technology and computer vision, large-scale river inspections using UAVs equipped with high-definition cameras have become an efficient and routine method. Because the river environment itself is a complex water-land transition zone, pollution plumes on the water surface often exhibit a physical diffusion pattern of decreasing concentration from the source to the periphery. Riverbanks are composed of various complex physical materials, including solid concrete flood walls, masonry gaps, shallow silt, and natural vegetation. These hydrological dynamics and geological structural features together constitute the complex environmental basis for river remote sensing monitoring. Therefore, traditional target detection algorithms, which mainly rely on color and texture features of the image surface for pure visual feature matching, can only identify abnormal targets exposed in the light, and are almost completely ineffective against illegal discharges hidden below the water surface or obscured by dense shoreline vegetation. Some methods that attempt to locate pollution sources by utilizing the characteristics of water surface pollution diffusion lack common-sense constraints on the physical structure of the shoreline. They are not only easily affected by water flow ripples, causing pathfinding deviations, but also often result in absurd situations where the calculated highest concentration point of the pollution source falls on flood control concrete walls or flat mudflats. This leads to a high false alarm rate in the detection of concealed sewage outlets, making it difficult to meet the actual operational needs of precise environmental law enforcement. Summary of the Invention
[0003] To address the shortcomings of existing technologies, this invention provides a YOLO-based remote sensing image detection method for river channel anomalies, thereby solving the aforementioned technical problems.
[0004] A YOLO-based remote sensing image detection method for river channel anomalies includes the following steps:
[0005] S1: Establish an anomaly dataset based on river anomaly images and preprocess the acquired anomaly dataset;
[0006] S2: Label the anomaly types in the preprocessed anomaly dataset, and divide the labeled anomaly dataset into training set and test set. The anomaly types should include at least water pollution.
[0007] S3: Use the training set to train YOLO object detection, and obtain the final detection model after meeting the requirements of the test set;
[0008] S4: Acquire a remote sensing image of the river channel anomaly as the input image, use the detection model to identify it, and output the target detection box and the corresponding category of the river channel anomaly target;
[0009] S5: When the detected abnormal target in the river channel includes water pollution, the concentration gradient of the detected water pollution area is calculated in reverse to obtain the color gradient direction within the water pollution area, and the vector of the color gradient direction is used as the pollution source direction vector.
[0010] S6: Perform semantic segmentation on the riverbank area in the remote sensing image of the river channel anomaly to identify the material category of the riverbank; according to the preset material weight table, assign a probability weight value containing hidden sewage outlets to the riverbanks of different material categories to generate a bank weight map.
[0011] S7: Based on the bank weight map, determine the search area within the riverbank area according to the pollution source direction vector; calculate the probability score of each pixel within the search area, and determine the pixel with the highest score as the final hidden sewage outlet location and output it.
[0012] Preferably, step S1, when preprocessing the acquired abnormal dataset, specifically includes the following steps:
[0013] Set the sliding window and preset sliding step size;
[0014] A non-overlapping sliding method is used to crop the abnormal river channel image using the sliding window, making it uniform to a preset pixel size and then normalizing it.
[0015] During the cropping process, when the sliding window moves to the image boundary and the size of the remaining area is smaller than the preset pixel size, the remaining area is filled with zero pixel values.
[0016] Preferably, in step S3, the YOLO object detection training uses a multi-task loss function during the training process;
[0017] The multi-task loss function is composed of bounding box regression loss, confidence loss, and classification loss.
[0018] Preferably, in step S2, the identification of abnormal types specifically includes: personnel abnormalities, shoreline garbage, discharge outlets, construction activities, oil pollution on the water surface, fishing activities, floating garbage, and floating plants.
[0019] Preferably, Label Studio is used to identify the types of exceptions.
[0020] During calibration, the image dataset was divided into training and testing sets in a 7:3 ratio, and the format of the image dataset was adjusted to PASCAL VOC format.
[0021] Preferably, after identification using the detection model in step S4, the step further includes a threshold optimization step for the detection results, as shown below:
[0022] Obtain the accuracy and recall of the model output at different confidence thresholds, and plot the PR curve;
[0023] The confidence level corresponding to the inflection point of the PR curve is extracted as the optimal confidence threshold;
[0024] The target detection boxes are filtered based on the optimal confidence threshold, and the final categories of abnormal targets in the river channel and the target detection boxes are output.
[0025] Preferably, step S5, when performing the concentration gradient inverse calculation for the detected water pollution area, specifically includes the following steps:
[0026] The image of the polluted water area is converted from the RGB color space to the target color space, and a specific component of the target color space is extracted as a concentration proxy index. The target color space is the HSV color space or the CIELAB color space, and the specific component is the lightness channel or the saturation channel.
[0027] The gradient field corresponding to the concentration proxy index is calculated using the gradient operator;
[0028] The normalized direction vector is obtained by statistically averaging the gradients in the opposite directions of the gradient field, and is used as the direction vector of the pollution source.
[0029] Preferably, in step S6, any one of the DeepLabV3+ model, Segformer model, or FCN-ViT model is used to perform semantic segmentation on the riverbank area.
[0030] Preferably, the material categories in the material weighting table include at least: concrete bank walls, bare ground, stone retaining walls, natural stone crevices, shallow gravel beaches, and vegetation-covered areas.
[0031] In the material weight table, the probability weight value corresponding to each material category is set in the range of 0 to 1.
[0032] Preferably, step S7, when calculating the probability score of each pixel within the search area, specifically includes the following steps:
[0033] Starting from the geometric center of the polluted water area, draw a ray along the direction vector of the pollution source, and record the intersection of the ray with the riverbank as the reference point.
[0034] Using the reference point as the center, a fan-shaped area is defined as the search area according to a preset angle;
[0035] Within the search area, the probability score of each pixel is calculated using the following formula;
[0036]
[0037] in, Indicates coordinates as The probability score of each pixel. Indicates coordinates as The material weight corresponding to each pixel. Let be the distance decay function. Indicates coordinates as The Euclidean distance from the pixel to the reference point.
[0038] The beneficial effects of this invention are as follows: This solution utilizes a YOLO network optimized with a multi-task loss function to achieve high-precision comprehensive identification of various river anomalies, such as personnel, shoreline garbage, and water pollution, greatly enriching the dimensions of intelligent water environment monitoring. Furthermore, after capturing water pollution areas, this invention creatively introduces a topological anchoring mechanism that combines concentration gradient inverse estimation with semantic maps of shoreline physical materials. This not only accurately extracts physical vector trajectories pointing to the source along the gradient direction of water color, but also, by assigning differentiated probability weights to different shoreline materials for hiding sewage outlets, and combining this with a distance decay mapping algorithm, accurately maps and locks the final predicted sewage outlet coordinates to the shoreline material where pipelines are most easily hidden according to physical principles, breaking through the blind spots of traditional visual algorithms that easily violate physical principles. Attached Figure Description
[0039] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0040] Figure 1 A schematic diagram of the structure of a YOLO-based remote sensing image detection method for river channel anomalies provided by the present invention;
[0041] Figure 2 A schematic diagram of the PR curve of a YOLO-based remote sensing image detection method for river channel anomalies provided by the present invention;
[0042] Figure 3 The image shows the segmentation effect of the riverbank type in the YOLO-based remote sensing image detection method for river anomalies provided by this invention.
[0043] Figure 4 The diagram shows the target categories and target detection bounding boxes for a YOLO-based remote sensing image detection method for river anomalies provided by this invention. Detailed Implementation
[0044] The following disclosure provides many different embodiments or examples for implementing various embodiments of the invention. To simplify the disclosure, specific embodiments are described below. Of course, these are merely examples and are not intended to limit the scope of the invention.
[0045] The embodiments of the invention will now be described in detail with reference to the accompanying drawings.
[0046] like Figure 1 As shown, a YOLO-based remote sensing image detection method for river channel anomalies includes the following steps:
[0047] S1: Establish an anomaly dataset based on river anomaly images and preprocess the acquired anomaly dataset;
[0048] S2: Label the anomaly types in the preprocessed anomaly dataset, and divide the labeled anomaly dataset into training set and test set. The anomaly types should include at least water pollution.
[0049] S3: Use the training set to train YOLO object detection, and obtain the final detection model after meeting the requirements of the test set;
[0050] S4: Acquire a remote sensing image of the river channel anomaly as the input image, use the detection model to identify it, and output the target detection box and the corresponding category of the river channel anomaly target;
[0051] S5: When the detected abnormal target in the river channel includes water pollution, the concentration gradient of the detected water pollution area is calculated in reverse to obtain the color gradient direction within the water pollution area, and the vector of the color gradient direction is used as the pollution source direction vector.
[0052] S6: Perform semantic segmentation on the riverbank area in the remote sensing image of the river channel anomaly to identify the material category of the riverbank; according to the preset material weight table, assign a probability weight value containing hidden sewage outlets to the riverbanks of different material categories to generate a bank weight map.
[0053] S7: Based on the bank weight map, determine the search area within the riverbank area according to the pollution source direction vector; calculate the probability score of each pixel within the search area, and determine the pixel with the highest score as the final hidden sewage outlet location and output it.
[0054] To address the technical bottleneck of existing remote sensing detection methods, which can only identify visible anomalies but struggle to locate concealed sewage outlets, this solution first collects river images to construct a dataset. A non-overlapping sliding window is used for cropping and normalization preprocessing to label multiple anomalies, including water pollution and shoreline debris, and to divide the dataset into training and testing sets. Then, a YOLO model is trained to output bounding boxes containing category and confidence scores. When water pollution is detected, a source tracing mechanism converts it to HSV or CIE. The design uses the LAB color space to extract the brightness or saturation channels as concentration proxy indicators. It then calculates the brightness gradient field using Sobel or Scharr operators and takes a statistical average of the gradient in the opposite direction to generate a direction vector pointing to the pollution source. Simultaneously, it employs segmentation networks such as DeepLabV3+ to perform semantic segmentation on the riverbank, classifying its physical structure into materials such as solid concrete, masonry joints, or natural vegetation. Based on physical principles, it assigns weights to the probability of concealed pipes, generating a bankbank weight map. Finally, a ray is drawn along the direction vector to intersect with the bankbank, forming a reference point. This point is used to delineate a fan-shaped search area. The probability score is calculated by multiplying the material weight of each pixel within the area by the Gaussian distance decay function. The highest-scoring point is then forcibly selected and output as the coordinates of the hidden sewage outlet. The core principle of this design lies in integrating the hydrodynamic plume diffusion laws with hydrogeological and physical priors, transforming the purely mathematical pixel gradient convergence in computer vision into spatial topological convergence constrained by the probability of physical geological materials. Compared to traditional single-object detection networks, which are prone to misclassifying the highest concentration source as falling on a solid, seamless flood wall or flat mudflat, this invention effectively overcomes surface visual blind spots. The pathfinding trajectory avoids solid obstacles that are physically impossible to penetrate pipes, accurately locating the most vulnerable physical points where pipelines are most likely to be hidden. This embodiment is specifically implemented on a Windows 11 system with an AMD Ryzen 7 5700G CPU with Radeon Graphics, 16GB of memory, and the Ultralytics YOLO framework. Training parameters are set as follows: a stochastic gradient descent optimizer with momentum is used; the initial learning rate is set to 0.01; the weight decay coefficient is 0.0005; and the batch processing parameter is set to 16. A cosine annealing learning rate scheduling strategy is used, with an initial learning rate of 0.01, and the final learning rate decays to 1% of the initial value. Training is performed on 100 full datasets, and an early stopping mechanism is used: training is terminated early when the loss value on the test set does not decrease after 10 consecutive full datasets. For data augmentation, YOLO's default Mosaic and MixUp strategies are used to improve the model's generalization ability. After the network training is completed, images from the test set are input into the network for detection, resulting in standard river channel anomaly detection results.
[0055] More specifically, in step S1, the preprocessing of the acquired abnormal dataset includes the following steps:
[0056] Set the sliding window and preset sliding step size;
[0057] A non-overlapping sliding method is used to crop the abnormal river channel image using the sliding window, making it uniform to a preset pixel size and then normalizing it.
[0058] During the cropping process, when the sliding window moves to the image boundary and the size of the remaining area is smaller than the preset pixel size, the remaining area is filled with zero pixel values.
[0059] In the preprocessing stage of river remote sensing images, this invention employs a fixed-size sliding window of 780×780 pixels, with a non-overlapping sliding step size equal to the window size of 780 pixels. The image is traversed and cropped sequentially from the top-left corner coordinates. When the right or bottom boundary of the image is reached, and the height or width of the remaining image area is less than 780 pixels, a boundary padding strategy is forcibly invoked, using zero-pixel values to fill in the missing dimensions, thereby outputting a sequence of image blocks of uniform size and normalized processing. The core principle of this design is that the preset pixel size of 780×780 is slightly larger than the default 640×640 input specification of the YOLO model. This maximizes the preservation of high-frequency texture details of small anomalies on the river surface while maintaining compatibility with the model's receptive field. Simultaneously, the non-overlapping step size eliminates data redundancy, and the zero-pixel padding mechanism prevents forced truncation of edge features in physical space. Compared to traditional techniques that directly compress, scale, or randomly crop high-resolution remote sensing images, resulting in severe pixel distortion, aspect ratio imbalance, and omission of edge targets, this implementation method ensures the morphological integrity of sparsely distributed small-scale anomalies such as shoreline garbage and tiny sewage outlets before they enter the neural network. It transforms non-standard data in edge regions into standardized tensor inputs, providing a non-variable underlying pixel benchmark for subsequent water pollution concentration gradient inversion and shoreline material semantic segmentation in the overall invention. Furthermore, it substantially improves the boundary recall rate and coordinate mapping accuracy of the overall hidden sewage outlet topology localization algorithm.
[0060] More specifically, in step S3, the YOLO object detection training uses a multi-task loss function during the training process;
[0061] The multi-task loss function is composed of bounding box regression loss, confidence loss, and classification loss.
[0062] To address the issues of missed detection and low localization accuracy of multi-scale anomalies in complex river scenarios, this invention employs the YOLO11n architecture and combines it with a multi-task loss function for joint optimization during the model training phase in a specific embodiment. The specific implementation involves: constructing a feature pyramid structure using the YOLO11n backbone network, performing grid partitioning on feature maps at different scales, and dividing each feature map into... grid cells The resolutions are downsampled by 8, 16, and 32 times respectively, corresponding to the original input image resolution. For each grid cell, the model predicts multiple candidate bounding boxes based on the current receptive field and calculates the total gradient during backpropagation training using a multi-task loss function composed of bounding box regression loss, confidence loss, and classification loss.
[0063] In this embodiment of the invention, the YOLO11n model optimization employs a multi-task loss function, whose total loss... Loss from bounding box regression Target classification loss and distribution focus loss It consists of three weighted components. The calculation method is as follows:
[0064] in, To balance the weight hyperparameters of the bounding box regression loss, To balance the weight hyperparameters of the target classification loss, The weight hyperparameters are used to balance the distribution focus loss. Specifically, the bounding box regression loss... CIoU loss is used to simultaneously measure the consistency between the predicted bounding box and the ground truth bounding box in terms of overlap area, center distance, and aspect ratio; object classification loss. The error between the predicted class probability and the true label is calculated using binary cross-entropy loss; distribution focus loss is also used. This is used to refine the prediction of bounding box coordinates. By using the joint backpropagation of the above multi-task loss functions, the network's detection accuracy for small and occluded abnormal targets in complex river scenarios is improved.
[0065] More specifically, in step S2, the identification of abnormal types also includes: personnel abnormalities, shoreline garbage, discharge outlets, construction activities, oil pollution on the water surface, fishing activities, floating garbage, and floating plants.
[0066] In the specific implementation of the anomaly dataset labeling stage, image annotation tools are used to classify and label the preprocessed river remote sensing images according to a pre-defined classification system. Specifically, the river anomaly features are accurately classified into nine major feature labels: personnel anomalies, shoreline garbage, visible discharge outlets, construction activities, water pollution, surface oil pollution, fishing activities, floating garbage, and floating vegetation, and then converted into a standardized dataset format. The core principle of this multi-dimensional classification design lies in constructing a river ecological semantics of all physical features, enabling the deep convolutional neural network to simultaneously learn, through shared feature extraction layers, the abrupt changes in the spectral reflectance of the water surface at the non-rigid edges of oil and water pollution, the abrupt changes in the geometric texture of the shoreline of construction traces and accumulated garbage, and the heterogeneous visual distribution patterns of the dynamic target morphology of personnel and fishing operations. Compared to the limitations of traditional single-target detection networks, which can only identify floating objects or single illegal buildings in isolation, this implementation method achieves comprehensive perception of the complex ecological environment of rivers and human illegal activities across the entire scenario. This not only greatly eliminates the redundancy of computing power during multi-task concurrent inspections, but also plays a logical gating role in the overall invention. That is, the subsequent concentration gradient inverse calculation and mapping localization mechanism is triggered only when a specific type of water pollution is accurately filtered out, thus avoiding the ineffective consumption of computing power on non-polluting targets.
[0067] The classification criteria for river channel anomalies are shown in Table 1 below:
[0068] Table 1. River Channel Anomaly Categories
[0069]
[0070] More specifically, Label Studio is used to identify the types of exceptions.
[0071] During calibration, the image dataset was divided into training and testing sets in a 7:3 ratio, and the format of the image dataset was adjusted to PASCAL VOC format.
[0072] In the processing implementation of the river channel anomaly remote sensing image dataset, the initial image file list is first globally randomly rearranged using the `shuffle` function of Python's built-in `random` module to eliminate distribution biases that may be introduced by the original UAV flight path acquisition order. Then, the shuffled sample set is strictly divided into training and test sets according to a 70% to 30% ratio, and the corresponding image file names are recorded and saved to a separate directory. During iterative training, the network model's forward performance is validated in each round using 30% of the test set samples that did not participate in gradient updates. The model is required to have a multi-class average accuracy that consistently exceeds a preset high-confidence benchmark threshold, such as 90%, and the validation set loss curve should show a continuous decline and eventually converge smoothly without overfitting. This serves as the hard generalization ability evaluation threshold for truncating training and solidifying the final detection model, i.e., the aforementioned test set requirements.
[0073] In the target calibration phase, the Label Studio open-source visual annotation platform was deployed. Labels and high-contrast colors were configured according to preset river anomalies to perform precise bounding box selection of multi-scale anomalies in the image. Finally, all calibration results were uniformly exported to the PASCAL VOC format, generating a structured XML file decoupled from the original image but with a one-to-one coordinate mapping. The core principle of this design lies in using a statistical random sampling mechanism combined with a standardized data processing pipeline. This ensures both the rich sample diversity required for YOLO model gradient descent and maintains the generalization ability evaluation benchmark of the independent test set. The PASCAL VOC specification, with its XML tree structure, encapsulates spatial geometric coordinates and classification semantic information, enabling integration with the underlying data loader of the target detection network. Compared to the data leakage and parsing misalignment problems caused by traditional manual sequential partitioning or the use of non-standard text storage, this implementation effectively eliminates the overfitting defect of the network to specific continuous river backgrounds, significantly improves the joint convergence speed of the model for complex river anomalies, and provides low-error initial spatial coordinate anchors for subsequent pollution plume gradient inversion and shoreline physical material mapping processes.
[0074] More specifically, after identification using the detection model in step S4, the step further includes a threshold optimization step for the detection results, as detailed below:
[0075] Obtain the accuracy and recall of the model output at different confidence thresholds, and plot the PR curve;
[0076] The confidence level corresponding to the inflection point of the PR curve is extracted as the optimal confidence threshold;
[0077] The target detection boxes are filtered based on the optimal confidence threshold, and the final categories of abnormal targets in the river channel and the target detection boxes are output.
[0078] In the specific implementation of the post-processing stage of target detection output, this invention introduces a dynamic optimization mechanism for confidence thresholds based on data distribution characteristics. During the model testing stage, instead of directly using the default static constant empirical threshold, it extracts the precision and recall data matrix corresponding to the model traversing consecutive confidence thresholds on the test set, to plot... Figure 2 The two-dimensional PR curve is shown; subsequently, a mathematical optimization algorithm is used to calculate the geometric point or F1 score peak point on the curve that is closest to the ideal coordinates (1,1) as the logical inflection point, and the confidence value mapped by this inflection point is extracted as the optimal confidence threshold; in actual inference, this optimal threshold is directly used to truncate and filter the original candidate target detection boxes generated by the forward propagation of the input river remote sensing image, such as... Figure 4 As shown, the final output includes the denoised river anomaly category and precise bounding box. The core principle of this design lies in using a statistically driven feedback model to quantify and balance the conflict between the sensitivity and specificity of deep neural networks when processing complex river background noise, transforming subjectively set truncation parameters into mathematically objective optimal decision boundaries. Compared to the inherent defects of traditional target detection technologies, such as the easy omission of small pollution patches due to fixed thresholds and the easy misjudgment of water surface reflective ripples as anomalies, this implementation not only significantly suppresses false alarms of artifacts in complex water optical environments, but also ensures the authenticity and reliability of the initial spatial coordinates passed to the subsequent water pollution concentration gradient inverse calculation module, eliminating invalid outlet searches and wasted computing power induced by erroneous detection boxes.
[0079] As a further preferred embodiment of the above detection steps, to suppress false positives of water pollution caused by localized stagnant water discoloration, bottom sediment turbulence, or algal eutrophication patches in complex hydrological environments, the detection method also includes a joint detection mechanism based on hydrodynamic topological constraints. Specific implementation methods are as follows:
[0080] In the forward inference network of the detection model, a topology prediction head is added in parallel at the prediction end to deconstruct the complete water pollution event into three sub-targets with strict physical spatial causality: sewage outlet, corresponding to the pollutant injection point; pollution plume, corresponding to the high-concentration diffusion zone; and diffusion-fusion zone, corresponding to the low-concentration water mixing zone. During the target detection inference stage, the detection model simultaneously outputs the candidate bounding boxes and their center pixel coordinates for the above three types of sub-targets. Then, the main channel flow direction vector of the current river segment is obtained, and the first spatial vector pointing from the center point of the sewage outlet to the center point of the pollution plume, and the second spatial vector pointing from the center point of the pollution plume to the center point of the diffusion-fusion zone are calculated. The shortest Euclidean distance between the bounding boxes of the three types of sub-targets is further calculated, and it is determined whether the shortest Euclidean distance is less than a preset spatial adjacency connectivity threshold. Then, the cosine similarity between the first and second spatial vectors and the main channel flow direction vector is calculated respectively.
[0081] A water pollution alarm is output only if the three bounding boxes—the discharge outlet, the pollution plume, and the diffusion-fusion zone—all satisfy the spatial adjacency and connectivity condition, and the two calculated cosine similarities are both greater than zero (i.e., the vector angle is less than 90 degrees), and the physical transport law of pollutant diffusion in the direction of water flow is met. Conversely, if an isolated discharge outlet is detected without a matching pollution plume and diffusion-fusion zone, or if the calculated diffusion vector contradicts the actual physical water flow direction (i.e., the cosine similarity is less than zero), a confidence penalty weight is applied to the candidate box cluster, or it is even directly filtered out. The design principle of this joint detection mechanism is to break through the technical limitations of traditional target detection algorithms that rely solely on isolated pixel texture features, and to deeply couple deep learning visual feature extraction with the continuous transport equation of matter in macroscopic fluid dynamics. Compared to existing technologies that easily misjudge irregularly shaped natural water surface reflections or isolated suspended objects as pollution events, this implementation method's forced detection model establishes a material diffusion logic chain in the two-dimensional image space that conforms to three-dimensional physical reality. This enables remote sensing monitoring to intelligently leap from identifying isolated surface features to reasoning about spatial causal laws, eliminating invalid warnings caused by non-pollution factors from the algorithm's underlying layer and ensuring the accuracy of inspections.
[0082] More specifically, step S5, which involves calculating the concentration gradient inversely for the detected water pollution area, includes the following steps:
[0083] The image of the polluted water area is converted from the RGB color space to the target color space, and a specific component of the target color space is extracted as a concentration proxy index. The target color space is the HSV color space or the CIELAB color space, and the specific component is the lightness channel or the saturation channel.
[0084] The gradient field corresponding to the concentration proxy index is calculated using the gradient operator;
[0085] The normalized direction vector is obtained by statistically averaging the gradients in the opposite directions of the gradient field, and is used as the direction vector of the pollution source.
[0086] In the specific implementation of the water pollution source tracing stage, the water pollution area image output by the target detection network is first nonlinearly transformed from the original RGB color space to the HSV or CIE LAB target color space, and the saturation or brightness channel is accurately extracted as a concentration proxy indicator. Then, the Sobel or Scharr space differentiation operator is used to perform two-dimensional convolution on the single-channel image to calculate the concentration gradient field, thereby obtaining the intensity and direction of the brightness change of each pixel. Since higher pollutant concentration usually has stronger light absorption and corresponding lower brightness value, the reverse direction of each feature gradient in the gradient field is extracted, and the reverse gradient of all pixels in the pollution area is globally statistically averaged and normalized, finally outputting a high-confidence pollution source direction vector. The core principle of this design is that by transforming the dimension of the color space, the coupling interference between natural light intensity and water surface ripples is removed, and the physical process of pollution plume spreading from the source to the periphery in fluid dynamics, resulting in continuous concentration decay, is mapped to a quantifiable mathematical convergence problem in computer vision. Compared to existing technologies that only provide a rough bounding box of the polluted area or blindly search for color extrema in the RGB space which is easily affected by light whitening, this implementation effectively shields the environmental noise of complex water surface reflection and shoreline shadow by using multi-dimensional channel decoupling. Furthermore, it smooths the pixel gradient abrupt changes caused by local water turbulence through a global statistical averaging strategy, providing a strong anti-interference pathfinding reference line for the subsequent shoreline material topology mapping process in the overall invention.
[0087] More specifically, in step S6, any one of the DeepLabV3+ model, Segformer model, or FCN-ViT model is used to perform semantic segmentation on the riverbank area.
[0088] In practical implementation, to address the need for riverbank material identification during the hidden sewage outlet location phase, the DeepLabV3+ model, or models with global attention mechanisms such as Segformer and FCN-ViT, are selected. Pixel-level semantic segmentation is performed on the extracted regions of interest along the riverbank. Specifically, the hollow spatial pyramid pooling module in the DeepLabV3+ network is used to extract multi-scale shoreline image features, accurately classifying the complex physical structure of the river boundary into preset material categories such as solid concrete, natural vegetation, and masonry mudflats, and outputting a semantic mask image with the same resolution as the original image. Figure 3As shown. The core principle of this design lies in introducing a deep semantic segmentation network, which can transform visual texture pixels into geological structure information with physical common sense attributes. By using a multi-scale contextual receptive field, it overcomes the interference of lighting changes and vegetation shadows on material classification in remote sensing images. Compared to traditional technologies that rely solely on blind geometric inference based on water surface anomalies or rely on manual full-coverage inspections, this implementation incorporates the physical logic of the concealed discharge outlets as a hard spatial constraint into the source tracing algorithm. This physical logic includes: solid and dense concrete flood control dikes cannot illegally connect concealed pipes; dense vegetation or silt gaps easily conceal discharge outlets. This narrows the candidate search domain of the algorithm and eliminates logical misjudgments that map the coordinates of hidden discharge outlets onto solid physical obstacles. This weight allocation mechanism based on physical semantics, while grounded in pure mathematical calculations, imbues the algorithm with real geological meaning, significantly improving its noise resistance and detection rate against highly concealed illegal discharge activities.
[0089] More specifically, the material categories in the material weight table include at least: concrete revetment, bare ground, stone retaining wall, natural stone crevices, shallow gravel beach and vegetation-covered area;
[0090] In the material weight table, the probability weight value corresponding to each material category is set in the range of 0 to 1.
[0091] For each type of material, a weight value between 0 and 1 is preset, as shown in Table 2 below:
[0092] Table 2 Material Weighting Table
[0093]
[0094] In the shoreline analysis phase for accurately locating hidden sewage outlets, a high-precision semantic segmentation network is used to perform pixel-level classification of the riverbank area. The extracted geographical features are strictly mapped to specific material categories such as concrete banks, stone retaining walls, natural stone crevices, shallow gravel beaches, and vegetation-covered areas. Based on the concealment attributes of the geological structure of each physical material, a probability weight of the outlet's existence is assigned within a closed interval of 0 to 1. Concrete banks, which are flat, seamless, and extremely difficult to conceal pipes, are assigned very low weights of 0.0 to 0.1, while natural stone crevices and shallow gravel beaches, which are easy to bury pipes, are assigned high probability weights of 0.6 to 0.8 and 0.7 to 0.9, respectively. This architecture design transforms the high correlation between the location of illegal sewage outlets and the camouflage of the natural environment in engineering into a probability distribution matrix that can be analyzed by computer vision. Through quantitative evaluation of the physical density of materials and the redundancy of spatial gaps, an impedance filter carrying the physical semantics of the surface is constructed for the source tracing and pathfinding algorithm. Compared to traditional single-modal tracing techniques that rely solely on geometric Euclidean distance and blindly adhere to the shoreline or ignore underlying geological properties, this implementation method achieves the following beneficial effects: it establishes a spatial topological mapping mechanism based on physical and logical constraints, effectively intercepting invalid searches on hard, flat artificial structures. In the overall invention, it forms a strong coupling with the water pollution concentration gradient inverse vector of the preceding steps, accurately guiding the final spatial positioning anchor point to high-risk, concealed areas, and greatly improving the absolute coordinate calibration accuracy of tracing underground pipes.
[0095] More specifically, in step S7, calculating the probability score of each pixel within the search area includes the following steps:
[0096] Starting from the geometric center of the polluted water area, a ray is drawn along the direction vector of the pollution source, and the intersection of the ray and the riverbank is recorded as the reference point.
[0097] Using the reference point as the center, a fan-shaped area is defined as the search area according to a preset angle;
[0098] Within the search area, the probability score of each pixel is calculated using the following formula;
[0099]
[0100] in, Indicates coordinates as The probability score of each pixel. Indicates coordinates as The material weight corresponding to each pixel. Let be the distance decay function. Indicates coordinates as The Euclidean distance from the pixel to the reference point.
[0101] In one specific embodiment, firstly, using the geometric center point of the water pollution area output by the target detection network as the physical starting point, a ray projection is made along the normalized direction vector generated by inversely calculating the concentration gradient, and the first intersection point of this ray with the riverbank boundary extracted by semantic segmentation is marked as a spatial reference point; then, using this reference point as the center, a fan-shaped region of interest with an expansion angle of ±30° and a radius of 100 pixels is delineated on the bank side as a restricted search space; within this fan-shaped search area, a probability score is calculated pixel by pixel. Gaussian distance decay function via Euclidean distance and attenuation scale parameters The spatial penalty for deviation from the baseline is quantified; finally, the algorithm globally searches for the pixel coordinates with the highest score and maps and locks them as the predicted location of the hidden sewage outlet, and outputs them together with the results of regular river anomaly detection as a standardized environmental monitoring report.
[0102] This design deeply integrates fluid dynamics trajectory projection with a spatial probability distribution model. It uses geometric rays to determine the macroscopic source tracing direction, material weights to assess the physical feasibility of illegally constructed geological pipelines, and Gaussian distance decay to define spatial confidence boundaries. This transforms the unsteady inverse problem of highly concealed underwater or vegetated discharge outlets into a local optimization problem constrained by multidimensional physical principles. Compared to existing technologies that can only provide a general range of surface pollution or rely on blind manual investigation along the coast, this design significantly reduces the on-site verification and search radius for environmental enforcement.
[0103] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features therein. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention, and they should all be covered within the scope of the claims and specification of the present invention.
Claims
1. A method for detecting river channel anomalies in remote sensing images based on YOLO, characterized in that, Includes the following steps: S1: Establish an anomaly dataset based on river anomaly images and preprocess the acquired anomaly dataset; S2: Label the preprocessed anomaly dataset with anomaly types, and divide the labeled anomaly dataset into training and testing sets. The anomaly types must include at least water pollution. S3: Train the YOLO target detection model using the training set, and obtain the final detection model after meeting the requirements of the testing set. S4: Obtain remote sensing images of river anomalies as input images, use the detection model for identification, and output target detection boxes and the corresponding categories of river anomalies. S5: When the detected category of a river anomaly includes water pollution, perform inverse concentration gradient calculation on the detected water pollution area to obtain the water pollution level. S6: Semantically segment the riverbank area in the remote sensing image of the river anomaly to identify the material category of the riverbank; according to the preset material weight table, assign a probability weight value containing a hidden sewage outlet to the riverbank of different material categories to generate a bankbank weight map; S7: Based on the bankbank weight map, determine the search area in the riverbank area according to the pollution source direction vector; calculate the probability score of each pixel in the search area, determine the pixel with the highest score as the final location of the hidden sewage outlet and output it.
2. The method for detecting river channel anomalies in remote sensing images based on YOLO according to claim 1, characterized in that, In step S1, the preprocessing of the acquired abnormal dataset specifically includes the following steps: setting a sliding window and a preset sliding step size; using a non-overlapping sliding method, cropping the abnormal river image using the sliding window to make it uniform to a preset pixel size, and performing normalization processing; during the cropping process, when the sliding window moves to the image boundary and the remaining area size is smaller than the preset pixel size, using a zero pixel value to fill the boundary of the remaining area.
3. The method for detecting river channel anomalies in remote sensing images based on YOLO according to claim 1 or 2, characterized in that, In step S3, YOLO object detection training employs a multi-task loss function during the training process; the multi-task loss function is jointly composed of bounding box regression loss, confidence loss, and classification loss.
4. The method for detecting river channel anomalies in remote sensing images based on YOLO according to claim 1, characterized in that, In step S2, the identification of abnormal types specifically includes: personnel abnormalities, shoreline garbage, discharge outlets, construction activities, oil pollution on the water surface, fishing activities, floating garbage, and floating plants.
5. The method for detecting river channel anomalies in remote sensing images based on YOLO according to claim 4, characterized in that, Label Studio was used to label the anomalies. During labeling, the image dataset was divided into training and testing sets in a 7:3 ratio, and the format of the image dataset was adjusted to PASCAL VOC format.
6. The method for detecting river channel anomalies in remote sensing images based on YOLO according to claim 1, characterized in that, After identification using the detection model in step S4, the step further includes a threshold optimization step for the detection results, as follows: obtain the accuracy and recall of the model output under different confidence thresholds, and plot the PR curve; extract the confidence corresponding to the inflection point of the PR curve as the optimal confidence threshold; filter the target detection box based on the optimal confidence threshold, and output the final category and target detection box of the river channel anomaly target.
7. The method for detecting river channel anomalies in remote sensing images based on YOLO according to claim 1, characterized in that, Step S5, which involves calculating the concentration gradient inversely for the detected water pollution area, specifically includes the following steps: converting the image of the water pollution area from the RGB color space to the target color space, and extracting specific components of the target color space as concentration proxy indicators, wherein the target color space is the HSV color space or the CIE LAB color space, and the specific components are the brightness channel or the saturation channel; calculating the gradient field corresponding to the concentration proxy indicator using a gradient operator; and statistically averaging the gradients in the opposite direction of the gradient field to obtain a normalized direction vector, which is used as the pollution source direction vector.
8. The method for detecting river channel anomalies in remote sensing images based on YOLO according to claim 1, characterized in that, In step S6, the riverbank area is semantically segmented using any one of the DeepLabV3+ model, Segformer model, or FCN-ViT model.
9. The method for detecting river channel anomalies in remote sensing images based on YOLO according to claim 1, characterized in that, The material categories in the material weight table include at least: concrete bank walls, bare ground, stone retaining walls, natural stone crevices, shallow gravel beaches, and vegetation-covered areas; the probability weight value for each material category in the material weight table is set in the range of 0 to 1.
10. The method for detecting river channel anomalies in remote sensing images based on YOLO according to claim 9, characterized in that, In step S7, calculating the probability score of each pixel within the search area specifically includes the following steps: taking the geometric center point of the water pollution area as the starting point, drawing a ray along the direction vector of the pollution source, and recording the intersection of the ray with the riverbank as the reference point; using the reference point as the center, delineating a fan-shaped area as the search area according to a preset angle; within the search area, calculating the probability score of each pixel, the calculation formula is as follows: ,in, Indicates coordinates as The probability score of each pixel. Indicates coordinates as The material weight corresponding to each pixel. Let be the distance decay function. Indicates coordinates as The Euclidean distance from the pixel to the reference point.