Method and device for detecting leakage of secondary water supply
Patent Information
- Application Number
- CN202410575801.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-10
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2044-05-10
AI Technical Summary
[0003]然而,尽管二次供水设备在供水方面发挥了重要作用,但与之相伴的管道漏水问题却日益突出
[0055]Compared with existing technologies, the beneficial effects of this invention include at least the following: The audio data-based leak detection method can perform leak detection in a non-invasive manner, without affecting the normal operation of the pipeline. Setting the number of recording devices according to the area of the collection area and the density of water pipes ensures optimal configuration for audio data collection under limited resource conditions. This avoids resource waste and improves the efficiency and rationality of resource utilization. A reasonable configuration of the number of recording devices better covers the collection area, ensuring comprehensive audio data collection. This helps improve the accuracy and reliability of leak detection and reduces the possibility of missed detections. The sampling frequency is dynamically adjusted according to different time ranges and water volume changes. This allows the recording devices to better adapt to the actual environment, improving the accuracy and reliability of audio data collection. By intelligently adjusting the sampling frequency, this method can quickly and accurately collect audio data according to the actual situation, improving the efficiency of leak detection. At the same time, it avoids unnecessary sampling and data processing, reducing computational costs. Using the random forest algorithm to establish a leak detection model can effectively improve detection accuracy and avoid false alarms or missed alarms caused by noise and other interference factors. PCA dimensionality reduction is performed on the audio data features, retaining features with a cumulative variance contribution of 95% to reduce feature dimensionality and improve the efficiency and accuracy of the random forest algorithm. The purpose of placing water pipes at different angles is to simulate the distribution of leaking pipes in a real-world environment as closely as possible. In practice, the angles of water pipes may vary; therefore, collecting data from different angles can better cover leak situations under different conditions. Changing the pipe placement angles enriches the dataset. The sound characteristics of leaking water pipes at different angles may differ; collecting data from multiple angles improves the model's generalization ability, making it more accurate in detecting leaks in practical applications. Choosing a regular angle distribution allows for the radiation of a large range of angles from a few angles, reducing unnecessary repeated measurements and making the dataset more concise. This saves time and cost in data collection and processing while still ensuring the diversity and representativeness of the dataset. Grouping and labeling the leak data according to the size and number of leak holes allows for a more detailed description of the leak situation. Classifying leak holes into three sizes—small, medium, and large—and categorizing them by number—single or multiple—provides a more comprehensive description of the leakage situation, further improving the model's accuracy and stability. Setting appropriate N and K values makes the random forest algorithm more stable, avoids overfitting, and improves the model's generalization ability. In summary, the secondary water supply leak detection method has advantages such as non-invasiveness, real-time performance, high accuracy, and ease of implementation, making it effectively applicable to the field of pipeline leak detection.
Smart Images

Figure CN118499710B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of leakage detection technology, and in particular to a method and apparatus for detecting leakage in secondary water supply systems. Background Technology
[0002] With the continuous advancement of urbanization, water supply systems are facing increasingly severe challenges. As an important component of the water supply system, secondary water supply equipment is generally installed above ground or in basements. Its function is to regulate peak water consumption and increase water pressure to meet the needs of large-area water use and high-rise building water use. Whether it is a unit with tap water or a factory or village without tap water, secondary water supply equipment can effectively provide a stable water volume and pressure to meet the needs of various water use scenarios.
[0003] However, while secondary water supply equipment plays a vital role in water supply, the accompanying problem of pipe leaks is becoming increasingly prominent. Pipe leaks not only waste water resources but can also damage the water supply system and even disrupt residents' daily lives.
[0004] Traditional pipe leak detection mainly relies on manual labor. While this method is intuitive, it is inefficient and costly, especially in areas with concentrated pipes and complex environments, such as basements and densely built-up areas, where manual detection becomes extremely difficult or even impossible. This makes it difficult to detect and address leaks in a timely manner, thereby exacerbating water waste and damage to the water supply system.
[0005] There are other leak detection methods on the market, such as sensor-based methods, which use sensors on pipes to detect leak sound signals and thus determine the leak location. However, this method has many limitations. First, it requires a large number of sensors, which increases costs. Second, the sensors may be affected by environmental noise, water flow noise, etc., resulting in low detection accuracy. In addition, the maintenance and replacement of sensors also increase the cost of use and make it difficult to achieve accurate and real-time monitoring.
[0006] Therefore, effectively addressing pipeline leakage issues during secondary water supply while ensuring water supply has become a pressing technical challenge for the water supply industry. To address this problem, this invention proposes a method and device for detecting leaks in secondary water supply systems. This solution employs a recording device to collect audio data from the pipeline area in real time, and then processes and analyzes the audio data using a random forest algorithm to achieve real-time and accurate leak detection. This method avoids the inconvenience and cost associated with traditional sensor deployment, while also improving the accuracy and real-time performance of the detection. Summary of the Invention
[0007] The purpose of this invention is to provide a method and device for detecting leaks in secondary water supply systems. This method involves distributing a small number of recording devices that can provide real-time feedback in a pipeline area to achieve real-time monitoring. It also employs a random forest network for leak detection, thus solving the problems of delay and cost associated with manual detection. This significantly improves the accuracy of detection and computational efficiency.
[0008] The objective of this invention is achieved through the following technical solution:
[0009] This application proposes a method for detecting leaks in a secondary water supply system, the method comprising:
[0010] The system collects audio data, including modeling data and real-time detection data; and processes the audio data to obtain processed data.
[0011] Based on the random forest algorithm, a leak detection model is established using the processed modeling data;
[0012] The processed real-time detection data is input into the leak detection model to obtain the detection results;
[0013] Issue warnings based on detection results and obtain terminal feedback results; optimize the model based on terminal feedback results.
[0014] Preferably, in the secondary water supply leakage detection method, the acquisition of audio data includes modeling data and real-time detection data; and the processing of the audio data to obtain processed data includes:
[0015] Audio data from different water pipe angles was collected, grouped, and labeled to obtain modeling data;
[0016] Set up a recording device to collect audio data in real time and obtain real-time detection data;
[0017] The audio data is preprocessed to obtain a preprocessed audio signal; the preprocessing includes format conversion, filtering, and amplification.
[0018] MFCC feature extraction is performed on the preprocessed audio signal to obtain audio data features;
[0019] The audio data features are subjected to PCA dimensionality reduction; features whose cumulative variance contribution reaches a preset ratio are retained.
[0020] Preferably, the secondary water supply leakage detection method, wherein the leakage detection model is established based on the random forest algorithm using processed modeling data, includes:
[0021] The features of the modeled audio data after dimensionality reduction are divided into training and testing sets;
[0022] The data from the training set is input into a random forest classifier to train the leak detection model; predictions are made using the test set, and the leak detection model is optimized based on the prediction results.
[0023] Preferably, the secondary water supply leakage detection method includes collecting and grouping audio data from different water pipe angles to obtain modeling data; including:
[0024] Audio data was collected at different water pipe angles to obtain modeling data; the water pipe angles included 0°, 30°, 45°, 60° and 90°.
[0025] The modeling data is first grouped and labeled according to multiple rules, including pipe angle, water flow rate, and presence or absence of leakage.
[0026] The leakage data features in the first group are grouped into a second group according to the size and number of leakage holes and then marked.
[0027] Preferably, in the secondary water supply leakage detection method, the step of inputting the training set data into a random forest classifier to establish a training model includes:
[0028] N features are randomly selected from different groups with replacement, and the operation is repeated K times to form K feature sets. Decision trees are then built with each of the K feature sets as the root node.
[0029] The method for determining N is as follows:
[0030] Set the initial range of N And N≤100; where N z The total number of features is represented by floor(), which rounds up.
[0031] Preset a set of K values and set multiple different N values to obtain model processing efficiency and model output metrics;
[0032] The relationships between N and model processing efficiency and model output metrics were obtained respectively.
[0033] The adjusted N value ranges between the N1 value corresponding to the model output efficiency threshold and the N2 value corresponding to the model output index threshold.
[0034] Preferably, in a secondary water supply leakage detection method, the step of inputting processed real-time detection data into a leakage detection model to obtain detection results includes:
[0035] The processed real-time detection data is then input into the trained leak detection model.
[0036] Based on the analysis results of the leakage detection model, determine whether there is a leakage; if the prediction result is a leakage, draw the original audio and the audio after removing the silence, and cut it to a preset length for display;
[0037] Set a waiting time interval, and execute multiple processed real-time water leakage signals in a loop within the waiting time interval.
[0038] Preferably, in the secondary water supply leakage detection method, the step of setting up a recording device to collect audio data in real time includes:
[0039] The number of recording devices should be determined based on the area of the collection area and the density of water pipes.
[0040] The number of recording devices is:
[0041]
[0042] Where P is the number of recording devices; if P is less than 1, then 1 is selected; if P is greater than 1, then the result is rounded up or down. g is the number of water pipes per square meter of projected area. y The preset number of water pipes per square meter; S is the total projected area of the region, S y This is the preset projection area.
[0043] Preferably, the secondary water supply leakage detection method, wherein the step of setting up a recording device to collect audio data in real time further includes:
[0044] Divide the time range and set the sampling frequency according to the time range; specifically:
[0045] Divide the first time range according to the season; set the first preset sampling frequency within the first time range;
[0046] The flow rate is divided into groups based on the first time frame; the flow rate is also divided into groups based on the amount of water in different time periods in historical records.
[0047] Obtain historical fault records of water pipes, and adjust the sampling frequency based on historical fault probability, current flow group, and water pipe usage time;
[0048]
[0049] Where F is the adjusted sampling frequency of the device; F0 is the first preset sampling frequency; Z is the historical failure probability of the sampling water pipe corresponding to the device within the first time range; L is the usage time of the sampling water pipe corresponding to the device; L y The estimated usage time of the sampling water pipe; α is a coefficient, determined by the current flow group, 0 < α ≤ 1.
[0050] Optionally, the secondary water supply leakage detection method further includes:
[0051] Different indicator signs are set according to different test results;
[0052] Monitor the amount of sampled data in the database and periodically delete redundant data.
[0053] On the other hand, this application proposes a secondary water supply leakage detection device, the device including a memory and at least one processor, the memory storing a computer program, and the at least one processor being configured to execute the computer program to implement the steps of a method for secondary water supply leakage detection.
[0054] This application also proposes a computer-readable storage medium that stores computer instructions, which, when read by a computer, execute the method for detecting secondary water supply leakage.
[0055] Compared with existing technologies, the beneficial effects of this invention include at least the following: The audio data-based leak detection method can perform leak detection in a non-invasive manner, without affecting the normal operation of the pipeline. Setting the number of recording devices according to the area of the collection area and the density of water pipes ensures optimal configuration for audio data collection under limited resource conditions. This avoids resource waste and improves the efficiency and rationality of resource utilization. A reasonable configuration of the number of recording devices better covers the collection area, ensuring comprehensive audio data collection. This helps improve the accuracy and reliability of leak detection and reduces the possibility of missed detections. The sampling frequency is dynamically adjusted according to different time ranges and water volume changes. This allows the recording devices to better adapt to the actual environment, improving the accuracy and reliability of audio data collection. By intelligently adjusting the sampling frequency, this method can quickly and accurately collect audio data according to the actual situation, improving the efficiency of leak detection. At the same time, it avoids unnecessary sampling and data processing, reducing computational costs. Using the random forest algorithm to establish a leak detection model can effectively improve detection accuracy and avoid false alarms or missed alarms caused by noise and other interference factors. PCA dimensionality reduction is performed on the audio data features, retaining features with a cumulative variance contribution of 95% to reduce feature dimensionality and improve the efficiency and accuracy of the random forest algorithm. The purpose of placing water pipes at different angles is to simulate the distribution of leaking pipes in a real-world environment as closely as possible. In practice, the angles of water pipes may vary; therefore, collecting data from different angles can better cover leak situations under different conditions. Changing the pipe placement angles enriches the dataset. The sound characteristics of leaking water pipes at different angles may differ; collecting data from multiple angles improves the model's generalization ability, making it more accurate in detecting leaks in practical applications. Choosing a regular angle distribution allows for the radiation of a large range of angles from a few angles, reducing unnecessary repeated measurements and making the dataset more concise. This saves time and cost in data collection and processing while still ensuring the diversity and representativeness of the dataset. Grouping and labeling the leak data according to the size and number of leak holes allows for a more detailed description of the leak situation. Classifying leak holes into three sizes—small, medium, and large—and categorizing them by number—single or multiple—provides a more comprehensive description of the leakage situation, further improving the model's accuracy and stability. Setting appropriate N and K values makes the random forest algorithm more stable, avoids overfitting, and improves the model's generalization ability. In summary, the secondary water supply leak detection method has advantages such as non-invasiveness, real-time performance, high accuracy, and ease of implementation, making it effectively applicable to the field of pipeline leak detection. Attached Figure Description
[0056] Figure 1This is a schematic diagram of a secondary water supply leakage detection method according to an embodiment of the present invention;
[0057] Figure 2 This is a schematic diagram of the modeling audio data grouping according to an embodiment of the present invention;
[0058] Figure 3 This is a schematic diagram illustrating audio data format conversion and silence removal according to an embodiment of the present invention;
[0059] Figure 4 This is a schematic diagram showing local features of audio data according to an embodiment of the present invention;
[0060] Figure 5 This is a schematic diagram of spectrum analysis according to an embodiment of the present invention. Detailed Implementation
[0061] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein; rather, they are provided to make the invention more comprehensive and complete, and to fully convey the concept of the exemplary embodiments to those skilled in the art.
[0062] Before introducing the method of this invention, let's first introduce the random forest algorithm and classifier:
[0063] The Random Forest Classifier is an ensemble learning method consisting of multiple decision trees. Each decision tree is trained independently by randomly bootstrapping the input samples with replacement and randomly selecting features to construct different decision trees. The final classification result is obtained by voting from all the decision trees or by averaging them.
[0064] Random forest classifiers have the following characteristics:
[0065] High accuracy: Random forest classifiers typically have high accuracy due to the use of voting or averaging strategies from multiple decision trees.
[0066] Anti-overfitting: Through random sampling and random feature selection, random forests can reduce the risk of overfitting and improve the model's generalization ability.
[0067] Capable of handling large numbers of features: Random forests can handle datasets with a large number of features and the importance of features can be evaluated during training.
[0068] There are many classification trees in a random forest. To classify an input sample, the input sample needs to be input into each tree for classification. Each tree independently gives its own opinion on this problem, that is, each tree votes, and the category with the most votes is the classification result of the forest. Each tree in the forest is independent. The prediction results made by 99.9% uncorrelated trees cover all situations, and these prediction results will cancel each other out. The prediction results of a few excellent trees will stand out and make a good prediction. Voting is used to select the classification results of several weak classifiers to form a strong classifier, which is the idea of random forest bagging (bootstrap aggregating).
[0069] When we use the random forest algorithm to predict a new sample, we input this sample into each tree, and each tree gives a prediction result. Then, the voting method can be used to determine the final result. For classification problems, the category with the most votes can be selected as the final category; for regression problems, the average value of the predicted values of all trees can be calculated as the final value.
[0070] The generation rules of the trees in the forest are as follows:
[0071] 1) If the size of the training set is N, for each tree, randomly and with replacement, N training samples are drawn from the training set as the training set of this tree; this makes the training sets of each tree different and contains repeated training samples. The purpose is to make the classification results of each tree not completely the same and not completely without intersection
[0072] 2) If the feature dimension of each sample is M, a constant m << M is specified, and m feature subsets are randomly selected from the M features. Each time the tree is split, the optimal one is selected from these m features;
[0073] 3) Each tree grows to the greatest extent and there is no pruning process.
[0074] Some embodiments of the present application provide a secondary water supply leakage detection method, and the method includes:
[0075] Collect audio data, where the audio data includes modeling data and real-time detection data; and process the audio data to obtain processed data;
[0076] Based on the random forest algorithm, a leakage detection model is established through the processed modeling data;
[0077] Input the processed real-time detection data into the leakage detection model to obtain a detection result;
[0078] Issue warnings based on detection results and obtain terminal feedback results; optimize the model based on terminal feedback results.
[0079] The working principle of the above technical solution is as follows: audio data of the pipeline area is collected through a recording device. The audio data includes raw data for modeling (modeling data) and real-time data for real-time detection (real-time detection data). The modeling data is used to establish a leak detection model, while the real-time detection data is used to monitor the pipeline status in real time. The collected audio data needs to be preprocessed, including format conversion, filtering, and amplification. Filtering aims to remove noise and interference while retaining the leak signal; amplification aims to enhance the signal strength and improve the accuracy of subsequent analysis.
[0080] The preprocessed audio signal needs feature extraction to extract features that reflect the leakage characteristics. Commonly used feature extraction methods include MFCC (Mel frequency cepstral coefficients) feature extraction. MFCC feature extraction can effectively extract feature information from the audio signal, which is helpful for subsequent classification and detection. However, the extracted features may have high dimensionality, increasing computational complexity and the risk of overfitting. Therefore, dimensionality reduction processing is needed to reduce computational complexity and improve classification performance. Based on the processed modeling data, a leakage detection model is established using the random forest algorithm. The random forest algorithm improves classification accuracy and stability by constructing multiple decision trees and combining their classification results.
[0081] The processed real-time detection data is input into the leak detection model to obtain the detection results. Based on the results, an early warning is issued; if a leak is detected, a corresponding warning signal is sent. This warning signal can be sent to terminal devices or the system so that appropriate measures can be taken promptly for repair or handling.
[0082] The leakage detection model was optimized based on feedback from the terminals. Adjustments and improvements were made to the model based on its accuracy and stability in practical applications, aiming to enhance its classification performance and adaptability.
[0083] The secondary water supply leakage detection method can achieve real-time and accurate leakage detection in areas with concentrated pipelines that are difficult for manual access by collecting and processing audio data in real time and establishing a secondary water supply leakage detection model. It avoids the inconvenience and cost problems of traditional sensor deployment and improves the accuracy and real-time performance of detection.
[0084] The advantages of the above technical solution are as follows: Traditional leak detection methods require disconnecting the pipeline or installing sensors, while audio data-based leak detection can be performed non-invasively without affecting the normal operation of the pipeline. Audio data-based leak detection allows for real-time monitoring of pipeline leaks, timely detection of leaks, and prompt handling to minimize losses. Using a random forest algorithm to build a leak detection model effectively improves detection accuracy and avoids false alarms or missed alarms due to noise or other interference. Audio data-based leak detection does not require complex equipment or technology; it only requires the collection and processing of audio data, making it highly feasible. In summary, secondary water supply leak detection methods have advantages such as non-invasiveness, real-time performance, high accuracy, and ease of implementation, and can be effectively applied in the field of pipeline leak detection.
[0085] Some embodiments of this application describe a method for detecting leakage in a secondary water supply system. The method involves collecting audio data, which includes modeling data and real-time detection data; and processing the audio data to obtain processed data, including:
[0086] Audio data from different water pipe angles was collected, grouped, and labeled to obtain modeling data;
[0087] Set up a recording device to collect audio data in real time and obtain real-time detection data;
[0088] The audio data is preprocessed to obtain a preprocessed audio signal; the preprocessing includes format conversion, filtering, and amplification; the purpose of filtering is to remove noise and interference while retaining the leak signal; the purpose of amplification is to enhance the signal strength and improve the accuracy of subsequent analysis;
[0089] MFCC feature extraction is performed on the preprocessed audio signal to obtain audio data features;
[0090] The audio data features are subjected to PCA dimensionality reduction; features with a preset contribution ratio of cumulative variance are retained, preferably 95%.
[0091] In random forest algorithms, principal component analysis (PCA) is sometimes used to extract the principal components of features in order to reduce feature dimensionality. PCA is a statistical method that transforms a set of correlated features into a set of linearly independent features called principal components. The number of principal components is usually less than the number of original features, but it retains most of the information from the original data.
[0092] Cumulative variance (CPV) is the sum of the variances of all principal components, reflecting the degree to which the principal components can explain the variation in the original data. Features with a CPV of 95% or higher mean that these features retain 95% of the information in the original data, while discarded features only account for 5% of the information. The aim is to reduce feature dimensionality while preserving as much of the effective information in the data as possible, improving the model's generalization ability and reducing the risk of overfitting. Retaining features with a CPV of 95% or higher helps in building better random forest models, while improving the model's robustness and generalization ability.
[0093] The 95% cumulative variance is not a fixed threshold; it can be adjusted based on different data and problems. Generally, higher cumulative variance retains more features and improves the accuracy of the random forest algorithm, but it also increases computational complexity and time. Conversely, lower cumulative variance retains fewer features and makes the random forest algorithm faster, but it may sacrifice some data information and accuracy. Therefore, a balance needs to be found between cumulative variance and the performance of the random forest algorithm.
[0094] To retain features with a cumulative variance of 95%, follow these steps:
[0095] Use techniques such as principal component analysis (PCA) to extract the features that best explain the variability of the data, ensuring that the retained features capture most of the variance in the data; build a model using the random forest algorithm, train the model using the retained features, and use appropriate evaluation functions to evaluate the model's performance, such as mean squared error (MSE) or accuracy.
[0096] The working principle of the above technical solution is as follows: Audio data from different water pipe angles is collected, grouped, and labeled to obtain modeling data. A recording device is set up to collect audio data in real time, obtaining real-time detection data.
[0097] The acquired audio data undergoes preprocessing, including format conversion, filtering, and amplification. Filtering aims to remove noise and interference while preserving the leaky signal; amplification aims to enhance signal strength and improve the accuracy of subsequent analysis.
[0098] MFCC feature extraction is performed on the preprocessed audio signal to obtain audio data features. Then, PCA dimensionality reduction is performed on the audio data features, retaining features with a cumulative variance contribution of 95% to reduce feature dimensionality and improve the efficiency and accuracy of the random forest algorithm.
[0099] Using the processed modeling data, a leak detection model is established using the random forest algorithm. The processed real-time detection data is then input into the leak detection model to obtain detection results. Early warnings are issued based on the detection results, and feedback from the terminal is obtained. The model is then optimized based on the terminal feedback to improve the accuracy and stability of leak detection.
[0100] In summary, the secondary water supply leakage detection method of this embodiment, through steps such as data acquisition, preprocessing, feature extraction, dimensionality reduction, model training and detection, early warning and model optimization, can effectively detect pipeline leakage and has high accuracy and real-time performance.
[0101] The above technical solution achieves the following results: By collecting audio data from different water pipe angles and grouping and labeling it, modeling data is obtained. The characteristics of different pipes are fully considered, improving the accuracy of leak detection. Recording equipment is set up, and real-time detection data is obtained by acquiring audio data in real time. This allows for timely response and rapid detection of leaks. The preprocessing stage includes format conversion, filtering, and amplification. Filtering aims to remove noise and interference, retaining the leak signal; reducing the false alarm rate and improving the reliability of leak detection; MFCC feature extraction is performed on the preprocessed audio signal to obtain the audio data features. Then, PCA dimensionality reduction is used to retain features with a cumulative variance contribution of up to 95%, which reduces feature dimensionality and improves the efficiency and speed of the algorithm. A random forest algorithm is used to build a leak detection model, and the processed real-time detection data is input into the model for detection. The random forest algorithm has high accuracy and robustness, and can effectively detect leaks. In summary, this secondary water supply leak detection method can provide highly accurate and real-time leak detection, and further improves the detection effect and algorithm efficiency through preprocessing, feature extraction, and dimensionality reduction steps.
[0102] Some embodiments of this application describe a secondary water supply leakage detection method, wherein a leakage detection model is established based on the random forest algorithm using processed modeling data; including:
[0103] The dimensionality-reduced modeling audio data features are divided into a training set and a test set; the ratio of the training set to the test set is 6:1.
[0104] The data from the training set is input into a random forest classifier to train the leak detection model; predictions are made using the test set, and the leak detection model is optimized based on the prediction results.
[0105] The working principle of the above technical solution is as follows: Audio data from different water pipe angles is collected, grouped, and labeled to obtain modeling data. The modeling data is preprocessed, including format conversion, filtering, and amplification. Then, MFCC feature extraction is performed on the preprocessed audio signals to obtain audio data features, and PCA dimensionality reduction is used to retain features with a cumulative variance contribution of up to 95%. The dimensionality-reduced modeling audio data features are divided into training and testing sets in a 6:1 ratio. The training set data is input into a random forest classifier to train the leak detection model; the random forest algorithm is an ensemble learning algorithm that can effectively reduce overfitting and improve the model's generalization ability. In the real-time detection stage, the processed real-time detection data is input into the leak detection model for detection; the leak detection model makes predictions based on the learned modeling data features and the random forest algorithm, outputting leak detection results. Predictions are made using the test set, and the leak detection model is optimized based on the prediction results. If the model performs poorly on the test set, the leak detection model can be optimized by adjusting the parameters of the random forest algorithm or by adding more modeling data.
[0106] In summary, this secondary water supply leakage detection method, by establishing a leakage detection model, achieves rapid and accurate identification of real-time detection data, providing an efficient and reliable method for water pipe leakage detection.
[0107] The above technical solution offers the following advantages: It employs an advanced random forest algorithm for modeling, effectively distinguishing between leaking sounds and normal sounds; after training, the model exhibits high accuracy and stability in leak detection. This method eliminates the need for manual inspections by professional technicians; simply installing equipment automatically monitors leak conditions, significantly saving time and labor costs. Data can be transmitted to the cloud for real-time monitoring of leaks in remote water pipes, improving detection flexibility and coverage. Predicting and optimizing the leak detection model using a test set enhances its reliability and robustness, allowing it to better adapt to leak detection tasks under different environments and conditions. This method requires no large-scale modifications or upgrades; only equipment installation and configuration are needed, resulting in lower costs compared to traditional leak detection methods. In summary, this secondary water supply leak detection method offers advantages such as high accuracy, high efficiency, remote monitoring capability, reliability, and cost-effectiveness, providing an effective solution for water pipe leak detection.
[0108] Some embodiments of this application describe a secondary water supply leakage detection method, which involves collecting and grouping audio data from different water pipe angles to obtain modeling data; including:
[0109] Audio data was collected at different water pipe angles to obtain modeling data; the water pipe angles included 0°, 30°, 45°, 60° and 90°.
[0110] The modeling data is first grouped and labeled according to multiple rules, including water pipe angle, water flow size, and presence or absence of leakage; the water flow size is divided into small, medium, and large.
[0111] The leakage data in the first group were grouped into a second group based on the size and number of leaks, and then labeled. Data with leaks were further categorized into small, medium, and large leaks based on the size of the leaks, and single or multiple leaks based on the number of leaks.
[0112] The working principle of the above technical solution is as follows: Audio data from different water pipe angles is collected and classified according to 0°, 30°, 45°, 60°, and 90°. Based on various rules, the modeling data is first grouped and labeled according to water pipe angle, water flow rate, and presence or absence of leaks for subsequent processing. The purpose of selecting different pipe angles during dataset collection is:
[0113] (1) Simulate the distribution of leaking pipes in the real environment as much as possible;
[0114] (2) Enrich the dataset by changing the different angles at which the pipes are placed;
[0115] (3) Selecting a regular angle distribution can radiate a large range of angle distributions through a few angles, reducing unnecessary repeated measurements and making the dataset more concise.
[0116] The closer the dataset is to the real environment and the richer the data in the dataset, the higher the accuracy of the prediction model will be; however, simply increasing the number of measurement angles will only make the dataset redundant, greatly increase the difficulty of dataset classification, and lead to a decline in model performance.
[0117] The first grouping is based on the size of the water flow; the water flow size is divided into large, medium, and small; the methods include the following, which are not specifically limited here.
[0118] Sound volume in decibels (dB): This measures the loudness of the sound produced by flowing water, usually expressed in decibels (dB). Generally, a higher decibel value indicates a larger water flow. A threshold can be set; for example, a flow exceeding X decibels is considered "large," flow between the threshold is considered "medium," and flow below the threshold is considered "small."
[0119] Audio spectrum analysis: By analyzing the spectrum of the sound produced by flowing water, different frequency components can be identified; for example, a deep rumble may correspond to lower frequencies, while a slight ticking may correspond to higher frequencies. The strength of the water flow can be classified based on the dominant frequency components in the spectrum.
[0120] Audio waveform characteristics: By analyzing the sound waveform produced by water flow, some features can be extracted, such as the amplitude, frequency, and duration of wave peaks and troughs. By comparing these features, the intensity of the water flow can be roughly determined.
[0121] The leakage data features in the first group are grouped and labeled according to the size and number of leaking holes. Data with leaks are further categorized into small, medium, and large holes based on size, and single or multiple holes based on the number of holes. Features, including temporal and frequency domain features of the sound, are extracted from each group. These extracted features are used as input to train and model a leak detection model using a random forest algorithm. The leak detection model is then tested using a test set to evaluate its accuracy and stability, and the prediction results are optimized and adjusted. Real-time collected water pipe sound data is input into the leak detection model for analysis and judgment, enabling rapid detection and alarm of leaks. In summary, this method, through steps such as data collection, grouping, feature extraction, random forest algorithm modeling, and model testing, achieves high accuracy and stability in detecting water pipe leaks at different angles and flow rates.
[0122] The effects of the above technical solution are as follows: The purpose of placing water pipes at different angles is to simulate the distribution of leaking pipes in a real-world environment as closely as possible. In practice, the angles of water pipes may vary; therefore, collecting data from different angles can better cover leakage situations under different conditions. Changing the pipe placement angles enriches the dataset. The sound characteristics of leaking water pipes at different angles may differ; collecting data from multiple angles improves the model's generalization ability, making it more accurate in detecting leaks in practical applications. Choosing a regular angle distribution allows for the radiation of a large range of angles from a few angles, reducing unnecessary repeated measurements and making the dataset more concise. This saves time and cost in data collection and processing while still ensuring the diversity and representativeness of the dataset. Grouping and labeling the leakage data according to the size and number of leak holes allows for a more detailed description of the leakage situation. Dividing the leak hole size into small, medium, and large, and the number of leak holes into single and multiple, provides a more comprehensive description of the leakage situation, further improving the model's accuracy and stability. By extracting features from each data set, including temporal and frequency domain features of the sound, leakage data can be quantitatively described from different perspectives. These features can serve as input for model training, helping the model learn and understand the sound characteristics under different leakage conditions. Using the random forest algorithm for training and modeling effectively handles complex classification problems and exhibits high accuracy and stability. Evaluating the leakage detection model using a test set verifies its performance and allows for optimization and adjustment, further improving its accuracy and practicality. Finally, inputting real-time collected water pipe sound data into the leakage detection model for analysis and judgment enables rapid detection and alarm of leakage conditions, helping to promptly identify and address leakage problems and prevent water waste and loss.
[0123] Some embodiments of the secondary water supply leakage detection method of this application include, in which the step of inputting training set data into a random forest classifier to establish a training model, includes:
[0124] N features are randomly selected from different groups with replacement, and the operation is repeated K times to form K feature sets. Decision trees are then built with each of the K feature sets as the root node.
[0125] The method for determining N is as follows:
[0126] Set the initial range of N And N≤100; (if Then N can be a maximum of 100; where N z The total number of features is represented by floor(), which rounds up.
[0127] Multiple different N values are set to obtain model processing efficiency and model output metrics; the model output metrics include accuracy, precision, and recall; a set of K values is preset; the K values satisfy... And K≤100;
[0128] The relationships between N and model processing efficiency and model output metrics were obtained respectively.
[0129] The adjusted N value falls between the N1 value corresponding to the model output efficiency threshold and the N2 value corresponding to the model output index threshold. The preferred value is (N1+N2) / 2; where N2 is the N value that simultaneously satisfies all model output indices; if N2 is a range, then the midpoint of this range is taken as the integer part.
[0130] The method for determining the value of K is similar to that for determining the value of N:
[0131] Select a value for N from the range of possible values, and preset the initial range of K values; the initial range of K values is... And K≤100;
[0132] Set multiple different K values to obtain model processing efficiency and model output metrics;
[0133] The relationships between K and model processing efficiency and model output metrics were obtained respectively.
[0134] The adjusted K value ranges between the K1 value corresponding to the model output efficiency threshold and the K2 value corresponding to the model output index threshold; the preferred value is (K1+K2) / 2.
[0135] The working principle of the above technical solution is as follows: Prepare a set of labeled training datasets, which contain various feature values and corresponding leakage labels; based on the total number of features N... z Determine the range of values for N. And N≤100; (if Then N can be a maximum of 100; where N z The total number of features is given by floor(), which rounds up. Then, N features are randomly selected from different groups with replacement, and this process is repeated K times to form a set of K features.
[0136] Using a random forest classifier, the training set data is input, and K decision trees are built with K feature sets as root nodes. Each decision tree is split based on its feature set, generating an independent decision tree model.
[0137] Within the preset ranges of K and N values, by pre-setting a set of K values and setting multiple different N values, the model processing efficiency and model output metrics are obtained. The model output metrics include accuracy, precision, and recall. Based on the relationship between N values and model processing efficiency and model output metrics, the adjusted range of N values is determined, which lies between the N1 value corresponding to the model output efficiency threshold and the N2 value corresponding to the model output metric threshold; the preferred value is (N1+N2) / 2; where N2 is the N value that simultaneously satisfies all model output metrics; if N2 is a range, the midpoint of this range is rounded down.
[0138] The method for determining the value of K is similar to that for determining the value of N:
[0139] Select a value for N from the range of possible values, and preset the initial range of K values; the initial range of K values is... And K≤100;
[0140] Set multiple different K values to obtain model processing efficiency and model output metrics;
[0141] The relationships between K and model processing efficiency and model output metrics were obtained respectively.
[0142] The adjusted K value ranges between the K1 value corresponding to the model output efficiency threshold and the K2 value corresponding to the model output index threshold; the preferred value is (K1+K2) / 2.
[0143] The calculation method for the model output index is as follows:
[0144] Accuracy: The proportion of samples correctly predicted by the model out of the total samples, calculated as (TP+TN) / (TP+FP+TN+FN); Precision: The proportion of samples predicted as positive by the model that are actually positive, calculated as (TP) / (TP+FP); Recall: The proportion of positive samples correctly predicted by the model out of all positive samples, calculated as (TP) / (TP+FN); F1 score: The harmonic mean of the model's precision and recall, calculated as (2×Precision×Recall) / (Precision+Recall).
[0145] The effects of the above technical solution are as follows: by using a random forest classifier, and by building multiple decision tree models and integrating their prediction results, the accuracy of leak detection can be improved; at the same time, by selecting features and reasonably adjusting the N and K values, the model processing efficiency can be optimized, enabling the leak detection system to respond quickly and process large amounts of data.
[0146] The Random Forest algorithm generates multiple decision trees, which enhances the model's robustness. However, in the construction of each tree, not all features are used for training; instead, a subset is randomly selected. N represents the number of features chosen in each random selection. Random feature selection prevents overfitting. Certain feature combinations may dominate in the training data, but if these features are absent in future data, the model may fail to classify correctly. Random feature selection ensures that the model doesn't solely rely on specific feature combinations from the training data.
[0147] K represents the number of repeated samplings when building the decision tree. Each sampling randomly selects a subset of data from the original dataset to train the decision tree, further improving the model's robustness. K repeated samplings can further increase the model's generalization ability. Since each sampling may select data from a different subset, it ensures that the model does not rely solely on a specific subset of the training data. Simultaneously, multiple repeated sampling and training can reduce the model's variance, thereby improving the model's prediction accuracy. In summary, by setting appropriate N and K values, the random forest algorithm can be made more stable, while avoiding overfitting and improving the model's generalization ability.
[0148] Since each decision tree is built on a different set of features, the importance of each feature in the decision tree can be analyzed to understand the decision-making process of the leak detection model.
[0149] This method is applicable to leak detection problems of varying sizes and types. By adjusting the N and K values, it can be flexibly adapted to different datasets and detection requirements.
[0150] In summary, this technical solution can provide efficient, accurate, and robust leak detection, offering effective support for water resource management and conservation.
[0151] After training on the training set, the data is then tested using the test set.
[0152] In this embodiment, the output model has an accuracy of 0.957 (describing the accuracy of the model's predictions).
[0153] Precision is 1.000 (describing the stability of the prediction model); Recall is 0.882 (describing the accuracy of predicting positive samples out of all actual positive samples); F1 score is 0.938 (measuring the balance between precision and recall).
[0154] Some embodiments of this application describe a secondary water supply leakage detection method, wherein the processed real-time detection data is input into a leakage detection model to obtain the detection result; including:
[0155] The processed real-time detection data is then input into the trained leak detection model.
[0156] Based on the analysis results of the leakage detection model, determine whether there is a leakage; if the prediction result is a leakage, draw the original audio and the audio after removing the silence, and cut it to a preset length for display;
[0157] Set a waiting time interval, and repeatedly execute multiple processed real-time leakage signals within the waiting time interval. The preferred waiting time is 10 seconds.
[0158] The working principle of the above technical solution is as follows: The raw data detected in real time is preprocessed, including filtering, noise reduction, and mute removal. This preprocessed real-time detection data is then input into a pre-trained leak detection model. The random forest model analyzes and predicts based on the input feature values. The leak detection model analyzes the input data and provides corresponding detection results. If the prediction result is a leak, it indicates that a leak exists. Based on the leak detection results, the system can perform corresponding processing. The system draws both the original audio and the audio after removing mute, and truncates them to a preset length for display, allowing users to more intuitively understand the leak situation. A waiting time interval is set, and the system will repeatedly process and detect real-time leak signals according to this interval, achieving continuous, real-time leak detection. During the waiting time interval, the system can continue to collect and process new real-time data and perform the next round of leak detection.
[0159] The advantages of the above technical solution are as follows: This method can acquire and process audio data in real time, and input the processed real-time detection data into the leak detection model to quickly obtain detection results. If a leak is detected, an early warning signal can be issued in a timely manner so that corresponding measures can be taken for repair or treatment. This greatly improves the real-time performance and accuracy of leak detection, and reduces water waste and safety risks caused by leaks. This method can draw the original audio and the audio after removing silence, and cut out a preset length for display, making the identification and analysis of leak signals more intuitive and easier to understand. This helps users better understand the leak situation and further verify the accuracy and reliability of the model. By setting a waiting time interval, this method can repeatedly execute the detection of multiple processed real-time leak signals. This greatly improves the automation and efficiency of detection, and reduces the possibility of human intervention and misjudgment. At the same time, the waiting time setting can be adjusted according to actual needs to balance the real-time performance and accuracy of detection. This method avoids the inconvenience and cost problems of traditional sensor deployment, and reduces the cost of leak detection. At the same time, through real-time detection and early warning, the efficiency of leak handling is improved, and water waste and safety risks caused by leaks are reduced. This is of great significance for saving water resources, protecting the environment, and improving production safety.
[0160] This application includes several embodiments of a secondary water supply leakage detection method, wherein the step of setting up a recording device and collecting audio data in real time through the recording device includes:
[0161] The number of recording devices should be determined based on the area of the collection area and the density of water pipes.
[0162] The number of recording devices is:
[0163]
[0164] Where P is the number of recording devices; if P is less than 1, then 1 is selected; if P is greater than 1, then the result is rounded up or down. g is the number of water pipes per square meter of projected area. y The number of water pipes per square meter is preset; S is the total projected area of the region. y S is the preset projection area; y The value range is between 35 and 50.
[0165] The working principle of the above technical solution is as follows:
[0166] The number of recording devices required is determined based on the area of the recording area and the density of water pipes. The specific calculation formula is as follows:
[0167]
[0168] Where P is the number of recording devices; if P is less than 1, then 1 is selected; if P is greater than 1, then the result is rounded up or down. g is the number of water pipes per square meter of projected area. y The number of water pipes per square meter is preset; S is the total projected area of the region. y S is the preset projection area; y The value range is between 35 and 50; when P is greater than 1, the recording equipment is evenly distributed according to the area.
[0169] The purpose of this formula is to calculate the required number of recording devices based on the actual area and water pipe density. This formula allows for adjustment of the number of recording devices according to the actual situation, ensuring comprehensive coverage of the audio data collection area. The unit area setting ensures that the sound attenuation range is within a reasonable range, thereby guaranteeing the accuracy and reliability of the audio data. By appropriately setting the number and location of the recording devices, sound changes in different areas can be better captured, and effective leak detection can be performed.
[0170] After calculating the value of P, some special cases need to be handled:
[0171] If P is less than 1, then one recording device is selected, which means that even in cases of low area and low pipe density, at least one recording device needs to be set up to collect audio data.
[0172] If P is greater than 1, the result is rounded to the nearest integer. This ensures that, given a high area and high pipe density, the number of recording devices can be appropriately increased to meet the acquisition needs.
[0173] The above technical solution achieves the following effects: By setting the number of recording devices based on the area of the collection area and the density of water pipes, optimal configuration for audio data acquisition can be ensured under limited resource conditions. This avoids resource waste and improves the efficiency and rationality of resource utilization. A reasonable configuration of the number of recording devices better covers the collection area, ensuring comprehensive audio data acquisition. This helps improve the accuracy and reliability of leak detection and reduces the possibility of missed detections. This method can flexibly adjust the number of recording devices according to actual conditions, adapting to different collection areas and conditions. Whether in large or small areas, and regardless of high or low water pipe density, it can be reasonably configured according to actual needs, improving the applicability and flexibility of the method. The required number of recording devices can be quickly calculated using preset formulas and conditions, simplifying the operation process. Simultaneously, a reasonable configuration of recording devices can improve data acquisition efficiency, shorten data acquisition time, and accelerate the processing speed of leak detection. A reasonable configuration of the number of recording devices can reduce the cost of leak detection, including the costs of equipment purchase, deployment, and maintenance. By optimizing resource allocation, the overall cost of the leak detection system becomes more economical and efficient. In summary, the secondary water supply leak detection method, by adjusting the number of recording devices based on the area of the collection zone and the density of water pipes, can achieve rational resource allocation, improve data coverage, flexibly adapt to different scenarios, simplify operation, increase efficiency, and reduce costs. This helps improve the accuracy and reliability of leak detection and reduce the losses and risks caused by leaks.
[0174] Some embodiments of the secondary water supply leakage detection method of this application, wherein the method of setting up a recording device to collect audio data in real time, further includes:
[0175] Divide the time range and set the sampling frequency according to the time range; specifically:
[0176] The first time range is divided according to the season; a first preset sampling frequency is set within the first time range; the first sampling frequency can be the average sampling frequency of this time range in historical records.
[0177] Divide the flow into groups within the first time range; divide the flow into groups according to the average value of the water volume in different time periods within the first time range in the historical record; where each hour of each day can be used as a time period; set multiple flow ranges, if the water flow within different time periods is within the same range, then it is divided into the same flow group;
[0178] Obtain the historical failure records of the water pipe, and adjust the sampling frequency according to the historical failure probability, the current flow group where it is located, and the usage time of the water pipe;
[0179]
[0180]
[0181] Among them, F is the adjusted sampling frequency of the device; F0 is the first preset sampling frequency; Z is the historical failure probability of the sampling water pipe of the device within the first time range; (if a recording device only samples one water pipe, then Z is the historical failure probability of this water pipe; if a recording device samples multiple water pipes, then Z is the failure probability corresponding to the water pipe with the highest historical failure probability among the multiple water pipes); 0 < Z < 1; L is the usage time of the sampling water pipe corresponding to the device; L y is the expected usage time of the sampling water pipe; (if a recording device only samples one water pipe, L is the usage time of the device corresponding to this sampling water pipe; L y is the expected usage time of the sampling water pipe; (if a recording device samples multiple water pipes, then is the maximum value calculated for multiple water pipes, and the time unit can be days); α is a coefficient 0 < α ≤ 1, D is the total number of flow groups, and I is the flow group where the current time period is located; for example, if the water volume has 3 levels: large, medium, and small, then the total number of flow groups is 3, that is, D = 3, the first flow group I = 1, the second flow group I = 2, the third flow group I = 3, the smaller I is, the smaller the corresponding water volume is. If the current time period belongs to the first flow group, then I = 1.
[0182] The working principle of the above technical solution is as follows: A first time range is divided according to the season, and a first preset sampling frequency is set within this range. The first preset sampling frequency can be the average sampling frequency of this time range in historical records to ensure that the collected audio data has a certain similarity to historical records. For example, in winter, the temperature is relatively low, and the probability of water pipes freezing and bursting is relatively high, so the sampling frequency needs to be appropriately increased. Then, the flow rate is further divided within the first time range; the flow rate is divided according to the water volume in different time periods in historical records, with each hour as a time period. Different time periods within the same range are divided into the same flow rate group; this better adapts to the actual situation of water volume changes in different time periods, improving the accuracy and timeliness of leak detection. Next, historical fault records (leakage records) of the water pipes are obtained, and the sampling frequency is adjusted according to the historical fault probability (leakage probability), flow rate grouping, and the usage time of the water pipes; the formula for adjusting the sampling frequency is:
[0183]
[0184]
[0185] Where F is the adjusted sampling frequency of the device, F0 is the first preset sampling frequency, Z is the historical failure probability of the sampling water pipe corresponding to the device within the first time range, and L is the usage time of the sampling water pipe corresponding to the device. y This represents the estimated usage time of the sampling water pipe. α is a coefficient, D is the total number of flow groups, and I is the flow group for the current time period.
[0186] The above technical solution offers the following advantages: It dynamically adjusts the sampling frequency based on different time ranges and water volume changes, enabling the recording equipment to better adapt to the actual environment and improving the accuracy and reliability of audio data acquisition. By intelligently adjusting the sampling frequency, it can quickly and accurately acquire audio data according to actual conditions, improving the efficiency of leak detection. Simultaneously, it avoids unnecessary sampling and data processing, reducing computational costs. This method comprehensively considers factors such as historical fault records, water pipe usage time, and water volume changes to adjust the sampling frequency, helping to reduce false alarms and missed alarms and improve the accuracy of leak detection. It can flexibly divide time ranges and flow rate groups according to actual conditions, adapting to different collection areas and conditions. It can effectively detect leaks regardless of different seasons or significant water volume variations. It can be further expanded and optimized according to actual needs, such as by adding more historical fault records and water pipe usage time considerations to improve the accuracy and reliability of leak detection. In summary, this secondary water supply leakage detection method, by setting up a recording device to collect audio data in real time and setting the sampling frequency according to the time range, can achieve benefits and effects such as adaptive adjustment, improved efficiency, reduced false alarms and false alarms, flexible adaptation to different scenarios, and scalability; it helps to improve the accuracy and reliability of leakage detection and reduce the losses and risks caused by leakage.
[0187] This application includes embodiments of a secondary water supply leakage detection method, the method further comprising:
[0188] Different indicator signs are set according to different test results;
[0189] Monitor the amount of sampled data in the database and periodically delete redundant data.
[0190] The working principle and effects of the above technical solution are as follows:
[0191] By acquiring audio data in real time and processing and analyzing it, different detection results can be obtained. Different indicator lights can be set according to these results. For example, a yellow indicator light can be set when a leak is detected; a green indicator light can be set when a normal situation is detected; and a red indicator light can be set when an abnormal situation is detected. By setting different indicator lights, the leak detection results can be displayed intuitively, facilitating user judgment and decision-making.
[0192] During leak detection, a large amount of sampling data accumulates in the database over time; this data may contain a significant amount of redundant data, i.e., duplicate or useless data. To save storage space and improve data processing efficiency, it is necessary to periodically monitor the amount of sampling data in the database and delete redundant data. By setting a threshold or based on data usage, the amount of sampling data in the database is checked periodically. If the set threshold is exceeded or certain time conditions are met, redundant data is automatically deleted. This ensures that the amount of data in the database remains within a reasonable range, meeting the needs of leak detection while avoiding unnecessary waste of storage space.
[0193] Through the above steps, this embodiment of the secondary water supply leakage detection method can set different indicator signs according to different detection results, and regularly monitor and delete redundant data in the database. This helps to improve the accuracy and reliability of leakage detection, while optimizing the use of storage space.
[0194] This application embodiment also provides a secondary water supply leakage detection device, the device including a memory and at least one processor, the memory storing a computer program, and the at least one processor being configured to execute the computer program to implement the steps of a secondary water supply leakage detection method.
[0195] This application also provides a computer-readable storage medium for storing a computer program. When the computer program is executed, it implements the steps of the secondary water supply leakage detection method in this application. The specific implementation method is consistent with the implementation method and the technical effect achieved in the above-described secondary water supply leakage detection method, and some contents will not be repeated.
[0196] In this application, a readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. The program product can take the form of any combination of one or more readable media. A readable medium can be a readable signal medium or a readable storage medium. A readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0197] Computer-readable storage media may include data signals propagated in baseband or as part of a carrier wave, carrying readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The readable storage medium may also be any readable medium capable of sending, propagating, or transmitting a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, or any suitable combination thereof. Program code for performing operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java and C++, as well as conventional procedural programming languages such as C or similar programming languages. The program code may be executed entirely on a user computing device, partially on an associated device, as a standalone software package, partially on a user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving remote computing devices, the remote computing devices can be connected to user computing devices via any type of network, including local area networks (LANs) or wide area networks (WANs), or they can be connected to external computing devices (e.g., via the Internet using an Internet service provider).
[0198] This application describes the invention from the perspectives of purpose, performance, progress, and novelty, and it meets the functional enhancement and use requirements emphasized by the Patent Law. The above description and drawings are merely preferred embodiments of this application and are not intended to limit this application. Therefore, all structures, devices, features, etc., that are similar to or identical to those of this application, i.e., all equivalent substitutions or modifications made in accordance with the scope of this patent application, shall fall within the scope of protection of this patent application.
[0199] Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of the invention without departing from the principles and spirit of the invention, and all such changes should fall within the protection scope of the claims of the present invention.
Claims
1. A method for detecting leaks in a secondary water supply system, characterized in that, The method includes: Collect audio data, which includes modeling data and real-time detection data; process the audio data to obtain processed data; Based on the random forest algorithm, a leak detection model is established using the processed modeling data; The processed real-time detection data is input into the leak detection model to obtain the detection results; Based on the detection results, issue early warnings and obtain terminal feedback results; optimize the model based on the terminal feedback results. The collected audio data includes: Audio data from different water pipe angles was collected, grouped, and labeled to obtain modeling data; Real-time audio data is collected through recording equipment to obtain real-time detection data; The water pipe angles included 0°, 30°, 45°, 60°, and 90°; the audio data collected at different water pipe angles was grouped and labeled as follows: The modeling data is first grouped and labeled according to multiple rules, including pipe angle, water flow rate, and presence or absence of leakage. The leakage data features in the first group are grouped into a second group according to the size and number of leakage holes and then marked.
2. The secondary water supply leakage detection method according to claim 1, characterized in that, The audio data is processed to obtain processed data, including: The audio data is preprocessed to obtain a preprocessed audio signal; the preprocessing includes format conversion, filtering, and amplification. MFCC feature extraction is performed on the preprocessed audio signal to obtain audio data features; The audio data features are subjected to PCA dimensionality reduction; features whose cumulative variance contribution reaches a preset ratio are retained.
3. The secondary water supply leakage detection method according to claim 2, characterized in that, The method, based on the random forest algorithm, establishes a leak detection model using processed modeling data; including: The features of the modeled audio data after dimensionality reduction are divided into training and testing sets; The data from the training set is input into a random forest classifier to train the leak detection model; predictions are made using the test set, and the leak detection model is optimized based on the prediction results.
4. The secondary water supply leakage detection method according to claim 3, characterized in that, The step of inputting the training set data into a random forest classifier to build a training model includes: N features are randomly selected from different groups with replacement, and the operation is repeated K times to form K feature sets. Decision trees are then built with each of the K feature sets as the root node. The method for determining N is as follows: Set the initial range of N. And N 100; of which The total number of features is represented by floor(), which rounds up. Preset a set of K values and set multiple different N values to obtain model processing efficiency and model output metrics; The relationships between N and model processing efficiency and model output metrics were obtained respectively. The adjusted N value ranges between the N1 value corresponding to the model output efficiency threshold and the N2 value corresponding to the model output index threshold.
5. The secondary water supply leakage detection method according to claim 1, characterized in that, The processed real-time detection data is input into the leak detection model to obtain the detection results; include: The processed real-time detection data is then input into the trained leak detection model. Based on the analysis results of the leakage detection model, determine whether there is a leakage; if the prediction result is a leakage, draw the original audio and the audio after removing the silence, and cut it to a preset length for display; Set a waiting time interval, and then repeatedly execute multiple processed real-time water leakage signals within that time interval.
6. The secondary water supply leakage detection method according to claim 1, characterized in that, The real-time acquisition of audio data via a recording device includes: The number of recording devices should be determined based on the area of the collection area and the density of water pipes. The number of recording devices is: Where P is the number of recording devices. If P is less than 1, then select 1. If P is greater than 1, then round up or down according to the calculation result. g is the number of water pipes per square meter of projected area. The preset number of water pipes per square meter; S is the total projected area of the region. This is the preset projection area.
7. The secondary water supply leakage detection method according to claim 1, characterized in that, The method of acquiring audio data in real time through a recording device also includes: Divide the time range and set the sampling frequency according to the time range; specifically: Divide the first time range according to the season; set the first preset sampling frequency within the first time range; The flow rate is divided into groups based on the first time frame; the flow rate is also divided into groups based on the amount of water in different time periods in historical records. Obtain historical fault records of water pipes, and adjust the sampling frequency based on historical fault probability, current flow group, and water pipe usage time; Where F is the sampling frequency after the device is adjusted; Z represents the first preset sampling frequency; Z represents the historical failure probability of the sampling water pipe corresponding to the device within the first time range; L represents the usage time of the sampling water pipe corresponding to the device. This is the estimated usage time of the sampling water pipe; The coefficient is determined by the current traffic group. .
8. The secondary water supply leakage detection method according to claim 1, characterized in that, The method further includes: Different indicator signs are set according to different test results; Monitor the amount of sampled data in the database and periodically delete redundant data.
9. A secondary water supply leakage detection device, characterized in that, The apparatus includes a memory and at least one processor, the memory storing a computer program, and the at least one processor being configured to, when executing the computer program, implement the steps of the method as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Method and system for identifying and monitoring pipeline leakage
CN116228770A
Noisemeter intelligent detection method
CN116447526A