Method for Automatic Detection of Underwater Dam Defects Based on Underwater Robot and Improved YOLOv8

The method addresses inefficiencies in underwater dam defect detection by using an improved YOLOv8 model with deformable convolutional networks and large kernel attention, enabling efficient and accurate real-time detection of underwater dam defects.

US20260378035A1Pending Publication Date: 2026-11-26DALIAN UNIV OF TECH +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
US19/218126
Authority / Receiving Office
US · United States
Patent Type
Applications(United States)
Current Assignee / Owner
Filing Date
2025-05-23
Publication Date
2026-11-26

AI Technical Summary

Technical Problem

Current methods for detecting underwater dam defects are inefficient, labor-intensive, and lack systematic, accurate solutions due to the complex underwater environment, which causes challenges such as color distortion, motion blur, and low contrast in images captured by underwater robots.

Method used

An automatic detection method using an underwater robot and an improved YOLOv8 model, involving data collection, labeling, network structure enhancement with deformable convolutional networks and large kernel attention, and real-time deployment for efficient and accurate detection of underwater dam defects.

Benefits of technology

The method provides real-time, efficient, and accurate detection of underwater dam defects, reducing manual effort and improving detection accuracy by enhancing the YOLOv8 network's ability to handle irregular shapes and lighting issues, thus ensuring dam safety.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure US20260378035A1-D00000_ABST
    Figure US20260378035A1-D00000_ABST
Patent Text Reader

Abstract

A method for automatic detection of underwater dam defects based on an underwater robot and improved YOLOv8, includes the following steps: obtaining, by an underwater robot equipped with an underwater high-definition camera, the video of underwater dam defects, and extracting images of underwater defects; labeling, by the LabelImg software, the images of defects, to form a dataset for underwater dam defect detection; improving a YOLOv8 network structure for underwater defect detection, to obtain an improved YOLOv8 model; training and improving the YOLOv8 model by using the dataset for underwater dam defect detection, to obtain a model for underwater dam defect detection; and building, based on PyQT5, a human-machine interaction interface of a system for underwater dam defect detection, deploying it on a mobile workstation, and combining it with the underwater robot to build a real-time system for underwater dam defect detection.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure belongs to the fields of dam defect detection, deep learning, and underwater robot, and in particular relates to a method for automatic detection of underwater dam defects based on underwater robot and improved YOLOv8 (You Only Look Once v8).BACKGROUND

[0002] Dams, as an important water infrastructure, play an important role in promoting economic and social development. They have a variety of functions, including water supply, power generation, and flood control. However, dam failure may lead to catastrophic loss of life and property downstream. With the complex interaction of time and environmental erosion and other factors, internal chemical reactions and structural loads can gradually lead to deterioration of concrete dams, resulting in various defects such as cracks, spalling, and exposed rebars, which can seriously affect the strength, durability, and overall stability of the structure. Therefore, ensuring timely detection, monitoring, and repair of these defects is crucial for maintaining the safe operation of dams.

[0003] Defects in dams often occur or appear on the surface of the structure, not only threatening the operation of concrete dams, but also causing other defects to dams. For the detection of apparent defects in the above-water part of dams, advanced detection methods based on technologies such as cameras, unmanned aerial vehicles, and computer vision have been developed, improving detection efficiency. However, the detection of defects in the underwater part of dams remains a difficult problem to solve. Xu et al. applied ground penetrating radar technology to detect underwater defects in hydraulic buildings, which can detect hidden dangers such as uneven settlement and cracks in impermeable carpet or apron underwater structures with high accuracy; Venkatesh et al. operated a remote operated vehicle (ROV) equipped with ultrasonic equipment to detect underwater defects, demonstrating the feasibility of ultrasonic pulse method in underwater detection; Ma et al. performed image enhancement and segmentation of underwater cracks based on an ROV equipped with a binocular camera, and combined the calculated disparity map and segmentation map to determine widths of the cracks. The use of ROV for underwater dam detection is currently an important trend, but the underwater dam surface has a wide range and a large area, resulting in a large amount of video data, and manual visual detection is time-consuming and labor-intensive. Moreover, underwater environment is more complex than above-water environment. Since light is absorbed by the medium and scattered by suspended particles during propagation in water, underwater dam images captured by underwater robots often face a variety of challenges, including color distortion, motion blur, low contrast, uneven lighting, etc. Therefore, the detection and identification of images of underwater dam defects is a difficult problem, and there is currently no systematic, efficient and accurate method for detecting images of underwater dam defects.SUMMARY

[0004] In view of this, an objective of the present disclosure is to propose a method for automatic detection of underwater dam defects based on underwater robot and improved YOLOv8, which is used to detect a variety of underwater dam defects, ensuring an efficient, accurate and real-time detection.

[0005] The technical solution of the present disclosure is:

[0006] A method for automatic detection of underwater dam defects based on underwater robot and improved YOLOv8, which includes the following step S1 to step S6.S1: Data Collection

[0007] An underwater robot is operated to collect data on underwater dam defects at upstream of a dam, where due to scattering and attenuation of light during propagation in water, a lighting fixture needs to be turned on in deep water environment, and various data on underwater dam defects is collected at a distance of 20-50 cm from a dam surface, from different angles; and data processing is performed on the captured underwater video, and defect image frames are manually extracted by a VLC (Video LAN Client) video player to finally obtain an image dataset for training an improved YOLOv8, including crack, spalling, and exposed rebar defects.S2: Data Processing

[0008] For features of cracks, spalling, and exposed rebars in underwater dam defects, defect labeling meets the following standards: for cracks and exposed rebars mostly with elongated features, labeling boxes with an aspect ratio ranging from 3:1 to 5:1 are selected for the labeling of cracks and exposed rebars; for spalling mostly with a blocky feature, labeling boxes with an aspect ratio ranging from 2:1 to 1:1 are selected for the labeling of spalling; labeling should ensure that all features of a defect are included in a labeling box, while the labeling box should conform to edges of the defect and not contain too many background features.

[0009] Based on the above labeling standards, a LabelImg software is used to manually label the images of underwater dam defects in an image dataset of an improved YOLOv8, and a category and coordinate information of the defect by a rectangular box are indicated, specifically including center point coordinates, a length, a width and a category of the labeling box, which are saved in an .xml file in one-to-one correspondence with an image.

[0010] Further, the dataset for underwater dam defect detection is a VOC format dataset containing the images of underwater dam defects and one-to-one corresponding .xml files, which are converted from .xml files to .txt files for facilitating data reading of the improved YOLOv8 model. The dataset for underwater dam defect detection is randomly divided into a training set, a test set, and a validation set according to a ratio of 7:2:1, for training, validation during training, and final performance testing of the improved YOLOv8 model, respectively. Then the final dataset for underwater dam defect detection is created.S3: Network Structure Improvement(1) Model Building

[0011] A YOLOv8 model is built, which consists mainly of a backbone network (Backbone), a neck network (Neck), and detection heads (Head). First, the images of underwater defects are input into the backbone network to extract features, the extracted features are input into the neck network, and finally the categories of defects in the detection heads are identified and marked. Based on detection efficiency, a detection accuracy and a model parameter size, the depth, width, and maximum number of channels of the model are set to: 0.33, 0.25 and 1024, respectively, that is, YOLOv8n is set as a basic model of the method for detection of underwater dam defects.(2) Model Improvement

[0012] In response to the problem of blurred images and unclear features of underwater defects, which results in poor detection performance of the model, the YOLOv8 network structure is improved, to enhance its ability to detect underwater crack, spalling, and exposed rebar defects.

[0013] The improvements of the YOLOv8 model is specifically as follows:

[0014] The irregular shapes and blurred features of underwater dam defects lead to increased detection difficulty, and the detection performance of the basic model is difficult to meet the detection requirements of actual underwater dam defects. To improve detection accuracy and efficiency, deformable convolutional networks (DCN) are used to change the last C2f module of the backbone network and all C2f modules of the neck network to C2f-DCN modules, which improves the network's ability to adapt to geometrical changes in scale and proportion of underwater dam defects or geometrical transformations of model. The deformable large kernel attention (DLKA) layer is added after the backbone network of the basic model to increase attention to variable size features of defects and enhance the model's ability to identify underwater defects, and finally, the improved YOLOv8 model is obtained.S4: Model Training

[0015] Based on the dataset for underwater dam defect detection created in step S2, the improved YOLOv8 model built in step S3 is trained and optimized, and hyperparameters are optimized based on the results on the training set and the test set, to obtain a model with an optimal combination of detection accuracy, detection efficiency and model size, where the main steps of model training are as follows:

[0016] (1) The hyperparameters for training the network are set, such as training epoch, batch size, initial learning rate (lr), and iterative rounds for closing mosaic training. The hyperparameters are adjusted to ensure that the network is trained to converge and does not overfit, and a model parameter file best.pt is saved in folder weights after model training is completed.

[0017] (2) The best.pt is loaded to initialize the model, and detection performance testing on the trained YOLOv8 model is performed based on the test set. The detection performance of the model is evaluated using evaluation metrics including precision (P), recall (R), F1-score, average precision (AP), mean AP (mAP), and frame per second (FPS) for various types of defects, where P, R, F1-score, AP and mAP are in the range of [0, 1], the closer the values are to 1, the better the detection performance of the model is. FPS should be greater than 30 in order to meet the needs of real-time detection. According to the evaluation metrics, different hyperparameters are set, different models are trained, and the model with the best combination of the metrics is used for the real-time detection of underwater dam defects.S5: Model Deployment

[0018] YOLOv8 detection model weights obtained from training are deployed on a mobile workstation, a human-machine interaction interface is built based on a PyQt5 (Python Qt) framework, and a real-time detection system for underwater dam defect is built by combining the human-machine interaction interface with the underwater robot, where a high-definition camera carried by the underwater robot captures a underwater dam scene in real time and transmits it to a ground workstation for instant detection, while the defect detection results are displayed on the workstation and stored locally.

[0019] Further, to satisfy the requirements of defect detection, a software interface of the real-time system for underwater dam defect detection is divided into three main modules: an operation area, a main window, and a result statistics area. The operating area is used for loading model, initializing parameters, selecting functions, etc. The main window is used for displaying input images, videos, and detected image data. The result statistics area is used for displaying real-time detection results, including types, confidence levels, and locations of defects.

[0020] S6: The underwater robot is operated to detect an underwater part of a hydraulic building in a reservoir. ROV inspection plan should be designed based on the actual site, including the speed of the robot, the distance from the building, brightness of a lighting fixture, etc. The detection results and reports are generated by the detection system for underwater dam defect.

[0021] Compared with the conventional technology, the present disclosure has the following beneficial effects:

[0022] (1) The present disclosure provides a real-time efficient detection of underwater dam defects based on the improved YOLOv8 deep learning detection network, which can reduce the cost and danger of manual underwater detection, and improve the efficiency of underwater defect detection in hydraulic buildings.

[0023] (2) The present disclosure improves the YOLOv8 network structure to be suitable for the detection of images of underwater defects, improves the detection accuracy of underwater dam defects, enhances the robustness of the network, and effectively reduces interference such as color distortion, motion blur, low contrast, and uneven lighting.

[0024] (3) The present disclosure combines underwater robot, ground mobile workstation, and deep learning technology to achieve the combination of hardware and software, and builds an automatic detection system for underwater dam defects, which enables the operation of underwater robot to detect the surface of the dam while obtaining the detection results of dam surface defects, providing a scientific basis for the safety detection of dam.BRIEF DESCRIPTION OF THE DRAWINGS

[0025] FIG. 1 is a schematic diagram of an improved YOLOv8 network structure of the present disclosure;

[0026] FIG. 2 is a schematic flowchart of a method according to an embodiment of the present disclosure;

[0027] FIG. 3 is a graph showing an input and an output result of an underwater defect of the present disclosure; and

[0028] FIG. 4 is a schematic diagram of an implementation of a real-time system for underwater dam defect detection according to the present disclosure.DETAILED DESCRIPTION OF THE EMBODIMENTS

[0029] Specific implementations of the present disclosure will be further described below with reference to the accompanying drawings and technical solutions.

[0030] To deepen the understanding of the present disclosure by those skilled in the art, the present disclosure is described in further detail below with reference to the accompanying drawings and embodiments. In order to improve the performance of YOLOv8 in tasks of underwater dam defect detection, the present disclosure has made improvements to the original structure, as shown in FIG. 1.

[0031] The YOLOv8 network is a type of one stage object detection network YOLO series, mainly composed of the following three parts: a backbone network, a neck network and detection heads, with a total of 22 main network layers. Compared to YOLOv5, YOLOv8 uses C2f modules, instead of C3 modules; in the detection heads of YOLOv8 decoupled-heads are used, object branches are removed, the classification is separated from the detection heads, and are based on an anchor free network framework.

[0032] The C3 module in conventional YOLOv5 uses residual connections, while C2f in YOLOv8 refers to Densenet to add more skip connections, eliminates convolution operations in branches, and adds an additional Split operation, which enriches feature information and reduces the computational effort, ensuring a balance between the two.

[0033] The SPPF (Spatial Pyramid Pooling Fast) structure is a consecutive max pooling with a residual structure for three times. The convolution kernel is unified to 5×5, and the results before and after each pooling are concatenated. In the maximum pooling operation, the feature map will become smaller after feature extraction, so the padding will be increased before feature extraction to ensure that the size of the feature map remains unchanged after each pooling. YOLOv8 applies different detectors at different levels of the network, and each detector is responsible for predicting a bounding box of a scale. This design allows YOLOv8 to capture information on objects at different scales to improve the accuracy of object detection.

[0034] As shown in FIG. 1, based on the YOLOv8 model, the present disclosure changes the last C2f module of the backbone network and all C2f modules of the neck network into C2f-DCN modules containing deformable convolutional networks to improve the network's ability to adapt to geometrical changes in the scale and proportion of underwater dam defects or geometrical transformations of the model. A deformable large kernel attention layer is added after the SPPF layer of the backbone network of the basic model to increase the attention to the features of variable-size defects and improve the model's ability to identify underwater defects.

[0035] An automatic detection method for underwater dam defects based on underwater robot and improved YOLOv8 is descried, and the present disclosure is described in further detail below with reference to the accompanying drawings and specific embodiments.

[0036] FIG. 2 is a schematic flowchart of a method according to an embodiment of the present disclosure. The method specifically includes the following step I to step VI.(I) Data Collection of Images of Underwater Dam Defects

[0037] An underwater robot is operated to collect data of underwater dam defects on the upstream dam surface and the bottom plate of the stilling floor. Due to the scattering and attenuation of light during propagation in water, it was necessary to turn on the lighting in deep water environment, and collect various data on the underwater dam defects from different angles at a distance of 20-50 cm from the dam surface. Data processing is performed on the captured underwater video, and defect image frames are manually extracted by a VLC video player to finally obtain image data, including crack, spalling and exposed rebar defects.(II) Data Processing of Images of Underwater Dam Defects(1) Data Labeling

[0038] For features of cracks, spalling, and exposed rebars in underwater dam defects, the defect labeling should meet the following standards: cracks and exposed rebars are mostly slender features, so the labeling boxes with an aspect ratio ranging from 3:1 to 5:1 are selected for the labeling of cracks and exposed rebars; spalling is mostly blocky features, so the labeling boxes with an aspect ratio ranging from 2:1 to 1:1 are selected for the labeling of spalling. When labeling, it should be ensured that all features of the defect are included in the labeling box, and the labeling box should fit the edges of the defect and not contain too many background features.

[0039] Based on the above labeling standards, the LabelImg software is used to manually label the images of underwater dam defects in images for training and improving YOLOv8, where the cracks, spalling, and exposed rebars are labeled as: uw-crack, uw-spalling and uw-exposedrebar, respectively. The categories and coordinate information of the defects are indicated by rectangular boxes, specifically including the center point coordinates, length, width, and category of the labeling box, which are saved in the .xml file in one-to-one correspondence with image.(2) Data Format Conversion

[0040] The above .xml file is not suitable for the reading format of YOLOv8. It is necessary to convert the .xml file to a .txt file through a program for training the YOLOv8 network; the converted dataset is randomly divided into a training set, a test set, and a validation set according to a ratio of 7:2:1, which are used for network training, validation during training and final performance testing of the network, respectively; the dataset includes two folders, images and labels, each of which has three folders, train, test and val. The defect images correspond one-to-one with labeling information of the defects, and the final dataset for underwater dam defect detection is obtained.(III) Building and Improving the YOLOv8 Network Structure(1) Model Building

[0041] The YOLOv8 detection model is built, which consists mainly of a backbone network (Backbone), a neck network (Neck) and detection heads (Head). Considering the detection efficiency, detection accuracy, and model parameter size, YOLOv8n is selected as the basic model, and the depth, width, and maximum number of channels (max_channels) are 0.33, 0.25, and 1024, respectively.(2) Model Improvement

[0042] In response to the problem that underwater defect images are blurred and features are not obvious, resulting in poor detection performance, the YOLOv8 network structure is improved to enhance its ability to detect underwater crack, spalling, and exposed rebar defects. The improvements of the network are specifically as follows:

[0043] DCNs are used to change the last C2f module of the backbone network and all C2f modules of the neck network to C2f-DCN modules, which improves the network's ability to adapt to geometrical changes in the scale and proportion of underwater dam defects or the geometrical transformations of the model; and DLKA layer is added after the backbone network of the basic model to increase the attention to the features of defect with variable size and enhance the model's ability to identify underwater defects, and finally obtain the improved YOLOv8 model. DLKA operates in a receptive field similar to self-attention while avoiding computational overhead. The DLKA module can be expressed as:Attention=Conv1×1(DDW−D−Conv(DDW−Conv(F′))),Output=Conv1×1(Attention⊗F′)+FThe input feature is denoted as F∈RC×H×W, and F′=GELU(Conv(F)), the attention component ∈RC×H×W represents an attention map, each value represents the relative importance of the corresponding feature, and the operator ⊗ represents the element-wise product operation. Unlike the traditional attention mechanisms, LKA attention does not require additional normalization function, such as sigmoid or Softmax, which tends to ignore high-frequency information, thereby reducing the performance of the self-attention-based methods. The convolutional layers of DLKA are replaced by deformable convolutional networks because deformable convolutional networks improve the ability to capture objects of irregular shapes and sizes. Such objects are common in underwater defect image data, so this enhancement is particularly important.(IV) Training and Optimizing of the Model for Underwater Dam Defect Detection

[0045] The model training tasks of this embodiment run on a workstation equipped with NVIDIA 3090 GPU (Graphics Processing Unit), Intel i9-10850K CPU (Central Processing Unit), with Ubuntu 18.04 operating system, and 128 GB of running memory.

[0046] The YOLOv8 model built and improved in step S3 is trained and optimized based on the dataset for underwater dam defect detection created in step S2, and model hyperparameters are optimized based on the results on the training set and the test set, to obtain a model with an optimal combination of detection accuracy, detection efficiency and model size. The main steps of model training are as follows:

[0047] (1) The hyperparameters for training the network are set, that is, the initial number of iterations (epoch) is set to 300, the batch size is set to 16, the initial learning rate is set to 0.01, and the iterative rounds for closing mosaic training (close_mosaic) is set to 50, that is, mosaic training is closed for the last 50 iterations. The loss functions for both the training and validation tend to be stable and converge, and the model parameters best.pt are saved in the folder weights after the model training is completed.

[0048] (2) After the training is completed, the test set is used to evaluate the detection performance and generalization performance of the model. The test set is input into the trained model best.pt to calculate the accuracy of the test set, where the closer the values of P, R, F1-score, AP and mAP are to 1, the better the detection performance of the model is. FPS should be greater than 30 in order to meet the need of real-time detection. According to the evaluation metrics, different hyperparameters are set, different models are trained, and the model with the best combination of the metrics is used for the real-time detection of underwater dam defects.(V) Deployment of the Model for Underwater Dam Defect Detection

[0049] The optimal detection model weights obtained from the above training are deployed on the mobile workstation, and a human-machine interaction interface is built based on the PyQt5 framework. In addition, a real-time detection system for underwater dam defects is built by combining the human-machine interaction interface with the underwater robot. The a high-definition camera carried by the underwater robot captures underwater dam scene in real time and transmits it to the ground workstation for an instant detection. At the same time, the defect detection results are displayed on the workstation and stored locally.

[0050] The software interface of the real-time detection system for underwater dam defect developed by the present disclosure is divided into three main modules: operation area, main window, and result statistics area. The operating area is used for loading model, initializing parameters, selecting functions, etc. ; the main window is used for displaying input images, videos, and image detection results output after detection; and the result statistics area is used for displaying real-time detection results, including types, confidence levels, and locations of defects.(VI) Real-Time Detection of Underwater Dam Defects Based on Underwater Robot and the Improved YOLOv8 Model

[0051] The underwater robot is operated to detect the underwater part of the hydraulic structure in the reservoir. As shown in FIG. 4, in this embodiment, the robot inspection scheme is designed according to the actual reservoir situation, including the speed of the underwater robot, the distance from the structure, the brightness of the lighting fixture, etc. While the underwater robot inspects the upstream dam surface, the images captured by the high-definition camera are transmitted to the ground workstation through cables. The engineer operates the system for underwater dam defect detection on the ground to perform real-time detection of the images captured by the underwater robot and generate the detection results and reports, providing a scientific basis for the subsequent dam repair and maintenance.

[0052] The above-mentioned embodiments are merely intended to describe the preferred implementations of the present disclosure, but not to limit the scope of the present disclosure. Various alterations and improvements made to the technical solutions of the present disclosure by those of ordinary skill in the art without departing from the spirit of the present disclosure all fall within the scopes of protection defined in the claims of the present disclosure.

Claims

1. A method for automatic detection of underwater dam defects based on an underwater robot and improved YOLOv8, comprising:S1: Data collectionoperating the underwater robot to collect data of underwater defects of a dam upstream from different angles at a distance of 20-50 cm from a dam surface; performing data processing on a collected underwater video, and manually extracting defect image frames by a video lan client (VLC) video player to obtain images of underwater dam defects, comprising crack, spalling and exposed rebar defects;S2: Data processingfor features of cracks, spalling, and exposed rebars, labeling according to following standards: for the cracks and the exposed rebars mostly with an elongated feature, labeling boxes with an aspect ratio ranging from 3:1 to 5:1 are selected for labeling the cracks and the exposed rebars; for the spalling mostly with a blocky feature, labeling boxes with an aspect ratio ranging from 2:1 to 1:1 are selected for labeling of the spalling; labeling should ensure that all features of a defect are comprised in a labeling box, while the labeling box should conform to edges of the defect and contain as few background features as possible;using a LabelImg software to manually label the images of underwater dam defects in an image dataset of an improved YOLOv8 model, and indicating a category and coordinate information of the defect by rectangular box, comprising center point coordinates, length, width and a category of the labeling box, which are saved in an .xml file in one-to-one correspondence with an image of underwater dam defects, whereinthe dataset for underwater dam defect detection is a VOC format dataset containing the images of underwater dam defects and one-to-one corresponding .xml files, which are converted from .xml files to .txt files; randomly dividing the dataset for underwater dam defect detection into a training set, a test set, and a validation set according to a ratio of 7:2:1, for training, validation during training, and final performance testing of the improved YOLOv8 model, respectively;S3: Model structure improvement(1) Model buildingbuilding a YOLOv8 model, which consists mainly of a backbone network, a neck network and detection heads, wherein first, the images of underwater defects are input into the backbone network to extract features, then the extracted features are input into the neck network, and finally categories of defects are identified and marked in the detection heads; and based on detection efficiency, a detection accuracy and a model parameter size, depth, width, and maximum number of channels of the YOLOv8 model are set to: 0.33, 0.25 and 1024, respectively, that is, the YOLOv8n model is set as a basic model of the method for detection of underwater dam defects; and(2) Model improvementchanging, by using deformable convolutional networks, a last C2f module of the backbone network and all C2f modules of the neck network to C2f-DCN modules; and adding a deformable large kernel attention layer after the backbone network of the basic model to obtain the improved YOLOv8 model;S4: Model trainingtraining and optimizing, based on the dataset for underwater dam defect detection created in step S2, the improved YOLOv8 model built in step S3, and optimizing hyperparameters based on results on the training set and the test set, to obtain a model with an optimal combination of detection accuracy, detection efficiency, and model size;S5: Model deploymentdeploying optimal model weights obtained from training on a mobile workstation, building a human-machine interaction interface based on a PyQt5 framework, and building a real-time system for underwater dam defect detection by combining the human-machine interaction interface with the underwater robot, wherein a high-definition camera carried by the underwater robot captures a underwater dam scene in real time and transmits it to a ground workstation for an instant detection, while defect detection results are displayed on the workstation and stored locally;a software interface of the real-time system for underwater dam defect detection comprises three main modules: an operation area, a main window, and a result statistics area; the operating area is used for loading models, initializing parameters, and selecting functions; the main window is used for displaying input images, videos, and detected image data; and the result statistics area is used for displaying real-time detection results, comprising types, confidence levels, and locations of defects; andS6: operating the underwater robot to detect an underwater part of a hydraulic building in a reservoir, designing a robot inspection plan based on an actual site, comprising a speed of the robot, a distance from the building, and brightness of a lighting fixture, and generating, by the real-time system for underwater dam defect detection, the detection results and reports.

2. The method for automatic detection of underwater dam defects based on the underwater robot and the improved YOLOv8 according to claim 1, wherein in step S4, steps of model training comprise:setting the hyperparameters for training the network, comprising rounds for training, batch size, initial learning rate, rounds for closing mosaic training, adjusting the hyperparameters to ensure that the improved YOLOv8 model is trained to converge and does not overfit, and saving a parameter file best.pt of the trained model in a folder weights.