# Fault Diagnosis Algorithm of Beam Pumping Unit Based on Transfer Learning and DenseNet Model
## 1 Preface  
Oil, as a nonrenewable energy source, is increasingly important to the development of modern society and the economy. Most of the authors' country's oil fields have entered the middle and late stages of production, and many oil wells have more than 95% water content, and problems such as eccentric wear, corrosion, and scaling are serious. By 2018, CNPC had 184,600 oil wells in service, of which 90% were beam pumping wells. Twenty-five per cent of oil wells had a pump inspection period of less than 300 days, of which 4237 wells had more than 3 high-frequency pump inspections, accounting for 17% of the operation volume. The operation cost is 700 million yuan, affecting the output of 250,000 tons. The beam pumping unit has the characteristics of field operation, large quantity, scattered location, harsh environment, and complex working conditions, and it is very difficult to manage and monitor. To diagnose and discover various abnormal working conditions of pumping wells as early as possible, petroleum engineering scientists have studied various fault diagnosis techniques, such as expert system fault diagnosis, fuzzy fault diagnosis, neural network fault diagnosis, and deep learning fault diagnosis. The most widely used method to analyze the performance and fault diagnosis of pumping wells is by means of a hanging nodes indicator diagram. The hanging node indicator diagram is a closed curve which can reflect the downhole condition of the oil well based on the shape, and different working conditions have different curve characteristics. Artificial perception methods are time-consuming, labor-intensive, and error-prone. Therefore, an automated diagnosis method is needed to improve the efficiency of manual maintenance. In 1988, after visiting many famous experts, [PERSON] et al. [1] developed an expert system for fault diagnosis of rod pumping wells. They achieved this by converting the indicator diagram on the ground into a downhole indicator diagram, then comparing itwith the standard indicator diagram to determine the type of fault. However, the weakness of the system is that it relies too much on the domain knowledge of experts in the petroleum industry. In 1990, [PERSON] et al. [2] introduced the theory of artificial neural networks into the indicator diagram recognition domain. They applied the error back propagation learning algorithm to train the neural network and were able to identify 15 types of indicator diagrams. The neural network method has shown good application potential in this kind of problem. However, due to the relatively simple structure of the neural network it uses, the effect of using it is not ideal. In 1994, [PERSON] et al. [3] used a three-layer hybrid feedforward network model of the sinusoidal hidden layer perceptron algorithm and the sigmoid output layer perceptron algorithm, which completed the classification task of 11 fault types through the training of 167 dynamometer diagrams. In 2016, [PERSON] et al. [4] used a fuzzy neural network to solve the problem of oil pumping unit fault diagnosis. The fuzzy theory diagnosis method needs to establish a membership function first, but the membership function is artificially constructed and contains subjective factors. In addition, there are certain requirements for the selection of characteristic elements, which limits the application of the fuzzy neural network method. The fault diagnosis method of artificial perception pattern has the problems of high cost, long time, inconsistent analysis results, and being error-prone. Traditional pattern recognition technology requires a lot of domain expert knowledge and expression reasoning mechanisms, which are difficult to popularize and use. The machine learning diagnosis method can extract characteristic information to analyze and evaluate the system only by analyzing the historical monitoring data. The application data model replaces the accurate complex system model, which has good generalization and is easy to apply.