Detecting Unsafe Conditions of a Lathe using an Artificial Neural Network with Three-axis Acceleration Data

Detecting unsafe conditions of a lathe is critical to prevent hazards in a workplace. This study proposed an artificial neural network (ANN) model to classify the state of a lathe into one of the nine conditions (two normal conditions and seven unsafe conditions) based on three-axis acceleration data. The two normal conditions were (1) idle and (2) normal processing. The seven unsafe conditions included unsafe states of a lathe (i.e., eccentric rotation, chipping, improper workpiece fixation, and base looseness) and a worker (i.e., glove contact, hair contact, and necklace contact). The acceleration data for each condition were measured for 30 s using a small lathe and smoothed with the moving average. The datasets were randomly divided into three different sets for training (70%), validation (15%), and testing (15%). The ANN model was trained using the training and validation sets and its performance was evaluated using the testing set. The testing results showed that the classification accuracy of the ANN model proposed in this study (100%) was better than that of a multiclass linear support vector machine model (68%). The procedure and the ANN model established in this study can be utilized to detect unsafe conditions of a lathe and other industrial machines. Keyword: Artificial neural network; Lathe; Support vector machine; Unsafe condition


Introduction ‡
Operating a machine under unsafe conditions is harmful because it may evoke unpredictable accidents that cause severe injury, and even fatality and material loss. According to a 2016 report of industrial accidents, the number of people injured by machinery and equipment was 9,900, which accounted for 19% of the total number of the industrial accidents in Korea; additionally, the number of deaths from machinery and equipment was 220, which was 22.6% of the total deaths [1]. Furthermore, Smith [2] reported that 11% of all injuries and illnesses in the US mining industry in 2010 were caused by machinery. Dźwiarek and Latała [3] also reported that 28% of the major accidents that occurred from 2005-2010 were caused by the mechanical equipment. Furthermore, according to a report by Liberty Mutual, US employers spent $48.6 billion on medical expenses, productivity loss, and administrative expenses for workers' injuries. Finally, research by Colorado State University estimated that the direct and indirect costs for workplace injuries to be about $128 billion [4]. Therefore, an early detection of unsafe conditions of the operating machine with superior accuracy performance is strategically crucial to prevent ‡.Corresponding author Email: kjung@ulsan.ac.kr accident in a workplace as well as to secure the safety of workers.
Accurately detecting unsafe conditions of a machine is critical to prevent industrial accidents; however, the classification accuracy needs to be improved. Advanced classification methods such as artificial neural network (ANN) and support vector machine (SVM) have been widely applied as classifiers in the detection and diagnosis of machine conditions. For example, Jiang et al. [5] proposed a probabilistic neural network to detect three fault types (i.e., imbalance, misalignment, and friction) and reported an accuracy of 95.4% at a rotational speed of 5000 rpm. McCormick and Nandi [6] used ANN to detect the fault conditions of rotating machine based on vibration signals with reported accuracy 99%.Samanta and Al Balushi [7] also proposed ANN model for fault diagnosis of rotating machine with accuracy varied from 81% to 100%. Next, Rajeswari et al. [8] developed a multi-class support vector machine to detect malfunction of a bearing installed on a rotating machine by using a vibration sensor, and reported an accuracy of 98.8%. Samanta et al. [9] used SVM and ANN to detect the bearing fault detection with accuracy varied from 85.1%-100%. Liu et al. [10] also used SVM-based model to identify the rotating machinery fault with average accuracy 92.5%-97.5%.
In addition, existing studies also proposed other methods for the detection of unsafe conditions of a machine. Li and Chen [11] identified three fault types (i.e., unbalance, looseness, and misalignment) of a centrifugal fan by using ant colony optimization based on values measured from a vibration sensor; however, they did not report the quantitative performance. Painuli et al. [12] used the K-star algorithm on vibration signals to determine the normal and abnormal conditions of a lathe and reported an accuracy as 78%. Lastly, Aditiya et al. [13] proposed a hidden Markov model based on data obtained from an unbalanced state of a rotating machine, and reported an accuracy of 88.4%.
In the industry applications, instead of high accuracy, the detection model should also consider various types of unsafe conditions of machine. However, previous studies have only focused on unsafe conditions for a machine in their classification studies. For instance, Rajeswari et al. [8] and Aditiya et al. [13] only considered two conditions (normal and abnormal) in their classification model, while Jiang et al. [5] included three faulty types (imbalance, misalignment, and friction) of a machine. In other words, most of the aforementioned studies only emphasized the machine side (e.g., cutting tools and bearings). However, industrial accidents are mostly caused by unsafe human acts (88%) rather than by the machine itself (10%). Although the detection of unsafe conditions caused by human errors(non-machine factors) while operating lathe machine is highly important, it has not been comprehensively investigated since previous studies have only focused on the machinery-related causative factors in the development of detection model. Thus, a study that simultaneously considered both of machine and non-machine factors in the development of detection model for unsafe conditions of lathe is needed.
The present study was aimed at establishing an artificial neural network (ANN) model to detect various unsafe conditions of a lathe based on three-axis acceleration data measured from an accelerometer. ANN models have demonstrated preeminent performance in detecting faults in various fields, providing good and stable accuracies [5][6][7][14][15][16][17][18]. Thus, we used an ANN model to establish a practical model with good accuracy. To define the unsafe conditions of a lathe, a comprehensive analysis of the accident statistics for a lathe has been conducted in this study. The representative unsafe conditions generated from both of the machine and non-machine factors considered in this study including (1) eccentric rotation, (2) chipping, (3) improper workpiece fixation, (4) base looseness, (5) glove contact, (6) hair contact, and (7) necklace contact. A three-axis, position-based acceleration sensor was installed on the motor unit of a lathe to measure the trembling movement of the machine while it was in operation. A standard feed-forward ANN model was established using the acceleration data measured for each unsafe condition, and its performance was quantitatively evaluated and compared with that of a support vector machine-based model.
The rest of the paper were organized as follows: after a brief introduction on the background and motivation of this study, the next Section of Method and Materials describes the equipment, experimental design, data acquisition, the development of ANN and SVM models, as well as the statistical analysis used in this study. The Results Section presents the results of the proposed models in classifying the unsafe conditions of the lathe. The Discussion Section discusses and summarizes the significance of the study also provides several future research ideas regarding the applicability of the proposed model for various industrial applications. Lastly, the Conclusions Section concludes the main findings of this study.

Method and Materials Equipment
A small lathe machine (Model Z20002M, Shenzhen Zhouyu Intelligent Technology Co., Ltd., China) was used in this study. The main components of the lathe were a unit motor, headstock, tailstock, bed, slider, base, spindle, and three-jaw chuck, as depicted in Figure 1. The unit motor, headstock, and three-jaw chuck of the lathe were coupled, and the overall size of the machine was 220 mm (length) × 140 mm (width) × 150 mm (height) with a weight of 3.3 kg. The diameter and length of the workpiece used for the lathe were 2 mm and 135 mm, respectively. The height from the base of the lathe to the center of the jaw chuck was 25 mm. Additionally, the distance between the jaw chuck and the tailstock was 135 mm. The travel distances of the z-axis slider (tool shelf) and x-axis slider (carriage) of the lathe were 30 mm and 160 mm, respectively. Next, the motor speed of the machine was up to 20,000 rpm/min; however, it can be dropped to 2,000 rpm/min while machining a metal. In addition, the workpiece materials for the lathe can be gold, silver, copper, aluminum, plastic, wood, or acrylic.
This study used a three-axis, position-based acceleration sensor (Phidget Spatial Precision 3/3/3 High Resolution, Phidgets, USA) to measure the trembling movement of the lathe. The specifications of the acceleration sensor of Phidgets used in this study were listed in Table 1 [19]. The acceleration sensor decomposes the gravitational acceleration into three axes (x, y, and z) and measures the vector value on each corresponding axis. The gravitational acceleration in the three axial directions was obtained while attaching a sensor onto the lathe. A custom program was coded for this study to collect the acceleration data from the sensor. The acceleration data were measured 62.5 times per second in three axial directions; these data were tabulated in an Excel file to be processed further in the data analysis.

Data Acquisition
In this study, the acceleration data were measured for two normal and seven abnormal states of lathe as depicted in the Figure 2. The normal conditions were divided into an idle state (normal 1) and a normalprocessing state (normal 2). The idle state is defined as a condition in which the workpiece (diameter = 3 mm, length = 4.5 cm) is fixed to the chuck and the lathe is operating (Fig. 2a). Alternatively, the normal-processing state is the condition in which the lathe is operating normally (i.e., the end of the workpiece is in contact with the edge of the cutting tool) as shown in Fig. 2b. Furthermore, this study defined abnormal conditions by analyzing accident cases related to a lathe [5,11,[20][21][22][23]. The abnormal (dangerous) conditions included four types of machine malfunctions (i.e., eccentric rotation, chipping, improper workpiece fixation, and base looseness) and three types of unsafe acts committed by a worker or non-machine factors (i.e., glove contact, hair contact, and necklace contact). The eccentric rotation was simulated by installing a cutting tool that deviated 10° from its correct angle on the chuck (Fig. 2c), while chipping was simulated by introducing a thin chip (length = 30 mm) onto the cutting tool (Fig.  2d). Next, the improper workpiece fixation to the chuck was performed by untightening the workpiece from the jaw chuck (Fig. 2e). Lastly, the base or foundation looseness malfunction was imitated by loosening the base and the body of the lathe as shown in Fig. 2f.
The last three unsafe or abnormal conditions considered in this study that can be caused by human error in workplace were glove contact, hair contact, and necklace contact. The glove contact was simulated by contacting the workpiece with a cotton glove (Fig. 2g), while hair contact was imitated by contacting the workpiece with a brush (Fig. 2h). Lastly, the necklace contact was simulated by touching a necklace to the workpiece as shown in Fig. 2i.
The acceleration data elicited from the lathe was measured and quantified by using the following fourstep procedure. Firstly, an acceleration sensor was taped on the top of the lathe's motor and a USB cable (USB Mini-B, cable length: 1.8 m) was connected between the sensor and a desktop computer. Then, the lathe was operated under one of the normal or abnormal conditions. Lastly, the acceleration data were measured for about 30 s for each condition using the custom measurement program coded using C++. Lastly, a moving average (time window = 10) was applied for 1,865 data points (30 s × 62.5 Hz) to eliminate noise from the measured data.

Artificial Neural Network
Artificial neural network (ANN) is one of the supervised learning method that inspired from the structure and function of the biological neural networks of human brain. ANN is known as the most commonly used algorithm among others approaches in fault detection [18,[24][25][26]. This computational model interconnects many ''neurons" and the output of a neuron can be the input of another. The weights of networks are obtained through an iterative learning phases according to the known input-output patterns [24]. The primary advantage of ANN is its ability to learn patterns in very complex conditions [26]. ANN has a variety of structures, but the most extensively used is the feed-forward network trained via back-propagation. Thus, in this study, a standard feed-forward artificial neural network model was developed in Matlab 2017a (Mathworks, Inc., USA) with Neural Network Pattern Recognition App to classify the normal and abnormal states of the lathe. The pattern recognition is a process of training the neural network to assign the correct target classes to a set of input data. The trained network then can be used to classify the unseen data during the training phase.
The learning or training function to update the weights and biases for the back-propagation method was activated by using a scaled conjugate gradient method. This method can train any network as long as its weight, input, and transfer functions have derivative functions. The back-propagation is used to calculate the derivative of performance with respect to the weight and bias [18].
The structure of the proposed ANN model used in this study consisted of three layers (i.e., an input layer, hidden layer, and output layer) that are interconnected, as illustrated in Figure 3. The layers of the proposed ANN model were fully-connected layers in which neurons between two adjacent layers are fully pair wise connected. The input layer had three units corresponding to the three-axis acceleration values on three axes (x-axis, y-axis, and z-axis).This layer fed the initial data into the network for further processing by the subsequent layer. Thus, the input of the proposed neural network model was a 3 × 16,785 matrix, representing acceleration data on three axes for nine lathe states.
Next, the hidden layer was a set of 10 neurons as a default value of the networks. The neurons were activated with a transfer function of hyperbolic tangent sigmoid function (tan-sigmoid transfer function) with output range [-1,1]. In addition, the output layer had nine outputs (idle, normal operation, eccentric rotation, chip attached, workpiece loose, base looseness, friction due to a cotton glove, friction due to hair, and friction due to a necklace) to classify the state of a lathe. The target data for the networks should consisted of vectors of all zero values except for a 1 in element i, where i is the represented class. Hence, the output of the proposed neural network model was a 9 × 16,785 matrix, representing the nine states of the lathe.
Lastly, this study used cross entropy as a loss or error function to measure the performance of the proposed neural network. Thus, lower the cross entropy resulted in higher classification accuracy performances. Zero cross entropy indicates no error. The cross entropy function was used during the iterative back-propagation process in order to optimize the weights of the ANN model [27]. The acceleration data collected from the experiment of this study were randomly divided into three different data sets (i.e., training, validation, and testing). The training data was used during the network training and for adjusting unit of weights of the connection layers. The neural network was trained to obtain the underlying relationship between the input and the target. Next, the validation data was used to measure network generalization and to halt the training process once the generalization stops improving. Lastly, the testing data sets was used as a completely independent measure of the network performance for the data which were unseen during the training process. In this study, the learning data represented 70% of the total data and consisted of 11,749 samples for each condition of the lathe. Meanwhile, the validation and testing data sets were 15% each, which included 2,518 samples.

Support Vector Machine
A support vector machine (SVM) model was constructed to objectively compare the classification performance of the proposed ANN model. The SVM model uses a supervised classification method based on statistical learning theory that constructs an optimal separating hyper-plane in high-dimensional space [28][29][30]. In this study, we employed traditional or simple SVM without kernel modification to fairly compare the accuracy performances with our proposed standard ANN model in classifying the lathe states.
The three-axis acceleration data (x-axis, y-axis, and z-axis) were regarded as a predictor of the SVM and randomly partitioned into training (70%) and testing (30%) sets. The class labels of the SVM were the same as the ANN model. We employed a one-against-all strategy to construct the multiclass SVM classifiers, in which a binary SVM for each class was generated to distinguish members of that class from non-members of other classes [29,31]. A linear kernel function was used to construct the SVM model in Matlab. Lastly, the performance of the SVM model was quantified in terms of the classification accuracy for the learning and testing sets.

Statistical Data Analysis
A one-factor analysis of variance (ANOVA) was conducted using Minitab v17.0 (Minitab Inc., USA) at significance level of α = 0.05 to investigate whether the acceleration data are significantly different based on the conditions of the lathe. The independent variables of this study were the nine conditions of the lathe. Meanwhile, the dependent variables were the acceleration data measured for each axis. Since the number of data points for each axis (1,865) is high, which can cause inflation in the degrees of freedom of the error term, this study used average values (five for each axis) of every 373 data points, which resulted in 36 degrees of freedom for the error term; this is slightly greater than the large number required for the central limit theorem. In addition, Tukey tests were also employed for post-hoc analysis of the significant independent variable at the same significance level (α = 0.05).

Results
In this section, the statistical analysis and the classification results on the lathe unsafe conditions are presented. The statistical analysis of ANOVA revealed that the average acceleration along the x-axis was significantly different among the states of the lathe, as shown in Figure 4a (F(8, 36) = 425.12, p< 0.001). Tukey tests showed that five out of nine states of the lathe were distinguished into different groups. Next, the average acceleration on the y-axis was also significant, as depicted in Figure 4b (F(8, 36) = 134.45, p< 0.001). However, Turkey tests found that only four out of nine were clearly grouped into different groups. Lastly, the average acceleration on the z-axis differed significantly, as displayed in Figure 4c (F(8, 36) = 1479.47, p< 0.001). Tukey tests revealed that all states of the lathe, with the exception of one, were distinguished into different groups.
The performance of the ANN model proposed in this study achieved perfect performance on cross-entropy, as shown in the learning curve ( Figure 5). It can be observed that the training and validation performances on crossentropy were overlapped each other. The learning curve demonstrated how the network's performance improved during the network's training. During training and validation phases, the cross-entropy that used to evaluate the ANN model performance tends to decrease as the epoch increased, eventually converging at about 40 epochs. The epoch represents the number times that the training algorithm passed through the entire training data. A well trained ANN model should have very low cross-entropy value at the end of the training [27]. In this study, the crossentropy value was less than 10 -5 or close to zero at about 40 epochs. The physical interpretation of this value would be that the desired outputs or a set of target categories and the ANN's outputs in the training set on average have become very close to each other. In other words, the model has suitably fit to the training data sets. As a result, the training and validation performances in this study reached 100%.  Furthermore, these results indicate that the ANN was well trained with the learning data set and correctly classified 2,518 samples in the validation set into either normal and abnormal states of the lathe. In addition, there were considerable variations in the values of the acceleration data on three-axis as shown in Fig. 4. These phenomena resulted in better training of the ANN and ultimately revealed a high performance on the classification accuracy. The ANN model showed perfect classification accuracy (100%) for the testing data set, which is better than that of the multiclass linear SVM model (68%). This study established a multiclass linear SVM in order to compare the performance of the proposed ANN model. The classification accuracies of the linear SVM for the learning and testing data sets were 68.5% and 68.3%, respectively.

Discussion
The present study developed an artificial neural network (ANN) model to detect normal and abnormal or dangerous conditions of a lathe machine based on acceleration sensor data on three-axis. The normal conditions were divided into two states: idle and normal processing. The abnormal conditions were defined by analyzing accident cases and consisted of seven unsafe conditions of lathe: eccentric rotation, chipping, improper workpiece fixation, base looseness, glove contact, hair contact, and necklace contact. A small lathe machine was operated to measure data transmitted from an acceleration sensor. As a result, it was determined that the accuracy of the ANN model developed in this study was 100%, which was significantly better than a model based on a support vector machine (SVM). The findings of this study can be utilized to detect unsafe conditions in real-time to reduce industrial accidents and secure the safety of workers.
Although there were some conditions overlapping in each axis, they could be separated if we considered combinations of all axes. For example, for the x-axis, the eccentric rotation (mean ± SD: -0.35 × 0.02) and base looseness (0.26 × 0.02) conditions were largely different. Alternatively, the chip attached (0.14 × 0.02) and workpiece loose (0.12 × 0.02) conditions were quite similar to each other. However, the chip attached (0.35 × 0.02) and workpiece loose (-0.06 × 0.02) conditions for the z-axis were largely different. Based on these results, the classification accuracy of the ANN model was very good when all three axes data are used in the training phase of ANN.
To objectively evaluate the classification performance of the proposed ANN model, this study compared the ANN model with a multiclass linear SVM model. Both ANN and SVM methods have been widely used to solve various supervised classification problems. As aforementioned, this study compared the proposed standard ANN model with the linear multiclass SVM without any kernel adjustment in order to establish a fairly comparison between the models. As a result, the ANN model in this study worked better than the SVM with a linear kernel. The ANN classification accuracy of this study was more than 31% higher than the linear SVM method. These results indicated the effectiveness of the proposed ANN model in classifying the state of a lathe into either normal or abnormal states based on acceleration sensor data. The superiority of the ANN method over the SVM method can be explained based on the fact that the ANN can capture nonlinear patterns in the data, while the linear SVM failed to do so.
Although this study has delivered promising results, two future studies are needed in order to improve the applicability of the ANN model for industrial settings. First, the effect of the sampling rate should be investigated in future works. Acceleration measurements of this study were sampled at 62.5 Hz/s and successfully identified various abnormal conditions. However, a higher number of measurements per second may be required if the rotation speed of a lathe machine is significantly faster than the lathe used in this study (20,000 rpm). Thus, it is necessary to conduct an indepth study to determine the appropriate number of acceleration measurements that need to be taken per second to apply the results of this study to a lathe machine with a faster rotation speed. Second, it is also recommended to develop a transfer learning model to extend the applicability of this ANN model. Transfer learning is a method used to re-train a pre-learned deep network to fit into a new environment. The transfer learning can enable the ANN model proposed in this study to be applied to other types of machines (e.g., milling machines and drilling machines), as well as to unsafe conditions that were not considered in this study.

Conclusions
This paper aimed at developing an artificial neural network (ANN) model to classify the lathe states into either normal and abnormal conditions based on threeaxis acceleration sensor data. The normal conditions were divided into two states: idle and normal processing. Meanwhile, the abnormal conditions consisted of seven unsafe conditions of lathe: eccentric rotation, chipping, improper workpiece fixation, base looseness, glove contact, hair contact, and necklace contact. A small lathe machine was operated under the predetermined nine conditions and their acceleration data were measured using an acceleration sensor. The acceleration data on Epochs three-axis then were fed into the neural network to classify the states of lathe. An objective comparison of the classification performance between ANN and SVM classifiers was also completed in this study. The result of this study revealed that the performance of the proposed ANN model (100%) has been found to be substantially better for testing data set than that of linear multiclass SVM (68%). The findings showed promising results and the potential application of ANN as classifier in the lathe condition detection. In sum, we expect that the proposed ANN model of this study would be helpful in the development of the unsafe conditions detection system of the lathe operation in real-time to prevent industrial accidents and consequently improve safety of workers.