Water plant water pump water spraying hazard source detection method based on YOLOv8 and CBAM attention mechanism
By constructing a self-made dataset and embedding a YOLOv8 model with the CBAM attention mechanism, the limitations and accuracy issues of water pump spraying fault detection in water plants were resolved. This enabled precise, automated, and scenario-based detection of water pump spraying hazards, improving detection efficiency and applicability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHONGQING UNIV OF TECH
- Filing Date
- 2025-12-16
- Publication Date
- 2026-05-15
AI Technical Summary
Existing technologies for detecting water pump spraying faults in water plants suffer from limitations of manual inspections, mismatch between datasets and scenarios, and insufficient model recognition accuracy, making it difficult to achieve accurate, automated, and scenario-based detection.
We constructed and optimized a self-made dataset, embedded a YOLOv8 model with the CBAM attention mechanism, and enhanced the features of the water spray target through field collection, data augmentation and annotation processing, combined with channel and spatial attention mechanisms, to train and infer the model and achieve automated detection.
It enables precise, automated, and scenario-based detection of water pump spray hazards, reduces blind spots and false detection rates in manual inspections, improves detection efficiency and applicability, and ensures the stable operation of the water supply system.
Smart Images

Figure CN122049795A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of target detection and industrial equipment fault detection technology, specifically a method for detecting hazardous sources of water pump spraying in water plants based on YOLOv8 and CBAM attention mechanisms. Background Technology
[0002] As the core power equipment of the water supply system, water pumps in water plants are susceptible to water spraying malfunctions. Failure to identify these malfunctions in a timely manner can lead to equipment corrosion, mechanical failures, and even water supply interruptions, directly impacting water supply stability and production safety. Current detection technologies in this field mainly revolve around three approaches: manual inspection, adaptation to general network datasets, and application of traditional YOLOv8 models. However, all of these approaches have significant shortcomings and are insufficient to meet the accurate detection needs of real-world water plant scenarios, as detailed below:
[0003] 1. Inherent drawbacks of traditional manual inspection methods:
[0004] As a basic inspection method that has been used in water plants for a long time, relying on staff to periodically go to the site to check for water pump spraying faults through visual observation and tool measurement has significant limitations: First, the coverage is limited. Water plants have a large number of water pumps, which are widely distributed, and some equipment is located in narrow spaces or dense pipeline areas, which can easily create blind spots in the inspection. Second, it is inefficient. It cannot achieve 24-hour continuous monitoring, and sudden spraying faults are difficult to detect in time. The delayed response can easily lead to the expansion of the fault. Third, it is highly subjective. The identification results depend on the experience of the staff, and it is easy to miss or misdetect due to fatigue and visual errors. Moreover, the inspection data is mostly paper records, which are difficult to trace and statistically analyze.
[0005] 2. The inapplicability of publicly available online datasets to real-world water treatment plant environments:
[0006] Some detection solutions directly use publicly available general object detection datasets to train models for water pump spray detection in water plants, which has serious scene adaptation problems: First, the data scenes are very different, and the collection environment and target shape of the publicly available datasets do not match the real scene of the water plant; second, the target features do not match, and the publicly available datasets lack background information such as pipe interfaces and equipment outlines specific to water plant pumps, which makes it impossible for the trained model to accurately identify spray targets in real scenes.
[0007] 3. The traditional YOLOv8 model has limitations when directly used for water jet recognition:
[0008] Applying the traditional YOLOv8 model without scene adaptation optimization to a water plant scenario reveals significant performance shortcomings: First, feature extraction lacks specificity. The backbone network of traditional YOLOv8 typically employs general convolution and pooling operations, failing to actively enhance core features such as irregular water flow edges and dynamic spray targets. It can only process all features indiscriminately, resulting in insufficient feature capture accuracy for non-rigid, dynamic targets like water spray. Second, it has poor resistance to interference from complex backgrounds. In a water plant scenario, background noise such as equipment shadows, pipe reflections, ground water stains, and alternating light and shadow can easily be confused with water spray features. Traditional YOLOv8 lacks a feature filtering mechanism and cannot effectively distinguish between targets and background, leading to a high false detection rate.
[0009] Therefore, a new solution is needed to address the above problems. Summary of the Invention
[0010] The purpose of this invention is to provide a method for detecting water pump spraying hazards in water plants based on YOLOv8 and CBAM attention mechanisms, which solves the problems of limitations of manual inspection, mismatch between datasets and scenarios, and insufficient model recognition accuracy in the existing technology, and realizes the accuracy, automation, and scenario-based detection of water pump spraying hazards in water plants.
[0011] To achieve the above objectives, the present invention provides the following technical solution: a method for detecting hazardous sources of water pump spraying in water treatment plants based on YOLOv8 and CBAM attention mechanisms, comprising at least the following steps:
[0012] S1: Construct and optimize a self-made dataset;
[0013] S2: Construct a CBAM-YOLOv8 fusion model, and design the fusion of CBAM attention module and YOLOv8;
[0014] S3: Perform model training and inference to achieve automatic identification of water spray hazard sources.
[0015] Furthermore, S1 includes at least the following steps:
[0016] S1.1: On-site scene collection and shooting. Personnel were arranged to go to the actual operation area of the water plant to conduct on-site shooting under different conditions and collect water pump spray samples in real environment to ensure that the dataset is highly consistent with the actual application scenario.
[0017] S1.2: Sample equalization processing. To address the issue of a low proportion of water spraying failure samples in the self-made dataset, data augmentation techniques are used to expand the water spraying samples, making the proportion of water spraying samples match the model training requirements and alleviating the training bias caused by sample imbalance.
[0018] S1.3: Annotation processing. For the collected sample images, the target detection annotation tool is used to accurately annotate the water spraying areas in the image, clearly defining the boundaries of each water spraying area and clearly identifying the specific location of the water spraying in the image. This provides intuitive and clear supervision information for model training, helping the model to quickly learn the regional features of the water spraying target.
[0019] Furthermore, the different situations in S1.1 include at least different types of water pumps, different operating conditions such as normal operation, water spray failure, different time periods, and different lighting conditions.
[0020] Furthermore, the data augmentation techniques include at least horizontal flipping, vertical flipping, random rotation, adaptive brightness adjustment, and random cropping.
[0021] Furthermore, S2 includes at least the following steps:
[0022] S2.1: Embed the CBAM attention module before the SPPF module of the YOLOv8 model. This position is the connecting node between feature extraction and multi-scale feature fusion, which can perform targeted enhancement and filtering of deep features output by the backbone network without changing the original YOLOv8 network structure and inference process.
[0023] S2.2: The CBAM module, through the synergistic effect of channel attention and spatial attention, first filters out the feature channels that are more critical to water spray detection, strengthening the response of core features. These core features include at least water mist texture and water flow contour. Then, it focuses on the positional information of the water spray area in the image, assigning high weight to the target area, while simultaneously reducing interference from the background area. The background area includes at least weakening equipment shadows and pipe reflections, thus achieving accurate purification of effective features.
[0024] S2.3: Implement feature transfer design, directly input the enhanced features output by the CBAM module into the SPPF module of YOLOv8 for multi-scale pooling fusion, maintain the integrity of subsequent feature fusion, detection head prediction and other links, and ensure the coherence of model inference logic.
[0025] Furthermore, S3 includes at least the following steps:
[0026] S3.1: Training environment configuration. Based on the PyTorch deep learning framework, a model training platform is built, the training batch size is set to 12, the initial learning rate is 0.001, the Adamw optimizer is used, and the training is iterated for 100 rounds to ensure that the model converges fully.
[0027] S3.2: Inference process design: Deploy the trained fusion model to a regular server or computer, directly read the real-time images of water pumps collected by the existing monitoring cameras in the water plant, and output the location coordinates and confidence level of the water spray target through model inference to complete the automatic identification of water spray hazard sources.
[0028] Compared with the prior art, the beneficial effects of the present invention are:
[0029] 1. Significantly enhanced feature focusing capability: This invention uses the dual feature enhancement and filtering of the CBAM attention mechanism to capture the core features of the water spraying target in a targeted manner, and achieves accurate feature focusing on difficult-to-identify targets such as minor leaks and long-distance water spraying; at the same time, it greatly reduces the interference of complex background noise in water plants, making the model's logic for distinguishing water spraying areas from the background more in line with the actual scene.
[0030] 2. Strong scene adaptability: This invention supplements and equalizes the scene of the self-made dataset, and combines it with targeted optimization of the model, so that the model can adapt to detection scenarios with different types of water pumps, different lighting conditions, and different water spray intensities. This solves the problems of unsuitable network datasets and poor generalization of traditional models, and has a wider range of applications.
[0031] 3. Replaces manual inspection and improves detection efficiency. This invention enables 24-hour automatic and continuous detection of water pump spraying hazards, eliminates blind spots and lag in manual inspection, quickly outputs fault information, provides timely basis for equipment maintenance, and effectively reduces the risk of fault expansion.
[0032] 4. Low deployment cost and easy to promote: This invention does not require new hardware equipment, sensors or modification of existing monitoring systems. It fully reuses the existing monitoring image resources and self-made datasets of water plants. It can be achieved by simply upgrading the software algorithm. The deployment threshold is low and the cost is controllable, making it easy to promote and apply on a large scale in various water plants.
[0033] 5. Highly practical: The water spray confidence level, location coordinates, and other information output by this invention can directly support water plant equipment maintenance decisions, help staff accurately locate fault points, prioritize the handling of serious faults, improve operation and maintenance efficiency, and ensure the stable operation of the water supply system. Attached Figure Description
[0034] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0035] Figure 1 This is a flowchart of the technology of the present invention;
[0036] Figure 2 This is a diagram of the YOLOv8 network structure after incorporating CBAM in this invention;
[0037] Figure 3 This is a partial image of the self-made dataset of this invention;
[0038] Figure 4 This is a schematic diagram of the normalized confusion matrix of the present invention;
[0039] Figure 5 This is a schematic diagram of the performance evaluation curve of the model of the present invention. Detailed Implementation
[0040] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.
[0041] This invention aims to provide a method for detecting hazardous sources of water pump spraying in water treatment plants based on the YOLOv8 and CBAM attention mechanism. Using a self-made water pump spraying dataset as the core training foundation, it addresses the core shortcomings of existing technologies through pure algorithmic collaborative optimization. The specific technical problems are as follows:
[0042] 1. Overcomes the limitations of traditional manual inspection: Automatically and continuously detects water pump spraying hazards 24 hours a day, eliminating blind spots, improving detection efficiency and timeliness, and reducing the risk of missed or false detections caused by manual labor intensity and subjective errors;
[0043] 2. Solve the problem of mismatch between publicly available online datasets and real water plant scenarios: Relying on the scenario-specific advantages of self-made datasets, through dataset optimization and model adaptation, the trained model can accurately match the target shape and background environment of water pumps spraying water in water plants, avoiding recognition failures caused by differences in data scenarios;
[0044] 3. Optimize the training adaptability of the self-made dataset: In view of the inherent characteristics of imbalanced samples and limited scene coverage in the self-made dataset, the quality of the dataset is improved through data augmentation, detailed annotation and other means. Combined with the adjustment of the model loss function, the model training bias problem is solved and the support of the dataset for detection performance is strengthened.
[0045] 4. Overcome the technical shortcomings of traditional YOLOv8 models: By embedding the CBAM attention mechanism, the model's ability to extract features from small-sized water spray targets is improved, and its resistance to interference from complex backgrounds in water plants is enhanced, while maintaining real-time detection, thus achieving accurate identification and localization of water spray targets;
[0046] 5. Ultimately, the goal is to achieve "precise, automated, and scenario-based" detection of water pump spray hazards in water plants, providing accurate and timely data for equipment maintenance and fault handling, reducing production safety risks, and ensuring the stable operation of the water supply system.
[0047] Please see Figures 1-5 A method for detecting hazardous sources of water pump spraying in water treatment plants based on YOLOv8 and CBAM attention mechanisms includes at least the following steps:
[0048] S1: Construct and optimize a self-made dataset;
[0049] S2: Construct a CBAM-YOLOv8 fusion model, and design the fusion of CBAM attention module and YOLOv8;
[0050] S3: Perform model training and inference to achieve automatic identification of water spray hazard sources.
[0051] S1 includes at least the following steps:
[0052] S1.1: On-site scene collection and shooting. Personnel were arranged to go to the actual operation area of the water plant to conduct on-site shooting under different conditions and collect water pump spray samples in real environment to ensure that the dataset is highly consistent with the actual application scenario.
[0053] S1.2: Sample equalization processing. To address the issue of a low proportion of water spraying failure samples in the self-made dataset, data augmentation techniques are used to expand the water spraying samples, making the proportion of water spraying samples match the model training requirements and alleviating the training bias caused by sample imbalance.
[0054] S1.3: Annotation processing. For the collected sample images, the target detection annotation tool is used to accurately annotate the water spraying areas in the image, clearly defining the boundaries of each water spraying area and clearly identifying the specific location of the water spraying in the image. This provides intuitive and clear supervision information for model training, helping the model to quickly learn the regional features of the water spraying target.
[0055] The different situations in S1.1 include at least different types of water pumps, different operating conditions such as normal operation, water spray failure, different time periods, and different lighting conditions.
[0056] Data augmentation techniques include at least horizontal flipping, vertical flipping, random rotation, adaptive brightness adjustment, and random cropping.
[0057] S2 includes at least the following steps:
[0058] S2.1: Embed the CBAM attention module before the SPPF module of the YOLOv8 model. This position is the connecting node between feature extraction and multi-scale feature fusion, which can perform targeted enhancement and filtering of deep features output by the backbone network without changing the original YOLOv8 network structure and inference process.
[0059] S2.2: The CBAM module, through the synergistic effect of channel attention and spatial attention, first filters out the feature channels that are more critical to water spray detection, strengthening the response of core features. Core features include at least water mist texture and water flow contour. Then, it focuses on the positional information of the water spray area in the image, assigning high weight to the target area, while reducing background interference. Background interference includes at least weakening equipment shadows and pipe reflections, thus achieving accurate purification of effective features.
[0060] S2.3: Implement feature transfer design, directly input the enhanced features output by the CBAM module into the SPPF module of YOLOv8 for multi-scale pooling fusion, maintain the integrity of subsequent feature fusion, detection head prediction and other links, and ensure the coherence of model inference logic.
[0061] S3 includes at least the following steps:
[0062] S3.1: Training environment configuration. Based on the PyTorch deep learning framework, a model training platform is built, the training batch size is set to 12, the initial learning rate is 0.001, the Adamw optimizer is used, and the training is iterated for 100 rounds to ensure that the model converges fully.
[0063] S3.2: Inference process design: Deploy the trained fusion model to a regular server or computer, directly read the real-time images of water pumps collected by the existing monitoring cameras in the water plant, and output the location coordinates and confidence level of the water spray target through model inference to complete the automatic identification of water spray hazard sources.
[0064] Table 1: Data related to model training after embedding CBAM
[0065]
[0066] In summary, the present invention has the following technical features:
[0067] 1. The present invention features a targeted attention fusion design. Before precisely embedding the CBAM attention module into the SPPF module of YOLOv8, it utilizes the logic of "first purifying features and then multi-scale fusion" to selectively enhance the key features of the water spray target and suppress background interference through a dual attention mechanism of channel and space, thereby achieving selective optimization of feature extraction.
[0068] 2. This invention has optimized the self-made dataset. From field collection and sample enhancement to scene supplementation and accurate annotation, the entire process is designed around the characteristics of the self-made water plant spray dataset, realizing the collaborative optimization of the dataset and model and solving the scene adaptation problem.
[0069] 3. This invention is implemented using a lightweight pure algorithm, without the need for additional hardware devices or sensors. It improves the recognition effect while ensuring real-time detection through module fusion and parameter optimization at the algorithm level. It has low deployment cost and strong adaptability.
[0070] 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 method for detecting hazardous sources of water pump spraying in water treatment plants based on YOLOv8 and CBAM attention mechanism, characterized in that: At least the following steps are included: S1: Construct and optimize a self-made dataset; S2: Construct a CBAM-YOLOv8 fusion model, and design the fusion of CBAM attention module and YOLOv8; S3: Perform model training and inference to achieve automatic identification of water spray hazard sources.
2. The method for detecting hazardous sources of water pump spraying in water treatment plants based on YOLOv8 and CBAM attention mechanism according to claim 1, characterized in that: S1 includes at least the following steps: S1.1: On-site scene collection and shooting. Personnel were arranged to go to the actual operation area of the water plant to conduct on-site shooting under different conditions and collect water pump spray samples in real environment to ensure that the dataset is highly consistent with the actual application scenario. S1.2: Sample equalization processing: Data augmentation techniques are used to expand the water spray samples so that the proportion of water spray samples matches the model training requirements and alleviates the training bias caused by sample imbalance. S1.3: Annotation processing. For the collected sample images, the target detection annotation tool is used to accurately annotate the water spraying areas in the image, clearly defining the boundaries of each water spraying area and clearly identifying the specific location of the water spraying in the image. This provides intuitive and clear supervision information for model training, helping the model to quickly learn the regional features of the water spraying target.
3. The method for detecting hazardous sources of water pump spraying in water treatment plants based on YOLOv8 and CBAM attention mechanism according to claim 2, characterized in that: The different situations in S1.1 include at least different types of water pumps, different operating conditions such as normal operation, water spray failure, different time periods, and different lighting conditions.
4. The method for detecting hazardous sources of water pump spraying in water treatment plants based on YOLOv8 and CBAM attention mechanism according to claim 2, characterized in that: The data augmentation techniques include at least horizontal flipping, vertical flipping, random rotation, adaptive brightness adjustment, and random cropping.
5. The method for detecting hazardous sources of water pump spraying in water treatment plants based on YOLOv8 and CBAM attention mechanism according to claim 2, characterized in that: S2 includes at least the following steps: S2.1: Embed the CBAM attention module before the SPPF module of the YOLOv8 model. This position is at the junction of feature extraction and multi-scale feature fusion. S2.2: The CBAM module, through the synergistic effect of channel attention and spatial attention, first filters out the feature channels that are more critical to water spray detection, strengthening the response of core features. These core features include at least water mist texture and water flow contour. Then, it focuses on the positional information of the water spray area in the image, assigning high weight to the target area, while simultaneously reducing interference from the background area. The background area includes at least weakening equipment shadows and pipe reflections, thus achieving accurate purification of effective features. S2.3: Implement feature transfer design, directly input the enhanced features output by the CBAM module into the SPPF module of YOLOv8 for multi-scale pooling fusion, maintain the integrity of the process, and ensure the coherence of the model inference logic.
6. The method for detecting hazardous sources of water pump spraying in water treatment plants based on YOLOv8 and CBAM attention mechanism according to claim 5, characterized in that: The S3 includes at least the following steps: S3.1: Training environment configuration. Based on the PyTorch deep learning framework, a model training platform is built, the training batch size is set to 12, the initial learning rate is 0.001, the Adamw optimizer is used, and the training is iterated for 100 rounds to ensure that the model converges fully. S3.2: Inference process design: Deploy the trained fusion model to a regular server or computer, directly read the real-time images of water pumps collected by the existing monitoring cameras in the water plant, and output the location coordinates and confidence level of the water spray target through model inference to complete the automatic identification of water spray hazard sources.