Water surface pollution prediction method, device, equipment and medium

Through image segmentation and identification technology, pollutants and clarity in the water surface area are automatically monitored, pollution warning information is generated, and the problems of low efficiency and high cost of water surface pollution monitoring in the existing technology are solved, and efficient and accurate water surface pollution monitoring is achieved.

CN120220075AActive Publication Date: 2025-06-27NORTHWEST ENGINEERING CORPORATION LIMITED
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510667826.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-23
Publication Date
2025-06-27
Estimated Expiration
2045-05-23

AI Technical Summary

Technical Problem

In the prior art, water surface pollution monitoring is low efficiency, long time, high labor costs and limited scope, making it difficult to effectively monitor the water quality of the entire basin.

Method used

By obtaining the image segmentation training set, the initial segmentation model and the original water surface image, sample expansion and model migration training are carried out, image segmentation model is generated, pollutants and clarity in the water surface area are identified, and pollution warning information is generated.

Benefits of technology

It realizes automated water surface pollution monitoring, improves monitoring efficiency and accuracy, reduces labor costs, and is suitable for comprehensive monitoring of large-scale waters.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120220075A_ABST
    Figure CN120220075A_ABST
Patent Text Reader

Abstract

The invention provides a water surface pollution prediction method and device, equipment and a medium, and relates to the technical field of image processing, and the method comprises the steps: obtaining an image segmentation training set, a first initial segmentation model, a second initial segmentation model, and a water surface original image of a target region; segmenting the second sample image through the trained first initial segmentation model, generating a pseudo segmentation label, and constructing an image segmentation pseudo training set; training a second initial segmentation model of parameter migration through the sample expansion image set and the image segmentation pseudo training set, and generating an image segmentation model; segmenting the water surface original image through an image segmentation model to generate a water surface area image; the trained image recognition model is adopted to recognize pollutants in the water surface area image, and pollutant data are generated; and identifying the clarity of the water surface area image by using the trained support vector machine, and generating clarity data. The method is high in monitoring and prediction efficiency, short in time consumption, low in labor cost and capable of effectively monitoring the whole watershed of the water surface.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image processing, and in particular, to a method, device, equipment and medium for predicting water surface pollution. Background Art

[0002] With the acceleration of urbanization construction, it has caused certain impacts on the environment and ecology. A large number of pollutants have appeared on the water surfaces of many rivers. These pollutants are composed of various natural and artificial wastes, and they accumulate and rot on the water surface, which will seriously affect the water environment and water resource security.

[0003] In the related art, for the pollution monitoring of the water surface area, it is necessary for staff to go to the vicinity of the water surface area for on-site detection. Although the water quality detection of the on-site water surface area can be achieved, the monitoring efficiency is low, the time consumption is long, the required labor cost is high, and the scope is limited. Summary of the Invention

[0004] The present invention aims to solve at least one of the above problems.

[0005] To solve the above problems, the present invention provides a method, device, equipment and medium for predicting water surface pollution.

[0006] In a first aspect, the present invention provides a method for predicting water surface pollution, including: Obtaining an image segmentation training set, a first initial segmentation model, a second initial segmentation model, and an original water surface image of a target area, wherein the image segmentation training set includes a first sample image, a second sample image, and a segmentation label corresponding to the first sample image; Based on the segmentation label, performing sample augmentation on the first sample image to generate a sample augmentation image set; training the first initial segmentation model according to the sample augmentation image set to obtain a trained first initial segmentation model, and migrating the model parameters of the trained first initial segmentation model to the second initial segmentation model to obtain a second initial segmentation model with parameter migration; segmenting the second sample image through the trained first initial segmentation model to generate a pseudo-segmentation label, and constructing an image segmentation pseudo-training set; training the second initial segmentation model with parameter migration through the sample augmentation image set and the image segmentation pseudo-training set to generate an image segmentation model; Segmenting the original water surface image through the image segmentation model to generate a water surface area image; identifying pollutants in the water surface area image by using a trained image recognition model to generate pollutant data; identifying the clarity of the water surface area image by using a trained support vector machine to generate clarity data; Generating a pollution warning message according to the pollutant data and the clarity data.

[0007] Optionally, identifying the clarity of the water surface area image by using the trained support vector machine to generate clarity data, including: Obtain an image classification training set and an initial support vector machine, where the image classification training set includes water area image samples and corresponding clarity classification labels; Extract and fuse the color feature training vectors and texture feature training vectors of the water area image samples respectively to generate training feature fusion information; train the initial support vector machine according to the training feature fusion information and the clarity classification labels to generate the trained support vector machine; Input the water surface area image into the color space, calculate the second moment of each color component, and extract the corresponding color feature target vector; Perform gray-scale transformation on the water surface area image to generate a water surface gray-scale image, and determine the gravitational amplitude and gravitational direction angle of each pixel in the water surface gray-scale image according to the gravitational formula group, where the gravitational formula group includes: ; ; ; ; Among them, is the gravitational amplitude of the i th pixel in the water surface gray-scale image, is the gravitational direction angle of the i th pixel in the water surface gray-scale image, is the gravitational component of the i th pixel in the water surface gray-scale image in the x axis direction, is the gravitational component of the i th pixel in the water surface gray-scale image in the y axis direction, is the gravitational constant, is the gray value of the i th pixel, is the gray value of the i th neighbor pixel of the j th pixel. The i th pixel has a total of s neighbor pixels, is the Euclidean distance between the i th pixel and the j th neighbor pixel, is the included angle in the horizontal direction between the i th pixel and the j th neighbor pixel; Determine the direction angle vector of each pixel according to the gravitational direction angle and the direction angle vector formula, and the direction angle vector formula includes: ; wherein, is the direction angle vector of the i -th pixel, is the gravitational direction angle of the first pixel in the neighborhood of the i -th pixel, is the gravitational direction angle of the second pixel in the neighborhood of the i -th pixel, is the gravitational direction angle of the i -th pixel in the neighborhood of the s -th pixel; Determine the texture value of each pixel according to the direction angle vector and the texture value formula, and generate a texture feature target vector of the water surface area image according to the texture value of each pixel. The texture value formula includes: ; wherein, is the texture value of the i -th pixel, is the j -th component of the direction angle vector, is the judgment value based on a preset threshold for the component ; Fuse the color feature target vector and the texture feature target vector and perform normalization processing to generate water surface feature fusion information, and input the water surface feature fusion information into the trained support vector machine to generate the clarity data.

[0008] Optionally, the trained image recognition model includes a backbone network layer, a neck network layer, an adaptive attention mechanism layer, a fully connected layer, a feature fusion layer, and a detection layer connected in sequence; The backbone network layer is used to extract feature information maps of different dimensions in the water surface area image and construct a regional feature image set; The neck network layer is used to perform average pooling operations on the feature information maps in the regional feature image set to generate average pooling values corresponding to the feature information maps; The adaptive attention mechanism layer is used to perform convolution operations on the average pooling values according to the convolution kernel and the convolution kernel formula, and obtain corresponding feature weights through an activation function. The convolution kernel formula includes: ; wherein, k is the size of the convolution kernel, Lis the number of channels connecting the fully connected layer to the feature fusion layer, and are both hyperparameters, is the odd sign for absolute value; The fully connected layer is used to connect the feature information map to the feature fusion layer based on different channels; The feature fusion layer is used to fuse the feature information map according to the feature weight formaldehyde to generate a regional feature fusion image; The detection layer is used to identify and mark the pollutants in the regional feature fusion image to generate the pollutant data.

[0009] Optionally, based on the segmentation label, sample augmentation is performed on the first sample image to generate a sample augmentation image set, including: Performing mirroring, rotation transformation, and grayscale adjustment on the first sample image respectively to generate corresponding sample mirror images, sample rotation images, and sample grayscale images; Adding watermark noise and illumination noise to the first sample image, the sample mirror image, the sample rotation image, and the sample grayscale image respectively to generate corresponding first sample noise images, sample noise mirror images, sample noise rotation images, and sample noise grayscale images; Based on the segmentation label, according to the first sample noise image, the sample noise mirror image, the sample noise rotation image, and the sample noise grayscale image, construct the sample augmentation image set.

[0010] Optionally, training the first initial segmentation model according to the sample augmentation image set to obtain a trained first initial segmentation model, including: Inputting the sample input images in the sample augmentation image set into the first initial segmentation model; Perform a convolution operation on the sample input image through the first initial segmentation model to obtain a sample first convolution image, perform a convolution operation and a non-linear activation process on the sample first convolution image to generate a sample second convolution image, perform a max pooling operation on the sample first convolution image and the sample second convolution image respectively to generate a sample first pooling image and a sample second pooling image, add the features of the sample first pooling image and the sample second pooling image to generate a sample feature image, perform a convolution operation and a non-linear activation process on the sample feature image to generate a sample convolution image, perform a skip connection on the sample convolution image and the sample first pooling image and perform a convolution activation operation to generate a sample third convolution image, perform an upsampling operation on the sample third convolution image to generate a sample sampling image and perform a convolution activation operation to generate a sample fourth convolution image; perform a skip connection on the sample fourth convolution image and the sample first convolution image and perform a convolution activation operation to generate a sample segmentation image; Through the deviation evaluation of the sample segmentation image and the segmentation label corresponding to the sample input image, perform cyclic training optimization on the first initial segmentation model until the deviation evaluation result of the sample segmentation image and the segmentation label is within the preset threshold range, and obtain the trained first initial segmentation model.

[0011] Optionally, the deviation evaluation result includes a correctness deviation evaluation parameter, a segmentation deviation evaluation parameter, and a missed detection evaluation parameter. The process of performing cyclic training optimization on the first initial segmentation model through the deviation evaluation of the sample segmentation image and the segmentation label corresponding to the sample input image until the deviation evaluation result of the sample segmentation image and the segmentation label is within the preset threshold range and obtaining the trained first initial segmentation model includes: According to the sample segmentation image and the segmentation label, determine the number of correctly segmented pixel points and the number of incorrectly segmented pixel points in the sample segmentation image, and generate the correctness deviation evaluation parameter based on the correctness evaluation formula. The correctness evaluation formula includes: ; Wherein, is the correctness deviation evaluation parameter, n is the number of regions divided in the sample segmentation image into n regions, is the number of correctly segmented pixel points in the i th region of the sample segmentation image, M is the number of all pixel points in the sample segmentation image; Based on the correct segmentation pixel count and the incorrect segmentation pixel count, generate the segmentation deviation evaluation parameter according to the segmentation deviation evaluation formula, where the segmentation deviation evaluation formula includes: ; where is the segmentation deviation evaluation parameter, and are both the incorrect segmentation pixel counts, and is the number of pixels in the sample segmentation image that belong to the i th region and are segmented into pixels of the j th region, is the number of pixels in the sample segmentation image that belong to the j th region and are segmented into pixels of the i th region; Based on the incorrect segmentation pixel count, generate the missed detection evaluation parameter according to the missed detection evaluation formula, where the missed detection evaluation formula includes: ; where is the missed detection evaluation parameter; When the correctness deviation evaluation parameter, the segmentation deviation evaluation parameter, and the missed detection evaluation parameter exceed the preset threshold range, based on the operation process of the first initial segmentation model, reverse-infer the segmentation label to obtain a sample label processing image set; construct a sample processing image set according to the sample first convolution image, the sample second convolution image, the sample first pooling image, the sample second pooling image, the sample feature image, the sample convolution image, the sample third convolution image, the sample sampling image, the sample fourth convolution image, and the sample segmentation image; optimize the model parameters of the convolution operation, pooling operation, and upsampling operation in the first initial segmentation model according to the sample label processing image set and the sample processing image set; When the correctness deviation evaluation parameter, the segmentation deviation evaluation parameter, and the missed detection evaluation parameter are within the preset threshold range, obtain the trained first segmentation model.

[0012] Optionally, generating the pollution warning information according to the pollutant data and the clarity data includes: Determine the proportion of the coverage area of the pollutant in the target area according to the pollutant data; Determine the warning parameter corresponding to the target area by setting dynamic weights for the coverage area proportion and the clarity data; When the warning parameter exceeds the warning threshold, generate the pollution warning information and send it to the back-end staff.

[0013] In a second aspect, the present invention provides a water surface pollution prediction device, including: An acquisition module, configured to acquire an image segmentation training set, a first initial segmentation model, a second initial segmentation model, and an original water surface image of a target area, wherein the image segmentation training set includes a first sample image, a second sample image, and a segmentation label corresponding to the first sample image; A training module, configured to perform sample augmentation on the first sample image based on the segmentation label to generate a sample augmentation image set; train the first initial segmentation model according to the sample augmentation image set to obtain a trained first initial segmentation model, and transfer the model parameters of the trained first initial segmentation model to the second initial segmentation model to obtain a second initial segmentation model with parameter transfer; segment the second sample image through the trained first initial segmentation model to generate a pseudo-segmentation label, and construct an image segmentation pseudo-training set; train the second initial segmentation model with parameter transfer through the sample augmentation image set and the image segmentation pseudo-training set to generate an image segmentation model; An identification module, configured to segment the original water surface image through the image segmentation model to generate a water surface area image; identify pollutants in the water surface area image by using a trained image recognition model to generate pollutant data; identify the clarity of the water surface area image by using a trained support vector machine to generate clarity data; A warning module, configured to generate a pollution warning information according to the pollutant data and the clarity data.

[0014] In a third aspect, the present invention provides an electronic device, including a memory and a processor; The memory is configured to store a computer program; The processor is configured to implement the water surface pollution prediction method as described in the first aspect when executing the computer program.

[0015] In a fourth aspect, the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the water surface pollution prediction method as described in the first aspect is implemented.

[0016] The beneficial effects of the water surface pollution prediction method, device, equipment, and medium of the present invention are: By obtaining an image segmentation training set, a first initial segmentation model, a second initial segmentation model, and the original water surface image of the target area, and the image segmentation training set includes a first sample image, a second sample image, and a segmentation label corresponding to the first sample image, it provides the basic data for subsequent automated processing, thus avoiding the need for manual on-site detection in related technologies. Expand the first sample image based on the segmentation label, and use the expanded image set to train the first initial segmentation model. Then, transfer the trained model parameters to the second initial segmentation model, which not only improves the generalization ability of the model, but also significantly reduces the training time. At the same time, it does not require a large amount of training data, greatly reducing the cost of training the model. Then, use the trained first initial segmentation model to generate pseudo-segmentation labels and construct an image segmentation pseudo-training set, and further optimize the second initial segmentation model in combination with the previously generated sample-expanded image set, enhancing the adaptability of the model to complex scenarios and solving the problem of low model performance caused by insufficient samples. Then, perform segmentation processing on the water surface area in the original water surface image through the trained image segmentation model to extract the water surface area image from the original water surface image with a complex background, so that the subsequent analysis process can focus on the water surface part, thereby improving the accuracy of pollutant recognition. Identify pollutants in the water surface area through the trained image recognition model, and use the trained support vector machine to identify the water clarity, and then generate pollution warning information according to the analysis results to remind the staff to take corresponding pollution control measures, realizing the precise warning of the water quality in the target area, overcoming the limitation that related technologies cannot effectively monitor the entire basin, and solving the problem of long time consumption of traditional methods through algorithm automatic calculation. The present invention not only greatly reduces the labor cost, but also replaces manual annotation and detection through algorithm automatic calculation, making the whole process more efficient and accurate, and is applicable to the comprehensive monitoring of large-scale waters. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 It is a schematic flowchart of the water pollution prediction method provided by an embodiment of the present invention; Figure 2 It is a schematic structural diagram of the water pollution prediction device provided by an embodiment of the present invention; Figure 3 It is a schematic structural diagram of the electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0018] To make the above objects, features, and advantages of the present invention more apparent and understandable, the following provides a detailed description of specific embodiments of the present invention with reference to the accompanying drawings. Although some embodiments of the present invention are shown in the drawings, it should be understood that the present invention can be implemented in various forms and should not be construed as limited to the embodiments described herein. Instead, these embodiments are provided to more thoroughly and completely understand the present invention. It should be understood that the drawings and embodiments of the present invention are only for exemplary purposes and are not used to limit the protection scope of the present invention.

[0019] As used herein, the term "including" and its variants are open-ended, that is, "including but not limited to"; the term "based on" is "at least partially based on"; the term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments"; the term "optionally" means "optional embodiments". The relevant definitions of other terms will be given in the following description. It should be noted that the concepts of "first", "second", etc. mentioned in the present invention are only used to distinguish different devices, modules, or units, and are not used to limit the order or interdependence relationship of the functions performed by these devices, modules, or units.

[0020] It should be noted that the modifications of "one" and "multiple" mentioned in the present invention are illustrative rather than restrictive. Those skilled in the art should understand that unless otherwise clearly specified in the context, it should be understood as "one or more".

[0021] The names of the messages or information exchanged between multiple devices in the embodiments of the present invention are only for illustrative purposes and are not used to limit the scope of these messages or information.

[0022] In view of the problems existing in the above related technologies, this embodiment provides a method, device, equipment, and medium for predicting water surface pollution.

[0023] As Figure 1 shown, a method for predicting water surface pollution provided by an embodiment of the present invention includes: Obtaining an image segmentation training set, a first initial segmentation model, a second initial segmentation model, and an original water surface image of a target area, where the image segmentation training set includes a first sample image, a second sample image, and a segmentation label corresponding to the first sample image.

[0024] Specifically, an image sensor can be deployed to collect the original image of the water surface in the target area, where the target area refers to the river, lake, or other water areas where sleep pollution prediction will be carried out. The image segmentation training set, the first initial segmentation model, and the second initial segmentation model can be obtained on the Internet. The first initial segmentation model and the second initial segmentation model are improvements of the "teacher-student model", so as to train the "student" model through the "teacher" model to improve the performance of the student model for subsequent image segmentation. The image segmentation training set includes the first sample image, the second sample image, and the segmentation label corresponding to the first sample image, and the second sample image has no corresponding segmentation label.

[0025] Based on the segmentation label, perform sample augmentation on the first sample image to generate a sample augmentation image set; train the first initial segmentation model according to the sample augmentation image set to obtain a trained first initial segmentation model, and transfer the model parameters of the trained first initial segmentation model to the second initial segmentation model to obtain a second initial segmentation model with parameter transfer; segment the second sample image through the trained first initial segmentation model to generate pseudo-segmentation labels, and construct an image segmentation pseudo-training set; train the second initial segmentation model with parameter transfer through the sample augmentation image set and the image segmentation pseudo-training set to generate an image segmentation model.

[0026] Specifically, since the number of first sample images with corresponding segmentation labels is small, and labeling new first sample images requires a large amount of labor cost and time cost, sample augmentation is performed on the first sample images. For example, methods such as rotation, flipping, scaling, cropping, translation, color adjustment, and noise injection are used for sample augmentation to generate a sample augmentation image set for subsequent model training. Train the first initial segmentation model with the "teacher" attribute according to the sample augmentation image set to obtain a trained first initial segmentation model, and transfer the model parameters of the trained first initial segmentation model to the second initial segmentation model with the "student" attribute to achieve semi-supervised training learning of the "teacher-student model" to obtain the second initial segmentation model. Then, segment the second sample image without a sample label through the trained first initial segmentation model to generate pseudo-segmentation labels, and construct an image segmentation pseudo-training set. Thus, train the second initial segmentation model with parameter transfer through the sample augmentation image set and the image segmentation pseudo-training set to generate a high-precision and high-performance image segmentation model.

[0027] Segment the original water surface image through the image segmentation model to generate a water surface area image; use the trained image recognition model to identify the pollutants in the water surface area image to generate pollutant data; use the trained support vector machine to identify the clarity of the water surface area image to generate clarity data.

[0028] Specifically, the original water surface image is segmented by an image segmentation model to remove meaningless backgrounds and interference items, and only the area image related to the water surface is obtained, so that the subsequent model only analyzes the water surface area image to improve the recognition accuracy; a trained image recognition model is used to identify pollutants in the water surface area image, such as a convolutional neural network model, ChatGPT, and a hybrid model, etc., to generate pollutant data, and the pollutant data may include pollutant volume, quantity, and type; a trained support vector machine is used to identify the clarity of the water surface area image to generate clarity data, and the clarity data may include clear, relatively clear, and turbid.

[0029] According to the pollutant data and the clarity data, a pollution warning message is generated.

[0030] Specifically, a dynamic weighting method is used to fuse the pollutant data and the clarity data, analyze the pollution situation of the target area, calculate the warning parameters, and when the warning parameters exceed the warning threshold, a pollution warning message is issued to remind the staff to take corresponding pollution control measures.

[0031] In this embodiment, by obtaining an image segmentation training set, a first initial segmentation model, a second initial segmentation model, and a raw water surface image of the target area, and the image segmentation training set includes a first sample image, a second sample image, and a segmentation label corresponding to the first sample image, basic data is provided for subsequent automated processing, thus avoiding the need for on-site manual detection in related technologies. The first sample image is augmented based on the segmentation label, and the augmented image set is used to train the first initial segmentation model. Then, the trained model parameters are transferred to the second initial segmentation model, which not only improves the generalization ability of the model, but also significantly reduces the training time. At the same time, a large amount of training data is not required, greatly reducing the cost of training the model. Then, the trained first initial segmentation model is used to generate pseudo-segmentation labels and construct an image segmentation pseudo-training set, and the second initial segmentation model is further optimized in combination with the previously generated augmented image set, enhancing the adaptability of the model to complex scenarios and solving the problem of low model performance caused by insufficient samples. Then, the trained image segmentation model is used to perform segmentation processing on the water surface area in the raw water surface image to extract the water surface area image from the raw water surface image with a complex background, so that the subsequent analysis process can focus on the water surface part, thereby improving the accuracy of pollutant recognition. The pollutants in the water surface area are identified by the trained image recognition model, and the clarity of the water surface is identified by the trained support vector machine. Then, pollution warning information is generated according to the analysis results to remind the staff to take corresponding pollution control measures, realizing accurate warning of the water quality of the target area, overcoming the limitation that related technologies cannot effectively monitor the entire basin, and solving the problem of long time consumption of traditional methods through algorithmic automatic calculation. The present invention not only greatly reduces the labor cost, but also replaces manual annotation and detection with algorithmic automatic calculation, making the whole process more efficient and accurate, and is applicable to the comprehensive monitoring of large-scale waters.

[0032] Optionally, the step of identifying the clarity of the water surface area image by using the trained support vector machine and generating clarity data includes: Obtain an image classification training set and an initial support vector machine, where the image classification training set includes water area image samples and corresponding clarity classification labels; Extract and fuse the color feature training vectors and texture feature training vectors of the water area image samples respectively to generate training feature fusion information; train the initial support vector machine according to the training feature fusion information and the clarity classification labels to generate the trained support vector machine; Input the water surface area image into the color space, calculate the second-order moments of each color component, and extract the corresponding color feature target vectors; Perform grayscale transformation on the water surface area image to generate a grayscale water surface image, and determine the gravitational amplitude and gravitational direction angle of each pixel in the grayscale water surface image according to the gravitational formula group, where the gravitational formula group includes: ; ; ; ; where, is the gravitational amplitude of the i -th pixel in the grayscale water surface image, is the gravitational direction angle of the i -th pixel in the grayscale water surface image, is the gravitational component of the i -th pixel in the grayscale water surface image in the x axis direction, is the gravitational component of the i -th pixel in the grayscale water surface image in the y axis direction, is the gravitational constant, is the grayscale value of the i -th pixel, is the grayscale value of the i -th neighboring pixel of the j -th pixel. The i -th pixel has a total of s neighboring pixels, is the Euclidean distance between the i -th pixel and the j -th neighboring pixel, is the angle between the i -th pixel and the j -th neighboring pixel in the horizontal direction; Determine the direction angle vector of each pixel according to the gravitational direction angle and the direction angle vector formula, where the direction angle vector formula includes: ; where, is the direction angle vector of the i -th pixel, is the gravitational direction angle of the first pixel in the neighborhood of the i -th pixel, is the gravitational direction angle of the second pixel in the neighborhood of the i -th pixel, is the gravitational direction angle of the i -th pixel in the neighborhood of the s -th pixel; Determine the texture value of each pixel according to the direction angle vector and the texture value formula, and generate a texture feature target vector of the water surface area image according to the texture value of each pixel. The texture value formula includes: ; wherein, is the texture value of the i th pixel, is the j th component of the direction angle vector, is the judgment value based on a preset threshold for the component ; Fuse the color feature target vector and the texture feature target vector and perform normalization processing to generate water surface feature fusion information. Input the water surface feature fusion information into the trained support vector machine to generate the clarity data.

[0033] Specifically, an image classification training set and an initial support vector machine can be obtained through the Internet. The image classification training set includes water area image samples and corresponding clarity classification labels. The clarity classification labels can include clear, relatively clear, and turbid. Respectively extract and fuse the color feature training vector and the texture feature training vector of the water area image samples to generate training feature fusion information; according to the clarity classification labels, the support vector machine generates two image classification boundaries. Train the support vector machine with the training feature fusion information to make the water area image samples far away from the image classification boundaries and clarify the corresponding clarity classification labels, thereby completing the training and generating a trained support vector machine. For the extraction of the color feature target vector of the water surface area image, input the water surface area image into the color space, calculate the second-order moment of each color component, and obtain the corresponding color feature target vector. For the extraction of the texture feature target vector of the water surface area image, perform gray-scale transformation on the water surface area image, calculate the gravitational direction angle of each pixel in the water surface gray-scale image, calculate the corresponding texture value of the pixel point according to the direction angle vector of the pixel in the neighborhood, and construct the texture feature target vector corresponding to the water surface area image. By extracting and fusing the color feature target vector and the texture feature target vector of the water surface area image and classifying the water surface feature fusion information through the support vector machine, the acquisition of the corresponding classification information of the water surface area image is realized, and further the recognition of the water quality clarity degree of the water surface area image is realized, and the clarity data is generated.

[0034] Optionally, the trained image recognition model includes a backbone network layer, a neck network layer, an adaptive attention mechanism layer, a fully connected layer, a feature fusion layer, and a detection layer connected in sequence; The backbone network layer is used to extract feature information maps of different dimensions in the water surface area image and construct a regional feature image set; The neck network layer is used to perform average pooling operation on the feature information maps in the regional feature image set to generate average pooling values corresponding to the feature information maps; The adaptive attention mechanism layer is used to perform convolution operation on the average pooling value according to the convolution kernel and the convolution kernel formula, and obtain the corresponding feature weights through the activation function. The convolution kernel formula includes: ; wherein, k is the size of the convolution kernel, L is the number of channels for the fully connected layer to connect to the feature fusion layer, and are both hyperparameters, is the odd sign for absolute value; The fully connected layer is used to connect the feature information maps to the feature fusion layer based on different channels; The feature fusion layer is used to fuse the feature information maps according to the feature weights to generate a regional feature fusion image; The detection layer is used to identify and mark the pollutants in the regional feature fusion image to generate the pollutant data.

[0035] Specifically, the backbone network layer in the image recognition model extracts feature information maps of different dimensions in the water surface area image based on convolution blocks, pooling blocks and spatial pyramid pooling blocks of different sizes, and constructs a regional feature image set. For example, small convolution kernels (1X1, 3X3) are used to collect fine-grained features of the water surface area image, and small convolution kernels (7X7, 10X10) are used to capture larger-range global features of the water surface area image, expanding the receptive field. By extracting the feature information of the image through different convolution kernels, a regional feature image set can be constructed. The neck network layer performs average pooling operation on the feature information maps, and based on the adaptive attention mechanism layer, a convolution kernel is set to perform convolution operation on the average pooling value, and the corresponding feature weights are obtained through the activation function. The fully connected layer connects the feature information maps to the feature fusion layer based on different channels. In the feature fusion layer, the feature information maps are weighted and fused according to the optimized feature weights to obtain a regional feature fusion image. The detection layer detects and marks the pollutants in the regional feature fusion image. Through the backbone network layer in the image recognition model, the feature extraction of the water surface area image is realized. Setting the convolution kernel based on the adaptive attention mechanism layer can enhance the neck network layer's ability to capture the relationship between different channels, enabling the image recognition model to focus on key features, improving the model's representation ability for key features, and enhancing the detection accuracy of the detection layer for pollutants.

[0036] Optionally, the generating of the sample augmentation image set by performing sample augmentation on the first sample image based on the segmentation label includes: Mirror, rotate, and adjust the grayscale of the first sample image respectively to generate corresponding sample mirror images, sample rotation images, and sample grayscale images; Add watermark noise and illumination noise to the first sample image, the sample mirror image, the sample rotation image, and the sample grayscale image respectively to generate corresponding first sample noise images, sample noise mirror images, sample noise rotation images, and sample noise grayscale images; Based on the segmentation label, construct the sample augmented image set according to the first sample noise image, the sample noise mirror image, the sample noise rotation image, and the sample noise grayscale image.

[0037] Specifically, by mirroring, rotating, and adjusting the grayscale of the first sample image, and adding watermark noise and illumination noise, the construction of the sample augmented image set is realized, and the training of the first initial segmentation model is realized based on the sample augmented image set. The model parameters of the trained first initial segmentation model are migrated to the second initial segmentation model for setting, and the second initial segmentation model is trained and optimized through the sample augmented image set and the image segmentation pseudo-training set, realizing the construction of the image segmentation model. In this embodiment, the training of the model is realized when there are only a small number of first sample images with corresponding labels in the training set. Through the active migration of model parameters, the rapid construction of the second initial segmentation model is realized, and the model performance can be effectively improved through the training of the sample augmented image set and the image segmentation pseudo-training set.

[0038] In one embodiment, the adding watermark noise and illumination noise to the first sample image, the sample mirror image, the sample rotation image, and the sample grayscale image respectively to generate corresponding first sample noise images, sample noise mirror images, sample noise rotation images, and sample noise grayscale images includes: Obtain the images that need to add watermark noise and illumination noise in the first sample image, the sample mirror image, the sample rotation image, and the sample grayscale image as the sample images to be processed; Construct a blank sample image with the same size according to the size of the sample image to be processed; Using the preset watermark intensity and watermark frequency, and adopting the watermark sample image formula group, assign values to the pixel points in the blank sample image to generate watermark sample images corresponding to the first sample image, the sample mirror image, the sample rotation image, and the sample grayscale image. The watermark sample image formula group includes: ; ; wherein, is thei The pixel value of a pixel point is the pixel value of the i th pixel point in the water pattern sample image is the pixel value row offset is the pixel value column offset w is the width of the blank sample image h is the height of the blank sample image, % is the modulo operator K is the water pattern intensity f is the water pattern frequency Overlay the sample image to be processed with the water pattern sample image to generate a water pattern noise image. Using the sample noise image formula, add light noise to the pixel points in the water pattern noise image to generate a sample noise image corresponding to the first sample image, the sample mirror image, the sample rotation image, and the sample grayscale image. The sample noise image includes the first sample noise image, the sample noise mirror image, the sample noise rotation image, and the sample noise grayscale image. The sample noise image formula includes: ; where is the color value of the i th pixel point in the sample noise image is the color value of the i th pixel point in the water pattern noise image L is the preset light intensity is the reflection coefficient

[0039] Specifically, obtain the sample image to be processed in the first sample image, the sample mirror image, the sample rotation image, and the sample grayscale image, add water pattern noise and light noise, and obtain the sample noise image. Add water pattern noise to the sample image to be processed. By constructing a blank sample image with the same size as the sample image to be processed, and based on the preset water pattern intensity and water pattern frequency, assign values to the pixel points in the blank sample image to obtain the water pattern sample image, and overlay it with the sample image to be processed to obtain the water pattern sample image. Add light noise to the water pattern sample image. By superimposing light noise on the noise points in the water pattern noise image, obtain the sample noise image. By adding water pattern noise and light noise to the first sample image, the sample mirror image, the sample rotation image, and the sample grayscale image, the acquisition of the first sample noise image, the sample noise mirror image, the sample noise rotation image, and the sample noise grayscale image is realized, and thus the expansion of the sample image set is realized, which is convenient for the training of the model in the subsequent steps

[0040] Optionally, training the first initial segmentation model according to the sample-augmented image set to obtain a trained first initial segmentation model includes: Inputting the samples in the sample-augmented image set into the first initial segmentation model; Performing a convolution operation on the sample input image through the first initial segmentation model to obtain a sample first convolution image, performing a convolution operation and a non-linear activation process on the sample first convolution image to generate a sample second convolution image, respectively performing a max pooling operation on the sample first convolution image and the sample second convolution image to generate a sample first pooling image and a sample second pooling image, adding the features of the sample first pooling image and the sample second pooling image to generate a sample feature image, performing a convolution operation and a non-linear activation process on the sample feature image to generate a sample convolution image, skip connecting the sample convolution image and the sample first pooling image and performing a convolution activation operation to generate a sample third convolution image, performing an upsampling operation on the sample third convolution image to generate a sample sampling image and performing a convolution activation operation to generate a sample fourth convolution image; skip connecting the sample fourth convolution image and the sample first convolution image and performing a convolution activation operation to generate a sample segmentation image; Performing cyclic training optimization on the first initial segmentation model by evaluating the deviation between the sample segmentation image and the segmentation label corresponding to the sample input image, until the deviation evaluation result between the sample segmentation image and the segmentation label is within a preset threshold range, to obtain the trained first initial segmentation model.

[0041] Specifically, a sample input image is obtained from the sample augmented image set and input into the first initial segmentation model. The first initial segmentation model processes the sample input image: performing a convolution operation on the sample input image to generate a first convolutional image of the sample; performing a convolution operation and a non-linear activation process on the first convolutional image of the sample to generate a second convolutional image of the sample; performing a max pooling operation on the first convolutional image of the sample to generate a first pooling image of the sample, performing a max pooling operation on the second convolutional image of the sample to generate a second pooling image of the sample, and adding features according to the first pooling image of the sample and the second pooling image of the sample to generate a sample feature image; performing a convolution operation and a non-linear activation process on the sample feature image to generate a sample convolutional image; performing a skip connection between the sample convolutional image and the first pooling image of the sample and performing a convolution activation operation to generate a third convolutional image of the sample; performing an upsampling operation on the third convolutional image of the sample to generate a sample sampling image and performing a convolution activation operation to generate a fourth convolutional image of the sample; performing a skip connection between the fourth convolutional image of the sample and the first convolutional image of the sample and performing a convolution activation operation to generate a sample segmentation image. Deviation evaluation is performed based on the sample segmentation image and the sample label image corresponding to the sample input image, and the first initial segmentation model is cyclically trained and optimized. When the deviation between the sample segmentation image and the sample label image is within a preset threshold range, the training is stopped to obtain the trained first initial segmentation model. By performing deep convolutional operations on the sample input image, the extraction of multi-dimensional features of the sample input image is realized, and multi-scale feature fusion is realized by adding features between the first pooling image of the sample and the second pooling image of the sample. Skip connections are made between the sample convolutional image and the first pooling image of the sample, and between the fourth convolutional image of the sample and the first convolutional image of the sample, avoiding the loss of key information and effectively enhancing the semantic and spatial representation capabilities of the first segmentation model for processing the sample input image.

[0042] Optionally, the deviation evaluation results include a correctness deviation evaluation parameter, a segmentation deviation evaluation parameter, and a missed detection evaluation parameter. The cyclic training and optimization of the first initial segmentation model by performing deviation evaluation on the sample segmentation image and the segmentation label corresponding to the sample input image until the deviation evaluation result between the sample segmentation image and the segmentation label is within a preset threshold range to obtain the trained first initial segmentation model includes: According to the sample segmentation image and the segmentation label, determine the number of correctly segmented pixel points and the number of incorrectly segmented pixel points in the sample segmentation image, and generate the correctness deviation evaluation parameter based on the correctness evaluation formula, where the correctness evaluation formula includes: ; where is the correctness deviation evaluation parameter, nis divided into n regions in the sample segmentation image, is the number of correctly segmented pixel points in the i th region of the sample segmentation image, M is the number of all pixel points in the sample segmentation image; According to the number of correctly segmented pixel points and the number of incorrectly segmented pixel points, based on the segmentation deviation evaluation formula, generate the segmentation deviation evaluation parameter, and the segmentation deviation evaluation formula includes: ; where is the segmentation deviation evaluation parameter, and are both the number of incorrectly segmented pixel points, and is the number of pixel points in the sample segmentation image that belong to the i th region and are segmented into pixel points in the j th region, is the number of pixel points in the sample segmentation image that belong to the j th region and are segmented into pixel points in the i th region; According to the number of incorrectly segmented pixel points, based on the missed detection evaluation formula, generate the missed detection evaluation parameter, and the missed detection evaluation formula includes: ; where is the missed detection evaluation parameter; When the correctness deviation evaluation parameter, the segmentation deviation evaluation parameter, and the missed detection evaluation parameter exceed the preset threshold range, based on the operation process of the first initial segmentation model, reverse-infer the segmentation label to obtain a sample label processing image set; according to the sample first convolutional image, the sample second convolutional image, the sample first pooling image, the sample second pooling image, the sample feature image, the sample convolutional image, the sample third convolutional image, the sample sampling image, the sample fourth convolutional image, and the sample segmentation image, construct a sample processing image set; according to the sample label processing image set and the sample processing image set, optimize the model parameters of the convolutional operation, pooling operation, and upsampling operation in the first initial segmentation model; When the correctness deviation evaluation parameter, the segmentation deviation evaluation parameter, and the missed detection evaluation parameter are within the preset threshold range, obtain the trained first segmentation model.

[0043] Specifically, the preset threshold range can be set according to the actual situation. The deviation evaluation of the sample segmentation image is performed according to the correctness deviation evaluation parameter, the segmentation deviation evaluation parameter, and the missed detection evaluation parameter. When the correctness deviation evaluation parameter, the segmentation deviation evaluation parameter, and the missed detection evaluation parameter exceed the preset threshold range, a sample label processing image set and a sample processing image set are constructed, and the model parameters of the convolution operation, pooling operation, and upsampling operation in the first initial segmentation model are optimized; when the correctness deviation evaluation parameter, the segmentation deviation evaluation parameter, and the missed detection evaluation parameter are within the preset threshold range, the training is ended, and the trained first initial segmentation model is obtained. The correctness deviation evaluation parameter can be obtained by calculating the proportion of the number of correctly segmented pixel points in each region of the sample segmentation image to the total number of pixel points. The segmentation deviation evaluation parameter can be obtained by calculating the proportion of the number of correctly segmented pixel points in each region of the sample segmentation image to the number of incorrectly segmented pixel points. The missed detection evaluation parameter can be obtained by calculating the missed detection evaluation parameter to evaluate the effectiveness of the model in segmenting the sample segmentation image. Through the correctness deviation evaluation parameter, the segmentation deviation evaluation parameter, and the missed detection evaluation parameter, the deviation evaluation of the sample segmentation image is realized, and when it exceeds the preset threshold range, the first initial segmentation model is trained and optimized until the correctness deviation evaluation parameter, the segmentation deviation evaluation parameter, and the missed detection evaluation parameter are within the preset threshold range, and then the training is stopped to obtain the trained first initial segmentation model.

[0044] Optionally, generating the pollution warning information according to the pollutant data and the clarity data includes: Determining the proportion of the coverage area of the pollutant in the target area according to the pollutant data; Determining the warning parameter corresponding to the target area by setting dynamic weights for the coverage area proportion and the clarity data; When the warning parameter exceeds the warning threshold, generating the pollution warning information and sending it to the background staff.

[0045] Specifically, the warning threshold can be set according to the actual situation. By calculating the proportion of the coverage area of pollutants in the water surface area image based on the target area, and according to the proportion of the coverage area and the clarity data, corresponding dynamic weights are set, and the warning parameter is calculated. When the warning threshold is exceeded, a pollution warning message is sent to the background staff. Exemplarily, when the proportion of the coverage area of pollutants in the water surface area image reaches 30% and the clarity data is clear, a weight of 0.5 is set for the proportion of the coverage area, and a weight of 0.5 is set for the clarity data. The calculated warning parameter is 0.15, and the warning threshold is set to 0.6. Since the warning parameter does not exceed the warning threshold, no pollution warning message is generated and it is not sent to the background staff. Exemplarily, when the proportion of the coverage area of pollutants in the water surface area image reaches 10% and the clarity data is turbid, a weight of 0.3 is set for the proportion of the coverage area, and a weight of 0.7 is set for the clarity data. The calculated warning parameter is 0.73, and the warning threshold is set to 0.6. Since the warning parameter exceeds the warning threshold, a pollution warning message is generated and sent to the background staff. By calculating the proportion of the coverage area of pollutants based on the water surface area and the clarity data corresponding to the water surface area image, and setting dynamic weights, the acquisition of the warning parameter is realized, and when the warning threshold is exceeded, a pollution warning is issued to remind the staff to perform corresponding pollution treatment measures on the water surface area in a timely manner.

[0046] As Figure 2 shown, a water surface pollution prediction device provided by an embodiment of the present invention includes: An acquisition module, configured to acquire an image segmentation training set, a first initial segmentation model, a second initial segmentation model, and an original water surface image of a target area, where the image segmentation training set includes a first sample image, a second sample image, and a segmentation label corresponding to the first sample image; A training module, configured to perform sample augmentation on the first sample image based on the segmentation label to generate a sample augmentation image set; train the first initial segmentation model according to the sample augmentation image set to obtain a trained first initial segmentation model, and transfer the model parameters of the trained first initial segmentation model to the second initial segmentation model to obtain a second initial segmentation model with parameter transfer; segment the second sample image through the trained first initial segmentation model to generate a pseudo-segmentation label, and construct an image segmentation pseudo-training set; train the second initial segmentation model with parameter transfer through the sample augmentation image set and the image segmentation pseudo-training set to generate an image segmentation model; An identification module, configured to segment the original water surface image through the image segmentation model to generate a water surface area image; identify pollutants in the water surface area image by using a trained image recognition model to generate pollutant data; identify the clarity of the water surface area image by using a trained support vector machine to generate clarity data; An early warning module, configured to generate pollution early warning information according to the pollutant data and the clarity data.

[0047] As Figure 3 shown, an electronic device 300 provided by an embodiment of the present invention includes a memory 310 and a processor 320; the memory 310 is configured to store a computer program; the processor 320 is configured to implement the water surface pollution prediction method as described above when executing the computer program.

[0048] Or rather, an electronic device 300 includes a memory 310 and a processor 320 coupled to the memory 310; the memory 310 is configured to store a computer program; the processor 320 is configured to perform the following operations when executing the computer program: Obtain an image segmentation training set, a first initial segmentation model, a second initial segmentation model, and an original water surface image of a target area, where the image segmentation training set includes a first sample image, a second sample image, and a segmentation label corresponding to the first sample image; Based on the segmentation label, perform sample augmentation on the first sample image to generate a sample augmentation image set; train the first initial segmentation model according to the sample augmentation image set to obtain a trained first initial segmentation model, and transfer the model parameters of the trained first initial segmentation model to the second initial segmentation model to obtain a second initial segmentation model with parameter transfer; segment the second sample image through the trained first initial segmentation model to generate a pseudo-segmentation label, and construct an image segmentation pseudo-training set; train the second initial segmentation model with parameter transfer through the sample augmentation image set and the image segmentation pseudo-training set to generate an image segmentation model; Segment the original water surface image through the image segmentation model to generate a water surface area image; identify pollutants in the water surface area image by using a trained image recognition model to generate pollutant data; identify the clarity of the water surface area image by using a trained support vector machine to generate clarity data; Generate pollution early warning information according to the pollutant data and the clarity data.

[0049] A computer-readable storage medium provided by an embodiment of the present invention has a computer program stored thereon, and when the computer program is executed by a processor, the water surface pollution prediction method as described above is implemented.

[0050] Or rather, a non-volatile computer-readable storage medium has a computer program stored thereon, and when the computer program is executed by a processor, the processor is caused to perform the following operations: Obtain an image segmentation training set, a first initial segmentation model, a second initial segmentation model, and the original water surface image of the target area. Among them, the image segmentation training set includes a first sample image, a second sample image, and a segmentation label corresponding to the first sample image; Based on the segmentation label, perform sample augmentation on the first sample image to generate a sample augmentation image set; train the first initial segmentation model according to the sample augmentation image set to obtain a trained first initial segmentation model, and transfer the model parameters of the trained first initial segmentation model to the second initial segmentation model to obtain a second initial segmentation model with parameter transfer; segment the second sample image through the trained first initial segmentation model to generate a pseudo-segmentation label, and construct an image segmentation pseudo-training set; train the second initial segmentation model with parameter transfer through the sample augmentation image set and the image segmentation pseudo-training set to generate an image segmentation model; Segment the original water surface image through the image segmentation model to generate a water surface area image; use a trained image recognition model to identify pollutants in the water surface area image to generate pollutant data; use a trained support vector machine to identify the clarity of the water surface area image to generate clarity data; Generate a pollution warning message according to the pollutant data and the clarity data.

[0051] Now, an electronic device 300 that can be a server or a client of the present invention will be described. It is an example of a hardware device that can be applied to various aspects of the present invention. The electronic device 300 is intended to represent various forms of digital electronic computer devices, such as, laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device 300 can also represent various forms of mobile devices, such as, personal digital processors, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are only examples and are not intended to limit the implementation of the present invention described herein and / or claimed.

[0052] The electronic device 300 includes a computing unit, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) or a computer program loaded from a storage unit into a random access memory (RAM). In the RAM, various programs and data required for device operation can also be stored. The computing unit, ROM, and RAM are connected to each other through a bus. An input / output (I / O) interface is also connected to the bus.

[0053] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above methods. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM), etc. In this application, the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they can be located in one place, or they can be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiments of the present invention. In addition, the functional units in each embodiment of the present invention can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above integrated units can be implemented in the form of hardware or in the form of software functional units.

[0054] Although the present invention is disclosed as above, the scope of protection of the present invention is not limited thereto. Those skilled in the art can make various changes and modifications without departing from the spirit and scope of the present invention, and these changes and modifications will all fall within the scope of protection of the present invention.

Claims

1. A method for predicting water surface pollution, characterized in that, Including: Obtain an image segmentation training set, a first initial segmentation model, a second initial segmentation model, and the original water surface image of the target area, where the image segmentation training set includes a first sample image, a second sample image, and a segmentation label corresponding to the first sample image; Based on the segmentation label, perform sample augmentation on the first sample image to generate a sample augmentation image set; train the first initial segmentation model according to the sample augmentation image set to obtain a trained first initial segmentation model, and transfer the model parameters of the trained first initial segmentation model to the second initial segmentation model to obtain a second initial segmentation model with parameter transfer; segment the second sample image through the trained first initial segmentation model to generate a pseudo-segmentation label, and construct an image segmentation pseudo-training set; train the second initial segmentation model with parameter transfer through the sample augmentation image set and the image segmentation pseudo-training set to generate an image segmentation model; Segment the original water surface image through the image segmentation model to generate a water surface area image; identify pollutants in the water surface area image using a trained image recognition model to generate pollutant data; identify the clarity of the water surface area image using a trained support vector machine to generate clarity data; Generate a pollution warning message according to the pollutant data and the clarity data.

2. The water pollution prediction method according to claim 1, wherein The step of identifying the clarity of the water surface area image using a trained support vector machine to generate clarity data includes: Obtain an image classification training set and an initial support vector machine, where the image classification training set includes water area image samples and corresponding clarity classification labels; Extract and fuse the color feature training vectors and texture feature training vectors of the water area image samples respectively to generate training feature fusion information; train the initial support vector machine according to the training feature fusion information and the clarity classification labels to generate the trained support vector machine; Input the water surface area image into a color space, calculate the second-order moments of each color component, and extract the corresponding color feature target vectors; Perform gray-scale transformation on the water surface area image to generate a water surface gray-scale image, and determine the gravitational amplitude and gravitational direction angle of each pixel in the water surface gray-scale image respectively according to a set of gravitational formulas, where the set of gravitational formulas includes: ; ; ; ; wherein, is the gravitational amplitude of the i -th pixel in the water surface grayscale image, is the gravitational direction angle of the i -th pixel in the water surface grayscale image, is the gravitational component of the i -th pixel in the water surface grayscale image in the x -axis direction, is the gravitational component of the i -th pixel in the water surface grayscale image in the y -axis direction, is the gravitational constant, is the grayscale value of the i -th pixel, is the grayscale value of the i -th pixel of the j -th neighboring pixel. The i -th pixel has a total of s neighboring pixels, is the Euclidean distance between the i -th pixel and the j -th neighboring pixel, is the angle in the horizontal direction between the i -th pixel and the j -th neighboring pixel; Determine the direction angle vector of each pixel according to the gravitational direction angle and the direction angle vector formula, where the direction angle vector formula includes: ; Among them, is the i direction angle vector of the th pixel, i is the gravitational direction angle of the first pixel in the neighborhood of the th pixel, i is the gravitational direction angle of the second pixel in the neighborhood of the th pixel, i is the gravitational direction angle of the s th pixel in the neighborhood of the th pixel; Determine the texture value of each pixel according to the direction angle vector and the texture value formula, and generate the texture feature target vector of the water surface area image according to the texture value of each pixel, where the texture value formula includes: ; in, For the i The texture value of pixels, is the direction angle vector j Quantity, Based on the preset threshold The judgment value of Fuse the color feature target vector and the texture feature target vector and perform normalization processing to generate water surface feature fusion information, and input the water surface feature fusion information into the trained support vector machine to generate the clarity data.

3. The water pollution prediction method according to claim 1, characterized in that The trained image recognition model includes a backbone network layer, a neck network layer, an adaptive attention mechanism layer, a fully connected layer, a feature fusion layer, and a detection layer connected in sequence; The backbone network layer is used to extract feature information maps of different dimensions in the water surface area image and construct a regional feature image set; The neck network layer is used to perform average pooling operations on the feature information maps in the regional feature image set to generate average pooling values corresponding to the feature information maps; The adaptive attention mechanism layer is used to perform convolution operations on the average pooling values according to the convolution kernel and the convolution kernel formula, and obtain corresponding feature weights through the activation function. The convolution kernel formula includes: ; Among them, k is the size of the convolution kernel, L is the number of channels for the fully connected layer to connect to the feature fusion layer, and are both hyperparameters, is the odd sign for absolute value; The fully connected layer is used to connect the feature information maps to the feature fusion layer based on different channels; The feature fusion layer is used to fuse the feature information maps according to the feature weights to generate a regional feature fusion image; The detection layer is used to identify and mark the pollutants in the regional feature fusion image to generate the pollutant data.

4. The water pollution prediction method according to claim 1, wherein Based on the segmentation label, perform sample augmentation on the first sample image to generate a sample augmentation image set, including: Perform mirroring, rotation transformation, and grayscale adjustment on the first sample image respectively to generate corresponding sample mirror images, sample rotation images, and sample grayscale images; Add water ripple noise and illumination noise to the first sample image, the sample mirror image, the sample rotation image, and the sample grayscale image respectively to generate corresponding first sample noise images, sample noise mirror images, sample noise rotation images, and sample noise grayscale images; Based on the segmentation label, construct the sample augmentation image set according to the first sample noise image, the sample noise mirror image, the sample noise rotation image, and the sample noise grayscale image.

5. The water pollution prediction method according to claim 4, characterized in that Training the first initial segmentation model according to the sample augmentation image set to obtain a trained first initial segmentation model, including: Input the sample input images in the sample augmentation image set into the first initial segmentation model; Perform convolution operations on the sample input images through the first initial segmentation model to obtain sample first convolution images, perform convolution operations and non-linear activation processing on the sample first convolution images to generate sample second convolution images, perform max pooling operations on the sample first convolution images and the sample second convolution images respectively to generate sample first pooling images and sample second pooling images, perform feature addition on the sample first pooling images and the sample second pooling images to generate sample feature images, perform convolution operations and non-linear activation processing on the sample feature images to generate sample convolution images, perform skip connection on the sample convolution images and the sample first pooling images, and perform convolution activation operations to generate sample third convolution images, perform upsampling operations on the sample third convolution images to generate sample sampling images, and perform convolution activation operations to generate sample fourth convolution images; perform skip connection on the sample fourth convolution images and the sample first convolution images, and perform convolution activation operations to generate sample segmentation images; By performing a deviation evaluation on the segmentation labels corresponding to the sample segmentation images and the sample input images, the first initial segmentation model is cyclically trained and optimized until the deviation evaluation results of the sample segmentation images and the segmentation labels are within a preset threshold range, and the trained first initial segmentation model is obtained.

6. The water pollution prediction method according to claim 5, characterized in that The deviation evaluation results include a correctness deviation evaluation parameter, a segmentation deviation evaluation parameter, and a missed detection evaluation parameter. The process of cyclically training and optimizing the first initial segmentation model by performing a deviation evaluation on the segmentation labels corresponding to the sample segmentation images and the sample input images until the deviation evaluation results of the sample segmentation images and the segmentation labels are within a preset threshold range to obtain the trained first initial segmentation model includes: Based on the sample segmentation images and the segmentation labels, determine the number of correctly segmented pixel points and the number of incorrectly segmented pixel points in the sample segmentation images, and generate the correctness deviation evaluation parameter based on a correctness evaluation formula, where the correctness evaluation formula includes: ; Among them, is the correctness deviation evaluation parameter, n is the number of regions divided in the sample segmentation image into n regions, is the number of correctly segmented pixel points in the i th region of the sample segmentation image, M is the number of all pixel points in the sample segmentation image; Based on the number of correctly segmented pixel points and the number of incorrectly segmented pixel points, generate the segmentation deviation evaluation parameter based on a segmentation deviation evaluation formula, where the segmentation deviation evaluation formula includes: ; Among them, is the segmentation deviation evaluation parameter, and are both the number of mis-segmented pixel points, and is the number of pixel points belonging to the i th region in the sample segmentation image that are segmented into pixel points of the j th region, is the number of pixel points belonging to the j th region in the sample segmentation image that are segmented into pixel points of the i th region; Based on the number of incorrectly segmented pixel points, generate the missed detection evaluation parameter based on a missed detection evaluation formula, where the missed detection evaluation formula includes: ; Among them, is the missed detection evaluation parameter; When the correctness deviation evaluation parameter, the segmentation deviation evaluation parameter, and the missed detection evaluation parameter exceed the preset threshold range, reverse-infer the segmentation labels based on the operation process of the first initial segmentation model to obtain a sample label processing image set; construct a sample processing image set based on the sample first convolutional image, the sample second convolutional image, the sample first pooling image, the sample second pooling image, the sample feature image, the sample convolutional image, the sample third convolutional image, the sample sampling image, the sample fourth convolutional image, and the sample segmentation image; optimize the model parameters of the convolutional operation, pooling operation, and upsampling operation in the first initial segmentation model based on the sample label processing image set and the sample processing image set; When the correctness deviation evaluation parameter, the segmentation deviation evaluation parameter, and the missed detection evaluation parameter are within the preset threshold range, the trained first segmentation model is obtained.

7. The water pollution prediction method according to claim 1, characterized in that, The generating of the pollution warning information based on the pollutant data and the clarity data includes: Based on the pollutant data, determine the proportion of the coverage area of the pollutants in the target area; By setting dynamic weights for the proportion of the coverage area and the clarity data, determine the warning parameter corresponding to the target area; When the warning parameter exceeds the warning threshold, generate the pollution warning information and send it to the back-end staff.

8. A water surface pollution prediction device, characterized in that, including: An acquisition module, configured to acquire an image segmentation training set, a first initial segmentation model, a second initial segmentation model, and an original water surface image of a target area, wherein the image segmentation training set includes a first sample image, a second sample image, and a segmentation label corresponding to the first sample image; A training module, configured to perform sample augmentation on the first sample image based on the segmentation label to generate a sample augmentation image set; train the first initial segmentation model according to the sample augmentation image set to obtain a trained first initial segmentation model, and transfer the model parameters of the trained first initial segmentation model to the second initial segmentation model to obtain a second initial segmentation model with parameter transfer; segment the second sample image through the trained first initial segmentation model to generate a pseudo-segmentation label, and construct an image segmentation pseudo-training set; train the second initial segmentation model with parameter transfer through the sample augmentation image set and the image segmentation pseudo-training set to generate an image segmentation model; A recognition module, configured to segment the original water surface image through the image segmentation model to generate a water surface area image; recognize pollutants in the water surface area image by using a trained image recognition model to generate pollutant data; recognize the clarity of the water surface area image by using a trained support vector machine to generate clarity data; An early warning module, configured to generate a pollution early warning information according to the pollutant data and the clarity data.

9. An electronic device, characterized in that, Comprising a memory and a processor; The memory is configured to store a computer program; The processor is configured to implement the water pollution prediction method according to any one of claims 1 to 7 when executing the computer program.

10. A computer-readable storage medium, characterized in that, A computer program is stored on the storage medium, and when the computer program is executed by the processor, the water pollution prediction method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Intelligent edge detection method for power grid inspection and monitoring

    CN116385958A

  • Roof photovoltaic potential assessment method based on semi-supervised segmentation model

    CN118470438A

  • Semi-supervised video target segmentation method and system based on global and local feature fusion

    CN119625308A

  • Quickly extraction of morphology characterization parameters of recycled concrete sand particles based on deep learning technology

    US20230394806A1

  • Method and system for training a neural network model to perform image classification and image localization and / or segmentation

    WO2024080929A1