**1. Introduction**

Since 1920s, statistical process control (SPC) theory has played an important role in product quality improvement and quality supervision [1]. SPC mainly uses a statistical analysis method to monitor the production process, and scientifically distinguishes the random fluctuation and abnormal fluctuation of product quality in the production process [2,3]. Thus, the abnormal trend of production process is expected, so that production managers can take timely measures to eliminate abnormalities and restore the stability of the process, so as to achieve the purpose of improving and controlling the quality. Intelligent SPC data analysis is realized, which can reduce production time and cost and improve product quality. It will likely become an integral part of industry 4.0 technology. Among the many theories of SPC, control charts and histograms are the most important and practical visual indicators [4]. If the manufacturing process is affected not only by random factors, but also by other specific factors, there will be specific abnormal patterns in the control chart and histogram [5]. For example, as far as the control chart is concerned, the cyclic patterns might be related to the periodic variation in the power supply. Trend patterns may be related to factors that change slowly, while changes in raw materials, workers and machine tools may cause shift patterns.

In the early application of control charts, it is necessary to manually determine whether or not there is any abnor–mality in the control charts and what kind of abnormality occurs. It is easy to detect abnormalities beyond the control limit, but di fficult to identify abnormal patterns within the control limit, which is easily a ffected by the experience level of quality control personnel [6]. Then, many non-natural pattern detection methods based on supplementary rules were proposed by scholars [7–9]. The Nelson criterion is one of these methods [10]. However, control charts contain a lot of information about the production process. Supplementary rules cannot describe the specific modes of a process in detail. In addition, a large number of rules are used, which is not conducive to the real-time monitoring of production process, and will cause many false alarms [11,12]. In order to realize automated control chart pattern recognition (CCPR), scholars have designed a series of expert systems so that quality managemen<sup>t</sup> personnel can take timely remedial measures for uncontrolled manufacturing process [13–16]. They are mainly based on statistical tests and heuristic algorithms [17]. Because of the shortcomings of these judgment rules, early expert systems cannot ge<sup>t</sup> satisfactory results [18]. This stimulates interest in developing more accurate CCPR algorithms.

Because machine learning algorithms have strong pattern recognition capabilities, their applications in the CCPR field have received more and more attention and achieved some success. It mainly includes an artificial neural network (ANN) and a support vector machine (SVM). The multilayer perceptron (MLP) are the most widely used in ANN-based methods [19–21]. In [22], an e ffective CCPR system based on MLP is studied. The e ffects of di fferent layers of MLP and di fferent training algorithms on the results are also compared. It is found that the resilient back-propagation (RBP) algorithm has the best convergence speed and the Levenberg–Marquardt (LM) algorithm has the best optimization e ffect. In [23], a new learning algorithm based on bees algorithm is adopted, and an optimized radial basis function neural network (RBFNN) is trained, which shows good performance in CCPR tasks. In addition, the probability neural network (PNN) [24], spiking neural network (SNN) [25] and learning vector quantization (LVQ) [26–28] are also widely used. They all belong to supervised learning algorithms. At the same time, unsupervised algorithms such as self-organizing mapping (SOM) [29] and adaptive resonance theory (ART) are also used in CCPR. Because of its shallow structure and limited learning ability, ANN has some shortcomings, such as di fficulty in convergence and can easily fall into local minimum, which limits its further development. Subsequently, SVM and its variants have been proposed by scholars and used to solve CCPR problems. For example, weighted SVM [30], multi-kernel SVM [31] and fuzzy SVM [1]. They generally show better recognition accuracy than traditional ANN.

Histogram is a graphical representation of the distribution of quality data. Its distribution degree is a common tool for judging and predicting the quality of production process. Similar to the control chart pattern (CCP), the abnormality of the histogram pattern (HP) corresponds to specific factors. For example, skewed patterns are caused by poor processing habits of workers, and flat-top patterns indicate that production processes are a ffected by slow-changing factors. As far as we know, only one paper has studied histogram pattern recognition (HPR) in SCI and EI database in recent years [4]. In [4], an HPR method based on a fuzzy ART neural network is proposed. The advantage of this method is that it can cluster HPs adaptively and generate new classes for unknown patterns. At the same time, there is a big risk to classify the known patterns into new categories, which is not conducive to practical application. Moreover, the simulation data used in this paper are not random enough. The quality data of real processes cannot be fully simulated. The lack of research on HPR is a major drawback of SPC intelligent research. This is because histograms and control charts complement each other, as shown in Figure 1. According to the theory of a control chart, the quality data is normal. However, its histogram pattern is an island pattern, which means that the production process is abnormal. Control charts are suitable for identifying short-term anomalies, while histograms can reflect the long-term distribution of quality data. Therefore, the role of a histogram cannot be ignored, and enterprises are also in urgen<sup>t</sup> need of accurate automatic HPR.

**Figure 1.** Quality data and its histogram.

It is well known that in the field of pattern recognition, the input form of data has a grea<sup>t</sup> influence on classification, which is called the input representation problem. One form is to take the raw data as input [24,32,33], such as quality data in the control chart and the frequency of each interval in the histogram. Another form is to take the features extracted from the raw data as input, such as wavelet features [11], shape features [19,34,35] and statistical features [23,34]. The latter is called feature engineering, that is, experts design favorable features for pattern recognition problems based on experience. Most scholars' research shows that if the dimension of input data is too large, the classifier size of traditional machine learning algorithm will be too large, which is unfavorable. Its accuracy and e fficiency are often lower than the feature-based method, because the dimension of feature set is usually very small [11,29]. There is no doubt that the key to improve classification accuracy is to select the most advantageous feature set. To achieve this goal, a genetic algorithm (GA) [1] and local linear embedding (LLE) [36] are used to optimize features from high-dimensional feature sets. However, they only select good features from the known expert feature set, and do not improve the quality of feature set from the root. The discarded raw data still has potential values, so more advanced methods, such as feature learning, still need to be used. Feature learning refers to adaptively extract the most advantageous features from the raw data by using the deep neural network (DNN), without relying on any expert experience. Since the feature set is obtained by learning and minimizing the loss function, it can be considered that this feature set is the best choice for this classification task [37]. The most representative deep learning algorithms include the deep belief network (DBN) [38,39] based on the restricted Boltzmann machine (RBM), the convolutional neural network (CNN) [40–42] based on the convolution layer and pooling layer and the recurrent neural network (RNN) [43,44] based on the recursive layer. They have made remarkable achievements in machine vision, natural language processing and fault diagnosis [45].

On the basis of relevant research in recent years [18,46,47], this paper proposes to use multilayer bidirectional long short-term memory networks (Bi-LSTM) to learn the features of histogram and control chart, and finally realize HPR and CCPR. The Bi-LSTM is an improved method of RNN. Its special gate structure enables it to capture both short-term dependencies and long-term dependencies. This paper is an extension of previous studies [18]. Di fferent from previous studies, multilayer Bi-LSTM is used to replace the former one-dimensional CNN (1D-CNN), because it is specially used to process one-dimensional data such as time series, and has a stronger ability to process the relationship between before and after the sequence. It has also been compared with the traditional method and many typical deep learning methods. In addition, besides automatic CCPR, accurate HPR is also realized. Until now, HPR has been ignored by scholars. In this way, the automation and intelligence level of SPC has been improved more comprehensively. Furthermore, the six CCPs were studied before they were expanded to nine, making the CCPR more comprehensive and refined. In order to detect anomalies in production as quickly as possible, the length of the data we use for pattern recognition is 25. This is because longer data may mean that more defective products have been produced in the factory when abnormalities are identified [18].

The rest of this paper is organized as follows. Section 2 explains the basic structure of LSTM and the mathematical representation of HPs and CCPs. Section 3 introduces the details and process of the proposed method. Section 4 carries on the experiment and completes the related discussion. Finally, Section 5 summarizes the paper and gives the prospect of future work.
