Basic Application of Deep Convolutional Neural Network to Visual Inspection

aDepartment of Mechanical Engineering, Faculty of Engineering, Tokyo University of Science, Yamaguchi Sanyo-Onoda 756-0884, Japan bGunma Research and Development Center, Mitsubishi Pencil Co. Ltd. Fujioka, Gunma 375-8501, Japan cGraduate School of Natural Science and Technology, Okayama University Okayama 700-8530, Japan dMechanical Engineering Department, School of Sciences and Engineering, The American University in Cairo AUC Avenue, P.O.Box 74, New Cairo 11835, Egypt *Corresponding Author: nagata@rs.tusy.ac.jp


Introduction
Artificial neural network (ANN) which has four or more layers structure is called deep NN (DNN) and is recognized as a promising machine learning technique.Nagi et al. designed max-pooling convolutional neural networks (MPCNN) for vision-based hand gesture recognition (1) .The MPCNN could classify six kinds of gestures with 96% accuracy and allow mobile robots to perform real-time gesture recognition.Weimer et al. also designed a deep CNN architectures for automated feature extraction in industrial inspection process (2) .The convolutional neural network (CNN) automatically generates features from massive amount of training image data and demonstrates excellent defect detection results with low false alarm rates.Faghih-Roohi et al. presented a different type of deep CNN for automatic detection of rail surface defects (3) .It was concluded that the large CNN model performed a better classification result than the small and medium CNN, although the training required a longer time.Further, Zhou et al. used a CNN to classify the surface defects of steel sheets (4) .The CNN could directly learn better representative features from labeled images of surface defects.
In this paper, a DCNN is designed to inspect (detect) defects such as crack and burr phenomena occurred in the manufacturing process of resin molding, then the trained DCNN is evaluated through inspection trials.A training image generator is first developed to efficiently generate a lot of similar images for training by rotating, translating, scaling or transforming an original image.Then, the designed DCNN is trained using the images.The ability of the trained DCNN for classifying sample images in a training test set into "OK" or "NG" category is tested and evaluated.

Preparation of Training Data
Figures 1 and 2 show examples of "OK" and "NG" DOI: 10.12792/iciae2018.004samples for training.Numerous image files of produced workpieces and their paired labels for classification are needed to construct a reliable DCNN system.To cope with the need, a dialogue application called the training image generator was first developed for DCNN training that can efficiently produce a lot of similar images from an original one as shown in Fig. 3, in which similar deformed images are generated by rotating, translating, scaling or transforming an original image.For example, the images given with the number from 89 to 100 in Fig. 1 are similar but a little bit different.They are efficiently increased by rotating, translating or scaling the original image.
A training set consisting of 2040 samples, i.e., 1020 "OK" and 1020 "NG" samples, is prepared in advance."NG" samples include multiple images with undesirable crack, burr and/or knob (protrusion).It is expected that the DCNN designed in the next section is able to obtain the promising cognition ability to categorize samples into "OK" or "NG".where y1 and y2 are the outputs from the 13 th fully connected layer.

Design of Deep Convolutional Neural Network
Figure 5 shows the image of square filter to detect typical defects such as burr, crack, and so on.After the DCNN was trained, a categorization test was conducted using the training set. Figure 6 shows the scores of categorization "OK" and "NG" using all the samples in training set (total samples number is 2040).As can be seen, all the 2040 samples can be well identified with the accuracy more than 0.97.

Training Experiment
The generalization of the trained DCNN was simply evaluated using the training test samples shown in Fig. 7 which were not included in the training set.In other words, the training test set has not been ever used for training.Figure 8 shows the result of the accuracies of categorization "NG" using the 10 training test samples, in which it is observed that example, Fig. 9 shows the enlarged figure of the defect area of "image2.jpg" in Fig. 8.

Conclusions
Artificial neural network (ANN) which has four and more layers structure is called deep NN (DNN) and is recognized as a promising machine learning technique.In this paper, a DCNN was designed to inspect (detect) defects such as crack and burr phenomena occurred in the manufacturing process of resin molding, then the trained DCNN was evaluated.A training image generator was first developed to efficiently generate a lot of similar images for training from an original one.The DCNN was efficiently trained using the generated images.It has been suggested that the trained DCNN has a promising ability to be able to classify sample images in training test set into "OK" or "NG".Furthermore, the additional training method to cope with not well trained samples was shown and evaluated, so that the recognition ability could be effectively and pinpointedly improved to a level of categorization score over 0.96.The designed DCNN is expected to be able to be applied to an actual inspection process.

Fig. 2 .
Fig. 2. Image samples of "NG" products, in which crack, burr and/or protrusion are seen.

Figure 4
Figure 4 illustrates the designed DCNN with 15 layers.The structure of the DCNN is listed as follows:

Table 1
tabulates the main parameters for training of the DCNN.The training was conducted by using a single PC with a Core i7 CPU a GPU (NVIDIA GeForce GTX 1060, 6GB).In this DCNN design, it took about several minutes until the training accuracy reached to 0.95.

Figure 10
Figure 10 shows the additional 10 training samples

Fig. 7 .
Fig. 7. Training test samples of categorization "NG", which were not included in the training set.

Fig. 11 .
Fig. 11.Scores of categorization "OK" and "NG" using the samples in training sets (total samples number = 1040+1040), in which samples shown in Figs.7 and 10 are added.
samples Scores of categorization of OK and NG