Mechanical parts are an important part of the machinery industry. However, the current automated production lines for mechanical parts face great challenges. Different types and sizes of parts make automatic segmentation of parts on industrial lines prone to wrong segmentation. Therefore, this paper proposes a part classification method based on a convolutional neural network. The method can utilize a large amount of data of mechanical parts and then analyze and learn from the data through convolutional neural networks to detect and classify parts more accurately. It can effectively solve the problems of high-cost and error-prone manual parts classification and greatly reduce the cost of automatic detection and classification of enterprises. We adopt this model to conduct a series of experiments on the Pacon dataset. It includes the calculation of weights and the construction of confusion matrix values. The experimental results show that the model achieves excellent performance in parts classification and prediction.

1. Introduction

With the rapid development of modern industrialization, the manufacturing industry of mechanical parts [1] has a great prospect. Automatic parts [2] production has entered many enterprises. At present, China’s parts processing and detection industry has considerable market prospects, and high-quality parts processing has become a relatively scarce technology. Therefore, parts [3, 4] processing and detection industry is in urgent need of extensive expansion. Labor costs are getting more expensive now, but front-line workers cannot see the slight flaw. Such problems lead to the need to develop technology to identify and classify some parts.

In recent years, some researchers have made a lot of contributions to the method of judging the merits and demerits of parts [5, 6]. Among them, O Linins et al.[7] proposed the prediction of worn parts in the electromechanical system, which is a method to judge the merits and demerits of parts. The method uses 3D texture to predict the wear of parts more accurately. Xiang Y M et al. [8] improved the detection of mechanical parts in the upgrading transformation of enterprises. R Liu et al. [9] constructed the cloud inspection framework, data model, and process model and developed a prototype system that can serve for the detection of complex mechanical parts. This method can greatly improve the judgment accuracy of complex parts. I Viana et al. [10] developed a quality control method for mechanical parts. This method uses a single PTZ computer-aided design (CAD) model to match the sensing image of the element to be inspected more accurately. In addition, Yan Zhang et al. [11] developed a process quality inspection system based on image classification technology. It adopts the technology of interest point detection and interest point description, which can improve the efficiency and accuracy of parts detection to a certain extent. R Song [12] proposed an accurate detection method for blades, which uses optical detection and improves the detection accuracy of parts through an optical scanning device used to check blades.

The traditional part classification method can solve most parts prediction problems, but it still identifies small gaps between parts accurately. Methods [13] use a convolutional neural network for real-time recognition and location of mechanical parts. The algorithm can effectively improve the detection accuracy and speed of parts and sort parts. Methods [14] use a kind of new framework that includes deep three-dimensional convolutional neural networks (3D-CNNS) so as to learn machining features from CAD models of mechanical parts. The method can significantly improve present manufacturing feature detection technology and accurately identify various parts processing. Methods [15] are based on CNN. A multiscale convolutional neural network (MSCNN) was proposed to extract more powerful and differential features from the original signals. MSCNN can reduce the number of parameters and training time. Methods [16] develop a gearbox compound fault diagnosis system based on a convolutional neural network (CNN) to greatly shorten the training time of the model. Methods [17] propose a hierarchical multitask convolutional neural network (HMCNN) to diagnose bearing faults, which reduces the propagation of classification errors among multiple tasks and improves the accuracy of fault diagnosis.

In order to solve the above problems of mechanical parts, we propose to use a convolutional neural network to train the data set of parts. Our neural network model has obtained the optimal parameters of training machine parts through several iterations. Our convolutional neural network in Figure 1 uses this optimal parameter to predict the classification of parts and obtains accurate experimental results. In the experiment, our neural network model achieves good results.

2. Convolutional Neural Network for Part Classification

2.1. Network Construction

We use X as the input matrix of the initial neural network for the data set of parts. The input part data X ∈ R ^ nl, where n represents the number of data sets and l represents the number of attributes of each data set.

A convolutional neural network is a feed-forward neural network [18], which is inspired by the biological natural visual cognitive mechanism. The network of parts data can be directly input to the original data set for training, which can carry out complex preprocessing. Convolutional neural networks [19] usually contain convolution layer, pooling layer, and full connection layer. Convolutional layer: each convolutional layer in the convolutional neural network is composed of several convolutional units, and the parameters of each convolutional unit can be obtained through the optimization of the back propagation algorithm. The purpose of convolution operation is to extract different features of the input. The first convolution layer can only extract some low-level features such as edge, line, and angle while the network with more layers can iteratively extract more complex features from low-level features. Excitation layer: this layer performs a nonlinear mapping transformation on the output results of the convolution layer. Commonly used excitation functions are as follows: sigmoid function, Tanh function, and ReLU function. The pooling layer is sandwiching the continuous convolutional layer, which has two functions: 1. reducing the dimension of the feature vector output by the convolutional layer, thus reducing the number of training parameters; 2. reducing the transmission of noise, only retaining the most useful picture information. Generally, there are two pooling methods: maxpooling obtains the maximum value in a sliding window; averagepooling takes the average of all values in the sliding window.

Our method first carries out convolution at the convolution layer of a convolutional neural network [20]. The convolution kernel is 33 for training. The training formula is as follows:where y represents the eigenmatrix obtained through the convolution layer, which is the weight; B is the paranoid value, which is the data of each part.

The matrix Y passes through the excitation layer to obtain f (y). F (y) represents the matrix Y through the excitation function Relu. Relu is characterized by fast convergence and simple gradient calculation.

Modified linear unit (Relu) is a function that performs dot product on each pixel and replaces negative pixels with 0. Its purpose is to add nonlinear factors into CNN. Since most of the real-world problems solved by CNN are nonlinear, and convolution operation is a linear operation, a nonlinear function such as ReLU must be used to add nonlinear properties. And the Relu function is not activated at all when the input is less than 0, so a lower activation rate can be obtained.

2.2. Convolutional Kernel Construction

The zero padding in the convolutional neural network [21] is a hyperparameter that can be set, but it needs to be adjusted according to the size of the convolution kernel and the step and the size of the input matrix, so that the convolution kernel slides to the edge exactly. In our model, the matrix of part data and subsequent convolution kernel is set. The matrix of the feature graph is a square matrix, so the calculation formula of the size of the feature graph generated after convolution is as follows:where is the size of the input matrix, k is the size of the convolution kernel, S is the step length, and P is the number of zeroing layers.

The g function is the full connection layer. After the convolution layer, the eigenmatrix Y is obtained. After a series of nonlinear activation functions and a full connection layer, the classification results of parts are finally obtained. In equation (4), we can see that we use the full connection function to get the predicted value. The function of the full connection layer is to connect all the features, send the output value to the classifier, and convert the two-dimensional feature graph of the convolution output into a (N1) one-dimensional vector. That is, each neuron has a corresponding convolution kernel, which can carry out convolution and pooling operations, so as to obtain a complete picture.

The role of padding is to operate on the matrix size when performing convolution operations. Our experiment adopts a convolutional kernel of 33. In convolution operations, the convolutional kernel can exactly cover the underlying data matrix without additional additions, and all zero paddings are necessary for us.

3. Experiment

3.1. Data Set

We divide the data set Pacon into training set and test set. The ratio of training sets to test sets is about 3:1. The function of the training set is training the parameters of the neural network, so that the neural network can better fit the classification of data. The test set is to verify the merits of the model after training.

3.2. Parameter Settings

Our experimental setting parameters include the learning rate, the size of the convolution kernel, and the number of iterations. In the early stage of model training, a large learning rate will be used for model optimization. With the increase of iterations, the learning rate will gradually decrease, to ensure that the model will not have much fluctuation in the later stage of training, so as to be closer to the optimal solution. Learning rate is the role of ensuring the model for learning optimization.

The range of learning rate is set to {0.01, 0.03, 0.04}. The size of the convolution kernel is set to {11, 33, 55}. The number of iterations is set to {50, 100, 200, 500}.

We generally use accuracy to evaluate indicators. For a given test data set, the ratio of the number of samples correctly classified by the classifier to the total number of samples is called accuracy, which is used to indicate the magnitude of systematic and accidental errors in the measurement results.

3.3. Experimental Results
3.3.1. The Performance of Our Method in Evaluation Index of Sum of Squared Error

In this section, the results of our model in the index sum of squared error (SSE) are shown in the following figure. The abscissa represents the number of iterations, and the ordinate represents the sum of the squares of errors. The blue line segment in Figure 2 represents the curve of the SSE value transformation of this training set as the number of iterations increases. From the figure, we can obviously see that the SSE value decreases with the increase of iteration number, which indicates that in Table 1, the model tends to be stable with the increase of iteration number.

Rainfall distribution on 10–12 weights and .

3.3.2. Realization of Classification—Confusion Matrix and Accuracy

In this section, the confusion matrix values of the part test set under the neural network model are shown in Figure 3. The abscissa represents actual value, and the ordinate in Table 2 represents predicted value. Each column represents the forecast category, and the total for each column represents the number of data predicted for that category. Each row represents the true category of data, and the total number of data instances in each row represents the number of data instances in that category.

3.4. Summary and Outlook

The article presents a part classification method based on a neural network. The convolutional neural network is used to obtain the exact value and confusion matrix of parts classification. In the model, we propose to further update the weight values W1 and W2 obtained from the training set. We can sparse the model to make it fit the data more, which solves the problem of Table 3 being too complex and over fitting of the network, greatly reduces the input dimension, and improves the robustness, so that the model has better stability and superior effect. In future work, we plan to use better computational methods to achieve higher accuracy values of the model. For example, we intend to improve the backpropagation of convolutional neural networks and reduce the dependence of weight values on large datasets, which will allow us to achieve higher recognition accuracy with smaller datasets.

Data Availability

The data that support the findings of the study are available from the corresponding author upon reasonable request.

Conflicts of Interest

The authors declare that they have no conflicts of interest.