Tech Talk: Detecting unmilled areas in a milled surface

Tech Talk: Detecting unmilled areas in a milled surface

SenseIT focusses on industrial measurement systems where reliability and validity plays a very important role. Most of the time, our scanners are redundant, meaning that you do each calculation or measurement twice to eliminate outliers caused by noise or optical effects and to increase the overall measurement accuracy.

We tempt to avoid machine learning as it is usually really difficult to quantify why a classifier responds/behaves a certain way. It is like a black box where you have some input and some expected output and hope for the best that the classifier trains the correct features, but you are never 100% that the classifier behaves a certain way.

One of our customers wants to detect unmilled areas in a CNC milled surface. Normally a cnc milled surface is perfectly flat (micron precision) while an unprocessed region has a very high frequency of structures on the surface with a z-tolerance of about 0.2 mm. Our current 3D scanner measures within the 0.1 mm range so we should be able to detect these irregular areas, but due to liquids and natural material variations we get distortions that are in the same range as unmilled areas.

So we decided to take a different approach and used machine learning techniques to see if we are able to segment high frequency from low frequency areas.

With the human eye you can clearly see the differences of milled and unmilled areas (Fig 1):

Fig 1: Complete unmilled region (left), complete milled region (right)

Notice that you have frequencies and structures in the milled regions, but they look completely different than the unmilled regions.

Ultimately we want to detect partly unmilled regions on this surface as shown in Fig 2:

Fig 2: partially milled/unmilled regions

As we want to detect the unmilled regions with high probability, we decided to do the measurement twice, in two different ways. First of all we try to detect the high frequency regions in 3D (fig 3) and if we find some irregularities we do a similar measurement in 2D. If both classifiers respond positive we can be quite certain that we are dealing with an unmilled area.

Fig 3: Complete unmilled region in 3D (left), complete milled region in 3D with minor artifacts (right)

So we generated a database of unmilled surfaces, milled surfaces and partially milled surfaces.

With a subsample of the unmilled surfaces we trained several classifiers (multilayer perception, support vector machine and gaussian mixture model). Of course before you train the classifier you need to make sure that you provide it with the correct features so we used texture laws to segment specific patterns from the image (Fig 4).

Fig 4: Extracting (frequency) features from a 3D scan with help of texture laws

After training the different classifiers we noticed that for textures we got the best results with the gaussian mixture model; most likely because we only have one classification class.

We tested the performance of the classifiers on the 3 different datasets and with GMM we were able to detect all unmilled regions and half processed regions. About 10% of the milled surface responds to the classifier incorrectly (false positives) and we are now looking for a way to reduce this.

Some results:

Fig 5: Unmilled regions are detected correctly on the unmilled region testset (detected areas are shown in red)

Fig 6: Unmilled regions are detected correctly on the half processed region testset (detected areas are shown in red)

Fig 7: No unmilled regions detected in the 100% milled regions testset (detected areas are shown in red)

Conclusion: In the first tests we do get already good results, however we need to optimize the preprocessing and classifier variables in order to reduce the amount of false positives.