Training method of black and odorous water body recognition model and related equipment
By fusing multiple exponential bands with the original remote sensing image and introducing an attention mechanism, a black and odorous water body recognition model is solved, and the problem of low recognition accuracy and low automation of remote sensing monitoring of black and odorous water body in the existing technology is solved, and higher recognition accuracy and monitoring efficiency are achieved.
Patent Information
- Application Number
- CN202411875807.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-04-11
AI Technical Summary
The prior art has problems such as low recognition accuracy, low degree of automation, and difficulty in quickly obtaining the water range in remote sensing monitoring of black and odorous water bodies.
By fusing multiple exponential bands with the original remote sensing image and introducing an attention mechanism, a black and odorous water body recognition model is constructed, and the model is optimized using the U-Net network and attention mechanism module to improve the recognition accuracy.
It improves the recognition accuracy of black and odorous water bodies, enhances the model's learning of related features of black and odorous water bodies, inhibits the impact of irrelevant features, and improves the degree of automation and real-time monitoring.
Smart Images

Figure CN119810655A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of black and odorous water body recognition, and in particular to a training method for a black and odorous water body recognition model and related equipment. Background Art
[0002] Black and smelly water is an extremely turbid polluted water. In the visible and near-infrared spectrum, black and smelly water has obvious differences from other normal water in spectral characteristics and chromaticity. In true color remote sensing images, normal water appears pure black or green, while black and smelly water generally appears gray-green. Black and smelly water is mostly small water such as ditches and canals. At the same time, the identification of black and smelly water can be indirectly assisted by image features such as garbage dumping on the river bank, river section breakup, and sandy soil coverage. Therefore, it is very feasible to monitor black and smelly water using remote sensing technology.
[0003] In the investigation and treatment of black and odorous water bodies, due to the seasonality and dispersion of black and odorous water bodies, traditional monitoring is mainly carried out by manual field investigation and public supervision. Such methods have the disadvantages of low monitoring efficiency, poor timeliness, and a large number of manpower. With the rise of remote sensing technology, the advantages of fast processing speed, high degree of automation, real-time dynamic monitoring, and wide detection range can well make up for the shortcomings of traditional monitoring methods. Therefore, in recent years, the research on remote sensing information extraction of black and odorous water bodies has become more and more popular.
[0004] At present, the research on black and odorous water bodies monitored by remote sensing mostly adopts water quality parameter method, spectral index method or water body colorimetry method. The algorithms are mostly machine learning classification algorithms to analyze the band and spectral information. They all have problems such as the need for manual determination of thresholds, low degree of automation, difficulty in quickly and timely obtaining the water body range, and the same spectrum but different objects. Summary of the invention
[0005] The embodiment of the present invention provides a training method and related equipment for a black and odorous water body recognition model, which fuses multiple index bands with original remote sensing images and introduces an attention mechanism for model training, thereby improving the recognition accuracy of black and odorous water bodies when water bodies are recognized and extracted through the model.
[0006] A first aspect of the present invention provides a method for training a black and odorous water body recognition model, comprising:
[0007] Obtaining remote sensing images corresponding to each of the multiple water bodies;
[0008] Preprocessing the remote sensing images to obtain a preprocessed remote sensing image set;
[0009] Performing data enhancement processing on each remote sensing image in the remote sensing image set to obtain an enhanced remote sensing image set;
[0010] Performing band operation on each remote sensing image in the enhanced remote sensing image set to fuse multiple index channels to obtain a multi-channel combined remote sensing image set;
[0011] Construct an initial black and odorous water body recognition model based on the attention mechanism module and U-Net network;
[0012] The initial black and odorous water body recognition model is trained based on the multi-channel combined remote sensing image set to obtain a black and odorous water body recognition model.
[0013] A second aspect of the present invention provides a training device for a black and odorous water body recognition model, comprising:
[0014] An acquisition module, used for acquiring a remote sensing image corresponding to each of the multiple water bodies;
[0015] A preprocessing module, used for preprocessing the remote sensing images to obtain a preprocessed remote sensing image set;
[0016] A data enhancement module, used for performing data enhancement processing on each remote sensing image in the remote sensing image set to obtain an enhanced remote sensing image set;
[0017] A band operation module, used for performing band operation on each remote sensing image in the enhanced remote sensing image set, so as to fuse multiple index channels to obtain a multi-channel combined remote sensing image set;
[0018] A construction module is used to build an initial black and odorous water body recognition model based on the attention mechanism module and the U-Net network;
[0019] A training module is used to train the initial black and odorous water body recognition model based on the multi-channel combined remote sensing image set to obtain a black and odorous water body recognition model.
[0020] In a possible design, the preprocessing module is specifically used for:
[0021] Performing radiation calibration and radiation correction on the remote sensing image to convert the brightness value of the pixel corresponding to the remote sensing image and the radiation brightness value to obtain a converted remote sensing image;
[0022] Performing geometric correction on the converted remote sensing image to geometrically correct the remote sensing image;
[0023] Performing atmospheric correction on the geometrically corrected remote sensing image to obtain an atmospherically corrected remote sensing image, wherein the atmospherically corrected remote sensing image contains real spectral characteristics of ground objects;
[0024] The atmospheric correction remote sensing image is fused with the panchromatic image to obtain the remote sensing image set.
[0025] In a possible design, the data enhancement module is specifically used for:
[0026] Performing random data enhancement on a target remote sensing image to obtain an initial enhanced image, wherein the target remote sensing image is any remote sensing image in the remote sensing image set;
[0027] The initial enhanced image is divided to obtain divided images, wherein the divided images include black and odorous water body images and background object images, wherein the background objects include normal water bodies, buildings, roads and vegetation;
[0028] The segmented images and labels are cropped according to preset rules to obtain the enhanced remote sensing image set.
[0029] In a possible design, the data enhancement module is further specifically used for:
[0030] Randomly rotating and mirroring the target remote sensing image and the target label corresponding to the target remote sensing image to obtain a first remote sensing image and a first label, wherein the first remote sensing image corresponds to the first label;
[0031] Noise is randomly added to the first remote sensing image to obtain the initial enhanced image.
[0032] In a possible design, the multiple index channels include a normalized difference vegetation index and a normalized difference black and odorous water index, and the normalized difference vegetation index is expressed by the following formula:
[0033]
[0034] Wherein, NDVI is the normalized difference vegetation index, Rrs(NIR) is the remote sensing reflectance of the near infrared band, and Rrs(R) is the remote sensing reflectance of the red light band;
[0035] The normalized difference black and odorous water index is expressed by the following formula:
[0036]
[0037] Among them, NDBWI is the normalized difference black and odorous water index, Rrs(G) is the remote sensing reflectivity of the green light band, and Rrs(R) is the remote sensing reflectivity of the red light band.
[0038] In one possible design, the attention mechanism module includes a channel attention module and a spatial attention module, wherein the channel attention module is represented by the following formula:
[0039] Mc(F)=σ{MLP[AvgPool(F)]+MLP[MaxPool(F)]};
[0040] Among them, MLP is a multi-layer perceptron, σ is a Sigmoid activation function;
[0041] The spatial attention module is represented by the following formula:
[0042] Ms(F)=σ{f 7x7 [AvgPool(F); MaxPool(F)]};
[0043] Among them, f is a convolution layer with a convolution kernel of 7x7, σ is the Sigmoid activation function, and [;] represents serial connection.
[0044] In a possible design, the training module is specifically used for:
[0045] Dividing the multi-channel combined remote sensing image set according to a preset ratio to obtain a training set, a validation set and a test set;
[0046] The initial black and odorous water body recognition model is trained by the training set, and the trained initial black and odorous water body recognition model is verified by the verification set, and the verified initial black and odorous water body recognition model is verified by the test set to obtain the black and odorous water body recognition model.
[0047] The third aspect of the present invention provides an electronic device, comprising a memory and a processor, wherein the processor is used to implement the steps of the training method for the black and odorous water body identification model as described in the first aspect when executing a computer management program stored in the memory.
[0048] The fourth aspect of the present invention provides a computer-readable storage medium having a computer management program stored thereon. When the computer management program is executed by a processor, the steps of the training method for the black and odorous water body identification model as described in the first aspect above are implemented.
[0049] To sum up, it can be seen that in the embodiment provided by the present invention, multiple index bands are fused with the original remote sensing image, and remote sensing images of different channel combinations are used as input parameters of the model to construct a U-Net network model. At the same time, on the basis of the U-Net deep learning network model, an attention mechanism module is introduced to optimize the model in terms of channel attention and spatial attention, so that the model focuses on learning pixel features related to black and odorous water bodies, and suppresses the model from learning pixel features that are not related to black and odorous water bodies. Therefore, when the water body is identified and extracted through the model, the recognition accuracy of the black and odorous water body can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 A schematic diagram of a flow chart of a method for training a black and odorous water body recognition model provided in an embodiment of the present invention;
[0051] Figure 2 A virtual structural diagram of a training device for a black and odorous water body recognition model provided by an embodiment of the present invention;
[0052] Figure 3 A schematic diagram of the hardware structure of a training device for a black and odorous water body recognition model provided by an embodiment of the present invention;
[0053] Figure 4 A schematic diagram of an electronic device according to an embodiment of the present invention;
[0054] Figure 5 A schematic diagram of an embodiment of a computer-readable storage medium provided for an embodiment of the present invention. DETAILED DESCRIPTION
[0055] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0056] In the following description, specific embodiments of the present invention will be described with reference to steps and symbols performed by one or more computers, unless otherwise stated. Therefore, these steps and operations will be mentioned several times as being performed by a computer, and computer execution referred to herein includes operations by a computer processing unit of electronic signals representing data in a structured form. This operation converts the data or maintains it at a location in the computer's memory system, which can be reconfigured or otherwise change the operation of the computer in a manner familiar to testers in the field. The data structure maintained by the data is a physical location in the memory, which has specific characteristics defined by the data format. However, the principles of the present invention are described in the above text, which does not represent a limitation, and testers in the field will understand that the various steps and operations described below can also be implemented in hardware.
[0057] The principles of the present invention operate with many other general or special purpose computing, communication environments or configurations. Examples of well-known computing systems, environments and configurations suitable for use with the present invention may include, but are not limited to, handheld phones, personal computers, servers, multiprocessor systems, microcomputer-based systems, mainframe computers, and distributed computing environments, including any of the above systems or devices.
[0058] The terms "first", "second", and "third" in the present invention are used to distinguish different objects rather than to describe a specific order. In addition, the terms "include", "have", and any variations thereof are intended to cover non-exclusive inclusions.
[0059] The following describes the training method of the black and odorous water body identification model provided by the present invention from the perspective of the training device of the black and odorous water body identification model. The training device of the black and odorous water body identification model can be a server or a service unit in the server, without specific limitation.
[0060] See also Figure 1 , Figure 1 A flow chart of a method for training a black and odorous water body recognition model provided in an embodiment of the present invention, wherein the method for training a black and odorous water body recognition model comprises:
[0061] 101. Obtain a remote sensing image corresponding to each of the multiple water bodies.
[0062] In this embodiment, the training device of the black and odorous water body recognition model can obtain the remote sensing image corresponding to each water body in multiple water bodies, and the multiple water bodies include both black and odorous water bodies and non-black and odorous water bodies. That is, the remote sensing image includes both the remote sensing images corresponding to the black and odorous water bodies and the remote sensing images corresponding to the non-black and odorous water bodies.
[0063] 102. Preprocess the remote sensing images to obtain a preprocessed remote sensing image set.
[0064] In this embodiment, after obtaining the remote sensing image corresponding to each of the multiple water bodies, the training device of the black and odorous water body recognition model can preprocess the remote sensing image to obtain a set of preprocessed remote sensing images. Specifically, when preprocessing the remote sensing image, the training device of the black and odorous water body recognition model mainly forms a basic processing tool through algorithms and integrated secondary development tools, and preprocesses the remote sensing image of the water body based on the basic processing tool, wherein the preprocessing includes but is not limited to radiation calibration, radiation correction, geometric correction, atmospheric correction, outlier removal, and image fusion.
[0065] In one embodiment, the training device of the black and odorous water body recognition model preprocesses the remote sensing image to obtain a preprocessed remote sensing image set including
[0066] Perform radiometric calibration and radiometric correction on the remote sensing image to convert the pixel brightness value and radiometric brightness value corresponding to the remote sensing image to obtain a converted remote sensing image;
[0067] geometrically correcting the converted remote sensing images to geometrically correct the remote sensing images;
[0068] Performing atmospheric correction on the geometrically corrected remote sensing image to obtain an atmospherically corrected remote sensing image, which contains the true spectral characteristics of the ground objects;
[0069] The atmospherically corrected remote sensing image is fused with the panchromatic image to obtain a remote sensing image set.
[0070] In this embodiment, the real water body remote sensing reflectance data is very important for the study of remote sensing information extraction of black and odorous water bodies. The remote sensing information in the remote sensing image is recorded by the pixel brightness value (DN). In order to obtain the spectral reflectance of the ground object, it is necessary to convert the DN value and the radiation brightness value through radiation calibration. When the satellite takes remote sensing images of black and odorous water bodies, the satellite's attitude, altitude, speed, ground terrain undulations and atmospheric disturbances will cause the remote sensing image to be geometrically distorted during imaging. It is necessary to perform geometric correction to correct the geometric distortion in the remote sensing image. Due to atmospheric absorption, scattering and other reasons, satellite remote sensing images have a certain degree of distortion. In order to eliminate these distortions, atmospheric correction is required to obtain the real spectral characteristics of the ground object. At the same time, the pre-processed multispectral image and the panchromatic image are fused to obtain images with both multispectral characteristics and higher spatial resolution, and finally a remote sensing image set is obtained.
[0071] 103. Perform data enhancement processing on each remote sensing image in the remote sensing image set to obtain an enhanced remote sensing image set.
[0072] In this embodiment, after obtaining the remote sensing image set, the training device of the black and odorous water body recognition model can perform data enhancement processing on each remote sensing image in the remote sensing image set, wherein the data enhancement processing includes but is not limited to operations such as image rotation, image mirroring, and adding random noise to the image.
[0073] In one embodiment, the training device of the black and odorous water body recognition model performs data enhancement processing on each remote sensing image in the remote sensing image set to obtain an enhanced remote sensing image set:
[0074] Perform random data enhancement on the target remote sensing image to obtain an initial enhanced image, where the target remote sensing image is any remote sensing image in the remote sensing image set;
[0075] The initial enhanced image is divided to obtain a divided image, wherein the divided image includes a black and odorous water body image and a background object image, wherein the background object includes a normal water body, a building, a road and a vegetation;
[0076] The segmented images and labels are cropped according to preset rules to obtain a set of enhanced remote sensing images.
[0077] In this embodiment, the training device of the black and odorous water body recognition model can perform random data enhancement on the target remote sensing image. Specifically: the target remote sensing image and the target label corresponding to the target remote sensing image are randomly rotated and mirrored to obtain a first remote sensing image and a first label. The first remote sensing image corresponds to the first label, that is, the rotation angle of the remote sensing image and the label is the same, ensuring that the rotated remote sensing image and the rotated label remain corresponding; at the same time, the remote sensing image and the corresponding label are also mirrored to ensure that the mirrored remote sensing image and the mirrored label remain opposite; finally, random noise is added to the image to obtain an initial enhanced image. The purpose of adding random noise is to enable the model to maintain stable performance under a certain degree of interference, thereby enhancing the robustness of the model and reducing the sensitivity of the model to the training data set.
[0078] In addition, in order to clearly and intuitively obtain the information of black and odorous water bodies in subsequent model training, all the objects in the remote sensing images are divided into two categories: black and odorous water bodies and background objects. Among them, the background objects include normal water bodies, buildings, roads, vegetation and other objects. Since black and odorous water bodies are mostly small water bodies, the remote sensing images and the corresponding label images are randomly cropped into images of 256 pixels x 256 pixels in size, and it is ensured that they still maintain a one-to-one correspondence after cropping. Finally, a set of enhanced remote sensing images and the enhanced label images corresponding to each enhanced remote sensing image in the set of enhanced remote sensing images are obtained.
[0079] 104. Perform band operation on each remote sensing image in the enhanced remote sensing image set to fuse multiple index channels to obtain a multi-channel combined remote sensing image set.
[0080] In this embodiment, the substances contained in the water body determine the spectral characteristics of the water body, and at the same time, various physical and chemical properties of the water body, such as state, color, pH, etc., will produce images of the spectral characteristics of the water body. For clear water bodies with fewer impurities, almost all incident sunlight will be absorbed; for turbid black and smelly water bodies with more impurities, the suspended matter in the water will reflect part of the sunlight. Therefore, there are complex similarities and differences in spectral information between black and smelly water bodies and non-black and smelly water bodies, and it is difficult to distinguish between black and smelly water bodies and non-black and smelly water bodies during extraction. Therefore, when extracting remote sensing information of black and smelly water bodies, it is necessary to enrich the spectral information of remote sensing images so that the model focuses on the spectral characteristics related to black and smelly water bodies and suppresses spectral characteristics that are not related to black and smelly water bodies.
[0081] Therefore, after obtaining the enhanced remote sensing image set, the training device of the black and odorous water body recognition model can perform band operations on each remote sensing image in the enhanced remote sensing image set to fuse multiple index channels to obtain a multi-channel combined remote sensing image set. That is, each remote sensing image in the multi-channel combined remote sensing image set contains 6 effective bands and derived index band combinations, thereby optimizing the extraction effect of black and odorous water body images.
[0082] In the present invention, the normalized difference vegetation index (NDVI) and the normalized difference black and odorous water index (NDBWI) are selected for band calculation, wherein the role of the NDVI index is to help the model identify the vegetation type in the remote sensing background objects and suppress the spectral characteristics related to vegetation; the role of the NDBWI index is to help the model focus on identifying the spectral characteristics related to black and odorous water bodies and strengthen the extraction of black and odorous water feature information. Finally, six multi-channel combined remote sensing images of RGB+NIR+NDVI+NDBWI are used to complete band synthesis to obtain a multi-channel combined remote sensing image set.
[0083] Among them, multiple index channels include the normalized difference vegetation index and the normalized difference black and odorous water index. The normalized difference vegetation index is expressed by the following formula:
[0084]
[0085] Among them, NDVI is the normalized difference vegetation index, Rrs(NIR) is the remote sensing reflectance of the near infrared band, and Rrs(R) is the remote sensing reflectance of the red light band;
[0086] The reflectivity of pure water in the blue-green band is about 4%, the reflectivity of the red light below 600nm is significantly reduced, and almost all incident energy is absorbed in the near-infrared and short-wave infrared parts. Using this spectral feature, the ratio of the remote sensing reflectivity difference and sum of these two band combinations is selected to identify urban black and odorous water bodies, and the normalized difference black and odorous water index (NDBWI) is constructed. This index can better extract black and odorous water bodies. The normalized difference black and odorous water index is expressed by the following formula:
[0087]
[0088] Among them, NDBWI is the normalized difference black and odorous water index, Rrs(G) is the remote sensing reflectance of the green light band, and Rrs(R) is the remote sensing reflectance of the red light band.
[0089] 105. Construct an initial black and smelly water body recognition model based on attention mechanism and U-Net network.
[0090] In this embodiment, the remote sensing image contains various types of land objects such as buildings, farmland, roads, vegetation, bare land, etc. The present invention only focuses on black and smelly water bodies, and other types of land objects and non-black and smelly water bodies are treated as background. The background situation is relatively complex, which has a strong interference on the accuracy of the extraction results, and the shapes of black and smelly water bodies are mostly small water bodies. Therefore, the present invention introduces an attention mechanism in the U-Net model network to adjust the feature weights and inhibit the model from learning features that are not related to black and smelly water bodies, so that the model focuses on learning features related to black and smelly water bodies, thereby better realizing the extraction of black and smelly water bodies with small shapes. Therefore, the training device of the black and smelly water body recognition model can construct an initial black and smelly water body recognition model based on the attention mechanism and the U-Net network. The attention mechanism module includes a channel attention module and a spatial attention module, which are explained below respectively:
[0091] 1. Channel attention module;
[0092] The channel attention module makes the convolutional network pay more attention to which channels of the image play a greater role in the final output of the network, that is, which features have the greatest impact on the final predicted image. For the extraction of black and odorous water body features, the NDVI index and NDBWI index are integrated into the input remote sensing image. These two indexes play a more critical role in the model learning black and odorous water body features or suppressing non-black and odorous water body features than the four bands of the original image. Therefore, the introduction of the channel attention module can make the model pay more attention to the NDVI index channel and NDBWI index channel of the input image, achieving better recognition accuracy.
[0093] First, the input feature F is fully connected after global maximum pooling of length and width in spatial dimension, then the length and width of F are globally averaged and fully connected, the output results of the above two pooling are input into MLP multi-layer perceptron and added, and after Sigmoid activation function, the channel attention feature matrix Mc is generated, and finally the output result is multiplied by the input feature map to generate the final channel attention feature F. The calculation formula of the channel attention module is as follows:
[0094] Mc(F)=σ{MLP[AvgPool(F)]+MLP[MaxPool(F)]};
[0095] Among them, MLP is a multi-layer perceptron and σ is a Sigmoid activation function.
[0096] 2. Spatial attention module;
[0097] The spatial attention module makes the convolutional network pay more attention to the features of which positions play a greater role in the final output of the network, that is, the information of which positions has the greatest impact on the final predicted image, and improves the feature expression of key areas. According to the results of field surveys, black and odorous water bodies are mostly small water bodies with narrow river channels and many broken rivers. There are often factories or farms nearby. These spatial features are more important for the identification of black and odorous water bodies. The spatial attention module transforms the spatial information in the original image into another space and retains the key information. It generates a weight mask for each position and outputs it weightedly, thereby enhancing the specific target area of interest while weakening the irrelevant background area. Therefore, the spatial attention module is introduced to make the model pay more attention to the spatial features related to black and odorous water bodies.
[0098] First, perform global maximum pooling and average pooling on the weighted feature F, concatenate the generated features, and then perform convolution operation. Then, use the Sigoid function to activate the output spatial feature matrix Ms, and perform point multiplication operation on the weight matrix and the feature map F to obtain the final required spatial feature map F. The calculation formula of the spatial attention module is as follows:
[0099] Ms(F)=σ{f 7x7 [AvgPool(F); MaxPool(F)]};
[0100] Among them, f is a convolution layer with a convolution kernel of 7x7, σ is the Sigmoid activation function, and [;] represents serial connection.
[0101] It should be noted that in order to enable the U-Net network model to better extract the relevant features of black and odorous water bodies, the attention mechanism module is embedded in the U-Net network model. First, the channel attention module is embedded in the jump layer of U-Net, so that the weight of the underlying features and the features of the current channel can be controlled, the features between different channels can be compared and connected, and the features related to black and odorous water bodies are given a greater weight, so that the image with restored size in the subsequent upsampling process is more refined; then in the decoder part, the spatial attention module is embedded after each layer of upsampling operation, and the features obtained by the channel attention module are fused. Through the convolution operation, the spatial feature weight of the black and odorous water body can be controlled, so that the upsampling operation can more effectively restore the spatial information of the black and odorous water body features.
[0102] 105. The initial black and odorous water body recognition model is trained based on a multi-channel combined remote sensing image set to obtain a black and odorous water body recognition model.
[0103] In this embodiment, the training device of the black and odorous water body recognition model can divide the multi-channel combined remote sensing image set according to a preset ratio to obtain a training set, a verification set and a test set; the initial black and odorous water body recognition model is trained by the training set, and the trained initial black and odorous water body recognition model is verified by the verification set, and the verified initial black and odorous water body recognition model is verified by the test set to obtain the black and odorous water body recognition model.
[0104] It should be noted that after the training device of the black and odorous water body recognition model has completed the training of the black and odorous water body recognition model, the black and odorous water body recognition model can be used to identify whether the water body is a black and odorous water body. Specifically, the remote sensing image corresponding to the target water body can be obtained, and then the remote sensing image is preprocessed to obtain the preprocessed remote sensing image of the target water body, and the remote sensing image of the target water body is data enhanced to obtain the enhanced remote sensing image of the target water body, and then band operation is performed. During the band operation, the NDVI index and the NDBWI index are integrated into the enhanced remote sensing image of the target water body, and the remote sensing image integrated with the NDVI index and the NDBWI index is input into the black and odorous water body recognition model to obtain the recognition result of the black and odorous water body. The recognition result of the remote sensing image of the target water body can be compared with the manual annotation result through the black and odorous water body recognition model to obtain the comparison result, and the black and odorous water body recognition model is continuously optimized through the comparison result to improve the recognition accuracy of the model.
[0105] In summary, it can be seen that in the embodiment provided by the present invention, multiple index bands are fused with the original remote sensing image, and remote sensing images of different channel combinations are used as input parameters of the model to construct a U-Net network model. At the same time, on the basis of the U-Net deep learning network model, an attention mechanism module is introduced to optimize the model in terms of channel attention and spatial attention, so that the model focuses on learning pixel features related to black and odorous water bodies, and suppresses the model from learning pixel features that are not related to black and odorous water bodies, thereby further improving the recognition accuracy of black and odorous water bodies.
[0106] The above describes an embodiment of the present invention from the perspective of a training method for a black and odorous water body recognition model. The following describes an embodiment of the present invention from the perspective of a training device for a black and odorous water body recognition model.
[0107] See also Figure 2 , a virtual structural diagram of a training device for a black and odorous water body recognition model in an embodiment of the present invention, wherein the training device 200 for a black and odorous water body recognition model comprises:
[0108] An acquisition module 201 is used to acquire a remote sensing image corresponding to each of the multiple water bodies;
[0109] A preprocessing module 202 is used to preprocess the remote sensing images to obtain a preprocessed remote sensing image set;
[0110] The data enhancement module 203 is used to perform data enhancement processing on each remote sensing image in the remote sensing image set to obtain an enhanced remote sensing image set;
[0111] The band operation module 204 is used to perform band operation on each remote sensing image in the enhanced remote sensing image set to fuse multiple index channels to obtain a multi-channel combined remote sensing image set;
[0112] A construction module 205 is used to construct an initial black and odorous water body recognition model based on an attention mechanism module and a U-Net network;
[0113] The training module 206 is used to train the initial black and odorous water body recognition model based on the multi-channel combined remote sensing image set to obtain a black and odorous water body recognition model.
[0114] In a possible design, the preprocessing module 202 is specifically used for:
[0115] Performing radiation calibration and radiation correction on the remote sensing image to convert the brightness value of the pixel corresponding to the remote sensing image and the radiation brightness value to obtain a converted remote sensing image;
[0116] Performing geometric correction on the converted remote sensing image to geometrically correct the remote sensing image;
[0117] Performing atmospheric correction on the geometrically corrected remote sensing image to obtain an atmospherically corrected remote sensing image, wherein the atmospherically corrected remote sensing image contains real spectral characteristics of ground objects;
[0118] The atmospheric correction remote sensing image is fused with the panchromatic image to obtain the remote sensing image set.
[0119] In a possible design, the data enhancement module 203 is specifically used for:
[0120] Performing random data enhancement on a target remote sensing image to obtain an initial enhanced image, wherein the target remote sensing image is any remote sensing image in the remote sensing image set;
[0121] The initial enhanced image is divided to obtain divided images, wherein the divided images include black and odorous water body images and background object images, wherein the background objects include normal water bodies, buildings, roads and vegetation;
[0122] The segmented images and labels are cropped according to preset rules to obtain the enhanced remote sensing image set.
[0123] In a possible design, the data enhancement module 203 is further specifically used for:
[0124] Randomly rotating and mirroring the target remote sensing image and the target label corresponding to the target remote sensing image to obtain a first remote sensing image and a first label, wherein the first remote sensing image corresponds to the first label;
[0125] Noise is randomly added to the first remote sensing image to obtain the initial enhanced image.
[0126] In a possible design, the multiple index channels include a normalized difference vegetation index and a normalized difference black and odorous water index, and the normalized difference vegetation index is expressed by the following formula:
[0127]
[0128] Wherein, NDVI is the normalized difference vegetation index, Rrs(NIR) is the remote sensing reflectance of the near infrared band, and Rrs(R) is the remote sensing reflectance of the red light band;
[0129] The normalized difference black and odorous water index is expressed by the following formula:
[0130]
[0131] Among them, NDBWI is the normalized difference black and odorous water index, Rrs(G) is the remote sensing reflectivity of the green light band, and Rrs(R) is the remote sensing reflectivity of the red light band.
[0132] In one possible design, the attention mechanism module includes a channel attention module and a spatial attention module, wherein the channel attention module is represented by the following formula:
[0133] Mc(F)=σ{MLP[AvgPool(F)]+MLP[MaxPool(F)]}
[0134] Among them, MLP is a multi-layer perceptron, σ is a Sigmoid activation function;
[0135] The spatial attention module is represented by the following formula:
[0136] Ms(F)=σ{f 7x7 [AvgPool(F); MaxPool(F)]}
[0137] Among them, f is a convolution layer with a convolution kernel of 7x7, σ is the Sigmoid activation function, and [;] represents serial connection.
[0138] In a possible design, the training module 206 is specifically used for:
[0139] Dividing the multi-channel combined remote sensing image set according to a preset ratio to obtain a training set, a validation set and a test set;
[0140] The initial black and odorous water body recognition model is trained by the training set, and the trained initial black and odorous water body recognition model is verified by the verification set, and the verified initial black and odorous water body recognition model is verified by the test set to obtain the black and odorous water body recognition model.
[0141] above Figure 2 The training device for the black and odorous water body recognition model in the embodiment of the present invention is described from the perspective of modular functional entities. The training device for the black and odorous water body recognition model in the embodiment of the present invention is described in detail from the perspective of hardware processing. Please refer to FIG. 300, which is a schematic diagram of an embodiment of the training device 300 for the black and odorous water body recognition model in the embodiment of the present invention. The training device 300 for the black and odorous water body recognition model includes:
[0142] An input device 301, an output device 302, a processor 303 and a memory 304 (the number of the processor 303 can be one or more, Figure 3 In some embodiments of the present invention, the input device 301, the output device 302, the processor 303 and the memory 304 may be connected via a communication bus or other means, wherein: Figure 3 The communication bus connection is taken as an example.
[0143] Wherein, by calling the operation instruction stored in the memory 304, the processor 303 is used to perform the following steps:
[0144] Obtaining remote sensing images corresponding to each of the multiple water bodies;
[0145] Preprocessing the remote sensing images to obtain a preprocessed remote sensing image set;
[0146] Performing data enhancement processing on each remote sensing image in the remote sensing image set to obtain an enhanced remote sensing image set;
[0147] Performing band operation on each remote sensing image in the enhanced remote sensing image set to fuse multiple index channels to obtain a multi-channel combined remote sensing image set;
[0148] Construct an initial black and odorous water body recognition model based on the attention mechanism module and U-Net network;
[0149] The initial black and odorous water body recognition model is trained based on the multi-channel combined remote sensing image set to obtain a black and odorous water body recognition model.
[0150] By calling the operation instructions stored in the memory 304, the processor 303 is also used to execute Figure 1 Any method in the corresponding embodiment.
[0151] See also Figure 4 , Figure 4 A schematic diagram of an electronic device according to an embodiment of the present invention.
[0152] like Figure 4 As shown, an embodiment of the present invention provides an electronic device, including a memory 410, a processor 420, and a computer program 411 stored in the memory 410 and executable on the processor 420. When the processor 420 executes the computer program 411, the following steps are implemented:
[0153] Obtaining remote sensing images corresponding to each of the multiple water bodies;
[0154] Preprocessing the remote sensing images to obtain a preprocessed remote sensing image set;
[0155] Performing data enhancement processing on each remote sensing image in the remote sensing image set to obtain an enhanced remote sensing image set;
[0156] Performing band operation on each remote sensing image in the enhanced remote sensing image set to fuse multiple index channels to obtain a multi-channel combined remote sensing image set;
[0157] Construct an initial black and odorous water body recognition model based on the attention mechanism module and U-Net network;
[0158] The initial black and odorous water body recognition model is trained based on the multi-channel combined remote sensing image set to obtain a black and odorous water body recognition model.
[0159] In the specific implementation process, when the processor 420 executes the computer program 411, it can achieve Figure 1 Any implementation manner in the corresponding embodiments.
[0160] Since the electronic device introduced in this embodiment is a device used for implementing a training device for a black and odorous water body recognition model in the embodiment of the present invention, based on the method introduced in the embodiment of the present invention, technical personnel in this field can understand the specific implementation mode of the electronic device of this embodiment and its various variations. Therefore, how the electronic device implements the method in the embodiment of the present invention will not be described in detail here. As long as the equipment adopted by technical personnel in this field to implement the method in the embodiment of the present invention belongs to the scope of protection of the present invention.
[0161] Please refer to Figure 500, which is a schematic diagram of an embodiment of a computer-readable storage medium provided by an embodiment of the present invention.
[0162] As shown in Figure 500, the embodiment of the present invention further provides a computer-readable storage medium 600, on which a computer program 511 is stored. When the computer program 511 is executed by a processor, the following steps are implemented:
[0163] Obtaining remote sensing images corresponding to each of the multiple water bodies;
[0164] Preprocessing the remote sensing images to obtain a preprocessed remote sensing image set;
[0165] Performing data enhancement processing on each remote sensing image in the remote sensing image set to obtain an enhanced remote sensing image set;
[0166] Performing band operation on each remote sensing image in the enhanced remote sensing image set to fuse multiple index channels to obtain a multi-channel combined remote sensing image set;
[0167] Construct an initial black and odorous water body recognition model based on the attention mechanism module and U-Net network;
[0168] The initial black and odorous water body recognition model is trained based on the multi-channel combined remote sensing image set to obtain a black and odorous water body recognition model.
[0169] In the specific implementation process, the computer program 511 is executed by the processor to achieve Figure 1 Any implementation manner in the corresponding embodiments.
[0170] It should be noted that in the above embodiments, the description of each embodiment has its own emphasis, and for parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0171] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0172] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded computer, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0173] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0174] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0175] The embodiment of the present invention also provides a computer program product, which includes computer software instructions. When the computer software instructions are executed on a processing device, the processing device executes the following Figure 1 The process in the corresponding embodiment.
[0176] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid state disk (SSD)), etc.
[0177] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0178] In the several embodiments provided by the present invention, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There are other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0179] 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 may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0180] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0181] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program codes.
[0182] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A training method for a black and odorous water body recognition model, characterized in that: include: Obtaining remote sensing images corresponding to each of the multiple water bodies; Preprocessing the remote sensing images to obtain a preprocessed remote sensing image set; Performing data enhancement processing on each remote sensing image in the remote sensing image set to obtain an enhanced remote sensing image set; Performing band operation on each remote sensing image in the enhanced remote sensing image set to fuse multiple index channels to obtain a multi-channel combined remote sensing image set; Construct an initial black and odorous water body recognition model based on the attention mechanism module and U-Net network; The initial black and odorous water body recognition model is trained based on the multi-channel combined remote sensing image set to obtain a black and odorous water body recognition model.
2. The method according to claim 1, characterized in that The preprocessing of the remote sensing images to obtain a preprocessed remote sensing image set includes: Performing radiation calibration and radiation correction on the remote sensing image to convert the brightness value of the pixel corresponding to the remote sensing image and the radiation brightness value to obtain a converted remote sensing image; Performing geometric correction on the converted remote sensing image to geometrically correct the remote sensing image; Performing atmospheric correction on the geometrically corrected remote sensing image to obtain an atmospherically corrected remote sensing image, wherein the atmospherically corrected remote sensing image contains real spectral characteristics of ground objects; The atmospheric correction remote sensing image is fused with the panchromatic image to obtain the remote sensing image set.
3. The method according to claim 1, characterized in that The performing data enhancement processing on each remote sensing image in the remote sensing image set to obtain an enhanced remote sensing image set comprises: Performing random data enhancement on a target remote sensing image to obtain an initial enhanced image, wherein the target remote sensing image is any remote sensing image in the remote sensing image set; The initial enhanced image is divided to obtain divided images, wherein the divided images include black and odorous water body images and background object images, wherein the background objects include normal water bodies, buildings, roads and vegetation; The segmented images and labels are cropped according to preset rules to obtain the enhanced remote sensing image set.
4. The method according to claim 3, characterized in that The step of performing random data enhancement on the target remote sensing image to obtain an initial enhanced image includes: Randomly rotating and mirroring the target remote sensing image and the target label corresponding to the target remote sensing image to obtain a first remote sensing image and a first label, wherein the first remote sensing image corresponds to the first label; Noise is randomly added to the first remote sensing image to obtain the initial enhanced image.
5. The method according to any one of claims 1 to 4, characterized in that The multiple index channels include a normalized difference vegetation index and a normalized difference black and odorous water index, and the normalized difference vegetation index is expressed by the following formula: Wherein, NDVI is the normalized difference vegetation index, Rrs(NIR) is the remote sensing reflectance of the near infrared band, and Rrs(R) is the remote sensing reflectance of the red light band; The normalized difference black and odorous water index is expressed by the following formula: Among them, NDBWI is the normalized difference black and odorous water index, Rrs(G) is the remote sensing reflectivity of the green light band, and Rrs(R) is the remote sensing reflectivity of the red light band.
6. The method according to any one of claims 1 to 4, characterized in that The attention mechanism module includes a channel attention module and a spatial attention module, wherein the channel attention module is represented by the following formula: Mc(F)=σ{MLP[AvgPool(F)]+MLP[MaxPool(F)]}; Among them, MLP is a multi-layer perceptron, σ is a Sigmoid activation function; The spatial attention module is represented by the following formula: Ms(F)=σ{f 7x7 [AvgPool(F);MaxPool(F)]}; Among them, f is a convolution layer with a convolution kernel of 7x7, σ is the Sigmoid activation function, and [;] represents serial connection.
7. The method according to any one of claims 1 to 4, characterized in that The training of the initial black and odorous water body recognition model based on the multi-channel combined remote sensing image set to obtain the black and odorous water body recognition model includes: Dividing the multi-channel combined remote sensing image set according to a preset ratio to obtain a training set, a validation set and a test set; The initial black and odorous water body recognition model is trained by the training set, and the trained initial black and odorous water body recognition model is verified by the verification set, and the verified initial black and odorous water body recognition model is verified by the test set to obtain the black and odorous water body recognition model.
8. A training device for a black and odorous water body recognition model, characterized in that: include: An acquisition module, used for acquiring a remote sensing image corresponding to each of the multiple water bodies; A preprocessing module, used for preprocessing the remote sensing images to obtain a preprocessed remote sensing image set; A data enhancement module, used for performing data enhancement processing on each remote sensing image in the remote sensing image set to obtain an enhanced remote sensing image set; A band operation module, used for performing band operation on each remote sensing image in the enhanced remote sensing image set, so as to fuse multiple index channels to obtain a multi-channel combined remote sensing image set; A construction module is used to build an initial black and odorous water body recognition model based on the attention mechanism module and the U-Net network; A training module is used to train the initial black and odorous water body recognition model based on the multi-channel combined remote sensing image set to obtain a black and odorous water body recognition model.
9. An electronic device, characterized in that: include: A memory and a processor, wherein the processor is used to implement the training method of the black and odorous water body identification model as described in any one of claims 1 to 7 when executing the computer management program stored in the memory.
10. A computer-readable storage medium having a computer management program stored thereon, characterized in that: When the computer management program is executed by the processor, the training method of the black and odorous water body identification model as described in any one of claims 1 to 7 is implemented.