Detecting leaks in oil and gas pipelines is crucial for the safe operation of these systems. Current techniques for identifying oil and gas pipeline breaches are insufficient and fail to utilize the temporal attributes of the leak signal. This research proposes a fusion recognition model that integrates a long short-term memory network (LSTM) optimized using a one-dimensional convolutional neural network (1DCNN) with the dung beetle optimization algorithm (DBO). The model initially tackles the issue of excessive depth in the 1DCNN network, which paradoxically results in decreased accuracy and increased computational load. It develops a lightweight 1DCNN network via structural experiments that adaptively extracts data features. Subsequently, to mitigate the effects of the LSTM model's high stochasticity and the challenges associated with manual hyperparameter selection on detection accuracy, an enhanced LSTM model is proposed. This model is optimized through the integration of the Dung Beetle Optimization Algorithm (DBO) to refine the hyperparameters in LSTM. A 1DCNN-DBO-LSTM recognition model is developed, whereby the data features retrieved adaptively from the 1DCNN are fed into the enhanced DBO-LSTM for classification, and the T-SNE dimensionality reduction technique is utilized to visualize the network at each output layer. The model is assessed utilizing the precision and duration measures. The suggested model enhances recognition accuracy and reduces detection time compared to existing advanced models. The approach presented in this work can extract pipeline data features more swiftly and accurately, thus enhancing classification precision.