Traditional methods for detecting oil and gas leakage in subsea pipelines have low efficiency and accuracy. There are also many limitations in using conditions, and it heavily relies on manual detection. In view of the above problems, this paper proposed an ensemble method for automatic oil and gas leakage detection and preliminary evaluation based on 3D real-time sonar images. The method first used the U-net algorithm based on deep learning (DL) to perform real-time semantic segmentation of oil and gas leakage in sonar images, so as to realize real-time monitoring of it. Then, the grade of leakage was preliminarily evaluated through the results of semantic segmentation, and a reference standard for evaluating leakage was proposed. The integrated method proposed in this paper realized the automatic detection of oil and gas leakage in pipelines and the preliminary evaluation of leakage grade. The method improved detection efficiency and accuracy, avoids manual interference, and does not rely on numerous sensors and complex mathematical models. At the same time, the applicability of different feature extraction backbones in segmenting sonar images of oil and gas leakage was discussed. The feasibility of the method was verified by experiments. This method was compared to the effect of traditional manual detection in practical engineering. Therefore, it provided a technical reference for the engineering application of oil and automatic gas leakage detection in the future.