{'fraction_non_alphanumeric': 0.024645448248204454, 'fraction_numerical': 0.010244631594298005, 'mean_word_length': 5.100978647686833, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
FaultFace: Deep Convolutional Generative Adversarial Network (DCGAN) based Ball-Bearing Failure Detection Method

Failure detection is employed in the industry to improve system performance and reduce costs due to unexpected malfunction events. So, a good dataset of the system is desirable for designing an automated failure detection system. However, industrial process datasets are unbalanced and contain little information about failure behavior due to the uniqueness of these events and the high cost for running the system just to get information about the undesired behaviors. For this reason, performing correct training and validation of automated failure detection methods is challenging. This paper proposes a methodology called FaultFace for failure detection on Ball-Bearing joints for rotational shafts using deep learning techniques to create balanced datasets. The FaultFace methodology uses 2D representations of vibration signals denominated faceportraits obtained by time-frequency transformation techniques. From the obtained faceportraits, a Deep Convolutional Generative Adversarial Network is employed to produce new faceportraits of the nominal and failure behaviors to get a balanced dataset. A Convolutional Neural Network is trained for fault detection employing the balanced dataset. The FaultFace methodology is compared with other deep learning techniques to evaluate its performance in for fault detection with unbalanced datasets. Obtained results show that FaultFace methodology has a good performance for failure detection for unbalanced datasets.

ever, industrial process datasets are unbalanced and contain little information about failure behavior due to the uniqueness of these events and the high cost for running the system just to get information about the undesired behaviors.

Introduction
In control engineering, failure detection is the branch concerned on monitoring a system, identify the possible failures, and notifying its kind and location using only the available input and output data streams of the system. So, it makes possible detecting not only the system failures but also discovering hidden behavior patterns, which are reflected in plant stops that generate productivity and money losses for the companies. Also, failure detection is a challenging task for different reasons like the system complexity, the required prediction speed response, the size, and consistency of the dataset, or the number of performance indices evaluated. In the literature, there are several applications of machine learning and deep learning techniques for failure detection of industrial processes. In [1], a support vector machine (SMV) is employed to detect failures inside a wireless sensors network due to damages in the devices or faults in the communication. On the other hand, [2] shows the use of unsupervised K-means algorithm to detect failures on 3D stacked integrated circuits. In [3], a distributed machine learning classification algorithm to detect attacks into the power grid is shown, which use the K-means algorithm, SVM, decision tree, among other methods. Another application on semiconductors failure detection is given by [4], where an assessment of different Machine learning models is performed to detect several types of failures during the wafer manufacturing process. Also, [5] presents a failure detection algorithm that employs logistic regression models to detect failures due to mechanical component fatigue. On the other hand, [6] shows a prognosis method for shackles employing logistic regression to determine the decision boundaries for each failure. In the case of failure detection on robotic systems, [7] shows a comparison between classic ma-chine learning, statistical procedures, and the hybrid boosted gradient method, which is an improvement of the logistic regression. There is also an application of machine learning techniques for failure detection on directional drilling of oil wells [8], where the training process was performed using significant historical data from more than 80 oil wells for training a boosted gradient algorithm. Besides, machine learning can also be employed for Cyber-Physical Systems. In [9], the random forest method is used to perform disturbance detection on a smart grid system. Also, [10] present a survey of various machine learning algorithms like SVM, Logistic Regression, and random forest for failure detection on the Internet of Things (IoT) sensor networks. As can be observed, the applications presented on [1] - [10] employs time series analysis, machine learning, or deep learning methods for training the classifiers and perform the failure detection.
Notice that these applications have a good quality dataset, allowing a correct training of the failure detection algorithms.
However, on industrial processes, there is not always available a balanced, complete, or consistent dataset related with the failure behavior due to the longer time required to run a complete cycle of the process. Likewise, the cost and risk of running a process to get data from a failure behavior may produce more significant damages in the physical system. For this reason, the training of classifiers for industrial process sometimes relies totally on simulated data. For example, [11] shows an application where a machine learning algorithm is employed for early failure detection on CNC machines, which is trained using an identified state-space model of the system to generate the failure and nominal data of the machine. Also, [12], employs a simulation model of an electric car power drivers to train a machine learning model for failure detection based on an artificial neural network. The main challenge for this approach is that a representative model of the system is not always available for training a machine learning model accurately.
So that, fault detection in industrial processes with unbalanced datasets is an active research topic, which combines machine and deep learning techniques for fault classification and additional feature mining over scare fault data. For example [13], presents the use of bilayer Convolutional Neural Networks (CNN) for fault detection in chemical processes with unbalanced datasets, which is based on a exhaustive feature mining of the available data using wavelet packet decomposition. In [14], a CNN network combined with an initial normalization kernel is employed for fault detection in bearing mechanisms, mining additional data with the CNN convolution layers. Also, [15] presents the use of fusion autoencoders for skewed, incomplete, unbalanced datasets, with several denoising and resampling stages for feature extraction applied to fault detection on bearing elements. Notice that these works relays on deep feature extraction to compensate the unbalanced and incomplete dataset in order to improve the fault detection accuracy.
On the other hand, Generative Adversarial Networks (GAN) [16], proposed by Goodfellow in 2014, expand the reaches of Artificial Intelligence (AI) allowing the creation of new datasets based on small amounts of available data. These generated data is not only closer to the original but also can produce images combining different features extracted from the original dataset. For this reason, there are many applications of the GAN networks for classification problems.
For example, [17] shows the use of GAN networks for the artificial generation of synthetic data for training a detection model of Jellyfish swarms. In [18], a multi-class spectral GAN network is employed for the classification of multispectral images. Also, in [19], a Multiview GAN network is proposed for pearls classification, increasing the accuracy regarding classical methods. Likewise, [20] shows the application of GAN for medical images generation and classification for different body diseases. For failure detection on industrial processes, some reported works are using different GAN networks for dataset generation.
In [21], the fault diagnosis is performed for a planetary gearbox system using GAN networks and Stacked Denoising Autoencoders. Besides, [22] and [23] present unsupervised classification algorithms for rolling bearings in combination with GAN networks, which contains an unbalanced dataset. For all the GAN networks applications presented above, the feature extraction process is performed using algorithms like Autoencoders, external to the GAN network.
Nonetheless, there is a particular implementation of the GAN network known as Deep Convolutional Generative Adversarial Networks (DCGAN), which incorporate the automatic feature extraction layers for the images with the GAN network. Thus, all the feature extraction and training process is performed using only this network. There are some applications that use DCGAN networks for medical image generation [24] [25], or image augmentation [26]. However, for failure detection, there are few applications of the DCGAN reported like [27], where DCGAN is employed failure detection on photovoltaic systems or [28] where is employed for intrusion detection.
This paper presents a fault detection methodology called FaultFace, which is employed for the failure detection on ball-bearing joints for rotational shafts using DCGAN networks for dataset balancing. The system to be analyzed is the Case Western Reserve university benchmark [29], which is employed to evaluate different ball bearing joints faults on a rotational shaft axis.
A face portrait of the vibration signals is obtained for the nominal and failure behaviors, which correspond to a time-frequency representation of each signal. Six different FacePortraits are obtained from the vibration data, using Continuous Wavelet Transformation (CWT) with Morse Wavelet [30], Wavelet transformation with HAAR Wavelet [31], Circular Matrix Reading (CMR) [32], Toepliz matrix [33], Hankel matrix, and Gramian matrix [34].
Considering that the ball bearing dataset is unbalanced and contains few samples of nominal and failure cases, the DCGAN network is employed to generate new face portraits for the nominal and failure cases. Then, the balanced dataset generated by the DCGAN is used to train a Convolutional Neural Network (CNN) that perform the failure detection task. The structural similarity index (SSIM) is employed to measure the quality of the new dataset generated using the DCGAN network. Also, another balanced dataset is produced using a GAN network to compare not only the performance of the DCGAN network but also the overall performance of the faultFace methodology. The obtained results of the faultFace methodology are evaluated using the confusion matrix for the DCGAN and GAN datasets. The faultFace methodology is compared with a support vector machine (SVM) with Autoencoder and a Long Short Term Memory network (LSTM). Likewise, it is compared with other reported classification methods employed for the CWRU ball-bearing dataset.
The main contribution of this paper is presenting the FaultFace methodology, which leverage the deep learning techniques like CNN and DCGAN usually employed for face recognition in failure detection for industrial processes with unbalanced datasets. Also, a comparison between the FaultFace methodology with other failure detection methods is performed to asses the capabilities of FaultFace to improve fault detection given balanced dataset.
The structure of this paper is as follows. Section II presents the DCGAN and CNN networks employed for fault detection. Section III presents the ball-  the P G (x) and P (x). Once the discriminator cannot distinguish between P G (x) and P (x), it means that the generator learns the black-box behavior of P (x).
Notice that G and D are trained simultaneously in order to improve the estimation of P G (x) as well as the differentiation of P (x) against P G (x). So that, the GAN network can be defined as a minimax optimization problem as given by (1), where x ∼ P data (x) is the data from the original distribution P ( x) and z ∼ P z is the data from the distribution generated by G.
From (1), the GAN network tries to maximize the probability log(D(G(z))) of an accurate classification by D, while simultaneously trying to minimize the error on G by log(1 − D(G(z))). A block representation of the GAN network is presented in Fig.1. As can be observed, the generator network is feed with a random noise distribution to generate P G (x), which feed the discriminator network to determine whether the synthetic data produced by the generator is real or fake, and based on that result perform the training of the generator and the discriminator again. The minibatch stochastic gradient descent is employed as a training algorithm for the GAN network [16,32]. For the GAN network, the optimal training point is reached when P (x) = P G (x). Besides, the training process of G and D is performed simultaneously, reducing K times the gradient for training D and once for G, considering that the time for training D is higher than G.

DCGAN network
The deep convolutional GAN network (DCGAN) is a variation of the GAN network, where the generator and discriminator multilayer perceptron neural networks are replaced by a convolutional neural network to exploit its image processing capabilities. According to [35], the standard structure of a CNN presented in Fig.2. As can be observed, the discriminator CNN has an input layer of 28x28. Also, three hidden layers are employed with LeakReLU as the activation function. Finally, the output layer has a dimension of 256x1, which is fully connected with a Sigmoid activation function for the real and fake data classification. The kernel size for the CNN is 3x3 in all its layers with striding of 2 for all the hidden layers except by the output with striding of 1.
Besides, the generator network structure differs from the discriminator CNN, as shown in Fig.3. As can be observed, the generator CNN works perform the inverse CNN process. Initially, the sample random noise goes from a minibatch of Gaussian Random noise samples projected into a bigger feature space. After that, a 3x3 convolutional filter is applied, and the result is upsampled using a striding factor of 2, resulting in a higher-dimensional space. Thus, after some convolution layers, the generator returns a 2D image representation of the data.
In this paper, the minibatch has an initial size of 100 samples, which is projected into a 128 feature dimensional space representation to apply three hidden convolutional layers with an upsampling factor of 2 that generate a 28x28 pixels 2D grayscale image in the output layer. That will be compared with the discriminator to perform the DCGAN network training.

Study case: Ball-Bearing benchmark system
The Ball-Bearing benchmark system from Case Western Reserve University [29] and Rockwell automation were selected for testing the FaultFace method.
The benchmark system is presented in Fig.4. It is composed of two DC motors of 2Hp running at 1700 RPM which rotational shafts are joined using a ball-bearing coupling. This reference system is designed for testing different ball-bearing couplings diameters as well as inducing failures on the couplings using electrical

Ball-Bearing coupling failures
A ball-bearing coupling is presented in Fig.5. As can be observed, it is composed by an outer race (A), an inner race(B), the balls between the inner and outer race (C) to reduce the friction over the rotational shaft (D). According to [29], different failures can be induced into the ball-bearing benchmark system.
The first failure corresponds to damage on the inner race of the ball bearing, the second one is related to failures on the outer race due to the load position in the shaft (centered, opposite, orthogonal), and the third case is related to damages on the bearing balls. Table 1 summarize a set of possible failures for the benchmark system. As can be observed, the plant supports two different types of ball-bearing couplings denominated fan-end and drive-end with the possibility of generating different failure diameters.

FaultFace methodology
The block diagram representation of the FaultFace methodology is presented in Fig.7. Initially, the original unbalanced dataset of the ball-bearing nominal

Face portraits generation
The face portrait is a 2D image representation of a time series, which can  Likewise, the fifth faceportrait employs a Hankel transformation matrix [34].
Unlike Toeplitz matrix, this transformation produce a symetric matrix where the antidiagonals elements are equal. The sixth faceportrait is generated using the Gram matrix G [34], that is defined as all the possible inner products of m vectors that conforms the set V . It is defined by G = A T A, where A is a matrix with all the m vectors of V distributed as columns. In this paper, the m columns for the matrix A were generated splitting the normalized vibration timeseries into equal length vectors. An example of the obtained face portraits for nominal and failure datasets is shown in Fig.8. As can be observed, all the vibration FacePotraits were transformed into a 28x28 pixels grayscale image that can be employed for training the DCGAN network for dataset balancing.

DCGAN faceportrait quality assessment
A quantitative quality assessment of the balanced dataset produced by the DCGAN networks is performed to evaluate its accuracy for recreating the data distribution of the faceportraits. Thus, the structural similarity index (SSIM) is employed to measure the similarity of the generated faceportraits regarding to the original dataset. According to [36], the SSIM is given by (2) for two images x, and y, where µ x , µ y σ 2 x , σ 2 y , sigma xy correspond to the means, standard deviations and cross-covariance of x and y. Likewise, C 1 , C 2 , C 3 are the regularization constants given by C 1 = (0.01L) 2 , C 2 = (0.03L) 2 , and C 3 = C 2 /2 with L = 255 as the dynamic range for grayscale images. The SSIM index (2) returns a normalized value between [-1,1] where 1 represents a perfect matching between images x and y.
In this paper, the SSIM index is calculated for each single image of the original faceportrait dataset with respect to each single image generated for the DCGAN network for each case and faceportrait in order to see the distribution of the generated faceportraits. As example, Fig.11 shows a boxplot of the SSIM index calculated for the nominal CWT and Hankel faceportraits for the nominal and fault behaviors. As can be observed, the mean value for the SSIM index for the CWT faceportrait is above of 94% indicating a high similarity between the generated and the original dataset. Also, the deviation of the data is ±3%, which also indicates that the balanced dataset can improve the detection range of the faultFace methodology. In the case of Hankel faceportrait, the average SSIM index variates between 74% to 95%. In this case, the balanced dataset using Hankel faceportrait still performs a good representation of the system. In addition, the data distribution is symmetric and follows a normal distribution, considering that the DCGAN network uses a normalized Gaussian random seed to generate the initial distribution in the generator to produce the new faceportraits. Table 2 summarize the mean and standard deviation for all the faceportraits, which behavior is similar for all the generated faceportraits.

CNN training for fault classification
A CNN network is trained to perform the failure detection between nominal and failure behaviors using the faceportraits balanced dataset generated by the

Faultface obtained results
The results of the faultFace methodology are summarized using the confu-  Table 3 and

Results analysis of the faultFace methodology using DCGAN networks
The performance of the faultFace Methodology is quantified using the confusion matrix. Three indices given by (3) are calculated, the accuracy A, which    establishes the fault rate of the method, the coverage C, which indicates the overall effectiveness of the classifier, and the harmonic mean F, which defines the deviation of the data from the mean.
The proposed performance indices are summarized in  reason, it is possible to say that the choice of the face portrait is not a trivial task and has a significant effect over the fault detection final performance.

FaultFace methodology using GAN network
The FaultFace methodology is performed using a GAN network in order to compare with obtained results using the DCGAN for dataset balancing tasks.
In this case, the GAN network employs multilayer perceptron networks for the discriminator and the generator. The structure of the generator uses three full connected layers of 256, 512, and 1024 neurons respectively and an output layer of 784 neurons to fit with the 28x28 generated faceportrait dimensions. The initial minibatch input size is 100 samples generated using Gaussian distribution.
The activation function for the first two layers uses LeakyRelu as activation function, and hyperbolic tangent for the output layer. A batch normalization operator is included at the output of each activation function. The discriminator network is conformed by two fully connected layers with 512 and 256 neurons with leakyRelu activation function, and an output layer with sigmoid activation function to decide between a fake and correct image. A GAN network is trained for the nominal an failure behaviors of the ball-bearing system, for 40000 iterations using adam optimizer with a learning rate of 0.0002 with decay rate of 0.5. The obtained faceportraits obtained using GAN networks are shown in Fig.12 and Fig.13.
The quality of the new faceportraits generated with the GAN network is measured with the SSIM index presented in section 4.4. Fig.11   the generated data from the GAN diverges considerably from the original data, which will have an effect on the fault detection task.
In addition, a comparison between the SSIM of GAN and DCGAN generated balanced dataset is presented on Fig.15 for the CWT faceportrait. It can be observed that DCGAN network produces more accurate new data from the original dataset compared with the GAN network, with higher mean SSIM value and less dispersion of the data distribution. Table.7 shows the accuracy, precision, and harmonic mean from the confusion matrices obtained each faceportrait using the FaultFace methodology with

FaultFace comparison with other methodologies
An LSTM and a SVM with autoencoder networks are designed to perform the fault detection task for the ball-bearing system and compare its performance with the faultFace methodology. Likewise, the FaultFace methodology is also compared with results reported on the literature for the same ball-bearing benchmark system [29].

LSTM Network
A Long Short-Term Memory network (LSTM) [37] is used for the vibra-

SVM with Autoencoder
An autoencoder with a support vector machine (SVM) is implemented for the fault detection of the ball bearing system. The Autoencoder reduces the faceportraits dimensionality using a hidden layer of 100 neurons and an output layer of 10 output features. It is trained for 1000 epochs with L2 weight regularization of 0.004. After that, the SVM is trained using the output of the Autoencoder to perform the fault detection task. Table.9 shows the accuracy, coverage, and harmonic mean F metrics calculated for the ball bearing system using the unbalanced dataset, and the balanced datasets using the GAN and is essential to improve the fault detection task accuracy.

Fault detection technique for ball-bearing in the literature
A review about another methodologies for the ball bearing fault detection on the benchmark system [29] was performed to made a comparison with the FaultFace method [22], [23], [38]- [39]. In Table 10, a summary of the different reviewed papers is presented, which employ supervised learning in many cases, some unsupervised and another one use traditional vibration methods like fast Fourier transform. In [40] is presented a supervised machine learning approach using SVM for failure detection with the best fitness of 99%. Besides, [38] and [41] present the use of fractal theory for feature extraction and classification of failure with an accuracy of 98.4% and 96.59% respectively. On the other hand, [39] employs traditional Fourier analysis to detect the different failure behaviors

Results discussion
Comparing the FaultFace methodology proposed in this paper with the methods in Table.10, an accuracy of 100% can be reached using the proper FacePortrait as well as the DCGAN network for dataset balancing. Notice that most of the methods listed on table 10 requires a previous stage of feature extraction using different techniques, in order to create a rich training feature dataset to improve the detection accuracy. In the case of FaultFace method, automatic feature extraction is performed due to the use of trained CNN networks for the fault detection tasks. However, the quality of the balanced dataset is relevant for the success of the methodology. It can be observed when the DCGAN is replaced with a GAN network for dataset balancing, the accuracy of the detection is reduced as shown in Table 5 and Table 7. A possible cause for this condition is because DCGAN incorporate convolutional layers that can be trained for specific feature extraction and generation. But, in the case of GAN networks, classic multilayer perceptron layers are employed, which requires more training time and number of hidden elements to produce the desired data.
In the case of LSTM network, considering that the sampling frequency of the vibration signals in [29] is too high, more cell may be required to improve the method detection as well as different minibatch size to reduce the need of padding operators that affect the detection quality. For the SVM with autoencoder fault detection algorithm, the balanced dataset generated either with GAN or DCGAN networks improve significantly the overall performance of the detection over the unbalanced dataset.
So that, the combination between automated feature extraction layers, the dataset balancing methods (DCGAN), and deep learning classification algorithms as CNN makes a siginificative difference performing fault detection for ball bearing elements regarding to other methodologies. For these reasons, we can conclude that FaultFace is a suitable methodology for failure detection for unbalanced datasets that could be employed not only for ball bearing joints but also for different industrial processes. shows that the FaultFace offer excellent accuracy without the need to perform additional feature extraction and dimensional data reduction. Thus, it is possible to say that the FaultFace method can be considered as an alternative for failure detection not only for the Ball-Bearing problem but also for different industrial processes with unbalanced datasets and complex dynamics. As future works, the real-time implementation of the FaultFace methodology using edge computing devices is proposed as well as the extension of this methodology to other industrial processes than ball bearing elements. Moreover, the development of compressive deep learning algorithms is proposed to perform deep neural stable control techniques that introduce cognitive capabilities on the edge to smart industrial processes monitoring, prognosis, and control.