In today’s world, steel pipelines are an essential part of the infrastructure for various industries, such as oil and gas, energy, and industry. However, their flaws can lead to major accidents, resource loss, and environmental hazards. Therefore, it is crucial to identify defects early on and accurately determine them to ensure the safe and efficient operation of pipeline transportation systems. During research, a technique was developed for automatically detecting and classifying defects in steel oil and gas pipelines using neural networks. This method processes image data from an in-line inspection system. The initial data for this analysis comes from optical inspections of oil and gas pipelines. The study involved developing and testing a method that can detect defects in oil pipelines automatically with significant accuracy using data from optical examinations. Optical examination can be performed using both specialized endoscopic equipment and a crawler robot. The processing of diagnostic results using a neural network and data library can be done on an external medium or integrated into a diagnostic system for in-line monitoring. Testing of the pipe defect recognition method during optical inspection of the inner pipe surface demonstrated good results for detecting corrosion and erosion defects (response rates of 67% and 68%, respectively, with mAP values of up to 49% and 65%). Crack-type defects were identified with lower accuracy (response rate of 57%, mAP up to 42%).