Water body change detection method, equipment, storage medium, computer program product and device
By extracting and fusing features from dual-phase spectral images of water bodies, the problem of insufficient spectral information in existing technologies is solved, and the accuracy of water body change detection is improved.
Patent Information
- Application Number
- CN202410310264.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-18
- Publication Date
- 2025-09-19
AI Technical Summary
In existing water body change detection methods, feature extraction is only performed on point pixels or block pixels in the image, resulting in insufficient spectral information and affecting the accuracy of the detection results.
Feature extraction is performed on the dual-phase spectral image of the water body to be detected to obtain point pixel features and block pixel features. The features are then fused through the preset PB-DSConv model to generate a difference map for change detection.
By fusing point pixel and block pixel features, the sufficiency of spectral information is improved, thereby improving the accuracy of water body change detection.
Smart Images

Figure CN120673244A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image processing technology, and in particular to a water body change detection method, equipment, storage medium, computer program product and device. Background Art
[0002] At present, when detecting changes in water bodies, it is generally done based on hyperspectral images of the water bodies. This is because hyperspectral images can obtain a large number of continuous spectral segments within a specific wavelength range in the water body, providing more detailed and accurate spectral information. This spectral information can help us distinguish the characteristics of different substances, and thus help detect subtle changes in the water body.
[0003] Existing methods for detecting water changes based on hyperspectral images require feature extraction of the hyperspectral images. However, the extraction is generally only performed on point pixels or block pixels in the image. Subsequent detection is also based only on the extracted point pixel features or block pixel features, resulting in insufficient spectral information and low accuracy of subsequent detection results. Summary of the Invention
[0004] The main purpose of the present invention is to provide a water body change detection method, equipment, storage medium, computer program product and device, aiming to solve the technical problem that the existing feature extraction is only performed on point pixels or block pixels in the image, resulting in insufficient spectral information obtained and low accuracy of subsequent detection results.
[0005] To achieve the above object, the present invention provides a method for detecting water changes, the method comprising the following steps:
[0006] Perform feature extraction on the dual-phase spectral images of the water body to be detected, and obtain point pixel features and block pixel features corresponding to each of the dual-phase spectral images;
[0007] Performing feature fusion on the point pixel features and the corresponding block pixel features respectively to obtain fusion features corresponding to each of the dual-phase spectral images;
[0008] A difference map of the dual-phase spectral image is generated according to each of the fusion features, and change detection is performed on the water body to be detected based on the difference map.
[0009] Optionally, the step of performing feature extraction on the dual-phase spectral images of the water body to be detected to obtain point pixel features and block pixel features corresponding to each of the dual-phase spectral images includes:
[0010] Preprocess the dual-phase spectral images of the water body to be detected respectively, and select target point pixels from each preprocessed dual-phase spectral image;
[0011] Selecting target block pixels from each of the pre-processed dual-phase spectral images according to a preset range based on each of the target point pixels;
[0012] Based on the preset PB-DSConv model, feature extraction is performed on each of the target point pixels and the corresponding target block pixels to obtain point pixel features and block pixel features.
[0013] Optionally, the step of fusing the point pixel features and the corresponding block pixel features to obtain fused features corresponding to each of the dual-phase spectral images includes:
[0014] Determining a preset point pixel extraction weight and a preset block pixel extraction weight based on the preset PB-DSConv model;
[0015] Extracting the point pixel features according to the preset point pixel extraction weights, and extracting the block pixel features according to the preset block pixel extraction weights;
[0016] The extracted point pixel features and the corresponding extracted block pixel features are respectively subjected to feature fusion to obtain fusion features corresponding to each of the dual-phase spectral images.
[0017] Optionally, before the step of respectively extracting features from the dual-phase spectral images of the water body to be detected to obtain point pixel features and block pixel features corresponding to each of the dual-phase spectral images, the method further includes:
[0018] Preprocessing the initial dual-phase spectral images respectively, and selecting initial point pixels and initial block pixels from each preprocessed initial dual-phase spectral image;
[0019] Obtaining initial fusion features corresponding to each of the initial dual-phase spectral images through an initial PB-DSConv model according to the initial point pixel and the corresponding initial block pixels;
[0020] The contrast loss of the initial PB-DSConv model is determined based on each of the fusion features, and the initial PB-DSConv model is optimized based on the contrast loss to obtain a preset PB-DSConv model.
[0021] Optionally, the step of determining the contrast loss of the initial PB-DSConv model based on each of the fused features includes:
[0022] Performing spectral interaction on each of the fusion features, and predicting each interaction result to obtain a prediction result corresponding to each of the initial dual-phase spectral images;
[0023] The contrast loss of the initial PB-DSConv model is generated based on each of the prediction results.
[0024] Optionally, the step of obtaining initial fusion features corresponding to each of the initial bi-phase spectral images through an initial PB-DSConv model according to the initial point pixel and the corresponding initial block pixels includes:
[0025] Determining an initial point pixel extraction weight and an initial block pixel extraction weight based on the initial PB-DSConv model;
[0026] Obtaining an initial fusion feature according to the initial point pixel extraction weight, each of the initial point pixels, the initial block pixel extraction weight, and each of the initial block pixels;
[0027] Accordingly, the step of optimizing the initial PB-DSConv model based on the contrast loss to obtain a preset PB-DSConv model includes:
[0028] Optimizing the initial point pixel extraction weight and the initial block pixel extraction weight based on the contrast loss to obtain a preset point pixel extraction weight and a preset block pixel extraction weight;
[0029] A preset PB-DSConv model is generated according to the preset point pixel extraction weight and the preset block pixel extraction weight.
[0030] In addition, to achieve the above-mentioned purpose, the present invention also proposes a water body change detection device, which includes a memory, a processor, and a water body change detection program stored on the memory and runnable on the processor, and the water body change detection program is configured to implement the water body change detection method as described above.
[0031] In addition, to achieve the above-mentioned purpose, the present invention also proposes a storage medium, on which a water body change detection program is stored. When the water body change detection program is executed by a processor, the water body change detection method described above is implemented.
[0032] In addition, to achieve the above-mentioned purpose, the present invention also proposes a computer program product, which includes a water body change detection program, and when the water body change detection program is executed, it implements the water body change detection method described above.
[0033] In addition, to achieve the above-mentioned purpose, the present invention also proposes a water body change detection device, which includes: a feature extraction module, a feature fusion module and a change detection module;
[0034] The feature extraction module is used to extract features from the dual-phase spectral images of the water body to be detected, and obtain point pixel features and block pixel features corresponding to each of the dual-phase spectral images;
[0035] The feature fusion module is used to fuse the point pixel features and the corresponding block pixel features to obtain fusion features corresponding to each of the dual-phase spectral images;
[0036] The change detection module is used to generate a difference map of the dual-phase spectral image according to each of the fusion features, and perform change detection on the water body to be detected based on the difference map.
[0037] The present invention discloses the following steps: performing feature extraction on the dual-phase spectral images of the water body to be detected, obtaining the point pixel features and block pixel features corresponding to each of the dual-phase spectral images; performing feature fusion on the point pixel features and the corresponding block pixel features, obtaining the fusion features corresponding to each of the dual-phase spectral images; generating a difference map of the dual-phase spectral images according to each of the fusion features, and performing change detection on the water body to be detected based on the difference map. Because the present invention first performs feature extraction on the dual-phase spectral images of the water body to be detected, obtaining the corresponding point pixel features and block pixel features, then performs feature fusion on the point pixel features and the corresponding block pixel features, and finally performs water body change detection based on the fusion features obtained after fusion. Compared to the existing method of only detecting the extracted point pixel features or block pixel features, the present invention can fuse the point pixel features with the block pixel features, and then perform detection based on the fusion features obtained after fusion, which can make the obtained spectral information more complete and improve the accuracy of the detection results. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 This is a schematic diagram of the structure of a water body change detection device in the hardware operating environment involved in an embodiment of the present invention;
[0039] Figure 2 This is a flow chart of a first embodiment of a method for detecting changes in water bodies according to the present invention;
[0040] Figure 3 This is a detection flow chart of the first embodiment of the water body change detection method of the present invention;
[0041] Figure 4 This is a schematic diagram of the structure of the preset PB-DSConv model in the first embodiment of the water body change detection method of the present invention;
[0042] Figure 5 Schematic diagram of the flow of the second embodiment of the water body change detection method of the present invention;
[0043] Figure 6 This is a training flow chart of the second embodiment of the water body change detection method of the present invention;
[0044] Figure 7This is a schematic diagram of the structure of the spectral interaction layer in the second embodiment of the water body change detection method of the present invention;
[0045] Figure 8 Schematic diagram of the structure of the predictor in the second embodiment of the water body change detection method of the present invention;
[0046] Figure 9 This is a structural block diagram of the first embodiment of the water body change detection device of the present invention.
[0047] The purpose, features and advantages of the present invention will be further described with reference to the accompanying drawings and in conjunction with the embodiments. DETAILED DESCRIPTION
[0048] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0049] Reference Figure 1 , Figure 1 This is a schematic diagram of the structure of a water body change detection device in the hardware operating environment involved in an embodiment of the present invention.
[0050] like Figure 1 As shown, the water body change detection device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), and optionally the user interface 1003 may also include a standard wired interface and a wireless interface. The wired interface of the user interface 1003 may be a USB interface in the present invention. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (Wi-Fi) interface). The memory 1005 may be a high-speed random access memory (RAM) or a stable memory (NVM), such as a disk memory. The memory 1005 may optionally be a storage device independent of the aforementioned processor 1001.
[0051] Those skilled in the art will understand that Figure 1 The structure shown in does not constitute a limitation on the water body change detection device, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.
[0052] like Figure 1As shown, the memory 1005 identified as a computer storage medium may include an operating system, a network communication module, a user interface module, and a water body change detection program.
[0053] exist Figure 1 In the water body change detection device shown, the network interface 1004 is mainly used to connect to the background server and communicate data with the background server; the user interface 1003 is mainly used to connect to the user device; the water body change detection device calls the water body change detection program stored in the memory 1005 through the processor 1001, and executes the water body change detection method provided by the embodiment of the present invention.
[0054] Based on the above hardware structure, an embodiment of the water body change detection method of the present invention is proposed.
[0055] Reference Figure 2 , Figure 2 1 is a flow chart of the first embodiment of the water body change detection method of the present invention, which provides the first embodiment of the water body change detection method of the present invention.
[0056] It should be noted that at present, when detecting water changes, it is generally based on hyperspectral images of the water body. This is because hyperspectral images can obtain a large number of continuous spectral segments within a specific wavelength range in the water body, providing more detailed and accurate spectral information. These spectral information can help us distinguish the characteristics of different substances, and thus help detect subtle changes in the water body.
[0057] Existing methods for detecting water changes based on hyperspectral images require feature extraction of the hyperspectral images. However, the extraction is generally only performed on point pixels or block pixels in the image. Subsequent detection is also based only on the extracted point pixel features or block pixel features, resulting in insufficient spectral information and low accuracy of subsequent detection results.
[0058] To address the above-mentioned shortcomings, this embodiment provides a water body change detection method that first extracts features from the dual-phase spectral image of the water body to be detected, obtaining corresponding point pixel features and block pixel features. The point pixel features are then fused with the corresponding block pixel features, and finally, water body change detection is performed based on the fused features obtained. Compared to existing methods that only detect extracted point pixel features or block pixel features, this embodiment fuses the point pixel features with the block pixel features and then performs detection based on the fused features obtained. This provides more comprehensive spectral information and improves the accuracy of the detection results.
[0059] For ease of understanding, the following Figures 2 to 9 This embodiment and the following embodiments will be described.
[0060] like Figure 2 As shown, in the first embodiment, the water body change detection method includes the following steps:
[0061] Step S10: performing feature extraction on the dual-phase spectral images of the water body to be detected, and obtaining point pixel features and block pixel features corresponding to each of the dual-phase spectral images.
[0062] It is understandable that the method of this embodiment can be applied in scenarios where water changes are detected and monitored, and of course it can also be applied in other scenarios where detection or supervision is required, and this embodiment does not limit this. The execution subject of the method of this embodiment can be a computing service device with water change detection, network communication and program running functions, such as water quality monitoring equipment, etc., and can also be other electronic devices that achieve the same or similar functions. The following describes this embodiment and the following embodiments using the above-mentioned water change detection device (hereinafter referred to as the device).
[0063] It should be understood that the dual-temporal spectral images can be two hyperspectral images captured at different times. The time interval between the two images can be set based on actual conditions and is not limited in this embodiment. Furthermore, to ensure alignment between the two hyperspectral images, the device can perform image registration on the captured images, precisely matching their position, scale, and orientation.
[0064] For the convenience of subsequent explanation, in this embodiment, the obtained dual-phase spectral images can be respectively recorded as T1 and T2. After obtaining the dual-phase spectral images T1 and T2 of the water body to be detected, feature extraction can be performed on T1 and T2 respectively. Specifically, feature extraction is performed on the point pixels and block pixels in T1 to obtain the point pixel features and block pixel features corresponding to T1, and feature extraction is performed on the point pixels and block pixels in T2 to obtain the point pixel features and block pixel features corresponding to T2.
[0065] Furthermore, considering that there may be a lot of redundant information in the captured dual-phase spectral images T1 and T2, in order to further extract point pixel features, in this embodiment, the above step S10 includes:
[0066] Step S11: preprocessing the dual-phase spectral images of the water body to be detected respectively, and selecting target point pixels from each preprocessed dual-phase spectral image.
[0067] It is easy to understand that when the above device pre-processes T1 and T2, it can first perform dimensionality reduction processing on T1 and T2 respectively, retaining the bands in T1 and T2 that are beneficial to change detection. The dimensionality reduction can adopt the Sequential Floating Backward Selection (SFBS) method. Of course, other dimensionality reduction methods can also be used, and this embodiment does not limit this.
[0068] After the dimensionality reduction is completed, the T1 band and the T2 band obtained after the dimensionality reduction can be subjected to algebraic analysis respectively. For example, covariance analysis (CVA) algebraic analysis can be applied to explore the covariance relationship between the bands.
[0069] After algebraic analysis, the analysis results of T1 and T2 can be clustered respectively. The k-means clustering method can be used to generate binary pseudo labels corresponding to each pixel in T1 and binary pseudo labels corresponding to each pixel in T2, respectively, to distinguish water bodies and non-water bodies in T1 and T2;
[0070] After obtaining the binary pseudo-label, the Euclidean distance between each image of the water part in T1 and each pixel corresponding to the water part in T2 can be calculated, that is, the Euclidean distance between the pixel pairs of the water part is calculated, and the pixel with the shortest Euclidean distance is selected from T1 as the target point pixel corresponding to the above T1, and the pixel with the shortest Euclidean distance is selected from T2 as the target point pixel corresponding to the above T2.
[0071] Step S12: selecting target block pixels from each of the pre-processed dual-phase spectral images according to a preset range based on each of the target point pixels.
[0072] After obtaining the point pixel, it is necessary to obtain the block pixel corresponding to the point pixel as the target block pixel. When determining the block pixel, the block pixel can be selected according to a preset range centered on the target point pixel. For example, a 3*3 range is used, i.e., a target block pixel is formed with a length of 3 pixels and a width of 3 pixels centered on the target pixel. Similarly, a 5*5, 7*7, 9*9, or other preset ranges can also be used, and this embodiment does not limit this.
[0073] Step S13: performing feature extraction on each of the target point pixels and the corresponding target block pixels based on a preset PB-DSConv model to obtain point pixel features and block pixel features.
[0074] After obtaining the target point pixels and target block pixels corresponding to T1, as well as the target point pixels and target block pixels corresponding to T2, they can be input into the above-mentioned preset PB-DSConv model for feature extraction;
[0075] The above preset PB-DSConv model can be used to fuse point pixel features and block pixel features. Figure 3 and Figure 4 To explain, Figure 3 This is a detection flow chart of the first embodiment of the water body change detection method of the present invention. Figure 4 FIG. 1 is a schematic diagram of the structure of the preset PB-DSConv model in the first embodiment of the water body change detection method of the present invention. Figure 3 and Figure 4 As shown, after obtaining the target point pixel and target block pixel corresponding to T1, and the target point pixel and target block pixel corresponding to T2, the target point pixel can be respectively obtained by 1*1*c (i.e. Figure 3 The convolution kernel is C×1×1) and passed through 3 layers of DSConv (i.e. Figure 4 DSConv) is used to extract features, and the feature vector corresponding to the target point pixel in T1 and the feature vector corresponding to the target point pixel in T2 are obtained, which are used as the point pixel features of T1 and the point pixel features of T2 respectively. For the target block pixels, s*s*c (i.e. Figure 3 C×s×s), and pass through 3 layers of DSConv (i.e. Figure 4 DSConv) is used to perform feature extraction to obtain the feature vector corresponding to the target block pixels in T1 and the feature vector corresponding to the target block pixels in T2, which are used as the block pixel features of T1 and the block pixel features of T2 respectively.
[0076] Step S20: performing feature fusion on the point pixel features and the corresponding block pixel features respectively to obtain fusion features corresponding to each of the dual-phase spectral images.
[0077] After obtaining the point pixel features and the corresponding block pixel features, they can be fused through the above preset PB-DSConv model to obtain the fused features corresponding to T1 and the fused features corresponding to T2.
[0078] Furthermore, in order to achieve a better fusion effect, in this embodiment, the above step S20 includes:
[0079] Step S21: determining a preset point pixel extraction weight and a preset block pixel extraction weight based on the preset PB-DSConv model.
[0080] It should be noted that the preset point pixel extraction weight and the preset block pixel extraction weight may be provided in the preset PB-DSConv model of this embodiment. The preset point pixel extraction weight may be the weight occupied when extracting point pixels during fusion, and the block pixel extraction weight may be the weight occupied when extracting block pixels during fusion. In order to balance the influence of point pixels and block pixels on the model, the sum of the preset point pixel extraction weight and the preset block pixel extraction weight may be 1, that is, if the preset point pixel extraction weight is denoted as λ, the preset block pixel extraction weight may be 1-λ, where the range of λ is (0, 1).
[0081] Step S22: extracting the point pixel features according to the preset point pixel extraction weights, and extracting the block pixel features according to the preset block pixel extraction weights;
[0082] Step S23: performing feature fusion on the extracted point pixel features and the corresponding extracted block pixel features to obtain fusion features corresponding to each of the dual-phase spectrum images.
[0083] Continue as Figure 4 As shown, the weights can be extracted according to the preset pixel values (i.e. Figure 4 The point pixel features of T1 are extracted according to the preset block pixel extraction weights (i.e. Figure 4 1-λ) is used to extract the block pixel features of T1, and at the same time, the point pixel features of T2 are extracted according to the preset point pixel extraction weights, and the block pixel features of T2 are extracted according to the preset block pixel extraction weights.
[0084] After extraction, since block pixels have more sufficient spatial information features than point pixels, the extracted point pixel features and block pixel features corresponding to T1 can be fused to obtain the fused features corresponding to T1 (i.e. Figure 4 A1 in the figure), and perform feature fusion on the extracted point pixel features and block pixel features corresponding to T2 to obtain the fusion features corresponding to T2 (i.e. Figure 4 (A2).
[0085] Step S30: generating a difference map of the dual-phase spectral image according to each of the fusion features, and performing change detection on the water body to be detected based on the difference map.
[0086] It is understandable that after the fusion is completed, in order to measure the difference between the fusion features of T1 and the fusion features of T2, the fusion features can be calculated by means of mean squared error (MSE), and the above-mentioned difference map is generated according to the calculation results. Through the difference map, the differences and changes between T1 and T2 can be intuitively understood, and the change detection results of the water body to be detected can be obtained.
[0087] Continue to refer to Figure 3 After obtaining the fusion feature A1 corresponding to T1 and the fusion feature A2 corresponding to T2, the mean square error between A1 and A2 can be obtained according to the following formula 1:
[0088]
[0089] Among them, the above MES is the mean square error between A1 and A2, n is the number of samples, this embodiment uses two, so n is 2, A1 is the fusion feature of T1 (that is, Figure 3 A1 in the figure), A2 is the fusion feature of T2 (also known as Figure 3 (A2).
[0090] After obtaining the mean square error, the difference map corresponding to the dual-phase spectral image can be generated according to the mean square error corresponding to each pixel. In order to facilitate the determination of subsequent results, this embodiment can also cluster the difference map, and the k-means clustering method can also be used (i.e. Figure 3 K-means) is a method that randomly selects k samples from the difference map as the initial cluster centers. Then, for each sample, the distance from it to the k cluster centers is calculated, and it is assigned to the class corresponding to the cluster center with the smallest distance. Then, for each cluster, the cluster center position is recalculated. Finally, the above operation is repeated until the cluster center position remains unchanged, and the change detection result is obtained.
[0091] This embodiment preprocesses the dual-phase spectral image of the water body to be detected, then extracts features from the obtained target point pixels and target block pixels using a preset PB-DSConv model to obtain corresponding point pixel features and block pixel features. The point pixel features are then fused with the corresponding block pixel features, and finally, water body change detection is performed based on the fused features obtained. Compared to existing methods that only detect extracted point pixel features or block pixel features, this embodiment fuses point pixel features with block pixel features and then performs detection based on the fused features obtained after fusion. This provides more comprehensive spectral information and improves the accuracy of the detection results.
[0092] Reference Figure 5 , Figure 5 4 is a flow chart of the second embodiment of the water body change detection method of the present invention. Based on the above-mentioned first embodiment, the second embodiment of the water body change detection method of the present invention is proposed.
[0093] To obtain the above preset PB-DSConv model, Figure 5 As shown, in this embodiment, before the above step S10, the following steps are further included:
[0094] Step S01: pre-processing the initial dual-phase spectral images respectively, and selecting initial point pixels and initial block pixels from each pre-processed initial dual-phase spectral image.
[0095] It should be noted that the initial dual-phase spectral image may be a spectral image used as a training set, and may also be obtained by photographing the water body to be detected at certain time intervals, or directly obtained from a database, which is not limited in this embodiment.
[0096] After obtaining the above-mentioned initial dual-phase spectral image, it can also be preprocessed separately. The preprocessing operation process is consistent with the preprocessing operation process in the above-mentioned first embodiment, and can also include dimensionality reduction, algebraic analysis, clustering and calculation of Euclidean distance. Therefore, the specific process is not described in detail in this embodiment, and the point pixels obtained after preprocessing can be recorded as the above-mentioned initial point pixels.
[0097] After obtaining the initial point pixel, the above-mentioned device can also select block pixels according to a preset range with the initial point pixel as the center, as the above-mentioned initial block pixels. Its selection process is also consistent with the process of determining the target block pixels according to the target point pixel in the first embodiment, and this embodiment will not elaborate on this.
[0098] Step S12: obtaining initial fusion features corresponding to each of the initial bi-phase spectral images through an initial PB-DSConv model according to the initial point pixel and the corresponding initial block pixels.
[0099] It is understandable that after obtaining the initial point pixel and the initial block pixel, they can be used as positive samples, and corresponding position indexes are generated based on the positive samples for storage, and are generally subsequently trained and tested.
[0100] After generating positive samples, they can be input into the initial PB-DSConv model for training, refer to Figure 6 , Figure 6 This is a training flow chart of the second embodiment of the water body change detection method of the present invention, as shown in FIG. Figure 6 As shown, in this embodiment, the above-mentioned initial dual-phase spectrum images can be recorded as x1 and x2 respectively. Before fusion, they can also be obtained by 1*1*c (i.e. Figure 6 The convolution kernel is C×1×1) and passed through 3 layers of DSConv (i.e. Figure 6 DSConv) extracts the features of the initial point pixels of x1 and x2 respectively, obtains the feature vector corresponding to the initial point pixels in x1 and the feature vector corresponding to the initial point pixels in x2, and uses them as the initial point pixel features;
[0101] By s*s*c (i.e. Figure 6 C×s×s), and pass through 3 layers of DSConv (i.e. Figure 6 DSConv) extracts features of the initial block pixels of x1 and the initial block pixels of x2 respectively, obtains the feature vector corresponding to the initial block pixels in x1 and the feature vector corresponding to the initial block pixels in x2, and uses them as the initial block pixel features.
[0102] Then, the feature vector corresponding to the initial point pixel in x1 can be fused with the feature vector corresponding to the initial block pixel in x1, and the feature vector corresponding to the initial point pixel in x2 can be fused with the feature vector corresponding to the initial block pixel in x2. During fusion, the above initial PB-DSConv model can also set an initial point pixel extraction weight and an initial block pixel extraction weight. The initial point pixel extraction weight can be denoted as λ (i.e. Figure 6 λ in the middle), the initial block pixel extraction weight is recorded as 1-λ (i.e. Figure 6 1-λ), the range of λ is (0, 1), and the initial point pixel features and initial block pixel features are extracted according to the initial point pixel extraction weight and the initial block pixel extraction weight, and the extraction results are fused to obtain the initial fusion feature corresponding to x1 (i.e. Figure 6 f1) and the initial fusion features corresponding to x2 (i.e. Figure 6 f2).
[0103] Step S13: determining the contrast loss of the initial PB-DSConv model based on each of the fusion features, and optimizing the initial PB-DSConv model based on the contrast loss to obtain a preset PB-DSConv model.
[0104] It should be understood that the contrast loss can be the loss value calculated by the contrast loss function in the initial PB-DSConv model. During training, in order to find the correlation between bands, the step of determining the contrast loss of the initial PB-DSConv model based on each of the fusion features includes:
[0105] Perform spectral interaction on each of the fusion features, and predict each interaction result to obtain a prediction result corresponding to each of the initial bi-phase spectral images; and generate a contrast loss of the initial PB-DSConv model based on each of the prediction results.
[0106] Continue as Figure 6 As shown, spectral interaction can be performed on f1 and f2 respectively, that is, f1 and f2 are processed by the spectral interaction layer respectively, wherein the structure of the spectral interaction layer refers to Figure 7 , Figure 7 FIG. 1 is a structural diagram of the spectral interaction layer in the second embodiment of the water body change detection method of the present invention. Figure 7 As shown, the spectral interaction layer in this embodiment may include three 1x1 convolutional layers (i.e. Figure 7 1×1conv), where each convolutional layer contains a BN layer (i.e. Figure 7 BN) and ReLU activation function (i.e. Figure 7 (Medium ReLU);
[0107] Three 1x1 convolutional layers are used to embed spatial and spectral features more deeply into the projection vector, and the number of output channels of the convolutional layer can be set to n;
[0108] The spectral interaction layer can be used to perform spectral interaction on the extracted fusion features f1 and f2, further promoting the extracted spatial and spectral features to obtain deeper embedding vectors. The output feature vector size remains unchanged, and the spectral interaction result corresponding to f1 can be obtained (i.e. Figure 6 z1) and the spectral interaction results corresponding to f2 (i.e. Figure 6 (Z2).
[0109] After the spectrum interaction, in order to further convert the interaction results into actual results, this embodiment can use the predictor to predict z1 and z2 respectively, and continue as follows Figure 6 As shown, z1 and z2 can be input to the predictor (i.e. Figure 6 Predictor) to make predictions, refer to Figure 8 , Figure 8 FIG. 1 is a schematic diagram of the structure of the predictor in the second embodiment of the water body change detection method of the present invention. Figure 8 As shown, the predictor in this embodiment can use two batch normalization (i.e. Figure 8 The dense 1×1 convolutional layer (i.e. Figure 8 1×1conv) and ReLU layers (i.e. Figure 8 (ReLU in the middle).
[0110] In the predictor, the first convolutional layer can compress the input z1 or z2 to n / 2 output channels, and the next convolutional layer can expand the number of channels to n. The predictor receives the feature representation from the spectral exchange layer and the feature representation of a query image, and then uses these feature representations to predict the location and category of the target object, and obtains the prediction result corresponding to z1 (i.e. Figure 6 p1) and the prediction results corresponding to z2 (i.e. Figure 6 (p2).
[0111] After obtaining p1 and p2, the contrast loss of the initial PB-DSConv model can be obtained by the following formula 2:
[0112]
[0113] Among them, L(p1, p2) is the contrast loss of p1 and p2, p1 is the prediction result corresponding to z1 (that is, Figure 6 p1), p2 is the prediction result corresponding to z2 (that is, Figure 6 (p2).
[0114] After obtaining the contrast loss, the initial PB-DSConv model can be optimized by using the contrast loss until the loss converges and the training is completed. The specific process is as follows. The above step S12 includes:
[0115] Determining an initial point pixel extraction weight and an initial block pixel extraction weight based on the initial PB-DSConv model; obtaining an initial fusion feature according to the initial point pixel extraction weight, each of the initial point pixels, the initial block pixel extraction weight, and each of the initial block pixels;
[0116] Accordingly, the step of optimizing the initial PB-DSConv model based on the contrast loss to obtain a preset PB-DSConv model includes:
[0117] The initial point pixel extraction weight and the initial block pixel extraction weight are optimized based on the contrast loss to obtain the preset point pixel extraction weight and the preset block pixel extraction weight; and a preset PB-DSConv model is generated according to the preset point pixel extraction weight and the preset block pixel extraction weight.
[0118] It should be noted that before the start of training, a trainable parameter λ can be set and used as the above-mentioned initial point pixel extraction weight, and 1-λ as the above-mentioned initial block pixel extraction weight. After the initial point pixel features and the initial block pixel features are feature fused based on λ and 1-λ, the above-mentioned initial PB-DSConv model can reversely update and optimize λ according to the obtained contrast loss until the loss converges and the training is completed. The optimized point pixel extraction weight is used as the above-mentioned preset point pixel extraction weight, and the optimized block pixel extraction weight is used as the above-mentioned preset block pixel extraction weight, and the above-mentioned preset PB-DSConv model is obtained based on the preset point pixel extraction weight and the preset block pixel extraction weight.
[0119] This embodiment preprocesses the initial bi-temporal spectral image, then performs feature fusion on the obtained initial point pixels and initial block pixels using an initial PB-DSConv model. Spectral interaction is performed based on the fusion results, and prediction is performed based on the interaction results. The initial PB-DSConv model is optimized using the prediction results to obtain the aforementioned preset PB-DSConv model. Because the device of this embodiment can perform self-supervised learning in this manner, the feature representation capability is enhanced, thereby improving the generalization and robustness of the model.
[0120] It should also be emphasized that, since this embodiment can preprocess the initial dual-phase spectral image and obtain the initial point pixels and initial block pixels, it can directly use unlabeled data for training, thereby avoiding a lot of manpower, material resources and time consumption.
[0121] In addition, an embodiment of the present invention further provides a storage medium, on which a water body change detection program is stored. When the water body change detection program is executed by a processor, the water body change detection method described above is implemented.
[0122] In addition, an embodiment of the present invention further provides a computer program product, which includes a water body change detection program. When the water body change detection program is executed, the water body change detection method described above is implemented.
[0123] In addition, refer to Figure 9 , Figure 9 90 is a structural block diagram of a first embodiment of a water body change detection device according to the present invention; an embodiment of the present invention further provides a water body change detection device, the water body change detection device comprising: a feature extraction module 901, a feature fusion module 902, and a change detection module 903;
[0124] The feature extraction module 901 is used to extract features from the dual-phase spectral images of the water body to be detected, and obtain point pixel features and block pixel features corresponding to each of the dual-phase spectral images;
[0125] The feature fusion module 902 is used to fuse the point pixel features and the corresponding block pixel features to obtain fusion features corresponding to each of the dual-phase spectral images;
[0126] The change detection module 903 is configured to generate a difference map of the dual-phase spectral image according to each of the fusion features, and perform change detection on the water body to be detected based on the difference map.
[0127] This embodiment preprocesses the dual-phase spectral image of the water body to be detected, then extracts features from the obtained target point pixels and target block pixels using a preset PB-DSConv model to obtain corresponding point pixel features and block pixel features. The point pixel features are then fused with the corresponding block pixel features, and finally, water body change detection is performed based on the fused features. Compared to existing methods that only extract features from point pixels or block pixels, this embodiment fuses point pixel features with block pixel features and then performs detection based on the fused features. This provides more comprehensive spectral information and improves the accuracy of detection results.
[0128] As an embodiment, the feature extraction module 901 is also used to preprocess the dual-phase spectral images of the water body to be detected respectively, and select target point pixels from each preprocessed dual-phase spectral image; select target block pixels from each preprocessed dual-phase spectral image according to a preset range based on each target point pixel; and perform feature extraction on each target point pixel and the corresponding target block pixel based on a preset PB-DSConv model to obtain point pixel features and block pixel features.
[0129] As an embodiment, the feature fusion module 902 is also used to determine the preset point pixel extraction weights and the preset block pixel extraction weights based on the preset PB-DSConv model; extract the point pixel features according to the preset point pixel extraction weights, and extract the block pixel features according to the preset block pixel extraction weights; and perform feature fusion on the extracted point pixel features and the corresponding extracted block pixel features respectively to obtain the fusion features corresponding to each of the dual-phase spectral images.
[0130] Based on the first embodiment of the water body change detection device of the present invention, a second embodiment of the water body change detection device of the present invention is proposed.
[0131] In this embodiment, the feature extraction module 901 is also used to preprocess the initial dual-phase spectral images respectively, and select initial point pixels and initial block pixels from each preprocessed initial dual-phase spectral image; obtain the initial fusion features corresponding to each initial dual-phase spectral image through the initial PB-DSConv model according to the initial point pixels and the corresponding initial block pixels; determine the contrast loss of the initial PB-DSConv model based on each fusion feature, and optimize the initial PB-DSConv model based on the contrast loss to obtain a preset PB-DSConv model.
[0132] As an embodiment, the feature extraction module 901 is also used to perform spectral interaction on each of the fusion features, and predict each interaction result to obtain the prediction result corresponding to each of the initial dual-phase spectral images; and generate the contrast loss of the initial PB-DSConv model based on each of the prediction results.
[0133] As an embodiment, the feature extraction module 901 is further configured to determine an initial point pixel extraction weight and an initial block pixel extraction weight based on the initial PB-DSConv model; and obtain an initial fusion feature according to the initial point pixel extraction weight, each of the initial point pixels, the initial block pixel extraction weight, and each of the initial block pixels;
[0134] The feature extraction module 901 is also used to optimize the initial point pixel extraction weight and the initial block pixel extraction weight based on the contrast loss to obtain the preset point pixel extraction weight and the preset block pixel extraction weight; and generate a preset PB-DSConv model according to the preset point pixel extraction weight and the preset block pixel extraction weight.
[0135] Other embodiments or specific implementations of the water body change detection device of the present invention can refer to the above-mentioned method embodiments and will not be repeated here.
[0136] It should be noted that, in this document, the terms "comprises," "includes," or any other variations thereof are intended to encompass non-exclusive inclusion, such that a process, method, article, or system comprising a series of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or system. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or system comprising the element.
[0137] The serial numbers of the above embodiments of the present invention are for description only and do not represent the advantages or disadvantages of the embodiments.
[0138] Through the description of the above embodiments, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus the necessary general hardware platform, or of course by hardware, but in many cases the former is a better embodiment. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as a read-only memory image (ROM) / random access memory (RAM), a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal device (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0139] The above are only preferred embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention description and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for detecting water changes, characterized in that: The method comprises the following steps: Perform feature extraction on the dual-phase spectral images of the water body to be detected, and obtain point pixel features and block pixel features corresponding to each of the dual-phase spectral images; Performing feature fusion on the point pixel features and the corresponding block pixel features respectively to obtain fusion features corresponding to each of the dual-phase spectral images; A difference map of the dual-phase spectral image is generated according to each of the fusion features, and change detection is performed on the water body to be detected based on the difference map.
2. The water body change detection method according to claim 1, wherein: The step of extracting features from the dual-phase spectral images of the water body to be detected to obtain point pixel features and block pixel features corresponding to each of the dual-phase spectral images comprises: Preprocessing the dual-phase spectral images of the water body to be detected respectively, and selecting target point pixels from each preprocessed dual-phase spectral image; Selecting target block pixels from each of the pre-processed dual-phase spectral images according to a preset range based on each of the target point pixels; Based on the preset PB-DSConv model, feature extraction is performed on each of the target point pixels and the corresponding target block pixels to obtain point pixel features and block pixel features.
3. The water body change detection method according to claim 2, wherein: The step of fusing the point pixel features and the corresponding block pixel features to obtain fused features corresponding to each of the dual-phase spectral images comprises: Determining a preset point pixel extraction weight and a preset block pixel extraction weight based on the preset PB-DSConv model; Extracting the point pixel features according to the preset point pixel extraction weights, and extracting the block pixel features according to the preset block pixel extraction weights; The extracted point pixel features and the corresponding extracted block pixel features are respectively subjected to feature fusion to obtain fusion features corresponding to each of the dual-phase spectral images.
4. The water body change detection method according to claim 2 or 3, wherein: Before the step of extracting features from the dual-phase spectral images of the water body to be detected and obtaining point pixel features and block pixel features corresponding to each of the dual-phase spectral images, the method further includes: Preprocessing the initial dual-phase spectral images respectively, and selecting initial point pixels and initial block pixels from each preprocessed initial dual-phase spectral image; Obtaining initial fusion features corresponding to each of the initial dual-phase spectral images through an initial PB-DSConv model according to the initial point pixel and the corresponding initial block pixels; The contrast loss of the initial PB-DSConv model is determined based on each of the fusion features, and the initial PB-DSConv model is optimized based on the contrast loss to obtain a preset PB-DSConv model.
5. The water body change detection method according to claim 4, wherein: The step of determining the contrast loss of the initial PB-DSConv model based on each of the fusion features comprises: Performing spectral interaction on each of the fusion features, and predicting each interaction result to obtain a prediction result corresponding to each of the initial dual-phase spectral images; The contrast loss of the initial PB-DSConv model is generated based on each of the prediction results.
6. The water body change detection method according to claim 4, wherein: The step of obtaining the initial fusion features corresponding to each of the initial bi-phase spectral images through an initial PB-DSConv model according to the initial point pixel and the corresponding initial block pixels includes: Determining an initial point pixel extraction weight and an initial block pixel extraction weight based on the initial PB-DSConv model; Obtaining an initial fusion feature according to the initial point pixel extraction weight, each of the initial point pixels, the initial block pixel extraction weight, and each of the initial block pixels; Accordingly, the step of optimizing the initial PB-DSConv model based on the contrast loss to obtain a preset PB-DSConv model includes: Optimizing the initial point pixel extraction weight and the initial block pixel extraction weight based on the contrast loss to obtain a preset point pixel extraction weight and a preset block pixel extraction weight; A preset PB-DSConv model is generated according to the preset point pixel extraction weight and the preset block pixel extraction weight.
7. A water body change detection device, characterized in that: The water body change detection device includes: a memory, a processor, and a water body change detection program stored in the memory and executable on the processor. When the water body change detection program is executed by the processor, the water body change detection method according to any one of claims 1 to 6 is implemented.
8. A storage medium, characterized in that: The storage medium stores a water body change detection program, which, when executed by the processor, implements the water body change detection method according to any one of claims 1 to 6.
9. A computer program product, characterized in that The computer program product includes a water body change detection program, which implements the water body change detection method according to any one of claims 1 to 6 when executed.
10. A water body change detection device, characterized in that: The water body change detection device includes: a feature extraction module, a feature fusion module and a change detection module; The feature extraction module is used to extract features from the dual-phase spectral images of the water body to be detected, and obtain point pixel features and block pixel features corresponding to each of the dual-phase spectral images; The feature fusion module is used to fuse the point pixel features and the corresponding block pixel features to obtain fusion features corresponding to each of the dual-phase spectral images; The change detection module is used to generate a difference map of the dual-phase spectral image according to each of the fusion features, and perform change detection on the water body to be detected based on the difference map.