May 4, 2021

“AI is an evolutionary process”

Interview with Dr. Fabian Bause, Beckhoff

Published in Computer & AUTOMATION 03/2021,, WEKA Trade Media

The interview was conducted by Andrea Gillhuber, Computer & AUTOMATION.

Beckhoff has integrated machine learning into its TwinCAT 3 controllers and gained valuable experience in the field. In this interview, Dr. Fabian Bause, Product Manager TwinCAT, explains how machine learning can be profitably deployed.

What should always be the first step before companies deploy machine learning?

Dr. Fabian Bause: You should always start by analyzing in detail where machine learning – ML for short – can be deployed successfully, i.e. productively. We often see that new technologies are treated with extreme viewpoints. People either have reservations because they lack of experience, or they are so excited that they want to use them to master all insufficiently tackled past challenges. You shouldn’t embark in either direction but analyze objectively where ML can truly be helpful.

Once you have found a potentially suitable application for machine learning, you should implement it in a timely manner as a prototype with the project team's agility being a critical factor. LM projects are evolutionary by nature and cannot be squeezed into a preset method with its associated restrictions.

At the 2019 Hannover Messe, Beckhoff announced that it would integrate machine learning into the TwinCAT 3 control system. Which application areas have become standouts since then?

Last year we had a successful beta phase and a very successful launch of our first product, an inference engine for machine learning models that is seamlessly integrated into TwinCAT 3. The special feature of this solution is the ability to execute models such as neural networks directly in the TwinCAT real-time environment. This means that the application areas for such a machine are unlimited.

On the user side, a cluster of ML-based solutions for quality control and process monitoring/optimization has formed. A fully automated and controller-integrated quality control system that is based on existing machine data such as motor currents, rotation speeds and tracking errors enables the complete inspection of goods produced, and it does this 24 hours a day, seven days a week, without getting tired, and with a cycle time that is far superior to anything human beings can do. Process monitoring and process optimization are consecutive steps. If a process can be monitored with a trained model, the machine can notify its operator, who in turn adjusts the process instantly in order to maintain the desired product quality. The next step involves learning from this experienced machine operator and training the model in such a way that it can make the necessary parameter adjustments autonomously or function in an intermediate step as a “smart assistant” that issues parameterization recommendations.

In addition to the infrastructural components for ML in the controller, we are increasingly concerned with applications in the areas of image processing and motion control at Beckhoff. The goal is to provide users with optimized components in hardware and software that can be used without prior ML knowledge.

Machine learning in real time poses a challenge especially on the factory floor, where fast processes are running that require a certain amount of processing performance. How can ML nevertheless be used in real-time-controlled applications such as motion-based procedures?

First of all, it is important to recognize that training ML-based models takes much more time than the execution, i.e. inference, of learned models. On the hardware side, the inference runs on our IPCs. An essential aspect of its effective execution in the CPU is the consistent use of SIMD command extensions in combination with highly optimized cache memory management. In addition, the current trend towards more and more processor cores in the CPU supports the accelerated execution of neural networks, as they can be parallelized very efficiently. Taking a close look at the trained model is also essential – just as it is with ‘manually written’ source code. A large and possibly inefficient source code has longer execution times than lean and optimized source code. Trained ML models should always be adapted to the particular task and optimized. Executing neural networks in the microsecond range is no problem today. One good example of this is our trade show exhibit which employs a neural multi-layer perception network with 250 neurons. Its execution time on an Intel Core i3 CPU amounts to just a few microseconds with our highly optimized inference engine. We therefore do not expect any major obstacles in terms of computing power when using ML in image processing and motion applications.

Fabian Bause, Product Manager TwinCAT at Beckhoff Automation: “The current trend towards more and more processor cores per CPU supports the accelerated execution of neural networks, as they can be parallelized very efficiently.”
Fabian Bause, Product Manager TwinCAT at Beckhoff Automation: “The current trend towards more and more processor cores per CPU supports the accelerated execution of neural networks, as they can be parallelized very efficiently.”

When should machine learning be integrated into the application – during its development or later in its operational phase?

As I mentioned at the beginning, an ML project is an evolutionary process that should commence as early as possible in the machine manufacturer’s value chain. Not every application will have an optimal solution when a machine is put into operation at the end customer. In addition, newly relevant data may be identified and evaluated when the machine runs. This way, an ML model can be continually improved. To support this process technologically, Beckhoff has structured its inference engine in such a way that it can load newly created models without having to stop TwinCAT and without having to compile source code, i.e. while the machine keeps running. In many cases, users may already have a machine with a controller that includes no ML functionality. Since they want to improve their production, they increasingly consider the use of ML. This is where having an open control concept plays a critical role. Because of its many interfaces, even retrofitting a TwinCAT controller into an existing control concept does not pose an obstacle. We saw this at our first customer of TwinCAT Machine Learning, who used – and continues to use – a third-party controller. He added an Embedded PC from Beckhoff with TwinCAT 3 that can read essential data from the third-party controller and houses the inference in order to implement a quality control system within the TwinCAT environment. Reliable ML applications begin and end with the database.

How is the selection of training data handled in TwinCAT Machine Learning? Do you need a data scientist?

An ML project is teamwork, with the project team made up of different experts. The central person is the domain expert – for example, the machine builder or the expert for linear drives or the forming process. He or she identifies a challenge he wants to master via machine learning, i.e. he had a goal, and he is familiar with the machine. Together with a data scientist, who focuses mainly on the data analysis, he must define essential machine parameters that play a role in reaching the goal. The data scientist always works closely with the domain expert in order to highlight the importance of specific data patterns and behaviors. A data scientist alone, with no feedback to/from the domain expert, cannot operate adequately. At Beckhoff, we interact with our customers very flexibly and individually in accordance with their specific situation. Some machine builders already have data science departments, even if some are only a one-man show, to tackle this task. Others need significant help from us. Of course, we also have customers who contact us and ask for something like an ‘all-included package’ of data scientist services. In such cases, we happily put them in touch with our established network of specialized partner companies.

Do you need training data for each ML model?

Yes, that is always a prerequisite. Machine learning is always based on sample data that is used to teach the model. During the training phase, the models differ mainly by whether the training data is labeled or unlabeled. If the data is labeled, you can identify examples of an output that is expected with a given input during the training, i.e., the training is based on concrete examples. If the data is unlabeled, the output information is missing, and the algorithm is limited to finding internal abstract relationships. For example, this could be a certain number of clusters within the training data set.

How do you train a model to detect anomalies when no anomalies are known?

There are many ways to accomplish this. A simple, easy to describe variant involves training a classification model with a single known class, the ‘no anomaly’ class. You train the model exclusively with data that contains no anomalies and defines this set as ‘class A’. During the process, the algorithm recognizes 'class A’. But it also recognizes when the data exhibits another, unknown structure and reports an unspecified anomaly. To repeat: AI is an evolutionary process. If data is continuously collected at the machine and stored along with the classification result, the data scientist in cooperation with the domain expert can subsequently analyze in detail the process sequences during which an anomaly was detected. If necessary, a model can then be used that is able to not just recognize an anomaly but to identify the case in more detail.