A GAN-BPNN-Based Surface Roughness Measurement Method for Robotic Grinding

Existing machine vision-based roughness measurement methods cannot accurately measure the roughness of free-form surfaces (with large curvature variations). To overcome this problem, this paper proposes a roughness measurement method based on a generative adversarial network (GAN) and a BP neural network. Firstly, this method takes images and curvature of free-form surfaces as training samples. Then, GAN is trained for roughness measurement through each game between generator and discriminant network by using real samples and pseudosamples (from generator). Finally, the BP neural network maps the image discriminant value of GAN and radius of curvature into roughness value (Ra). Our proposed method automatically learns the features in the image by GAN, omitting the independent feature extraction step, and improves the measurement accuracy by BP neural network. The experiments show that the accuracy of the proposed roughness measurement method can measure free-form surfaces with a minimum roughness of 0.2 μm, and measurement results have a margin of 10%.


Introduction
Grinding is a widespread but essential process in manufacturing products. It is widely used in aerospace, automobile manufacturing, rail transit and other industries [1]. Traditionally, grinding is done by manual operation or multi-axis CNC machine tools. The former is time-consuming and labor-intensive, while the latter is limited by operating space. Recently, robotic belt grinding has become an alternative due to its low cost, efficiency and large operating space [2]. For small workpiece, the robot generally uses appropriate contact force to ensure the stability of the workpiece [3]. The robot holds the workpiece to complete the grinding operation and uses its dexterity to move to the best inspection position on the surface of the workpiece [4]. Multiple sampling points are planned according to the curvature of the workpiece surface, and the robot moves to each sampling point in turn to complete the surface image sampling.
As an important indicator of the quality of machined surfaces, surface roughness has a significant impact on product life and reliability [5]. The traditional probe-based measurement method [6][7][8][9] uses a probe that slides over the surface of the workpiece for measurement. This method has been proven to be highly reliable and highly accurate. However, it has several limitations, such as long measurement times, high environmental requirements and complex steps.
With the development of optical technology, a variety of noncontact measurement methods has been developed to address the limitations of the contact measurement method. For example, optical microscopy, confocal laser scanning microscopy and white light interferometry are used to measure surface roughness, but these methods are mainly used in laboratories, because their high cost and complicated operation are not suitable for real industrial production. Currently, the most popular noncontact measurement method feature extraction step. Finally, the BP neural network represents the correlation between the GAN discriminant value and the roughness (Ra).

Generative Adversarial Network
A GAN consists of two parts: the generative and discriminative networks, which use an adversarial game between generators and discriminators to achieve self-supervised learning. The main difference from the traditional network model is that the data training process contains both consistent and adversarial data. The generators and discriminators each optimize in different directions and form a competitive relationship with each other, but they also depend on each other to form a unified whole. In the adversarial training mode, the generator no longer learns directly from the training dataset, but learns iteratively in an indirect way through the optimization directions output by the discriminator, generating pseudosamples to mix the spurious with the genuine. A GAN computes faster and has greater expansion flexibility than a traditional network. In this paper, we propose using a GAN to discriminate the roughness of the surface of workpieces using the structure shown in Figure 1.
network play with each other to automatically learn the features in the image the feature extraction step. Finally, the BP neural network represents the corr tween the GAN discriminant value and the roughness (Ra).

Generative Adversarial Network
A GAN consists of two parts: the generative and discriminative networks, an adversarial game between generators and discriminators to achieve self-s learning. The main difference from the traditional network model is that the da process contains both consistent and adversarial data. The generators and disc each optimize in different directions and form a competitive relationship with but they also depend on each other to form a unified whole. In the adversari mode, the generator no longer learns directly from the training dataset, but le tively in an indirect way through the optimization directions output by the disc generating pseudosamples to mix the spurious with the genuine. A GAN comp and has greater expansion flexibility than a traditional network. In this paper, w using a GAN to discriminate the roughness of the surface of workpieces using ture shown in Figure 1.

Roughness
Ra Discriminator Pseudo images In other words, the loss function of GAN is as follows: The disadvantages of GAN: (1) GAN training is unstable, and the training degree of generator and dis should be carefully balanced.
(2) When the generator learns that some features of the real data successfu the discriminator, it will not update. As a result, the generated samples lack div a collapse mode occurs in GAN.
(3) When the overlap between the real and generated distributions is neg JS divergence between the real and generated distributions is minimized to log2. When the discriminator is optimal, the loss of the minimized generator is to log2, and G is no longer updated, resulting in the disappearance of the gen dient. p z (z) represented a prior on input noise variables, G(z) was generator of GAN, and D(x) represented the probability that x comes from real images. GAN's goal is training D(x) to maximize the probability of assigning the correct label to both training real samples and pseudosamples from G(z), at the same time training G(z) to minimize log(1 − D(G(z))). In other words, the loss function of GAN is as follows: The disadvantages of GAN: (1) GAN training is unstable, and the training degree of generator and discriminator should be carefully balanced.
(2) When the generator learns that some features of the real data successfully deceive the discriminator, it will not update. As a result, the generated samples lack diversity, and a collapse mode occurs in GAN.
(3) When the overlap between the real and generated distributions is negligible, the JS divergence between the real and generated distributions is minimized to a constant log2. When the discriminator is optimal, the loss of the minimized generator is also closer to log2, and G is no longer updated, resulting in the disappearance of the generator gradient.
In order to overcome the above shortcomings, the generator and discriminator network structures of the original GAN network are redesigned. In this paper, a deep convolutional neural network is used as the network structure of the generator and discriminator: The structure of the generative network is shown in Figure 2, and the corresponding discriminator network structure is shown in Figure 3.
Machines 2022, 10, x FOR PEER REVIEW 4 of convolutional neural network is used as the network structure of the generator and di criminator: The structure of the generative network is shown in Figure 2, and the correspondin discriminator network structure is shown in Figure 3.  From Equation (1), it can be seen that the objective of the discriminator is to obta the maximum value of ( ) , V G D . Then, it is necessary to maximize ( ) D x , which mea maximizing the probability that real samples and generated samples will be assigned th correct label. At the same time, the generator which means minimizing the difference between the generated samples and the true sam ples. Therefore, the value function of GAN can be decomposed into two optimizatio problems: (1) Fix the generator G , train the discriminator D , so that it can maximize the corre determination of whether the sample is from the real sample or from the sample generate by G . The objective function of D is, Finding the derivative of Equation (2) with respect to ( ) D x , such that its derivativ 0 gives, (3), the optimal discriminator is obtained as follows:  convolutional neural network is used as the network structure of the generator and dis criminator: The structure of the generative network is shown in Figure 2, and the correspondin discriminator network structure is shown in Figure 3.  From Equation (1), it can be seen that the objective of the discriminator is to obtai the maximum value of ( ) , V G D . Then, it is necessary to maximize ( ) D x , which mean maximizing the probability that real samples and generated samples will be assigned th correct label. At the same time, the generator which means minimizing the difference between the generated samples and the true sam ples. Therefore, the value function of GAN can be decomposed into two optimizatio problems: (1) Fix the generator G , train the discriminator D , so that it can maximize the correc determination of whether the sample is from the real sample or from the sample generate by G . The objective function of D is, Finding the derivative of Equation (2) with respect to ( ) D x , such that its derivativ 0 gives, (3 Rewriting Equation (3), the optimal discriminator is obtained as follows:  From Equation (1), it can be seen that the objective of the discriminator is to obtain the maximum value of V(G, D). Then, it is necessary to maximize D(x), which means maximizing the probability that real samples and generated samples will be assigned the correct label. At the same time, the generator G is trained to minimize log(1 − D(G(z))), which means minimizing the difference between the generated samples and the true samples.
Therefore, the value function of GAN can be decomposed into two optimization problems: (1) Fix the generator G, train the discriminator D, so that it can maximize the correct determination of whether the sample is from the real sample or from the sample generated by G. The objective function of D is, Finding the derivative of Equation (2) with respect to D(x), such that its derivative 0 gives, Rewriting Equation (3), the optimal discriminator is obtained as follows: (2) Fix the discriminator D and train the generator G, such that L = max minimizes the difference between the generated samples and the real samples. The objective function of G is given by, Substituting Equation (4) into Equations (2) and (5), we obtain, Machines 2022, 10, 1026

of 17
Introducing two important similarity metrics KL divergence (Kullback-Leibler divergence) and JS divergence (Jensen-Shannon divergence), Equation (6) is rewritten as, From Equation (7), it can be seen that fixing the discriminator, the goal of training the generator is to have a JS dispersion of 0 between P g and P data , i.e., P g = P data . At this point, the discriminator D * (G) = 1 2 . Thus, the equilibrium between generator and discriminator is realized by reciprocally training the GAN.

Measurement of Surface Roughness of Workpieces
In this method, a neural network is used to discriminate the surface roughness of a grinded workpiece. A small number of data images are used to train a generative adversarial network (GAN) to generate the required large dataset for training the discriminative network, which outputs the surface roughness measurements of the workpiece.

Image Acquisition and Data Preprocessing Methods Subsection
The radius of the curvature and roughness of the workpiece surface directly determine the refractive index of light, a factor which affects the imaging effect of the workpiece surface.
Therefore, 72 images of workpieces with different curvature radii and roughness were collected in this study. The 12 images with the roughest and smoothest surfaces were selected as the original training dataset for the GAN generator, with 6 smooth and 6 rough images, as shown in Figure 4. However, the amount of data in the original dataset of 12 images was too small to be used directly for training the GAN discriminator, which would lead to severe overfitting of the discriminator. Therefore, the original images were first rotated and panned to generate a sufficient number of derived images (32,000 images were generated in the experiment). (2) and (5), we obtain,

Substituting Equation (4) into Equations
Introducing two important similarity metrics KL divergence (Kullback-Leibler divergence) and JS divergence (Jensen-Shannon divergence), Equation (6) From Equation (7), it can be seen that fixing the discriminator, the goal of training the generator is to have a JS dispersion of 0 between g P and data P , i.e., DG= . Thus, the equilibrium between generator and discriminator is realized by reciprocally training the GAN.

Measurement of Surface Roughness of Workpieces
In this method, a neural network is used to discriminate the surface roughness of a grinded workpiece. A small number of data images are used to train a generative adversarial network (GAN) to generate the required large dataset for training the discriminative network, which outputs the surface roughness measurements of the workpiece.

Image Acquisition and Data Preprocessing Methods Subsection
The radius of the curvature and roughness of the workpiece surface directly determine the refractive index of light, a factor which affects the imaging effect of the workpiece surface.
Therefore, 72 images of workpieces with different curvature radii and roughness were collected in this study. The 12 images with the roughest and smoothest surfaces were selected as the original training dataset for the GAN generator, with 6 smooth and 6 rough images, as shown in Figure 4. However, the amount of data in the original dataset of 12 images was too small to be used directly for training the GAN discriminator, which would lead to severe overfitting of the discriminator. Therefore, the original images were first rotated and panned to generate a sufficient number of derived images (32,000 images were generated in the experiment).

GAN-Based Surface Roughness Discrimination Method
The generative network attempts to create images that the discriminant network cannot distinguish from real images during the training process, while the discriminant network is equivalent to a binary classification network to distinguish between the real training images and the images created by the generator. In this way, the model parameters are continuously optimized by the adversarial training between the two networks. Over multiple iterations, the images created by the generative network become closer to the real images, and the discriminant network increasingly understands the meaning of the roughness represented by the images, and finally gives the roughness value.
The process of training the GAN is shown in Figure 5.

GAN-Based Surface Roughness Discrimination Method
The generative network attempts to create images that the discriminant network cannot distinguish from real images during the training process, while the discriminant network is equivalent to a binary classification network to distinguish between the real training images and the images created by the generator. In this way, the model parameters are continuously optimized by the adversarial training between the two networks. Over multiple iterations, the images created by the generative network become closer to the real images, and the discriminant network increasingly understands the meaning of the roughness represented by the images, and finally gives the roughness value.
The process of training the GAN is shown in Figure 5.
Step 1: The original datasets (surface roughness images) are classified in a binary fashion and labeled as "smooth" and "rough" according to a certain threshold.
Step 2: Real surface roughness images marked by the classification in step 1 are rotated and panned to expand datasets.
Step 3: The GAN is trained using the "rough" category data in the dataset in Step 2.
Step 4: The GAN is trained using the "smooth" category data in the dataset in Step 2.
Step 5: The image data is generated from the generation network trained in steps 3 and 4 to complete the data set expansion.
Step 6: The discriminative network is retrained for the expanded smooth and rough datasets generated by the generative network in step 5 to obtain the final roughness recognition network model.  Step 1: The original datasets (surface roughness images) are classified in fashion and labeled as "smooth" and "rough" according to a certain threshold.
Step 2: Real surface roughness images marked by the classification in step tated and panned to expand datasets.
Step 3: The GAN is trained using the "rough" category data in the dataset in Step 4: The GAN is trained using the "smooth" category data in the dataset i Step 5: The image data is generated from the generation network trained in and 4 to complete the data set expansion.
Step 6: The discriminative network is retrained for the expanded smooth an datasets generated by the generative network in step 5 to obtain the final roughnes nition network model.

Training Results
To teach the GAN the meaning of "rough," real smooth images are added data to train the discriminator along with the output of the generator, as shown i 6a. Figure 6b shows examples of the surface roughness of workpieces generated GAN.

Training Results
To teach the GAN the meaning of "rough," real smooth images are added as fake data to train the discriminator along with the output of the generator, as shown in Figure 6a. Figure 6b shows examples of the surface roughness of workpieces generated by the GAN. Step 1: The original datasets (surface roughness images) are classified in a binary fashion and labeled as "smooth" and "rough" according to a certain threshold.
Step 2: Real surface roughness images marked by the classification in step 1 are rotated and panned to expand datasets.
Step 3: The GAN is trained using the "rough" category data in the dataset in Step 2.
Step 4: The GAN is trained using the "smooth" category data in the dataset in Step 2.
Step 5: The image data is generated from the generation network trained in steps 3 and 4 to complete the data set expansion.
Step 6: The discriminative network is retrained for the expanded smooth and rough datasets generated by the generative network in step 5 to obtain the final roughness recognition network model.

Training Results
To teach the GAN the meaning of "rough," real smooth images are added as fake data to train the discriminator along with the output of the generator, as shown in Figure  6a. Figure 6b shows examples of the surface roughness of workpieces generated by the GAN.  The GAN is trained using the expanded datasets, and then the GAN is able to generate a series of smooth and rough images as the training set. The problem is treated as a binary classification problem using the sigmoid function as the output activation function and the binary cross-entropy as the loss function for training, with the rough images labeled '1' and the smooth images labeled '0'. In this method, the same network structure of the classifier with the discriminator of the GAN is used, as shown in Table 1. In the method described above, a dataset with only roughness Ra of 0.2, 0.4, 3.2, 6.3 and radius of curvature R of 50, 1000, and infinity are used as the training set. However, the dataset in the actual test contains more cases of roughness and radius of curvatures. A qualified classifier should be able to accurately distinguish the cases which are not encountered in the training set. Some of the actual test results are shown in Table 2, which visually reflects the classifier's scoring of images with different roughness levels. The smaller score means the smoother surface. The test results show that the method can accurately determine the untrained intermediate roughness (0.8 and 1.6 are the untrained cases), which indicates that the network can understand the concept of "roughness."

Discriminating Method of Workpiece Surface Roughness
Roughness (Ra) is a small-distance (usually less than 1 mm) peak-valley that forms from a microgeometric shape error of the surface of the part. As shown above, the real surface image can obtain a discriminant value, nonlinearly related to roughness Ra through the trained GAN. In order to establish a mapping relationship between the discrimination value of GAN and surface roughness Ra, this paper proposes a surface roughness Ra discrimination method based on the BP neural network, which is shown in Figure 7.

Discriminating Method of Workpiece Surface Roughness
Roughness (Ra) is a small-distance (usually less than 1 mm) peak-valley that forms from a microgeometric shape error of the surface of the part. As shown above, the rea surface image can obtain a discriminant value, nonlinearly related to roughness Ra through the trained GAN. In order to establish a mapping relationship between the discrimination value of GAN and surface roughness Ra, this paper proposes a surface rough ness Ra discrimination method based on the BP neural network, which is shown in Figure  7. The input layer of the BP neural network for image discriminant value and radius of curvature is denoted as x i (i = 1, 2), and the output surface roughness is denoted as z. The number of neurons in the hidden layer is s, denoted as y i (1, 2, · · · , s). The bias value of the hidden layer is γ, and the bias of the output layer is θ. w denotes the connection weights from the input layer to the hidden layer, v denotes the connection weights from the hidden layer to the output layer, while f y and f z are the activation functions of the hidden and output layers, respectively. The forward propagation process of the BP neural network is expressed as: Equation (8) completes the mapping from x i (i = 1, 2) to z. α denotes the target value of the output, and the error of the BP neural network is: The error back-propagation process of the BP neural network is implemented by minimizing the objective function by Equation (9). The weights and biases of each layer are adjusted for each propagation as follows: From Equation (8), it can be seen that the data transfer process between the layers is transformed and connected by the activation function. Meanwhile, in the error backpropagation process in the BP neural network in Equation (10), the derivatives of the activation function adjust the connection weights of each layer to reduce the error to the desired range. Considering the requirement that the activation function be continuously differentiable, the sigmoid function is chosen as the output layer activation function, and the tanh function is chosen as the output layer activation function. To ensure accuracy of roughness estimation, this study determines the number of neurons in the hidden layer according to the Hecht-Nelson method [29] because the hidden layer affects the stability of the network. The number of input layer neurons is n, while the number of hidden layer neurons is 2n + 1. That is, the number of hidden layer neurons in the network is 5. Networks with different numbers of neurons have also been tested, as shown in Table 3. After determining that there should be one hidden layer for the BP neural network model, the number of neurons in the hidden layer must be determined. For each neural network model in Table 3, the average error between the actual and predicted values were recorded in 10 training sessions. It is clear from Table 3 that as the number of neurons in the hidden layer increases, the accuracy does not necessarily follow. When the number of hidden layer neurons increases from 3 to 5, the average error decreases from 12.42% to 6.24%. However, as the number of hidden layer neurons continues to increase to 7, the average error increases from 6.24% to 14.63%. The 2-5-1 neural network structure has the smallest error, and so this network structure is used in the real-time surface roughness model in this study.

Experiments
In this study, a robot is used to hold the workpiece while grinding a complex, curved item. The robotic grinding platform is built as shown in Figure 8, consisting of a belt grinder, a lightweight robot with seven degrees of freedom and a camera. Surface roughness is a key feature of the surface texture of a workpiece because it has a significant impact on the service life and reliability of a mechanical product. This paper proposes a vision-based roughness measurement method for comprehensively considering the cost, usability, and efficiency. This method consists of three stages: image acquisition, self-supervised learning and result discrimination. A narrow-angle industrial camera is used to build a vision-based surface roughness measurement system, as shown in Figure 9. Surface roughness is a key feature of the surface texture of a workpiece because it has a significant impact on the service life and reliability of a mechanical product. This paper proposes a vision-based roughness measurement method for comprehensively considering the cost, usability, and efficiency. This method consists of three stages: image acquisition, self-supervised learning and result discrimination. A narrow-angle industrial camera is used to build a vision-based surface roughness measurement system, as shown in Figure 9. Surface roughness is a key feature of the surface texture of a workpiece because it has a significant impact on the service life and reliability of a mechanical product. This paper proposes a vision-based roughness measurement method for comprehensively considering the cost, usability, and efficiency. This method consists of three stages: image acquisition, self-supervised learning and result discrimination. A narrow-angle industrial camera is used to build a vision-based surface roughness measurement system, as shown in Figure 9. The narrow-angle Balser ace 2 industrial camera meets the needs of this method for surface roughness measurement of curved workpieces. Its detailed parameters are shown in Table 4. Table 4. Parameters of Balser ace 2 narrow angle camera.

Resolution ratio
2.3 MP Figure 9. Surface roughness measurement system based on vision.
The narrow-angle Balser ace 2 industrial camera meets the needs of this method for surface roughness measurement of curved workpieces. Its detailed parameters are shown in Table 4. Balser ACE 2 samples images of standard grinding surface roughness contrasts as shown in Figure 10a, and images of standard milled surface roughness contrasts as shown in Figure 10b. There is no significant difference between images Ra 0.2 and Ra 0.1. The camera can distinguish surfaces with surface roughness Ra greater than 0.2. The image samples in Figure 10 are added to the training set of the proposed GAN to enrich the samples and increase the measurement accuracy of the model. Balser ACE 2 samples images of standard grinding surface roughness contrasts as shown in Figure 10a, and images of standard milled surface roughness contrasts as shown in Figure 10b. There is no significant difference between images Ra 0.2 and Ra 0.1. The camera can distinguish surfaces with surface roughness Ra greater than 0.2. The image samples in Figure 10 are added to the training set of the proposed GAN to enrich the samples and increase the measurement accuracy of the model. The blade-grinding process is divided into three processing stages according to the requirements of the grinding process: rough grinding, semi-finishing grinding and finishing grinding. The rough grinding stage removes a large amount of the material using the grinding parameters belt line speed 5 m/s, feed speed 3 mm/s, belt mesh 120 and contact force 15 N. The semi-finishing stage removes a small amount of material with the grinding parameters of belt line speed 5 m/s, feed speed 3 mm/s, belt mesh 320 and contact force 10 N. The finishing stage is mainly for finishing the surface of the workpiece with the grinding parameters belt line speed 5 m/s, feed speed 3 mm/s, belt mesh 320, and contact force 5 N. After each grinding stage, the surface roughness is measured and analyzed.
In this study, an industrial camera was used to take pictures of the workpiece surface under a specific light environment to measure the surface roughness conditions, as shown in Figure 11. In order to compare the measurement accuracy of different learning algorithms, ANN and CNN are added to train the surface roughness measurement model in this paper. The GAN-BPNN, ANN, CNN were used to judge the smoothness of the polished processing surface in Figure 11, as shown in Table 5. The proposed GAN-BPNN has The blade-grinding process is divided into three processing stages according to the requirements of the grinding process: rough grinding, semi-finishing grinding and finishing grinding. The rough grinding stage removes a large amount of the material using the grinding parameters belt line speed 5 m/s, feed speed 3 mm/s, belt mesh 120 and contact force 15 N. The semi-finishing stage removes a small amount of material with the grinding parameters of belt line speed 5 m/s, feed speed 3 mm/s, belt mesh 320 and contact force 10 N. The finishing stage is mainly for finishing the surface of the workpiece with the grinding parameters belt line speed 5 m/s, feed speed 3 mm/s, belt mesh 320, and contact force 5 N. After each grinding stage, the surface roughness is measured and analyzed.
In this study, an industrial camera was used to take pictures of the workpiece surface under a specific light environment to measure the surface roughness conditions, as shown in Figure 11. In order to compare the measurement accuracy of different learning algorithms, ANN and CNN are added to train the surface roughness measurement model in this paper. The GAN-BPNN, ANN, CNN were used to judge the smoothness of the polished processing surface in Figure 11, as shown in Table 5. The proposed GAN-BPNN has a margin of error of 10%. However, the prediction error of ANN and CNN were more than 10%. a margin of error of 10%. However, the prediction error of ANN and CNN were more than 10%. Figure 11. Roughness measurement based on machine vision. In order to measure blade surface roughness more accurately, this paper designs a sampling point distribution method based on constant chord height. The method realizes a dense distribution of sampling points in the region with a large curvature variation and a sparse distribution in the region with a small curvature variation, as shown in Figure 12.
(2) The baseline AE was obtained by connecting the end points of the curve.
(3) Determine whether there exists a point on the curve AE whose distance to the datum line is greater than  . If there is a point on AE , whose distance from the datum line AE is the farthest point is    In order to measure blade surface roughness more accurately, this paper designs a sampling point distribution method based on constant chord height. The method realizes a dense distribution of sampling points in the region with a large curvature variation and a sparse distribution in the region with a small curvature variation, as shown in Figure 12.  (1) Set a chord height ε.
(2) The baseline AE was obtained by connecting the end points of the curve.
(3) Determine whether there exists a point on the curve AE whose distance to the datum line is greater than ε. If there is a point on AE, whose distance from the datum line AE is the farthest point is n 0 , then delete the original datum line AE.
(4) Set n 0 to B and connect the AB and BE as the new datum line.
(5) Determine whether there exists a point on the curve AB whose distance to the datum line is greater than ε, and if there is a point on AB whose distance from the datum line AB is the farthest point is n 1 . Similarly, point n 2 on curve AB is obtained. Rewrite A, n 1 , B, n 2 , E as A, B, C, D, E. Repeat the above process until all points on the curve to the datum line position are less than the threshold ε. In this paper, five sampling points (A, . . . , E) marked in the figure were taken as examples to compare the roughness changes of blades before and after grinding, as shown in Figure 13. The robot planed the motion trajectory according to the position and curvature of the sampling points (20 mm × 20 mm area centered on this point), collecting images of the five sampling points in turn at the best angle, as shown in Figure 14. Repeat the above process until all points on the curve to the datum line posi less than the threshold  . In this paper, five sampling points (A,…, E) marked in th were taken as examples to compare the roughness changes of blades before an grinding, as shown in Figure 13. The robot planed the motion trajectory accordin position and curvature of the sampling points (20 mm × 20 mm area centered point), collecting images of the five sampling points in turn at the best angle, as sh Figure 14. The image data of the sampling points before and after polishing can obtain responding predicted value by the roughness discrimination model of the GAN + ral network, as shown in Table 6. It can be seen that the relative error between t dicted roughness and the real roughness (measured by SJ-210) has a margin of 10%, which meets the needs of industrial detection. The image data of the sampling points before and after polishing can obtain the corresponding predicted value by the roughness discrimination model of the GAN + BP neural network, as shown in Table 6. It can be seen that the relative error between the predicted roughness and the real roughness (measured by SJ-210) has a margin of error of 10%, which meets the needs of industrial detection.

Conclusions
In this paper, we propose a roughness evaluation method combining generative an adversarial network (GAN) and a BP neural network, which avoids the influence of surface image differences with different curvatures on the accuracy of roughness

Conclusions
In this paper, we propose a roughness evaluation method combining generative an adversarial network (GAN) and a BP neural network, which avoids the influence of surface image differences with different curvatures on the accuracy of roughness measurements. The method automatically learns features in the image by generators playing with discriminators, eliminating the independent feature extraction step. This does not merely shorten the prediction time but reduces the complexity of model training as well. Experiments show that the proposed method can measure a free-form surface with a minimum roughness of 0.2 µm, and measurement results have a margin of error of 10%. Since the proposed method does not require the operator to have the field knowledge of feature recognition, the method is easier to apply in a factory. However, the proposed roughness evaluation method using GAN takes a long time for model training due to its convolution process and depth structure characteristics. To overcome this problem, the adaptive model can be considered in future research to automatically adjust the hyperparameters.
Author Contributions: G.Z. was responsible for methodology and manuscript writing. C.L. was responsible for software. K.M. was responsible for experiments. F.N. was responsible for reviewing papers and providing funding support. H.L. provided resources. All authors have read and agreed to the published version of the manuscript.
Funding: This work is supported by Self-Planned Task (NO.SKLRS202204B) of State Key Laboratory of Robotics and System (HIT).