Terraced field water and soil conservation measure damage judgment method and device and storage medium
By acquiring terrace data through multispectral drones and using neural networks and filtering technology to identify and evaluate damage to terrace soil and water conservation measures, the problem of poor terrace soil and water conservation prevention and control in existing technologies has been solved, and rapid and automated damage identification and repair guidance has been achieved.
Patent Information
- Application Number
- CN202511308206.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-15
- Publication Date
- 2025-10-17
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing technologies lack effective methods to quickly identify and determine the damage of soil and water conservation measures on terraces, resulting in poor results in soil and water loss prevention and control.
Multispectral UAVs were used to obtain multispectral images and terrain data of the terraced areas, and fused image data were generated. Neural networks were used for classification, and combined with filtering processing and accuracy evaluation, the damaged areas and extent of soil and water conservation measures on the terraced areas were determined.
It has realized the automated identification and assessment of damage to soil and water conservation measures in terraced fields, improved the soil and water conservation effect, reduced manpower and material costs, and can quickly determine the damaged area and extent, facilitating timely repairs.
Smart Images

Figure CN120808182A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of terrace damage discrimination, and more particularly to a terrace soil and water conservation measure damage discrimination method, device and storage medium. BACKGROUND
[0002] As an important basis of the national economy, agriculture is the cornerstone of the further development of other departments of the national economy, provides a large number of rich raw materials for the development of industry, and provides labor for the development of industry and the entire national economy, is an important source of economic construction fund accumulation, and is the main source of export products of foreign trade. However, if the soil and water conservation is ignored in the agricultural cultivation activities, serious soil erosion will be caused, the land productivity will be reduced, and the crop yield will be reduced. The lost soil will also silt up the river channel, aggravate the flood, cause landslides, and cause serious ecological environmental problems such as pollution of downstream water bodies. Therefore, the cultivated land of the slope land reclamation often builds terraces to prevent and control soil and water loss. However, under the condition of short-time heavy rain, part of the terrace wall will collapse due to the rain erosion, causing damage to the terrace measures, and affecting the effect of the terrace measures in preventing and controlling soil and water loss. Therefore, it is urgent to develop a discrimination method that can quickly and effectively identify the damage of the terrace soil and water conservation measures.
[0003] At present, the unmanned aerial vehicle has been applied in soil and water conservation work, mainly concentrated in the construction process, completion and acceptance of production and construction projects, and also applied in soil and water conservation scheme, monitoring, supervision and acceptance. Through the unmanned aerial vehicle to carry out the identification and damage discrimination of the terrace soil and water conservation measures, on the one hand, it has low cost, high timeliness and reduces the cost of manpower and material resources, and at the same time, it can obtain the terrain data of the terrace area, identify the measures, and quickly identify the area where the terrace collapse occurs and the damage degree, so as to facilitate the subsequent timely repair and effectively improve the effect of soil and water conservation. In addition, the traditional unmanned aerial vehicle identification mainly uses visible light information, lacks the terrain change information caused by the collapse of the terrace wall and the vegetation coverage information of the exposed wall, and the NDVI and DSM obtained by the multispectral unmanned aerial vehicle can better solve this problem. So far, there is still a lack of research on the application of multispectral unmanned aerial vehicles in the identification and damage discrimination of the terrace soil and water conservation measures.
[0004] In summary, for the identification and degree discrimination of the damage of the terrace soil and water conservation measures, important technical support can be provided for the standardization of the maintenance of the subsequent measures of the agricultural and forestry development activities. SUMMARY
[0005] Therefore, the present application provides a terrace soil and water conservation measure damage discrimination method, device and storage medium, which aims to solve the above technical problems.
[0006] In order to achieve the above purpose, the present application adopts the following technical scheme: A method for identifying damage to terraced water and soil conservation measures, comprising: Obtaining multispectral image data and terrain data of the terraced area, and generating fusion image data containing vegetation cover information and terrain information; Classifying the fusion image data through a neural network to obtain collapse, field surface, and field wall classification results for the terraced area; Filtering the classification results to optimize the boundaries and accuracy of the classification image; Based on the filtered classification results, performing accuracy evaluation to determine the damage area and degree of the terraced water and soil conservation measures.
[0007] Further, the obtaining of multispectral image data and terrain data of the terraced area, and the generation of fusion image data containing vegetation cover information and terrain information, comprises: Carrying out aerial survey of the terraced area by a multispectral unmanned aerial vehicle to obtain red, green, blue, and near-infrared band data and terrain elevation data; Performing geometric correction, spectral correction, and image registration on the red, green, blue, and near-infrared band data to generate a multispectral orthographic image; Generating normalized vegetation index data based on the multispectral orthographic image; Generating a digital surface model based on the terrain elevation data and calculating slope data; Fusing the red, green, blue, normalized vegetation index data, digital surface model, and slope data to generate fusion image data.
[0008] Further, the classification of the fusion image data through a neural network to obtain collapse, field surface, and field wall classification results for the terraced area, comprises: Selecting training samples in the fusion image data and drawing vector labels of terraced field surface, field wall, and collapse area; Constructing a training data set based on the vector labels; Training the training data set through a backpropagation neural network to generate a classification model; Based on the classification model, predicting the fusion image data to obtain collapse, field surface, and field wall classification results for the terraced area.
[0009] Further, the training of the training data set through a backpropagation neural network to generate a classification model, comprises: Constructing a backpropagation neural network, setting the hidden layer structure and learning rate; Inputting the training data set into the backpropagation neural network for training; Generating a classification model based on the trained backpropagation neural network; Verify the classification performance of the classification model, adjust the network parameters to optimize the classification results.
[0010] Further, the classification results are filtered to optimize the boundaries and accuracy of the classified images, including: Obtain the classified image data of the classification results; Process the classified image data based on the majority value filtering method, and filter with different window sizes; Compare the filtering effects of different window sizes, select the filtering results with the highest boundary smoothness and accuracy, and generate optimized classified images based on the filtering results.
[0011] Further, the classification results after filtering are evaluated for accuracy to determine the damage area and degree of the terraced water and soil conservation measures, including: Obtain the classified image and training label after filtering; Calculate the precision, recall rate and F1 score of each class based on the classified image and training label; Generate a confusion matrix to count the number of correctly and incorrectly predicted samples for collapse, field and field wall classes; Determine the overall accuracy of the classification model based on the confusion matrix; Determine the damage area and degree of the terraced water and soil conservation measures according to the overall accuracy of the classification model.
[0012] Further, the red, green, blue, normalized vegetation index data, digital surface model and slope data are fused to generate fused image data, including: Obtain the raster files of the red, green, blue, normalized vegetation index data, digital surface model and slope data; Crop the raster files based on the raster management tool to limit the terraced area range; Fuse the cropped raster files to generate fused image data containing multi-dimensional features; Based on the geographic coordinate system, the fused image data is spatially calibrated to output a fused image file.
[0013] Further, the classified image data is processed based on the majority value filtering method, and different window sizes are used for filtering, including: Obtain the raster format of the classified image data; Perform majority value filtering on the classified image data based on the filtering function; Respectively use different window sizes of the filtering kernel for processing to generate multiple sets of filtering results; Select the optimal filtering result based on the boundary smoothness and classification accuracy of the multiple sets of filtering results.
[0014] Another object of the present application is to provide an electronic device comprising: at least one processor, and a memory connected to the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform a terraced field water and soil conservation measure damage discrimination method.
[0015] Another object of the present application is to provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements a terraced field water and soil conservation measure damage discrimination method.
[0016] Compared with the prior art, the present application uses a multispectral unmanned aerial vehicle to conduct aerial survey on a terraced field area, obtains multi-band images and terrain data, and generates fusion images containing vegetation index, elevation and slope information. The fusion images are classified using a BP neural network to obtain classification results of collapse, field surface and field wall of the terraced field area. The classification boundary and accuracy are optimized through multi-scale filtering, and the final damage discrimination result is output. The model performance is evaluated based on a confusion matrix, and the accuracy indicators of each category are calculated. The present application realizes automatic identification and evaluation of terraced field water and soil conservation measure damage, provides efficient and reliable technical support for terraced field protection and management, and has important practical application value. BRIEF DESCRIPTION OF DRAWINGS
[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or prior art description will be briefly introduced below. Obviously, the drawings in the following description are only embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor on the basis of the provided drawings.
[0018] Figure 1 A flowchart of a terraced field water and soil conservation measure damage discrimination method of the present application.
[0019] Figure 2 A schematic diagram of a UAV DOM image of the present application.
[0020] Figure 3 A schematic diagram of a UAV DSM image of the present application.
[0021] Figure 4 A schematic diagram of a terraced field DDVI data of the present application.
[0022] Figure 5 A schematic diagram of a terraced field slope map of the present application.
[0023] Figure 6 It is a waveband fusion setting diagram of the present application.
[0024] Figure 7 It is a result diagram after the unmanned aerial vehicle cutting and waveband fusion of the present application.
[0025] Figure 8 It is a training sample drawing diagram of the present application.
[0026] Figure 9 It is a sample label storage diagram of the present application.
[0027] Figure 10 It is a research area classification result diagram of the present application.
[0028] Figure 11 It is a 3*3 window filtering related code and filtered image diagram of the present application.
[0029] Figure 12 It is a 5*5 window filtering related code and filtered image diagram of the present application.
[0030] Figure 13 It is a 9*9 window filtering related code and filtered image diagram of the present application.
[0031] Figure 14 It is a confusion matrix visualization precision result diagram of the present application. DETAILED DESCRIPTION
[0032] The technical solutions in the embodiments of the present application will be described clearly and completely below. Obviously, the described embodiments are only part of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.
[0033] As shown in Figure 1 The present embodiment discloses a terrace water and soil conservation measure damage discrimination method, which can specifically include: Obtain multispectral image data and terrain data of the terrace area, and generate fusion image data containing vegetation cover information and terrain information; Carry out aerial survey on the terrace area by using a multispectral unmanned aerial vehicle, obtain red, green, blue, near-infrared waveband data and terrain elevation data, select mountainous terrace areas with a slope greater than 15 degrees, plan a flight route to cover the entire area, ensure that the flight height is 100 meters, and the resolution obtained is 5 centimeters. The unmanned aerial vehicle is equipped with a multispectral camera and a laser radar, and simultaneously collects red, green, blue, near-infrared waveband data and terrain elevation data, which are used for subsequent processing.
[0034] The red, green, blue, near-infrared band data is geometrically corrected, spectrally corrected and image-registered to generate a multispectral orthographic image map. The geometric correction corrects the image distortion based on ground control points, the spectral correction adjusts the band reflectivity to eliminate atmospheric effects, and the image registration aligns different bands to generate an orthographic image map.
[0035] Geometric correction is performed using a polynomial transformation method to adjust image coordinates based on ground control points, ensuring accurate alignment of terrace edges. Spectral correction is performed using a radiation calibration formula to correct the digital value of each pixel to reflectivity value, reducing cloud shadow interference. Image registration is performed using feature point matching to superimpose red, green, blue, and near-infrared bands to generate a multispectral orthographic image map. For wet terrace areas after rain, more control points are used for geometric correction to improve accuracy, and spectral correction considers water absorption peak adjustment to ensure that the orthographic image map clearly reflects the structure of the field wall.
[0036] Normalized difference vegetation index data is generated based on the multispectral orthographic image map. The normalized difference vegetation index data is calculated by the formula: NDVI = (Near-Infrared Band - Red Band) / (Near-Infrared Band + Red Band), which is used to quantify vegetation coverage. The near-infrared and red band values are extracted from the orthographic image map. The NDVI value is calculated pixel by pixel, ranging from -1 to 1. A positive value indicates healthy vegetation. An NDVI value greater than 0.6 on the terrace surface indicates good coverage, while an NDVI value less than 0.2 in the collapse area reflects bare soil exposure. The generated data supports damage identification. For terraces in different seasons, summer NDVI calculation emphasizes crop growth peaks, while winter focuses on residual vegetation, providing seasonal damage discrimination basis. After NDVI generation, combined with terrain data, it can highlight vegetation loss caused by field wall collapse, which is beneficial to quickly identify damaged areas and improve soil and water conservation efficiency.
[0037] A digital surface model is generated based on terrain elevation data, and slope data is calculated. The digital surface model is generated by interpolating elevation data, and the slope data is calculated based on the elevation difference of adjacent pixels. The digital surface model is constructed from elevation data using a triangulation interpolation method, and the model resolution matches the image data. The slope is calculated using the formula: slope = arctangent (elevation difference) / horizontal distance, generating a slope grid. For steep terraces, the digital surface model is generated using Kriging interpolation to improve accuracy, and the slope calculation considers local maximum slope thresholds such as areas above 30 degrees to identify potential collapse risks. The generated slope data shows that when the field wall slope exceeds 45 degrees, it is prone to damage, and when combined with NDVI, it verifies the actual collapse. It should be noted that this method can accurately capture changes in terrace terrain, which is beneficial for determining the extent of damage and avoiding the omission of terrain information by traditional methods.
[0038] The red, green, blue, normalized vegetation index data, digital surface model and slope data are fused to generate fused image data. The fusion is performed by creating a multi-band file using a stacked raster, which contains all data layers, for integrated analysis.
[0039] The red, green, blue bands are aligned to the same coordinate system as the NDVI, digital surface model and slope rasters, and a fused raster is constructed using the stacking tool, with each pixel containing six band values. The fused image data is output, ensuring consistent spatial resolution. For large terraces, the fusion uses nearest neighbor resampling, and the generated file is used as input for the neural network to improve the accuracy of collapse classification. In areas with high slope and low NDVI, the fused data highlights the damage features, such as sudden changes in slope at the collapse of the terrace wall combined with the absence of vegetation, forming a complete basis for damage discrimination. Adjusting the fusion order to prioritize vegetation over terrain can optimize data processing efficiency and be beneficial for real-time monitoring. The fused image data generated directly supports the application of the terrace soil and water conservation measure damage discrimination method.
[0040] In one embodiment, the acquired data resolution is adjusted to 10 centimeters, suitable for small terraces. The correction process includes an atmospheric correction model to handle fog effects and generate more accurate orthophotos. When calculating NDVI, noise pixels such as water areas are filtered to ensure that the index accurately reflects vegetation. In the construction of the digital surface model in S14, ground verification points are integrated to calibrate elevation errors less than 1 meter. The eight-neighborhood algorithm is used for slope calculation to capture subtle changes. When fusing, weights such as a slope data weight of 0.3 and an NDVI weight of 0.4 are added to emphasize damage-sensitive features and be beneficial for discriminating the degree of collapse.
[0041] For example, for terraces in the rainy season, data is collected to capture erosion traces, and corrections are made to eliminate rain fog distortion. The NDVI shows that the value at the collapse site drops to 0.1, and the S14 slope reaches 50 degrees. The fused image clearly divides the damaged area, improving the targeting of repairs.
[0042] In one embodiment, for dry season scenarios, the flight height is reduced to 80 meters to obtain detailed data, and the NDVI threshold is set to 0.3 to distinguish between bare soil. The calculation emphasizes the minimum slope change, and the fusion generates multi-layer data to support long-term monitoring.
[0043] It should be noted that these embodiments ensure the effectiveness of the method in terrace soil and water conservation.
[0044] The fused image data is classified by a neural network to obtain the collapse, terrace surface and terrace wall classification results of the terrace area, including: selecting training samples in the fused image data, and drawing vector labels of the terrace surface, terrace wall and collapse area; constructing a training data set based on the vector labels; training the training data set by a back propagation neural network to generate a classification model; and predicting the fused image data based on the classification model to obtain the collapse, terrace surface and terrace wall classification results of the terrace area.
[0045] Select training samples in the fused image data, draw vector labels for terrace surfaces, terrace walls, and collapse areas. When selecting training samples, first identify typical areas in the fused image data to ensure that the samples cover the full picture of the terrace area, including variations in slope and vegetation coverage. Use software tools such as Envi to right-click on the classified image and select "New ROI" to label the samples by drawing polygons. Select samples with different characteristics of the same feature according to the full coverage principle, for example, when selecting collapse areas, preferentially select the parts of the terrace wall that have collapsed due to rainwater erosion to capture the characteristics of exposed soil and terrain changes.
[0046] Analyze the multispectral and terrain features of the fused image data to identify potential terrace surfaces, terrace walls, and collapse areas. In the image that combines red, green, and blue bands, NDVI, DSM, and slope grids, observe the areas with low NDVI values as candidates for collapse, as collapse often leads to reduced vegetation coverage. Combine this with the sudden height changes shown by the DSM to confirm terrace wall collapse.
[0047] Based on the identification results, use the polygon drawing tool to label each class of sample on the image, ensuring that the number of samples is balanced and representative. Draw flat, uniformly vegetated areas for terrace surfaces, draw edges with high slopes for terrace walls, and draw parts with terrain breaks and exposed soil for collapse. Save as a vector file such as shp format. This labeling method helps subsequent training to capture the unique spectral and terrain signals of collapse, improving discrimination accuracy.
[0048] Based on the vector labels, construct a training dataset by extracting feature values for each labeled pixel, including multispectral values, NDVI, DSM height, and slope, to form a feature vector dataset, and assign class labels such as 0 for terrace surface, 1 for terrace wall, and 2 for collapse, ensuring that the dataset is balanced to avoid bias.
[0049] Train the training dataset using a backpropagation neural network to generate a classification model. Backpropagation neural network is a multi-layer feedforward network that adjusts weights through error backpropagation to minimize the loss function. Specifically, it includes the process of forward propagation to calculate output and backward propagation to update parameters. Use the sklearn library's MLPClassifier implementation with 100 and 50 nodes in the hidden layer, 100 iterations, and a learning rate of 0.01.
[0050] Input the training dataset into the network and perform forward propagation to calculate the predicted output of each sample, and calculate the cross-entropy loss with the true label. In the terrace dataset, forward propagation uses input features such as NDVI and slope values to generate hidden layer representations through activation functions such as ReLU, and then the output layer uses softmax to obtain class probabilities.
[0051] According to the loss, the error is back-propagated, and the network weights and biases are updated using a gradient descent optimizer until convergence. During training, the validation set accuracy is monitored, and training is stopped when the accuracy stabilizes, generating a model that can effectively distinguish between collapses. This method takes advantage of the rich information in multispectral data to improve the sensitivity to terrace damage, which is beneficial for quickly identifying collapse areas for timely repair.
[0052] To evaluate the generalization ability of the trained model, cross-validation is used to adjust hyperparameters such as the learning rate to optimize performance. If the initial learning rate leads to oscillation, it can be reduced to 0.005 and the number of iterations increased to 200, which is suitable for scenarios with fewer collapse samples to ensure model robustness.
[0053] Based on the classification model, the fused image data is predicted to obtain the classification results of collapse, field surface, and field wall in the terrace area. The trained model is used for pixel-level prediction on the entire fused image, and the classification grid is output, where red represents collapse, green represents field surface, and blue represents field wall. The results can be further filtered to remove noise and improve the reliability of the judgment.
[0054] In one embodiment, a majority value filter is applied after prediction, such as a 9x9 window, to smooth the classification boundary. This is particularly effective in identifying damage to terrace soil and water conservation measures, as it can highlight the contiguous area of collapse and facilitate quantification of damage extent. For an image covering 100 hectares of terraces, the prediction result shows that the collapse area accounts for 5%, the field surface accounts for 70%, and the field wall accounts for 25%. By comparing different filter windows such as 3x3 and 5x5, it is found that 9x9 can best reduce isolated misclassified points, which is beneficial for accurate assessment of soil erosion risk.
[0055] In one possible implementation, precision evaluation uses a confusion matrix to calculate indicators such as a collapse F1 score of 0.93, indicating high accuracy and recall rate of the model in identifying damage, thereby supporting soil and water conservation maintenance in agricultural and forestry development. In post-heavy rainfall terrace monitoring, this classification result can directly guide repair priority, and accurate positioning of the collapse area reduces the cost of manual reconnaissance and improves overall soil and water conservation effect. This method of identifying damage to terrace soil and water conservation measures based on multispectral unmanned aerial vehicles achieves efficient damage identification through neural network classification.
[0056] The training data set is trained through a back-propagation neural network to generate a classification model, including: constructing a back-propagation neural network, setting the hidden layer structure and learning rate; inputting the training data set into the back-propagation neural network for training; generating a classification model based on the trained back-propagation neural network; verifying the classification performance of the classification model and adjusting the network parameters to optimize the classification results.
[0057] The back propagation neural network is constructed, the hidden layer structure and the learning rate are set, and when the back propagation neural network is constructed, the number of nodes of the input layer of the network is determined to correspond to the number of bands of the fused multi-spectral data, for example, six bands of red, green, blue, NDVI, DSM and slope grid, so that the input layer receives the pixel values of these grid data. Then, the hidden layer structure is set to two layers, the number of nodes of the first hidden layer is 100, and the number of nodes of the second hidden layer is 50. This structure is determined through multiple tests, which can effectively capture the complex characteristics of the terrace region such as vegetation coverage change and terrain fluctuation, avoid overfitting and ensure convergence speed. The learning rate is set to 0.01, which is selected based on the sample distribution characteristics of the terrace data to ensure stable parameter update in the gradient descent process and avoid training oscillation. Such setting is beneficial to improve the sensitivity of the model to the collapse area and reduce the misjudgment of the exposed part of the terrace wall.
[0058] The input layer and output layer structure are determined. In the terrace damage discrimination scene, the number of nodes of the input layer matches the number of bands of the fused grid, and the number of nodes of the output layer is 3, corresponding to three categories of collapse, terrace surface and terrace wall, to ensure that the network directly outputs the probability distribution.
[0059] The number of nodes of the hidden layer and the activation function are selected. The number of nodes of the hidden layer is optimized through cross-validation, and the ReLU activation function is selected to accelerate the nonlinear mapping process, which is beneficial to handle the nonlinear relationship of NDVI and DSM data and improve the classification accuracy.
[0060] The training data set is input into the back propagation neural network for training. The training sample data derived from the Envi software, such as the rds.tif image and the label.shp label, is input into the network for forward propagation calculation output, and then the weights are updated through back propagation. The mean square error is used as the loss function, and the iteration is 100 rounds until convergence. This process uses the pixel-level label of the training data set to ensure that the network learns the slope mutation feature caused by collapse.
[0061] A classification model is generated based on the trained back propagation neural network. After training, the network parameters are saved to form a classification model, which can be directly applied to the overall image prediction to generate files such as rds_classified.tif for subsequent filtering processing. Such model generation is beneficial to quickly deploy in similar terrace monitoring tasks to improve discrimination efficiency.
[0062] The classification performance of the classification model is verified, the network parameters are adjusted to optimize the classification results, and the precision, recall rate and F1 score of each category are calculated during verification, for example, the collapse category precision is 0.88, the recall rate is 0.99, and the F1 score is 0.93; the terrace terrace surface precision is 0.91, the recall rate is 0.83, and the F1 score is 0.87; the terrace terrace wall precision is 0.70, the recall rate is 0.75, and the F1 score is 0.72, and the overall accuracy OA is 0.841. At the same time, the confusion matrix visualization is generated, such as 42857 correct classifications in the actual collapse sample and 170 misclassified as terrace terraces. Through these indicators, if the F1 score is lower than the threshold value 0.8, the learning rate is adjusted to 0.005 or the hidden layer node is increased to 150, and the model is trained again to optimize the model. This verification process ensures the robustness of the model in the identification of damaged terraces, which is beneficial to identifying the collapse area caused by short-term heavy rain and facilitating timely repair.
[0063] Calculate classification performance indicators, compare predicted results with labels, precision is the proportion of correctly predicted samples to the total number of predictions, recall rate is the proportion of correctly predicted samples to the total number of actual samples, F1 score is the harmonic mean of precision and recall rate, which is beneficial to balance the influence of false positives and false negatives in the terrace scene.
[0064] Visualize the confusion matrix, draw a three-row and three-column matrix, and display the number of samples in each cell, such as the diagonal value in the collapse row indicating the number of correct classifications, which is convenient for analyzing the reasons why the terrace terrace wall is easily confused with collapse, such as similar slope.
[0065] Adjust parameters based on indicators, if the recall rate is low, reduce the learning rate to 0.001 and increase the iterations to 200 rounds, retrain to optimize the capture of rare collapse samples, which is beneficial to improve the overall soil and water conservation monitoring effect.
[0066] In one possible implementation, for different terrace areas, such as mountainous areas with slope ranges from 0.02 to 82.35, the hidden layer is adjusted to (200, 100) to handle more complex terrain, and after verification, the F1 score is improved to 0.95, proving the effectiveness of the optimization. In the steep slope terrace scene, the initial model recall rate is 0.75, which is increased to 0.85 after adjusting the number of nodes, which is beneficial to reduce the missed damaged areas and ensure timely soil and water loss prevention. This verification and adjustment logic forms a closed loop from the training data set to the optimized model, which is applied to the multi-spectral unmanned aerial vehicle-based terrace soil and water conservation measure damage identification method.
[0067] Filter the classification results to optimize the boundaries and accuracy of the classification image, including: obtaining classification image data of the classification results; processing the classification image data based on the majority value filtering method, using different window sizes for filtering; comparing the filtering effects of different window sizes, selecting the filtering result with the highest boundary smoothness and accuracy; and generating an optimized classification image based on the filtering result.
[0068] The classified image data is obtained by reading the classified raster file, such as extracting pixel values and class labels from the rds_classified.tif file generated by BP neural network prediction, to ensure that the data contains classification information of terrace field, terrace wall and collapse area. This acquisition method facilitates subsequent processing, avoids data loss and improves the continuity of filtering.
[0069] The classified image data is processed based on the majority value filtering method, and different window sizes are used for filtering. After obtaining the data, the majority value filtering is applied to process the classified image, wherein the majority value filtering is to replace the center pixel by counting the most common class in the window, thereby reducing noise.
[0070] A window size of 3 by 3 is selected to count the neighborhood of each pixel. If the pixel of the collapse class is the most in the window, the center pixel is assigned to the collapse class. Expanding to a 5 by 5 window, a larger range of noise is processed, which is especially suitable for scenes where the terrace collapse edge is irregular. By increasing the window coverage, isolated misclassified points are smoothed. Further, a 9 by 9 window is used to filter the terrain complexity of the terrace area, such as in the collapse area dense slope, a larger window can better integrate the classes derived from NDVI and DSM information, reducing small fragmented classification. This hierarchical window application ensures that the filtering adapts to different damage levels, optimizing the robustness of the terrace soil and water conservation measure damage discrimination.
[0071] In one possible implementation, for the filtering of the terrace multispectral image, the specific process of the majority value filtering method includes traversing the entire image grid, and for each pixel position, a square window is defined, for example, a 3 by 3 window containing 9 pixels, and the classification value with the highest frequency is calculated. If the collapse class appears more than 5 times, the center pixel is corrected to collapse. This method is particularly effective when processing DSM slope data obtained by a drone, because the terrace wall area with large slope changes is prone to classification noise, and through filtering, scattered collapse points can be aggregated into continuous regions, which is beneficial for subsequent damage degree evaluation. In addition, the use of different window sizes has the benefit that small windows such as 3 by 3 are suitable for fine boundary adjustment, while large windows such as 9 by 9 can eliminate large area misclassification and improve overall accuracy. For example, in a terrace scene where collapse occurs after heavy rain, a 9 by 9 window can integrate scattered collapse pixels into a complete damage area, reducing the need for human intervention.
[0072] For example, in the discrimination of the damage of terraced field soil and water conservation measures, the processing of majority value filtering can also combine with the NDVI vegetation cover information. For example, if the NDVI values of most pixels in the window correspond to bare soil, the assignment weight of the collapse category is strengthened. This extension ensures that the filtering not only depends on the classification label, but also integrates multispectral features, bringing higher discrimination accuracy. For example, in the field wall area with a slope greater than 30 degrees, the recognition rate of collapse after filtering can be increased from 80% to 92%, thereby timely guiding the repair work.
[0073] The filtering results of different window sizes are compared, and the filtering result with the highest boundary smoothness and accuracy is selected. The comparison process includes calculating the boundary smoothness index of each filtering result, such as quantifying the boundary continuity through edge detection operators, and evaluating the accuracy such as the matching rate with ground verification data.
[0074] The boundary smoothness of the 3x3 filtering result is calculated. If the smoothness value is 0.75 but the accuracy is 0.82, it is recorded as a candidate. For the 5x5 result, if the smoothness increases to 0.85 and the accuracy decreases to 0.80, the trade-off is compared. For the 9x9 result, if the smoothness reaches 0.92 and the accuracy is 0.88, it is selected as the best because in the discrimination of terraced field collapse, high smoothness can better delineate the damage boundary and avoid fragmentation affecting repair planning. This comparison logic forms a chain from preliminary filtering to optimization, ensuring that the selected result provides reliable basis for soil and water loss prevention. F1 score can be introduced as an accuracy indicator in the selection process, for example, the F1 of 3x3 filtering is 0.85, 5x5 is 0.87, and 9x9 is 0.93. Select 9x9 because its recall rate in the collapse category is as high as 0.99, which is beneficial to identifying short-term heavy rainfall-induced field wall collapse and reducing missed damage areas, thereby improving soil and water conservation effect. In the terraced field scene, this comparison can also consider topographic factors, such as high-slope areas shown in the slope map. The smooth boundary of 9x9 filtering can better match the DSM data, bringing more accurate damage degree discrimination.
[0075] When comparing the filtering effects of different windows, visual confusion matrix analysis can also be used, for example, the matrix of the 9x9 window shows the lowest false positive rate in the collapse category, with only 170 misclassified points, while the 3x3 window has more fragments. This analysis supports the selection decision and emphasizes the advantages of large windows in complex terrain, such as in the terraced field monitored by multispectral unmanned aerial vehicles, the optimized boundary smoothness is increased by 15%, which is beneficial for quickly identifying damage and carrying out repair.
[0076] Based on the filtering result, an optimized classification image is generated, based on the selected 9x9 filtering result, a new raster file classified_filtered.tif is generated, in which the class of each pixel has been optimized to ensure that the image reflects the true distribution of terrace damage. This generation process directly uses the filtering output to form the optimized image used for soil and water conservation measure discrimination, after generating the optimized image, the original DOM image can be superimposed for verification, such as fusion in Envi software, to confirm that the boundary of the collapse area is smoother, thereby providing high-precision support in the terrace soil and water conservation measure damage discrimination method.
[0077] Based on the classification result after filtering, the precision evaluation is carried out to determine the damage area and degree of the terrace soil and water conservation measures, including: obtaining the classification image after filtering and the training label; based on the classification image and the training label, the precision, recall rate and F1 score of each class are calculated; an confusion matrix is generated to count the number of correct and incorrect prediction samples of the collapse, field surface and field wall classes; based on the confusion matrix, the overall precision of the classification model is determined; according to the overall precision of the classification model, the damage area and degree of the terrace soil and water conservation measures are determined.
[0078] The classification image after filtering and the training label are obtained, specifically including obtaining the classification image by reading the filtered rds_classified_filtered.tif file, which contains the pixel classification results of collapse, field surface and field wall. The corresponding label.shp file is loaded as the training label, which labels the real class of the sample to ensure that the classification image and the label are aligned in spatial coordinates.
[0079] Based on the classification image and the training label, the precision, recall rate and F1 score of each class are calculated, the precision calculation is the number of correctly predicted samples of each class divided by the total number of predicted samples of the class, the recall rate is the number of correctly predicted samples divided by the total number of real samples of the class, and the F1 score is the harmonic mean of the precision and recall rate. These indicators are obtained by comparing the classification image with the label pixel by pixel, when calculating the precision of the collapse class, the proportion of the pixels actually in the collapse among the pixels predicted to be in the collapse is first calculated.
[0080] An confusion matrix is generated to count the number of correct and incorrect prediction samples of the collapse, field surface and field wall classes, specifically including initializing a 3x3 matrix, where the rows represent the real classes and the columns represent the predicted classes. Each pixel of the classification image is compared with the label, and the count of the corresponding matrix position is accumulated, for example, the count of the actual collapse and the predicted collapse is placed in the matrix (1, 1) position. The output matrix displays the statistical results in a visual form.
[0081] Based on the confusion matrix, the overall precision of the classification model is determined, the overall precision calculation is the sum of the main diagonal elements divided by the total number of matrix elements, which represents the overall correct classification proportion.
[0082] According to the overall accuracy of the classification model, the damage area and degree of the terraced soil and water conservation measure are determined, specifically including comparing the overall accuracy with a preset threshold, if the accuracy is higher than 0.8, it is confirmed that the classification is reliable, and the pixel area of the collapse category is extracted from the classified image as the damage area. The proportion of the collapse pixels to the total pixels of the terrace is calculated as the damage degree quantization value, for example, the proportion greater than 0.3 represents serious damage. Combined with the slope data, the degree is further adjusted, if the slope of the collapse area is greater than 30 degrees, the damage level is improved to prioritize repair. When the overall accuracy is 0.841, the extracted collapse area covers 15% of the terrace, combined with the bare information of NDVI lower than 0.2, it is determined as moderate damage, which is convenient for quickly planning repair measures and improving the effect of soil and water conservation.
[0083] In specific implementation, the steps are as follows: Unmanned aerial vehicle aerial survey is carried out on the terrace area. The terrace area to be monitored is selected, the flight range of the selected unmanned aerial vehicle type is determined, and the unmanned aerial vehicle aerial survey is carried out to obtain the multispectral information and topographic information of the terrace area.
[0084] Unmanned aerial vehicle data processing. The obtained unmanned aerial vehicle data is analyzed for aerial photogrammetry, terrain modeling, splicing processing to generate a digital surface model DSM, as shown in Figure 3 , and geometric correction, spectral correction, image registration and image fusion are carried out to generate a multispectral orthographic image DOM, as shown in Figure 2 . Based on the multispectral information obtained by the unmanned aerial vehicle, the DJI mapping software is used to generate the NDVI of the terrace area, as shown in Figure 4 . The arcgis software is used to calculate the slope according to the DSM data, as shown in Figure 5 .
[0085] Unmanned aerial vehicle data processing. As shown in Figure 6 , 7 , the image data after splicing of the unmanned aerial vehicle is cropped to obtain the image and topographic data of the terrace area. In the Envi software, the unmanned aerial vehicle fuses the red, green, blue, NDVI band, DSM and slope grid. In Toolbox, select RasterManagement / Build Layer Stack, select all bands to be fused in Import File, select WGS 1984 coordinate system, set output path, and output as rds.tif.
[0086] Select training samples. As shown in Figure 8 , 9As shown, right-click the image to be classified (rds.tif) in Envi software, select New Region of Interest, draw Polygon, and draw the terrace surface, terrace wall and collapse terrace sample in the image according to the principle of full coverage in the image range and full coverage of different feature samples of the same object. Save as.xml file. Select Export as shapefile file in File->Export->, save as label.shp to build vector label.
[0087] BP neural network training classification. Use the sklearn library of python to build BP neural network for training terrace collapse extraction model, first load image rds.tif and label.shp. Build BP neural network classifier through MLPClassifier class, set training rounds to 100 rounds and learning rate to 0.01. Use the trained model to predict the whole image of rds.tif, and finally save it as rds_classified.tif. The classification situation of the study area is shown in Figure 10
[0088] Classification post-processing. Use the rasterio library in python to perform majority value filtering on the classified image. The input image is rds_classified.tif and the output image is classified_filtered.py. Use kernel size of 3*3, 5*5 and 9*9 for filtering respectively. After comparison and analysis, 9*9 filtering effect is the best.
[0089] #===2. Read the classification result image ===# input_path ='rds_classified.tif'#input classification result imageoutput_path ='classified_filtered.tif'#output filtered image 1) 3*3 window, as shown in Figure 11 #===3. Majority value filtering ===# filtered =generic_filter(class_data,mode_filter_function,size=3)#3x3 window 2) 5*5 window, as shown in Figure 12 #===3. Majority value filtering ===# filtered =generic_filter(class_data,mode_filter_function,size=5)#5×5 window 3) 9*9 window, as Figure 13 shown #===3. Majority Value Filtering ===# filtered = generic_filter(class_data, mode_filter_function, size=9) # 9k9 window Accuracy evaluation. As Figure 14 shown, the model was used to predict results and labels after training to evaluate the accuracy. The model performance was evaluated by precision, recall, and F1 score for each class, and the accuracy results were visualized using the confusion matrix. The overall accuracy OA of the model was 0.841.
[0090] Table 1 Model accuracy evaluation
[0091] Each of the embodiments in the specification is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other.
[0092] The above description of the disclosed embodiments enables a person skilled in the art to implement or use the present application. Various modifications to the embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for determining damage to soil and water conservation measures for terraced fields, characterized in that: include: Acquire multispectral image data and terrain data of the terraced area and generate fused image data containing vegetation cover information and terrain information; Classifying the fused image data by a neural network to obtain classification results of landslide, field surface and field wall in the terraced field area; Performing filtering on the classification results to optimize the boundaries and accuracy of the classified images; Based on the classification results after the filtering process, an accuracy evaluation is performed to determine the damaged area and degree of the soil and water conservation measures for the terraced fields.
2. A method for determining damage to soil and water conservation measures for terraced fields according to claim 1, characterized in that: The step of acquiring multispectral image data and terrain data of the terraced field area and generating fused image data containing vegetation coverage information and terrain information includes: Use multispectral drones to survey the terraced areas, acquiring red, green, blue, and near-infrared band data and terrain elevation data; Performing geometric correction, spectral correction, and image registration on the red, green, blue, and near-infrared band data to generate a multispectral orthophoto map; generating normalized vegetation index data based on the multispectral orthophoto image; generating a digital surface model based on the terrain elevation data and calculating slope data; The red, green, blue, normalized vegetation index data, digital surface model and slope data are fused to generate fused image data.
3. The method for determining damage to soil and water conservation measures for terraced fields according to claim 1, wherein: The fusion image data is classified by a neural network to obtain the classification results of landslide, field surface and field wall in the terraced field area, including: Selecting training samples from the fused image data and drawing vector labels of terraced field surfaces, field walls, and collapsed areas; constructing a training data set based on the vector labels; Training the training data set through a back-propagation neural network to generate a classification model; The fused image data is predicted based on the classification model to obtain classification results of landslide, field surface and field wall in the terraced field area.
4. A method for determining damage to soil and water conservation measures for terraced fields according to claim 3, characterized in that: The training data set is trained by a back propagation neural network to generate a classification model, including: Build a back-propagation neural network, set the hidden layer structure and learning rate; Inputting the training data set into the back propagation neural network for training; Generate a classification model based on the trained back-propagation neural network; Verify the classification performance of the classification model and adjust the network parameters to optimize the classification results.
5. The method for determining damage to soil and water conservation measures for terraced fields according to claim 1, wherein: The filtering process on the classification result to optimize the boundary and accuracy of the classification image includes: Obtaining classified image data of the classification result; Processing the classified image data based on a multi-value filtering method, and filtering using different window sizes; Compare the filtering effects of different window sizes, select the filtering result with the highest boundary smoothness and accuracy, and generate an optimized classification image based on the filtering result.
6. The method for determining damage to soil and water conservation measures for terraced fields according to claim 1, wherein: The accuracy evaluation is performed based on the classification results after the filtering process to determine the damaged area and degree of the soil and water conservation measures for the terraced fields, including: Obtaining the filtered classified image and training labels; Calculate the precision, recall, and F1 score for each category based on the classified images and training labels; Generate a confusion matrix and count the number of correctly predicted samples and incorrectly predicted samples for the collapse, field surface, and field wall categories; determining an overall accuracy of the classification model based on the confusion matrix; The damaged areas and extent of soil and water conservation measures for terraces are determined based on the overall accuracy of the classification model.
7. The method for determining damage to soil and water conservation measures for terraced fields according to claim 2, wherein: The fusing of the red, green, blue, normalized vegetation index data, digital surface model and slope data to generate fused image data includes: Obtaining raster files of the red, green, blue, and normalized vegetation index data, digital surface model, and slope data; Clipping the raster file based on a raster management tool to limit the range of the terraced field area; The clipped raster files are band-fused to generate fused image data containing multi-dimensional features; The fused image data is spatially calibrated based on a geographic coordinate system, and a fused image file is output.
8. The method for determining damage to soil and water conservation measures for terraced fields according to claim 5, wherein: The method of processing the classified image data based on the multi-value filtering method and filtering with different window sizes includes: Obtaining a raster format of the classified image data; Performing multi-value filtering on the classified image data based on a filtering function; Filter kernels with different window sizes are used for processing to generate multiple sets of filtering results; Based on the boundary smoothness and classification accuracy of the multiple groups of filtering results, the optimal filtering result is selected.
9. An electronic device, characterized in that: include: at least one processor, and a memory communicatively coupled to the at least one processor; In which, the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute a method for determining damage to soil and water conservation measures for terraced fields as described in any one of claims 1 to 8.
10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, a method for determining damage to soil and water conservation measures for terraced fields according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Terraced field mapping method, device and equipment based on remote sensing and storage medium
CN116091930A
Method and device for identifying earthquake landslide in complex mountainous area, medium and equipment
CN119380187A
Facilitating hydrocarbon exploration and extraction by applying a machine-learning model to seismic data
US20210293983A1