A method, device, equipment and medium for predicting water surface pollution

Through the image segmentation training set and model parameter migration method, the problem of low water surface pollution monitoring efficiency is solved, and efficient and accurate automatic monitoring and early warning of water surface pollution is achieved, which is suitable for large-scale water areas.

CN120220075BActive Publication Date: 2025-08-01NORTHWEST ENGINEERING CORPORATION LIMITED
View PDF 2 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In the prior art, water surface pollution monitoring is low efficiency, time-consuming and labor cost, and effective monitoring of the entire basin cannot be achieved.

Method used

By acquiring the image segmentation training set and the initial segmentation model, sample expansion and model parameter migration are performed to generate high-precision image segmentation models, and combined with the support vector machine to identify pollutants and clarity in the water surface area, and pollution warning information is generated.

Benefits of technology

It realizes automated monitoring of water surface pollution, 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 CN120220075B_ABST
    Figure CN120220075B_ABST
Patent Text Reader

Abstract

The present invention provides a method, device, equipment and medium for predicting water surface pollution, which relates to the technical field of image processing. The method includes 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; segmenting the second sample image by the trained first initial segmentation model to generate pseudo-segmentation labels, and constructing an image segmentation pseudo-training set; training the second initial segmentation model with parameter transfer by the sample augmented image set and the image segmentation pseudo-training set to generate an image segmentation model; segmenting the original water surface image by the image segmentation model to generate a water surface area image; identifying pollutants in the water surface area image by the trained image recognition model to generate pollutant data; and identifying the clarity of the water surface area image by the trained support vector machine to generate clarity data. The present invention has high monitoring and prediction efficiency, short time consumption and low labor cost, and can effectively monitor the entire water surface basin.
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 their accumulation and decay on the water surface 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:

[0007] 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;

[0008] 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;

[0009] 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;

[0010] Generate a pollution warning message based on the pollutant data and the clarity data.

[0011] Optionally, using the trained support vector machine to identify the clarity of the water surface area image and generate clarity data includes:

[0012] 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;

[0013] 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;

[0014] Input the water surface area image into a color space, calculate the second moment of each color component, and extract the corresponding color feature target vector;

[0015] 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:

[0016] ;

[0017] ;

[0018] ;

[0019] ;

[0020] Where 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 i th neighbor pixel of the j th pixel, the iA total of s neighboring pixels, is the i th pixel and the j th neighboring pixel's Euclidean distance, is the i th pixel and the j th neighboring pixel's angle in the horizontal direction;

[0021] According to the gravitational direction angle and the direction angle vector formula, determine the direction angle vector of each pixel, and the direction angle vector formula includes:

[0022] ;

[0023] wherein, is the i th pixel's said direction angle vector, is the i th pixel neighborhood's 1st pixel's said gravitational direction angle, is the i th pixel neighborhood's 2nd pixel's said gravitational direction angle, is the i th pixel neighborhood's s th pixel's said gravitational direction angle;

[0024] According to the direction angle vector and the texture value formula, determine the texture value of each pixel, and according to the said texture value of each pixel, generate the texture feature target vector of the water surface area image, and the texture value formula includes:

[0025] ;

[0026] wherein, is the i th pixel's said texture value, is the j th component of the said direction angle vector, is the judgment value based on a preset threshold for the component ;

[0027] 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.

[0028] 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;

[0029] The backbone network layer is used to extract feature information maps of different dimensions in the water area image and construct a regional feature image set;

[0030] 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;

[0031] 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:

[0032] ;

[0033] Where, 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;

[0034] The fully connected layer is used to connect the feature information maps to the feature fusion layer based on different channels;

[0035] The feature fusion layer is used to fuse the feature information maps according to the feature weights to generate a regional feature fusion image;

[0036] The detection layer is used to identify and mark the pollutants in the regional feature fusion image to generate the pollutant data.

[0037] Optionally, based on the segmentation label, sample augmentation is performed on the first sample image to generate a sample augmentation image set, including:

[0038] Mirroring, rotation transformation, and grayscale adjustment are respectively performed on the first sample image to generate corresponding sample mirror images, sample rotation images, and sample grayscale images;

[0039] Water ripple noise and illumination noise are respectively added to the first sample image, the sample mirror image, the sample rotation image, and the sample grayscale image to generate corresponding first sample noise images, sample noise mirror images, sample noise rotation images, and sample noise grayscale images;

[0040] Based on the segmentation label, the sample augmentation image set is constructed according to the first sample noise image, the sample noise mirror image, the sample noise rotation image, and the sample noise grayscale image.

[0041] Optionally, training the first initial segmentation model according to the sample-augmented image set to obtain a trained first initial segmentation model includes:

[0042] Inputting the samples in the sample-augmented image set into the first initial segmentation model;

[0043] Performing a convolution operation on the sample input image through the first initial segmentation model to obtain 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, respectively performing a max pooling operation on the first convolutional image of the sample and the second convolutional image of the sample to generate a first pooled image of the sample and a second pooled image of the sample, adding the features of the first pooled image of the sample and the second pooled 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, skip connecting the sample convolutional image and the first pooled 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; skip connecting 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;

[0044] Performing cyclic training optimization on the first initial segmentation model by performing a 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, and obtaining the trained first initial segmentation model.

[0045] Optionally, the deviation evaluation result includes a correctness deviation evaluation parameter, a segmentation deviation evaluation parameter, and a missed detection evaluation parameter. The cyclic training optimization of the first initial segmentation model by performing a 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, and obtaining the trained first initial segmentation model includes:

[0046] Determining the number of correctly segmented pixel points and the number of incorrectly segmented pixel points in the sample segmentation image according to the sample segmentation image and the segmentation label, and generating the correctness deviation evaluation parameter based on a correctness evaluation formula, where the correctness evaluation formula includes:

[0047] ;

[0048] Wherein, is the correctness deviation evaluation parameter,n is divided into n regions in the sample segmentation image; i is the number of correctly segmented pixel points in the M -th region of the sample segmentation image;

[0049] Based on the number of correctly segmented pixel points and the number of incorrectly segmented pixel points, a segmentation deviation evaluation parameter is generated according to a segmentation deviation evaluation formula, and the segmentation deviation evaluation formula includes:

[0050] ;

[0051] wherein, is the segmentation deviation evaluation parameter, and are both the number of incorrectly 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 in 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 in the i -th region;

[0052] Based on the number of incorrectly segmented pixel points, a missed detection evaluation parameter is generated according to a missed detection evaluation formula, and the missed detection evaluation formula includes:

[0053] ;

[0054] wherein, is the missed detection evaluation parameter;

[0055] 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, the segmentation label is reversed 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, a sample processing image set is constructed; according to the sample label processing image set and the sample processing image set, the model parameters of the convolutional operation, pooling operation, and upsampling operation in the first initial segmentation model are optimized;

[0056] 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.

[0057] Optionally, generating the pollution warning information according to the pollutant data and the clarity data includes:

[0058] Determine the proportion of the coverage area of the pollutant in the target area according to the pollutant data;

[0059] Determine the warning parameter corresponding to the target area by setting dynamic weights for the coverage area ratio and the clarity data;

[0060] When the warning parameter exceeds the warning threshold, generate the pollution warning information and send it to the background staff.

[0061] In a second aspect, the present invention provides a water surface pollution prediction device, including:

[0062] 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;

[0063] 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;

[0064] 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;

[0065] A warning module, configured to generate pollution warning information according to the pollutant data and the clarity data.

[0066] In a third aspect, the present invention provides an electronic device, including a memory and a processor;

[0067] The memory is used to store a computer program;

[0068] The processor is used to implement the water pollution prediction method as described in the first aspect when executing the computer program.

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

[0070] The beneficial effects of the water pollution prediction method, device, equipment and medium of the present invention are as follows:

[0071] 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 basic data for subsequent automated processing, thus avoiding the need for manual on-site detection in the related art. The first sample image is sample-expanded based on the segmentation label, and the first initial segmentation model is trained using the expanded image set. Then, the trained model parameters are migrated 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 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, the water surface area in the original water surface image is segmented by 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. The pollutants in the water surface area are identified by the trained image recognition model, and the water clarity is identified by the trained support vector machine. Then, a pollution warning message is generated according to the analysis results to remind the staff to take corresponding pollution control measures, realizing accurate early warning of the water quality of the target area, overcoming the limitation that the related technology cannot effectively monitor the entire basin, and solving the problem of long time consumption of the traditional method 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 water areas. Description of the Drawings

[0072] Figure 1 It is a schematic flowchart of the water pollution prediction method provided by an embodiment of the present invention;

[0073] Figure 2 The structural schematic diagram of the water pollution prediction device provided by the embodiment of the present invention;

[0074] Figure 3 The structural schematic diagram of the electronic device provided by the embodiment of the present invention. Specific embodiments

[0075] To make the above objects, features and advantages of the present invention more obvious and understandable, the specific embodiments of the present invention will be described in detail below 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. On the contrary, 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.

[0076] The term "including" and its variations used herein 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 of the functions performed by these devices, modules or units.

[0077] 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".

[0078] 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.

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

[0080] As Figure 1 shown, a water pollution prediction method provided by an embodiment of the present invention includes:

[0081] 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.

[0082] Specifically, an image sensor can be deployed to collect the original water surface image of the target area, where the target area refers to the river and lake 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 and facilitate subsequent image segmentation. The image segmentation training set includes the first sample image, the second sample image, and a segmentation label corresponding to the first sample image, and the second sample image has no corresponding segmentation label.

[0083] 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.

[0084] 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, so 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.

[0085] 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 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.

[0086] Specifically, segment the original water surface image through the image segmentation model, remove meaningless backgrounds and interference items, and only obtain the area image related to the water surface, so that subsequent models only analyze the water surface area image to improve the recognition accuracy; use the trained image recognition model to identify pollutants in the water surface area image, such as using a convolutional neural network model, ChatGPT, and hybrid models, etc., to generate pollutant data, and the pollutant data can include pollutant volume, quantity, and type; use the trained support vector machine to identify the clarity of the water surface area image to generate clarity data, and the clarity data can include clear, relatively clear, and turbid.

[0087] Generate pollution warning information according to the pollutant data and the clarity data.

[0088] Specifically, use the dynamic weighting method 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, issue pollution warning information to remind the staff to take corresponding pollution control measures.

[0089] In this embodiment, by obtaining an image segmentation training set, a first initial segmentation model, a second initial segmentation model, and an 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 basic data for subsequent automated processing, thus avoiding the need for manual on-site detection in related technologies. Based on the segmentation label, the first sample image is augmented, 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 combined with the previously generated sample-augmented image set to further optimize the second initial segmentation model, 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 original water surface image 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. 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 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 with algorithm automatic calculation, making the whole process more efficient and accurate, and is applicable to the comprehensive monitoring of large-scale waters.

[0090] Optionally, the step of identifying the clarity of the water surface area image by using the trained support vector machine to generate clarity data includes:

[0091] 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;

[0092] 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;

[0093] 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;

[0094] Perform grayscale transformation on the water surface area image to generate a grayscale water surface image, and respectively 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:

[0095] ;

[0096] ;

[0097] ;

[0098] ;

[0099] 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 s neighboring pixels, is the Euclidean distance between the i th pixel and the j th neighboring pixel, is the horizontal angle between the i th pixel and the j th neighboring pixel;

[0100] 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:

[0101] ;

[0102] where, is the direction angle vector of the i th pixel, is the gravitational direction angle of the 1st pixel in the neighborhood of the i th pixel, is thei the gravitational direction angle of the second pixel within a pixel neighborhood is the i gravitational direction angle of the s th pixel within a pixel neighborhood;

[0103] 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:

[0104] ;

[0105] wherein, is the i texture value of the th pixel, j is the th component of the direction angle vector, is a judgment value based on a preset threshold for the component

[0106] 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.

[0107] 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. Extract and fuse the color feature training vector and the texture feature training vector of the water area image sample respectively to generate training feature fusion information; according to the clarity classification label, the support vector machine generates two image classification boundaries, and the support vector machine is trained through the training feature fusion information to make the water area image sample far away from the image classification boundary and clarify the corresponding clarity classification label, 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, by inputting the water surface area image into the color space, calculate the second moment of each color component to 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.

[0108] 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;

[0109] The backbone network layer is used to extract feature information maps of different dimensions in the water area image and construct a regional feature image set;

[0110] 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;

[0111] The adaptive attention mechanism layer is used to perform convolution operations on the average pooling values according to a convolution kernel and a convolution kernel formula, and obtain corresponding feature weights through an activation function. The convolution kernel formula includes:

[0112] ;

[0113] 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;

[0114] The fully connected layer is used to connect the feature information maps to the feature fusion layer based on different channels;

[0115] The feature fusion layer is used to fuse the feature information maps according to the feature weights to generate a regional feature fusion image;

[0116] The detection layer is used to identify and mark the pollutants in the regional feature fusion image to generate the pollutant data.

[0117] Specifically, the backbone network layer in the image recognition model extracts feature information graphs of different dimensions in the water area image based on convolutional blocks, pooling blocks, and spatial pyramid pooling blocks with different sizes, and constructs a regional feature image set. For example, small convolutional kernels (1X1, 3X3) are used to collect fine-grained features of the water area image, and small convolutional kernels (7X7, 10X10) are used to capture larger-scale global features of the water area image, expanding the receptive field. By extracting the feature information of the image through different convolutional kernels, a regional feature image set can be constructed. The feature information graph is subjected to average pooling operation through the neck network layer, and a convolutional kernel is set based on the adaptive attention mechanism layer to perform convolutional operation on the average pooling value. The corresponding feature weights are obtained through the activation function, and the feature information graph is connected to the feature fusion layer based on different channels through the fully connected layer. In the feature fusion layer, the feature information graph is weighted and fused according to the optimized feature weights to obtain a regional feature fusion image, and the pollutants in the regional feature fusion image are detected and marked through the detection layer. Through the backbone network layer in the image recognition model, the feature extraction of the water area image is realized. Setting the convolutional 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 characterization ability of key features, and enhancing the detection accuracy of pollutants by the detection layer.

[0118] Optionally, the sample augmentation of the first sample image based on the segmentation label to generate a sample augmentation image set includes:

[0119] 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;

[0120] Adding 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;

[0121] Based on the segmentation label, constructing 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.

[0122] Specifically, by mirroring, rotating and grayscale adjusting the first sample image, and adding water ripple noise and light noise, the construction of the sample expanded image set is realized, and the first initial segmentation model is trained based on the sample expanded image set. The model parameters of the trained first initial segmentation model are migrated to the second initial segmentation model for setting. The second initial segmentation model is trained and optimized through the sample expanded image set and the image segmentation pseudo training set, and the construction of the image segmentation model is realized. This embodiment realizes the training of the model 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 second initial segmentation model is quickly constructed, and the model performance can be effectively improved by training with the sample expanded image set and the image segmentation pseudo training set.

[0123] In one embodiment, respectively adding water ripple noise and light noise to the first sample image, the sample mirror image, the sample rotated image, and the sample grayscale image to generate corresponding first sample noise images, sample noise mirror images, sample noise rotated images, and sample noise grayscale images includes:

[0124] Obtaining an image to be added with water ripple noise and light noise from among the first sample image, the sample mirror image, the sample rotated image, and the sample grayscale image as a sample image to be processed;

[0125] Constructing a blank sample image of the same size according to the size of the sample image to be processed;

[0126] By using the preset water ripple intensity and water ripple frequency, the water ripple sample image formula group is used to assign values to the pixel points in the blank sample image to generate water ripple sample images corresponding to the first sample image, the sample mirror image, the sample rotated image, and the sample grayscale image. The water ripple sample image formula group includes:

[0127] ;

[0128] ;

[0129] in, is the first i The pixel value of each pixel, For the watermark sample image i The pixel value of each pixel, 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 ripple intensity,f is the moire frequency;

[0130] Overlay the sample image to be processed with the moire sample image to generate a moire noise image. Using the sample noise image formula, add illumination noise to the pixel points in the moire 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 gray 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 gray image. The sample noise image formula is as follows:

[0131] ;

[0132] 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 moire noise image, L is the preset illumination intensity, is the reflection coefficient.

[0133] Specifically, obtain the sample image to be processed in the first sample image, the sample mirror image, the sample rotation image, and the sample gray image, add moire noise and illumination noise, and obtain the sample noise image. Add moire 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 moire intensity and moire frequency, assign values to the pixel points in the blank sample image to obtain the moire sample image, and overlay it with the sample image to be processed to obtain the moire sample image. Add illumination noise to the moire sample image. By superimposing illumination noise on the noise points in the moire noise image, obtain the sample noise image. By adding moire noise and illumination noise to the first sample image, the sample mirror image, the sample rotation image, and the sample gray image, the acquisition of the first sample noise image, the sample noise mirror image, the sample noise rotation image, and the sample noise gray image is realized, and then the expansion of the sample image set is realized, which is convenient for the training of the model in the subsequent steps.

[0134] Optionally, the training of the first initial segmentation model according to the sample-expanded image set to obtain the trained first initial segmentation model includes:

[0135] Input the sample input image in the sample-expanded image set into the first initial segmentation model;

[0136] 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, skip connect 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; skip connect the sample fourth convolution image and the sample first convolution image, and perform a convolution activation operation to generate a sample segmentation image;

[0137] 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.

[0138] 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 pooled image of the sample, performing a max pooling operation on the second convolutional image of the sample to generate a second pooled image of the sample, and adding features based on the first pooled image of the sample and the second pooled 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 pooled 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 sampled 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 based on the first pooled image of the sample and the second pooled image of the sample. Skip connections are made between the sample convolutional image and the first pooled 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.

[0139] 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 results of the sample segmentation image and the segmentation label are within a preset threshold range to obtain the trained first initial segmentation model includes:

[0140] Based on 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 a correctness evaluation formula, where the correctness evaluation formula includes:

[0141] ;

[0142] where, is the correctness deviation evaluation parameter, n is the number of regions into which the sample segmentation image is divided 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;

[0143] According to the number of correctly segmented pixel points and the number of incorrectly segmented pixel points, based on the segmentation deviation evaluation formula, the segmentation deviation evaluation parameter is generated, and the segmentation deviation evaluation formula includes:

[0144] ;

[0145] wherein, is the segmentation deviation evaluation parameter, and are both the number of incorrectly 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;

[0146] According to the number of incorrectly segmented pixel points, based on the missed detection evaluation formula, the missed detection evaluation parameter is generated, and the missed detection evaluation formula includes:

[0147] ;

[0148] wherein, is the missed detection evaluation parameter;

[0149] 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, the segmentation label is inversely deduced to obtain a sample label 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, a sample processing image set is constructed; according to the sample label processing image set and the sample processing image set, the model parameters of the convolution operation, pooling operation, and upsampling operation in the first initial segmentation model are optimized;

[0150] 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.

[0151] Specifically, the preset threshold range can be set according to the actual situation. The deviation of the sample segmentation image is evaluated based on 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 ratio 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 ratio 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.

[0152] Optionally, the generating the pollution warning information according to the pollutant data and the clarity data includes:

[0153] Determining the coverage area ratio of the pollutant in the target area according to the pollutant data;

[0154] Determining the warning parameter corresponding to the target area by setting dynamic weights for the coverage area ratio and the clarity data;

[0155] When the warning parameter exceeds the warning threshold, generating the pollution warning information and sending it to the background staff.

[0156] 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, the weight of 0.5 is set for the proportion of the coverage area, the weight of 0.5 is set for the clarity data, the calculated warning parameter is 0.15, the warning threshold is set to 0.6, the warning parameter does not exceed the warning threshold, no pollution warning message is generated, nor is it 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, the weight of 0.3 is set for the proportion of the coverage area, the weight of 0.7 is set for the clarity data, the calculated warning parameter is 0.73, the warning threshold is set to 0.6, the warning parameter exceeds the warning threshold, then 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, pollution warning is carried out to remind the staff to perform corresponding pollution treatment measures on the water surface area in time.

[0157] As Figure 2 shown, a water surface pollution prediction device provided by an embodiment of the present invention includes:

[0158] 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;

[0159] 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;

[0160] An identification module, configured to 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;

[0161] An early warning module, configured to generate a pollution early warning message according to the pollutant data and the clarity data.

[0162] 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 pollution prediction method as described above when executing the computer program.

[0163] 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:

[0164] 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;

[0165] 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;

[0166] 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;

[0167] Generate a pollution early warning message according to the pollutant data and the clarity data.

[0168] A computer-readable storage medium provided by an embodiment of the present invention, on which a computer program is stored. When the computer program is executed by a processor, the water pollution prediction method described above is implemented.

[0169] Alternatively, a non-volatile computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the processor performs the following operations:

[0170] 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. 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;

[0171] 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;

[0172] 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;

[0173] Generate a pollution warning message according to the pollutant data and the clarity data.

[0174] Now, an electronic device 300 that can be used as 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 merely examples and are not intended to limit the implementation of the present invention described herein and / or claimed.

[0175] The electronic device 300 includes a computing unit that 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 via a bus. An input / output (I / O) interface is also connected to the bus.

[0176] Those of ordinary skill in the art can understand that all or part of the processes of implementing the methods in 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 disc, 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 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.

[0177] 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 an 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; The performing sample augmentation on the first sample image based on the segmentation label to generate a sample augmentation image set includes: 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; The generating a pollution warning message according to the pollutant data and the clarity data includes: Determine the proportion of the coverage area of the pollutants 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 message and send it to the background staff.

2. The water pollution prediction method according to claim 1, characterized in that The 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 vector and texture feature training vector of the water area image sample respectively to generate training feature fusion information; train the initial support vector machine according to the training feature fusion information and the clarity classification label 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 respectively according to the gravitational formula group, where the gravitational formula group 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 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 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, 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 A 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, input the water surface feature fusion information into the trained support vector machine, and generate the clarity data.

3. The water pollution prediction method according to claim 1, wherein 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 the corresponding feature weights through the activation function, where 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 symbol 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 Training the first initial segmentation model according to the sample augmented image set to obtain the trained first initial segmentation model includes: Input the samples in the sample augmented 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; Perform a deviation evaluation on the sample segmentation image and the segmentation label corresponding to the sample input image, and perform cyclic training optimization on the first initial segmentation model until the deviation evaluation result between the sample segmentation image and the segmentation label is within a preset threshold range, and then obtain the trained first initial segmentation model.

5. The water pollution prediction method according to claim 4, characterized in that The deviation evaluation result includes a correctness deviation evaluation parameter, a segmentation deviation evaluation parameter, and a missed detection evaluation parameter. The performing a deviation evaluation on the sample segmentation image and the segmentation label corresponding to the sample input image, and performing cyclic training optimization on the first initial segmentation model until the deviation evaluation result between the sample segmentation image and the segmentation label is within a preset threshold range, and then 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 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; Generate the segmentation deviation evaluation parameter based on a segmentation deviation evaluation formula according to the number of correctly segmented pixel points and the number of incorrectly segmented pixel points, 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; Generate the missed detection evaluation parameter based on a missed detection evaluation formula according to the number of incorrectly segmented pixel points, where the missed detection evaluation formula includes: ; Among them, is the missed inspection 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 label 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 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.

6. A water surface pollution prediction device, characterized in that, For implementing the water pollution prediction method according to any one of claims 1-5, the water pollution prediction device includes: An acquisition module, configured to acquire an image segmentation training set, a first initial segmentation model, a second initial segmentation model, and a raw 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 raw 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 a pollution early warning information according to the pollutant data and the clarity data.

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

8. 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 5 is implemented.

Citation Information

Patent Citations

  • Intelligent edge detection method for power grid inspection and monitoring

    CN116385958A

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

    CN119625308A