Rural black and odorous water body classification method and system based on DHRSF
By using a DHRSF-based classification method for rural black and odorous water bodies, and employing satellite remote sensing image preprocessing and a cascaded forest model, combined with random forest, rotating forest, and support vector machine, the problem of scattered distribution and small area of rural black and odorous water bodies was solved, achieving efficient and accurate water body classification.
Patent Information
- Application Number
- CN202511739539.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-25
- Publication Date
- 2026-02-27
AI Technical Summary
Existing technologies are insufficient for effectively and quickly classifying black and odorous water bodies in rural areas, especially due to their scattered distribution, small area, and unbalanced samples, making it difficult for traditional methods to achieve accurate identification.
A classification method for rural black and odorous water bodies based on DHRSF is adopted. By preprocessing satellite remote sensing images and constructing a cascaded forest model, random forest, rotating forest and support vector machine are combined as base classifiers. Cross-entropy loss function is used for training to mine difficult samples and achieve efficient classification.
It improves the accuracy of classifying black and odorous water bodies in rural areas, simplifies the operation process, reduces the consumption of manpower and material resources, is suitable for use by non-professionals, and improves the efficiency of investigation.
Smart Images

Figure CN121582653A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of black and odorous water body classification technology, specifically to a classification method and system for rural black and odorous water bodies based on DHRSF. Background Technology
[0003] Conventional monitoring of black and odorous water bodies mainly relies on manual sampling and verification. This involves relying on staff's subjective impressions of the water's color and odor, combined with physicochemical indicators such as ammonia nitrogen, dissolved oxygen, oxidation-reduction potential, and suspended solids as specified in the guidelines. This method is time-consuming and labor-intensive, making it difficult to achieve large-scale regional monitoring. Furthermore, black and odorous water bodies are often scattered small bodies, making it difficult to detect problems promptly and effectively using manual methods, and allowing issues to easily fester in blind spots and dead ends.
[0004] Currently, there are three main strategies for classifying black and odorous water bodies: visual interpretation and manual classification; parametric models, which construct optical feature relationships for classification; and machine learning or deep learning models, which train models using known information and then use the trained models for prediction. This approach maximizes the ease of retrieving black and odorous water bodies, and its feasibility has been experimentally verified by many predecessors. However, considering the dispersed and small-area characteristics of black and odorous water bodies in rural areas, the proposed models do not show good classification results.
[0005] In recent years, in fields such as computer vision, a model structure that first uses convolutional neural networks to extract deep features and then uses random forests as classifiers is called deep forest. However, this type of method does not inherently possess a completely non-neural network deep structure. Deep forest models have advantages in small sample classification, but when studying rural black and odorous water bodies, which are fewer in number and smaller in area compared to normal water bodies, and also have the characteristics of sample imbalance, deep forest models do not perform well in classification. Summary of the Invention
[0006] The purpose of this invention is to provide a classification method and system for rural black and odorous water bodies based on DHRSF, so as to solve the problems raised in the prior art.
[0007] To achieve the above objectives, the present invention provides the following technical solution: A classification method for black and odorous water bodies in rural areas based on DHRSF, which includes the following steps: S1. Collect water body information and satellite remote sensing images of the study area, and perform preprocessing; S2. Construct a dataset that includes both black and odorous water bodies and non-black and odorous water bodies; S3. Construct and train a DHRSF model for classifying black and odorous water bodies; S4. Use the trained DHRSF model for classifying black and odorous water bodies to predict the water information in the study area and obtain the distribution of black and odorous water bodies.
[0008] According to the above scheme, in step S1, the preprocessing includes radiometric calibration and atmospheric correction; The radiometric calibration converts the brightness value (DN) of a pixel in a satellite remote sensing image into a radiance value, using the following formula: L λ =k•DN+c; Among them, L λ The radiance value is represented by band λ; k and c represent gain and bias, respectively, which can be read from the satellite remote sensing image header file; radiometric calibration can eliminate the error of the sensor itself and determine the accurate radiance value at the sensor inlet; The atmospheric correction, based on the MODTRAN4 algorithm and the radiative transfer algorithm, performs pixel-level correction, converting the radiance value into the actual surface reflectance, as shown in the following formula: ; Among them, L λ λ represents the radiance value of band λ; d represents the Earth-Sun astronomical unit distance, which is generally taken as 1; E0 represents the solar irradiance, with each band corresponding to a different solar irradiance; θ represents the solar zenith angle, which can be read from the satellite remote sensing image header file when the satellite remote sensing image is acquired. The radiometrically calibrated satellite remote sensing images are imported into the FLAASH algorithm for atmospheric correction. The FLAASH algorithm corrects each pixel to ensure that the data reflects the true condition of the Earth's surface. The FLAASH algorithm is an atmospheric correction module developed by the Institute for Spectroscopic Science with the support of the U.S. Air Force Research Laboratory. Atmospheric correction can eliminate errors caused by atmospheric scattering, absorption, and reflection.
[0009] According to the above scheme, step S2 includes performing coordinate transformation and matching on satellite remote sensing images containing black and odorous water bodies or non-black and odorous water bodies. The coordinate transformation and matching includes projecting the geographic coordinates of the measured data into the satellite remote sensing image coordinate system to form the coordinates of n collection points. Using the coordinates of n collection points as the center, expand n×n pixels according to the size of the water body; ensure that all expanded pixels represent the water surface. n expanded image slices centered on pixel points are cropped out; each acquisition point in the measured data represents a pit, so there will be no situation where two slices are adjacent; each pixel in the image slice is extracted and processed by band ratio and BOI index, and the slice is marked as whether it contains black and odorous water. The band ratio is used to distinguish between black and odorous water bodies and non-black and odorous water bodies by utilizing the absorption characteristics of water bodies to different spectral bands. The formula is as follows: Band Ratio=R NIR / R Red ; Wherein, Band Ratio represents the band ratio; R NIR Reflectance is expressed in the near-infrared band; R Red Reflectance is expressed in the red band; The BOI index uses the reflectance characteristics of a specific wavelength band to distinguish between black and odorous water bodies and non-black and odorous water bodies. The formula is as follows: ; Wherein, BOI represents the BOI index; B NIR Reflectance is expressed in the near-infrared band; B Red Reflectance is expressed in the red band; All image slices and their corresponding band values, band ratios, BOI indices, and labels were collected to construct a dataset containing both black and odorous water bodies and non-black and odorous water bodies.
[0010] According to the above scheme, in step S3, the construction and training of the DHRSF model for classifying black and odorous water bodies includes the following steps: S4-1, Dataset Preprocessing; S4-2, Constructing a cascaded forest; S4-3, Input feature values in the first layer of the cascaded forest; S4-4. Iterate through the training process and output the classification results after each iteration.
[0011] According to the above scheme, in step S4-1, the dataset is divided into a training set and a validation set; The data in the training set is standardized and normalized to ensure that all features have similar scales, and a feature subspace transformation is performed by randomly rotating the feature vectors of the data. The feature transformation is carried out by the following formula: Y=XW; Where X is the original data matrix of n×k, where n represents the number of samples and k represents the number of features; W is the transformation matrix of k×d, where d represents the most important selected feature vector; and Y is the transformed data matrix of n×d.
[0012] According to the above scheme, in step S4-2, the cascaded forest consists of three base classifiers, namely random forest, rotation forest and support vector machine; The random forest constructs an ensemble of multiple decision trees, each trained on a different subset of features; the different subsets of features refer to the random selection of features for the nodes of the multiple decision trees. A subset of features is formed by d, where d represents the number of input features; During the training process of each tree, the best binary cut point for all feature attributes is found at each node. The Gini index is used as the dividing criterion for the best binary cut point. The best binary cut point is selected for splitting until the stopping condition is met. Each decision tree in the random forest will produce a class vector result. Then, the results of all decision trees are combined and averaged to generate a 2-dimensional class vector, which serves as the final decision result for each forest. The rotating forest divides the processed training set into attribute sets and resamples the data to obtain multiple sample subsets. Principal component analysis is applied to each sample subset to obtain a new feature space. The coefficient matrix transformed by principal component analysis is multiplied with the processed training set to obtain a new training set. The base classifier is trained and the decision result is obtained. The support vector machine is trained using the entire dataset. It uses feature vectors and labels to solve a convex optimization problem to find the optimal hyperplane for classifying different data points, and generates a 2D class vector as the final decision.
[0013] According to the above scheme, in step S4-3, the processed data is input into a fully random forest and a random forest for preliminary classification to obtain a 2D probability distribution of the data; The 2D probability distributions of the data are concatenated to obtain N-dimensional data, which serves as the input feature value for the first layer of the cascaded forest. The first layer of the cascaded forest inputs the N-dimensional data for training, and combines the outputs of random forest, rotation forest, and support vector machine to obtain a 12-dimensional class distribution vector as prediction data. The 12-dimensional class distribution vector includes 2-class classification and 6 classifiers. The obtained class distribution vector is concatenated with the N-dimensional data of feature extraction to obtain an N+12-dimensional feature vector.
[0014] According to the above scheme, in step S4-4, Cross-entropy loss is calculated for each layer of prediction data, and the loss value for each subsample is calculated. The prediction data is a binary classification problem, and the formula is as follows: ; ; Where p(y i =1|x i ) is represented as y i When p(y) = 1, i.e., when the sample belongs to a black and odorous water body, the probability of a correct prediction is;i =0|x i ) is represented as y i When x = 0, i.e., when the sample belongs to a non-black and odorous water body, the probability of a correct prediction; i The input data is represented by θ; the parameter vector of the model is represented by h. θ (x i ) represents the model prediction x i The probability of a water body being black and odorous; The resulting formula is as follows: ; We simplify the expression using logarithmic properties; finally, we find the negative of the entire expression to obtain the cross-entropy loss, as shown in the following formula: ; Where J represents the value of the cross-entropy loss function; Based on the value of the cross-entropy loss function, hard sample mining is performed. The 30% of samples with the largest loss are defined as hard samples, which are concatenated with the N+12-dimensional feature vector. The concatenated data is then used as the input data for the second layer of the cascaded forest. Repeat the above process, concatenating the 12-dimensional class distribution vector obtained from each layer of the cascaded forest with the input data and hard samples of that layer to obtain the input data for the new layer of the cascaded forest; perform cross-validation in each iteration to verify the accuracy, and stop iterating if the accuracy does not improve. In each layer of learning, a rotating forest strategy is used to reconstruct new training samples, enabling the classifier to extract new feature information from different perspectives, and giving more weight to samples that are not correctly classified in each layer of learning. After the iteration is complete, the prediction results of each base classifier are collected; for classification tasks, a voting mechanism is used to determine the final classification result.
[0015] According to the above scheme, in step S4, the collected water information of the study area is processed by multi-granularity scanning. The water information of the study area is slid with sliders of different sizes to obtain sub-sample data of different dimensions. The sub-sample data is input into a completely random forest and a random forest. Each sample obtains a 2-dimensional probability distribution. After splicing, N-dimensional data is obtained, which is used as the feature extraction of the data and input into the DHRSF model for black and odorous water body classification. The model makes a probability vector for judging the water body category based on the pixel value of the water body area, thereby realizing the classification of black and odorous water bodies.
[0016] A classification system for black and odorous water bodies in rural areas based on DHRSF is proposed. The system includes: an image acquisition and preprocessing module, a dataset construction module, a DHRSF model construction and training module, and a result output module. The image acquisition and preprocessing module is used to acquire water body information and satellite remote sensing images of the study area, and to perform radiometric calibration and atmospheric correction on the acquired data. The dataset construction module is used to slice the preprocessed data into images, organize all image slices and their corresponding band values, band ratios, BOI indices and labels, and construct a dataset containing black and odorous water bodies and non-black and odorous water bodies. The DHRSF model construction and training module is used to preprocess the dataset; construct a DHRSF model for classifying black and odorous water bodies; input the preprocessed dataset into the DHRSF model for training; complete iterative training of the model, and output the classification results to the result output module after iteration; the result output module outputs the classified images and labels them on the images according to the classification results of the DHRSF model for classifying black and odorous water bodies. The DHRSF model construction and training module constructs a cascaded forest, which consists of three base classifiers: random forest, rotation forest, and support vector machine. Processed data is input into a fully random forest and a random forest for initial classification, resulting in a 2D probability distribution. These 2D probability distributions are then concatenated to obtain N-dimensional data, which serves as the input feature values for the first layer of the cascaded forest. The first layer of the cascaded forest inputs this N-dimensional data for training, combining the outputs of the three base classifiers to obtain a 12-dimensional class distribution vector as prediction data. The class distribution vector includes 2-class and 6-classifier classes. The obtained class distribution vector is concatenated with the N-dimensional data of feature extraction to obtain an N+12-dimensional feature vector. Cross-entropy loss is calculated on the training results, and the 30% of samples with the largest loss are defined as hard samples, which are concatenated with the N+12-dimensional data as the input data for the second layer of the cascaded forest. The above process is repeated, concatenating the 12-dimensional class distribution vector obtained from each layer of the cascaded forest with the input data of that layer and the hard samples to obtain the input data for the new layer of the cascaded forest. Cross-validation is performed in each iteration to verify the accuracy. If the accuracy does not improve, the iteration stops.
[0017] Compared with the prior art, the beneficial effects of the present invention are: 1. Directly inputting satellite remote sensing images into the DHRSF model avoids the complexity and uncertainty of traditional manual feature selection, saves a lot of manpower and material resources, and solves the problems of difficulty in obtaining samples due to the small area and small number of black and odorous water bodies in rural areas, as well as the problem of sample imbalance. 2. The DHRSF model, which uses random forest, rotation forest, and support vector machine as base classifiers, extracts deep features, thus improving the model's performance. 3. During the DHRSF training process, a hard sample mining strategy is used to increase the attention to hard-to-classify samples, improve the model's recognition ability, and increase the accuracy of water body classification. 4. This invention simplifies the traditional process of identifying black and odorous water bodies, is more user-friendly for non-professionals, and effectively improves the efficiency of investigating black and odorous water bodies in rural areas. Attached Figure Description
[0018] Figure 1 This is a schematic diagram illustrating the steps of the rural black and odorous water body classification method based on DHRSF of the present invention; Figure 2 This is a schematic diagram of the DHRSF model for classifying black and odorous water bodies in rural areas, based on the DHRSF classification method of this invention. Detailed Implementation
[0019] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0020] Example: Figures 1-2 As shown, the present invention provides a technical solution: a classification method for rural black and odorous water bodies based on DHRSF; Collect water body information and satellite remote sensing images of rural areas in a certain city, delineate the vector of ponds in the city, collect the true values of black and odorous water bodies and non-black and odorous water bodies on the ground and perform preprocessing; The preprocessing includes radiometric calibration and atmospheric correction; The radiometric calibration converts the brightness value (DN) of a pixel in a satellite remote sensing image into a radiance value, using the following formula: L λ =k•DN+c; Among them, L λ The radiance value is represented by band λ; k and c represent gain and bias, respectively, which can be read from the satellite remote sensing image header file; radiometric calibration can eliminate the error of the sensor itself and determine the accurate radiance value at the sensor inlet; The data reads k=0.0001, c=0.1, and the DN of a certain cell is 5000; Then the radiance value L λ =0.0001×5000+0.1=1.0; The atmospheric correction is performed at the pixel level based on the MODTRAN4 algorithm and the radiative transfer algorithm, converting the radiance value into the actual surface reflectance ρ, as shown in the following formula: ; Among them, L λλ represents the radiance value of band λ; d represents the Earth-Sun astronomical unit distance, which is generally taken as 1; E0 represents the solar irradiance, with each band corresponding to a different solar irradiance; θ represents the solar zenith angle, which can be read from the satellite remote sensing image header file when the satellite remote sensing image is acquired. The solar zenith angle was read as θ = 30°; d = 1; E0 = 190°. ρ=π×1.0×1×1 / 1900×cos(30°)≈0.0027; The radiometrically calibrated satellite remote sensing images are imported into the FLAASH algorithm for atmospheric correction. The FLAASH algorithm corrects each pixel to ensure that the data reflects the true condition of the Earth's surface. The FLAASH algorithm is an atmospheric correction module developed by the Institute for Spectroscopic Science with the support of the U.S. Air Force Research Laboratory. Atmospheric correction can eliminate errors caused by atmospheric scattering, absorption, and reflection.
[0021] A dataset containing both black and odorous water bodies and non-black and odorous water bodies was constructed based on the collected data. The coordinate transformation and matching are performed on satellite remote sensing images containing black and odorous water bodies or non-black and odorous water bodies. The coordinate transformation and matching includes projecting the geographic coordinates of the measured data into the coordinate system of the satellite remote sensing image to form the coordinates of n acquisition points. Using the coordinates of n collection points as the center, expand n×n pixels according to the size of the water body; ensure that all expanded pixels represent the water surface. n expanded image slices centered on pixel points are cropped out; each acquisition point in the measured data represents a pit, so there will be no situation where two slices are adjacent; each pixel in the image slice is extracted and processed by band ratio and BOI index, and the slice is marked as whether it contains black and odorous water. The band ratio is used to distinguish between black and odorous water bodies and non-black and odorous water bodies by utilizing the absorption characteristics of water bodies to different spectral bands. The formula is as follows: Band Ratio=R NIR / R Red ; Wherein, Band Ratio represents the band ratio; R NIR Reflectance is expressed in the near-infrared band; R Red Reflectance is expressed in the red band; Near-infrared reflectance R NIR =0.01, the reflectivity R in the red band Red =0.005; Band Ratio = R NIR / R Red =2; The BOI index uses the reflectance characteristics of a specific wavelength band to distinguish between black and odorous water bodies and non-black and odorous water bodies. The formula is as follows: ; Wherein, BOI represents the BOI index; B NIR Reflectance is expressed in the near-infrared band; B Red Reflectance is expressed in the red band; The reflectivity B in the near-infrared band NIR =0.01, reflectivity B in the red band Red =0.005; BOI Index = (0.01 - 0.005) / (0.01 + 0.005) ≈ 0.33 All image slices and their corresponding band values, band ratios, BOI indices, and labels were collected to construct a dataset containing both black and odorous water bodies and non-black and odorous water bodies.
[0022] Construct and train a DHRSF model for classifying black and odorous water bodies; The dataset is divided into an 80% training set and a 20% validation set; The data in the training set is standardized and normalized to ensure that all features have similar scales, and a feature subspace transformation is performed by randomly rotating the feature vectors of the data. The feature transformation is carried out by the following formula: Y=XW; Where X is the original data matrix of n×k, where n represents the number of samples and k represents the number of features; W is the transformation matrix of k×d, where d represents the most important selected feature vector; and Y is the transformed data matrix of n×d.
[0023] The cascaded forest in the DHRSF model for classifying black and odorous water bodies consists of three base classifiers: random forest, rotation forest, and support vector machine. The random forest constructs an ensemble of multiple decision trees, each trained on a different subset of features; the different subsets of features refer to the random selection of features for the nodes of the multiple decision trees. A subset of features is formed by d, where d represents the number of input features; During the training process of each tree, the best binary cut point for all feature attributes is found at each node. The Gini index is used as the dividing criterion for the best binary cut point. The best binary cut point is selected for splitting until the stopping condition is met. Each decision tree in the random forest will produce a class vector result. Then, the results of all decision trees are combined and averaged to generate a 2-dimensional class vector, which serves as the final decision result for each forest. The rotating forest divides the processed training set into attribute sets and resamples the data to obtain multiple sample subsets. Principal component analysis is applied to each sample subset to obtain a new feature space. The coefficient matrix transformed by principal component analysis is multiplied with the processed training set to obtain a new training set. The base classifier is trained and the decision result is obtained. The support vector machine is trained using the entire dataset. It uses feature vectors and labels to solve a convex optimization problem to find the optimal hyperplane for classifying different data points, and generates a 2D class vector as the final decision.
[0024] The processed data is input into a fully random forest and a random forest for preliminary classification, resulting in a 2D probability distribution of the data. The 2D probability distributions of the data are concatenated to obtain N-dimensional data, which serves as the input feature value for the first layer of the cascaded forest. The first layer of the cascaded forest inputs the N-dimensional data for training, and combines the outputs of random forest, rotation forest, and support vector machine to obtain a 12-dimensional class distribution vector as prediction data. The 12-dimensional class distribution vector includes 2-class classification and 6 classifiers. The obtained class distribution vector is concatenated with the N-dimensional data of feature extraction to obtain an N+12-dimensional feature vector.
[0025] Cross-entropy loss is calculated for each layer of prediction data, and the loss value for each subsample is calculated. The prediction data is a binary classification problem, and the formula is as follows: ; ; Where p(y i =1|x i ) is represented as y i When p(y) = 1, i.e., when the sample belongs to a black and odorous water body, the probability of a correct prediction is; i =0|x i ) is represented as y i When x = 0, i.e., when the sample belongs to a non-black and odorous water body, the probability of a correct prediction; i The input data is represented by θ; the parameter vector of the model is represented by h. θ (x i ) represents the model prediction x i The probability of a water body being black and odorous; The resulting formula is as follows: ; We simplify the expression using logarithmic properties; finally, we find the negative of the entire expression to obtain the cross-entropy loss, as shown in the following formula: ; Where J represents the value of the cross-entropy loss function; Based on the value of the cross-entropy loss function, hard sample mining is performed. The 30% of samples with the largest loss are defined as hard samples, which are concatenated with the N+12-dimensional feature vector. The concatenated data is then used as the input data for the second layer of the cascaded forest. Repeat the above process, concatenating the 12-dimensional class distribution vector obtained from each layer of the cascaded forest with the input data and hard samples of that layer to obtain the input data for the new layer of the cascaded forest; perform cross-validation in each iteration to verify the accuracy, and stop iterating if the accuracy does not improve. In each layer of learning, a rotating forest strategy is used to reconstruct new training samples, enabling the classifier to extract new feature information from different perspectives, and giving more weight to samples that are not correctly classified in each layer of learning. After the iteration is complete, the prediction results of each base classifier are collected; for classification tasks, a voting mechanism is used to determine the final classification result.
[0026] The DHRSF model for classifying black and odorous water bodies, which has been trained, is used to predict the water information in the study area and obtain the distribution of black and odorous water bodies. The collected water body information in the rural areas of the city was processed using multi-granularity scanning. The water body information in the rural areas of the city was slid through sliders of different sizes to obtain sub-sample data of different dimensions. The sub-sample data was input into a completely random forest and a random forest. Each sample obtained a 2D probability distribution. After concatenation, N-dimensional data was obtained, which was used as the feature extraction of the data and input into the DHRSF model for black and odorous water body classification. The model uses the pixel value of the water body area to make a probability vector for judging the water body category, thereby realizing the classification of black and odorous water bodies.
[0027] This invention provides another technical solution: a rural black and odorous water body classification system based on DHRSF; the system includes: an image acquisition and preprocessing module, a dataset construction module, a DHRSF model construction and training module, and a result output module; The image acquisition and preprocessing module is used to acquire water information and satellite remote sensing images of rural areas in the city, and to perform radiometric calibration and atmospheric correction on the acquired data. The dataset construction module is used to slice the preprocessed data into images, organize all image slices and their corresponding band values, band ratios, BOI indices and labels, and construct a dataset that includes black and odorous water bodies and non-black and odorous water bodies. The DHRSF model building and training module is used to preprocess the dataset; build a DHRSF model for classifying black and odorous water bodies; input the preprocessed dataset into the DHRSF model for training; complete iterative training of the model; and output the classification results to the result output module after the iteration is completed. The DHRSF model construction and training module constructs a cascaded forest, which consists of three base classifiers: random forest, rotation forest, and support vector machine. Processed data is input into a fully random forest and a random forest for initial classification, resulting in a 2D probability distribution. These 2D probability distributions are then concatenated to obtain N-dimensional data, which serves as the input feature values for the first layer of the cascaded forest. The first layer of the cascaded forest inputs this N-dimensional data for training, combining the outputs of the three base classifiers to obtain a 12-dimensional class distribution vector as prediction data. The class distribution vector includes 2-class and 6-classifier classes. The obtained class distribution vector is concatenated with the N-dimensional data of feature extraction to obtain an N+12-dimensional feature vector. Cross-entropy loss is calculated on the training results, and the 30% of samples with the largest loss are defined as hard samples, which are concatenated with the N+12-dimensional data as the input data for the second layer of the cascaded forest. The above process is repeated, concatenating the 12-dimensional class distribution vector obtained from each layer of the cascaded forest with the input data of that layer and the hard samples to obtain the input data for the new layer of the cascaded forest. Cross-validation is performed in each iteration to verify the accuracy. If the accuracy does not improve, the iteration stops. The result output module outputs the classified water body images of the rural areas of the city, and marks the locations of black and odorous water bodies and non-black and odorous water bodies on the images according to the classification results of the DHRSF model for black and odorous water body classification.
[0028] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from its spirit or essential characteristics. Therefore, the embodiments should be considered in all respects as exemplary and non-limiting, and the scope of the invention is defined by the appended claims rather than the foregoing description. Thus, all variations falling within the meaning and scope of equivalents of the claims are intended to be included within the present invention. No reference numerals in the claims should be construed as limiting the scope of the claims.
Claims
1. A classification method for black and odorous water bodies in rural areas based on DHRSF, characterized by: The method includes the following steps: S1. Collect water body information and satellite remote sensing images of the study area, and perform preprocessing; S2. Construct a dataset that includes both black and odorous water bodies and non-black and odorous water bodies; S3. Construct and train a DHRSF model for classifying black and odorous water bodies; S4. Use the trained DHRSF model for classifying black and odorous water bodies to predict the water information in the study area and obtain the distribution of black and odorous water bodies.
2. The rural black and odorous water body classification method based on DHRSF according to claim 1, characterized in that: In step S1, the preprocessing includes radiometric calibration and atmospheric correction; The radiometric calibration converts the brightness value (DN) of a pixel in a satellite remote sensing image into a radiance value, using the following formula: L λ =k•DN+c; Among them, L λ The radiance value is represented by band λ; k and c represent the gain and bias, respectively, which can be read from the satellite remote sensing image header file. The atmospheric correction, based on the MODTRAN4 algorithm and the radiative transfer algorithm, performs pixel-level correction, converting the radiance value into the actual surface reflectance, as shown in the following formula: ; Among them, L λ denoted as radiance value for band λ; d represents the Earth-Sun astronomical unit distance; E0 represents solar irradiance; θ represents solar zenith angle, which can be read from the satellite remote sensing image header file when the image is acquired. The radiometrically calibrated satellite remote sensing images are imported into the FLAASH algorithm for atmospheric correction; the FLAASH algorithm corrects each pixel to ensure that the data reflects the true condition of the Earth's surface.
3. The rural black and odorous water body classification method based on DHRSF according to claim 1, characterized in that: Step S2 includes performing coordinate transformation and matching on satellite remote sensing images containing black and odorous water bodies or non-black and odorous water bodies. The coordinate transformation and matching includes projecting the geographic coordinates of the measured data into the satellite remote sensing image coordinate system to form the coordinates of n acquisition points. Using the coordinates of n collection points as the center, expand to n×n pixels based on the size of the water body; Cropping out n expanded image slices centered on pixel points; extracting each pixel in the image slice and constructing band ratio and BOI index, and marking whether the slice contains black and odorous water bodies; The band ratio is used to distinguish between black and odorous water bodies and non-black and odorous water bodies by utilizing the absorption characteristics of water bodies to different spectral bands. The formula is as follows: Band Ratio=R NIR / R Red ; Wherein, Band Ratio represents the band ratio; R NIR Reflectance is expressed in the near-infrared band; R Red Reflectance is expressed in the red band; The BOI index uses the reflectance characteristics of a specific wavelength band to distinguish between black and odorous water bodies and non-black and odorous water bodies. The formula is as follows: ; Wherein, BOI represents the BOI index; B NIR Reflectance is expressed in the near-infrared band; B Red Reflectance is expressed in the red band; All image slices and their corresponding band values, band ratios, BOI indices, and labels were collected to construct a dataset containing both black and odorous water bodies and non-black and odorous water bodies.
4. The rural black and odorous water body classification method based on DHRSF according to claim 1, characterized in that: In step S3, constructing and training the DHRSF model for classifying black and odorous water bodies includes the following steps: S4-1, Dataset Preprocessing; S4-2, Constructing a cascaded forest; S4-3, Input feature values in the first layer of the cascaded forest; S4-4. Iterate through the training process and output the classification results after each iteration.
5. The rural black and odorous water body classification method based on DHRSF according to claim 4, characterized in that: In step S4-1, the dataset is divided into a training set and a validation set; The data in the training set is standardized and normalized to ensure that all features have similar scales, and a feature subspace transformation is performed by randomly rotating the feature vectors of the data. The feature transformation is carried out by the following formula: Y=XW; Where X is the original data matrix of n×k, where n represents the number of samples and k represents the number of features; W is the transformation matrix of k×d, where d represents the most important selected feature vector; and Y is the transformed data matrix of n×d.
6. The rural black and odorous water body classification method based on DHRSF according to claim 5, characterized in that: In step S4-2, the cascaded forest consists of three base classifiers, namely random forest, rotation forest and support vector machine; The random forest constructs an ensemble of multiple decision trees, each trained on a different subset of features; the different subsets of features refer to the random selection of features for the nodes of the multiple decision trees. Each feature constitutes a feature subset. Where d represents the number of input features; During the training process of each tree, the best binary cut point for all feature attributes is found at each node. The Gini index is used as the dividing criterion for the best binary cut point. The best binary cut point is selected for splitting until the stopping condition is met. Each decision tree in the random forest will produce a class vector result. Then, the results of all decision trees are combined and averaged to generate a 2-dimensional class vector, which serves as the final decision result for each forest. The rotating forest divides the processed training set into attribute sets and resamples the data to obtain multiple sample subsets. Principal component analysis is applied to each sample subset to obtain a new feature space. The coefficient matrix transformed by principal component analysis is multiplied with the processed training set to obtain a new training set. The base classifier is trained and the decision result is obtained. The support vector machine is trained using the entire dataset. It uses feature vectors and labels to solve a convex optimization problem to find the optimal hyperplane for classifying different data points, and generates a 2D class vector as the final decision.
7. The rural black and odorous water body classification method based on DHRSF according to claim 6, characterized in that: In step S4-3, the processed data is input into a fully random forest and a random forest for preliminary classification to obtain a 2D probability distribution of the data; The two-dimensional probability distributions of the data are concatenated to obtain N-dimensional data, which is used as the input feature values of the first layer of the cascaded forest. The first layer of the cascaded forest inputs N-dimensional data for training. Combining the outputs of random forest, rotation forest and support vector machine, a 12-dimensional class distribution vector is obtained as prediction data. The 12-dimensional class distribution vector includes 2 classifications and 6 classifiers. The obtained class distribution vector is concatenated with the N-dimensional data of feature extraction to obtain an N+12-dimensional feature vector.
8. The rural black and odorous water body classification method based on DHRSF according to claim 7, characterized in that: In step S4-4, Cross-entropy loss is calculated for each layer of prediction data, and the loss value for each subsample is calculated. The prediction data is a binary classification problem, and the formula is as follows: ; ; Where p(y i =1|x i ) is represented as y i When p(y) = 1, i.e., when the sample belongs to a black and odorous water body, the probability of a correct prediction is; i =0|x i ) is represented as y i When x = 0, i.e., when the sample belongs to a non-black and odorous water body, the probability of a correct prediction; i The input data is represented by θ; the parameter vector of the model is represented by h. θ (x i ) represents the model prediction x i The probability of a water body being black and odorous; The resulting formula is as follows: ; We simplify the expression using logarithmic properties; finally, we find the negative of the entire expression to obtain the cross-entropy loss, as shown in the following formula: ; Where J represents the value of the cross-entropy loss function; Based on the value of the cross-entropy loss function, hard sample mining is performed. The 30% of samples with the largest loss are defined as hard samples, which are concatenated with the N+12-dimensional feature vector. The concatenated data is then used as the input data for the second layer of the cascaded forest. Repeat the above process, concatenating the 12-dimensional class distribution vector obtained from each layer of the cascaded forest with the input data and hard samples of that layer to obtain the input data for the new layer of the cascaded forest; perform cross-validation in each iteration to verify the accuracy, and stop iterating if the accuracy does not improve. In each layer of learning, a rotating forest strategy is used to reconstruct new training samples, enabling the classifier to extract new feature information from different perspectives, and giving more weight to samples that are not correctly classified in each layer of learning. After the iteration is complete, the prediction results of each base classifier are collected; for classification tasks, a voting mechanism is used to determine the final classification result.
9. The rural black and odorous water body classification method based on DHRSF according to claim 1, characterized in that: In step S4, the collected water information of the study area is processed by multi-granularity scanning. The water information of the study area is slid with sliders of different sizes to obtain sub-sample data of different dimensions. The sub-sample data is input into a completely random forest and a random forest. Each sample obtains a 2-dimensional probability distribution. After concatenation, N-dimensional data is obtained and used as the feature extraction of the data. It is then input into the DHRSF model for black and odorous water body classification for classification. The model makes a probability vector for judging the water body category based on the pixel value of the water body area, thus completing the classification of black and odorous water bodies.
10. A rural black and odorous water body classification system based on DHRSF, characterized in that: The system includes: an image acquisition and preprocessing module, a dataset construction module, a DHRSF model construction and training module, and a result output module; The image acquisition and preprocessing module is used to acquire water body information and satellite remote sensing images of the study area, and to perform radiometric calibration and atmospheric correction on the acquired data. The dataset construction module is used to slice the preprocessed data into images, organize all image slices and their corresponding band values, band ratios, BOI indices and labels, and construct a dataset containing black and odorous water bodies and non-black and odorous water bodies. The DHRSF model construction and training module is used to preprocess the dataset; construct a DHRSF model for classifying black and odorous water bodies; input the preprocessed dataset into the DHRSF model for training; complete iterative training of the model, and output the classification results to the result output module after iteration; the result output module outputs the classified images and labels them on the images according to the classification results of the DHRSF model for classifying black and odorous water bodies. The DHRSF model construction and training module constructs a cascaded forest, which consists of three base classifiers: random forest, rotation forest, and support vector machine. Processed data is input into a fully random forest and a random forest for initial classification, resulting in a 2D probability distribution. These 2D probability distributions are then concatenated to obtain N-dimensional data, which serves as the input feature values for the first layer of the cascaded forest. The first layer of the cascaded forest inputs this N-dimensional data for training, combining the outputs of the three base classifiers to obtain a 12-dimensional class distribution vector as prediction data. The class distribution vector includes 2-class and 6-classifier classes. The obtained class distribution vector is concatenated with the N-dimensional data of feature extraction to obtain an N+12-dimensional feature vector. Cross-entropy loss is calculated on the training results, and the 30% of samples with the largest loss are defined as hard samples, which are concatenated with the N+12-dimensional data as the input data for the second layer of the cascaded forest. The above process is repeated, concatenating the 12-dimensional class distribution vector obtained from each layer of the cascaded forest with the input data of that layer and the hard samples to obtain the input data for the new layer of the cascaded forest. Cross-validation is performed in each iteration to verify the accuracy. If the accuracy does not improve, the iteration stops.