Detecting underwater cracks in ocean engineering structures is crucial for their maintenance. The traditional detection method relies on the diver's work with equipment, which is greatly affected by subjectivity and has low recognition efficiency. Deep learning algorithms can solve this problem, but building an underwater dataset to train the network is difficult due to the complex underwater environment. Therefore, this paper artificially made concrete crack detection blocks and took underwater images. The denoising diffusion probabilistic model (DDPM) was used to expand the dataset to increase the number of images to support neural network training. In the dataset, blurry images affect the recognition efficiency due to insufficient clarity in the underwater environment. To solve this problem, this paper adopts the wavelet transform combined with the histogram algorithm for image enhancement. This paper proposes an improved YOLOv8 network to recognize these crack images. The performance of the detection network is improved by adding the OMNI-Dimensional dynamic convolution (ODConv) network to the backbone network and replacing the header network using the low-aggregationdistribution (low-GD) and high-aggregation-distribution (high-GD) replacements in Gold-YOLO. Compared with the YOLOv8 network, the computation is reduced significantly, the model size is 8.8% of the original, the accuracy is improved by 13.67%, and the detection speed increases 20 frames. The results show that the method in this paper can effectively detect underwater cracks in real time. It has high recognition accuracy and detection efficiency while making the model lightweight. Moreover, this paper uses the skeleton extraction of the underwater cracks and the curve fitting method for the measurement, which helps to obtain the data information on cracks.