How IoT and computer vision could improve the casting quality
How IoT and computer vision could improve the casting quality
casting quality
Iker Pastor-López José Gaviria de la Puerta Borja Sanz
[email protected] Faculty of Engineering, University of Faculty of Engineering, University of
Faculty of Engineering, University of Deusto Deusto
Deusto Bilbao, Vizcaya Bilbao, Vizcaya
Bilbao, Vizcaya
industry, different approaches have been made to the use Deep Learning (DL)[17], that is a sub-field of Artificial Neu-
of computer vision for the detection of the assembly in the ral Networks (ANNs). A standard neural network (NN) is
fuses of gearboxes [30]. a collection of simple connected processors called neurons.
Following this field over the years, several studies have Each neuron produces a sequence of real-valued activations.
also been carried out on castings. In some of them, the detec- The neurons that obtain the inputs from the environment
tion of certain kind of defects in iron castings was executed are called input neurons, and other neurons get activated
through modelling the foundry production parameters as through weighted connections from previously active neu-
input[26]. These kind of studies uses the combination of ma- rons. The output neurons show the final results. DL algo-
chine learning tools with the data extracted from the foundry rithms use the same bases, but include different hidden lay-
using different sensors. ers, and in the last years different architectures have been
These industrial processes have been searching for years developed within these kind of networks [13].
for a convenient way to automate the failure detection pro- These techniques have also been applied to industrial
cess and to interconnect the whole process. As Bringas rightly inspection[31]. Optical Quality Control (OQC ensures that
stated [3], industrial processes have changed with the advent the product is visually free of imperfections or defects. In
of IoT which provides the interconnection of the different this way, it is a common practice in the industry to create
phases of the processes much more optimal by sharing infor- a new set of features that are manually engineered when a
mation among them. As an example, there have been some problem arises. Deep Learning techniques allow us to avoid
developed projects like IPRO (Intelligent Foundry Business this manual step and make t́he featureséngineering process
Process) that seek the generation of intelligent systems dur- automatic. In order to achieve this, it is necessary to get a
ing the industrial process control of foundry. These systems big labelled data-set. Unfortunately, in industrial processes
have a strong sensorization aspect and artificial intelligence there are several issues that pose a challenge when trying to
for the detection and prevention of undesirable situations. acquire this dataset.
The size of a typical data-set to train these systems may
serve as an example. The IRIS data-set[10]; is a traditional
dataset that is included in every traditional machine learning
course. It is composed by 150 instances with 4 attributes in
each of them. On the other hand, the MINST [18] dataset;
which is the equivalent data-set in the deep learning area, is
composed ofaround 70.000 instances of 20x20 images (e.g.,
20x20x3 channels (Red, Green and Blue), 1.200 features per
instance.
In summary, the first dataset contains 600 elements and
the second one around 84 million elements. Thus, nowadays,
the manual feature engineering process is still in use in the
industry. As shown in section 2 , our dataset is not big enough
to apply deep learning techniques. In recent years, several
authors tried to develop new techniques to avoid the use of
this manual feature engineering process when dealing with
small data-sets [16]. Our research is focused on this “small
Figure 1: The Foundry Processes. data” area. We organize the rest of the paper as follows: First,
we start with a complete description to prepare the dataset
Figure 1 shows the entire casting process; from the instant that is used for surface defect categorization. Secondly, we
that the casting is performed to the moment when the pieces describe the machine learning algorithms that are usedfor
are categorized depending on their quality, as good or bad. the experimentation. Finally, we present the results obtained
One of the steps of this process is the part where the whole with the combination of different groups of variables and
process is interconnected through the data. At the end of algorithms, as well as the conclusions of our work.
the process, the defects are successfully detected using the
computer vision. The information provided from the use of
2 DATASET PREPARATION
this technology will result in the improvement of the process
in the early stages and thus avoid defects. Data Gathering
In recent years, there has been a great evolution in the To acquire data from the surface of the castings, we devel-
machine learning area, using algorithms that are known as oped a functional machine vision system (see Figure 1) [20]
How IoT and computer vision could improve the casting quality IoT 2019, October 22–25, 2019, Bilbao, Spain
composed of: (i) a laser-based triangulation camera with noise. As a result of the process, we obtain a matrix with the
3D technology, (ii) a robotic arm and (iii) a computer with height values of the casting in each point.
several data processing capabilities [22].
(1) Image device. We use a laser-based triangulation cam-
era. By taking advantage of the high-power (3-B class)
laser, we are able to scan the casting even though tehir
surface tends to be dark.
(2) Processing device. We use a workstation with a XENON
E5506 processor working with 32 GB of RAM mem-
ory and a QUADRO FX1800 graphic processor unit.
This system process all the data and manages all the
devices.
(3) Robotic arm. We have adapted the camera to the
robotic arm due to the diversity of the castings.
Data Representation
Using this height matrix, we create other three representa-
tions (see Figure 3) of the data. With these representations
we aim to have more complete information about the surface
of the castings and different aspects of the data.
• Grey-scale Height Map [29]: In this representation
we convert each value of the height matrix into a range
between 0 and 255. As a result, we obtain a grey-scale
image with different levels of grey.
• Normals map: It does not only show data about the
heights, but also the direction of the surface in each
point. The resulting vectors for each point, have three
components, one per dimension (x, y, z). Then, we
Figure 2: Proposed prototype for data gathering. codify each one with an RGB color code (R = x, G =
y, B = z), resulting in an image with the vector’s data
To start with the data acquisition, the casting is put over a [22].
black painted table and adjusted on a special silicon mould. • Merge of the normals map and grey-scale height
We use this color to decrease unwished reflections of the map: The last generated representation, merges the
laser, thus, minimizing the noise. Additionally, the mould data of the grey-scale height map and the normals of
ensures that all the scanned castings are in the same position. vector one. In particular, we follow the next process:
Then, making a linear movement with the robotic arm, the (1) We calculate the cosine distance between each nor-
laser is projected over the surface of the casting, and with mal vector and a model vector defined as (0, 0, 1).
this projection, a set of height points are calculated. The This model vector represents a flat surface. A High
precision of our system is of 0.2mm. Then, we remove the value for this distance implies a pixel with a casting
points related to the working table in order to reduce the edge or surface defect.
IoT 2019, October 22–25, 2019, Bilbao, Spain Pastor-López, et al.
will increase the classification time and will influence in the on the creation of pieces for safety and precision components
accuracy of the result). within this industry.
This algorithm does not have a model training stage, and To create the dataset, we collect 645 foundry castings using
it just compares the distance between several instances. Tra- the segmentation system previously described. We use 176
ditionally, the metric used to evaluate distances has been correct casting to train the model, and 469 for testing. With
the euclidean distance and the aggregation metric used to this seed, we create a dataset composed by 5785 segments to
evaluate the class of the instances has been the simple vote train the machine-learning models.
[32]. We focus on the detection of 3 different defects: 1)inclu-
sion, 2) cold lap and 3) misrun. We also iinclude a new cate-
Bayesian Networks gory, called “Correct”, that represents the segments that are
Bayesian Networks[23], which are based on the Bayes Theo- correct, even though the method has marked them as faulty.
rem, are defined as directed acyclic graph models (DAG) for The number of samples in each category are indicated in
multivariate analysis. This model can help to know the sta- Table 1.
tistical dependencies between system variables. Each node
Table 1: Number of samples for each category.
represents problem variables that can be either a premise
or a conclusion and each link represents conditional depen-
dencies between such variables. They have an associated Category Number of samples
probability distribution function. Inclusion 387
Moreover, the probability function illustrates the strength Cold Lap 16
of these relationships in the graph[5]. The most important Misrun 52
capability of Bayesian Networks is their ability to determine Correct 5030
the probability that a certain hypothesis is true (e.g., the prob-
ability of an executable to be malware [9]) given a historical
data-set. The criteria for acceptance is based on the final require-
ments of the customer. Due to the final destination industry,
Support Vector Machines (SVM) the quality standards are very restrictive. To this end, we
SVM algorithms first map the input vector into a higher di- label each possible segment with its defects within the cast-
mension space, and then algorithms divide the n-dimensional ings.
space representation of the data into two regions using a The dataset is not balanced for the existing classes due to
hyperplane. In binary classification, the main goal of the algo- scarce data. To minimize the problems that the algorithms
rithm is to maximize the margin between those two regions tend to have in these cases (scarce and unbalanced data),
or classes. The margin is defined by the farthest distance be- we apply the Synthetic Minority Over-sampling Technique
tween the examples of the two classes and computed based (SMOTE)[7], which is a combination of over-sampling the
on the distance between the closest instances of both classes, less populated classes.
which are called supporting vectors[28]. Next, we conduct the following methodology to evaluate
the precision of our method to categorize the segments:
Decision Trees • Cross validation: it is a commonly used methodology
A Decision Tree classifies a sample through a sequence of in machine-learning evaluation. We use 10 as value of
decisions, in which the current decision helps to make the k (e.g., we split our dataset 10 times in 10 different in
subsequent decision. In this algorithms, nodes represent con- a learning set (90% of dataset) and testing set (10% of
ditions regarding the variables of a problem, whereas final the total data).
nodes represent the ultimate decision of the algorithm[24]. • SMOTE: In order to balance the dataset, we applythis
Thus, it can be represented graphically as trees. method, which was previously described.
To train the models, we use Random Forest, a combination • Training step: In this step, we use the algorithms
of weak classifiers (i.e. ensemble) of different randomly-built described in Table 2 to find the algorithm that has the
decision trees[2], and J48, the WEKA [12] implementation best performance.
of the C4.5 algorithm[25]. Finally, to determine the best results, we focus on the maxi-
mization of the accuracy and the Area Under Roc (AUC). The
4 EMPIRICAL VALIDATION first one shows the number of correct classified instances,
In order to evaluate the performance of our detector, we and the second one takes into account the relationship be-
use a collected dataset from a foundry specialized in the tween true positive rate and false positive rate. In our exper-
automotive sector. More specifically, the foundry is focused iment, we have more than two classes (one per defect type),
IoT 2019, October 22–25, 2019, Bilbao, Spain Pastor-López, et al.
to this end we have used a weighted values of accuracy and SVM algorithm family. Regarding accuracy, all values are
AUC. near 0.9, except the Naïve Bayes algorithm.
COM configuration results are 0.2 below the other seg-
mentation strategies. The worst results are obtained through
5 RESULTS DISCUSSION AND CONCLUSIONS Naïve Bayes, with the lowest accuracy, 0.4376 and with a low
We compare the detection capabilities using the different area result (just 0.7342).
algorithms. The results of the experiments are shown in ta- In table 4 we show the performance of the system combin-
ble 3. We can see that the results of BCLP and FFT are very ing all the systems. In this way, the Decision Trees once more
similar. The Area Under ROC Curve and the accuracy using have the best performance, both in accuracy and in the area
both categorization strategies are very close, (e.g., using a under ROC curve. There are no significant changes in the
bayesian network and a K2 kernel (BN: K2), the difference performance after combining the segmentation techniques
between the accuracy is only 0.538). Some algorithms have in this family of algorithms. On the other hand, there are
a lower performance in these categorization strategies (e.g, improvements in other families of algorithms (e.g., SVM).
Naïve Bayes with FTT only gets 0.3099 accuracy, worse than Combining these segmentation techniques slightly changes
a coin flip). As usual, we achieve the best results using Deci- the overall results, thus improving the performance of the
sion Trees; the bigger the value of N, the better the results of machine learning algorithms.In this way, the worst results
the model. Particularly, using a Decision Tree and Random are obtained using KNN algorithms. Although the change
Forrest, with 100 as the value of N, we obtain more than of K value improves the results, the AUC are still below the
0.91 and a 0.9238 Area under ROC Curve with the BCLP results presented by the other families of algorithms. In this
categorization method. The problem with these algorithms way, the most balanced results are obtained through the SVM
is that they tend to over-fit the data. family, since both accuracy and AUC get values over 0.9.
We obtain the best results using the Simple segmentation, In conclusion, in this first experimentation we can con-
using the Random Forest N = 100 (DT: RF N = 100). With clude that the best strategy is to use the Simple characteriza-
this configuration we obtain a 0.9664 accuracy and a 0.9763 tion method, but both BCLP and FTT get a good performance,
area under ROC curve. In general, the best results are ob- and could be used in some circumstances. The worst perfor-
tained through the Simple method. All the values of AUC mance is obtained by COM algorithms, and we discourage
are over 0.9, except KNN, the worst results are obtained with the use of these characterization method in these cases. In
this segmentation. On the other hand the best results are the second experiment we can conclude that combining the
again achieved through Decision Trees , followed by the
How IoT and computer vision could improve the casting quality IoT 2019, October 22–25, 2019, Bilbao, Spain
Table 3: Results of the categorization using BCLP, FFT, COM, and Simple feature sets by themselves.
Table 4: Results of the categorization using the combination of Simple feature set with BCLP, FFT, COM, and a combination
of all the feature sets.
characterization techniques improves the general results. Re- Decision Forest, SVM algorithms in general have better per-
garding machine learning algorithms, we can conclude that, formance when facing new instances, therefore they would
despite the fact that the best results are achieved through the be the best option to be include in a prototype of the system.
IoT 2019, October 22–25, 2019, Bilbao, Spain Pastor-López, et al.