Elevating pharma inspection with deep learning

March 15, 2021
Raffaele Pace, Engineering VP of Operations at Stevanato Group discusses how applying AI to visual inspection can yield quality and economic benefits

Raffaele Pace, Engineering VP of Operations at Stevanato Group 

The pharma industry has always benefited from the best and most cutting-edge technology available. This has enabled it to bring safer and more reliable drugs to market. In recent years, Artificial Intelligence (AI) has played a critical role in this mission, and has been implemented in almost every aspect of the pharma industry, from drug discovery and development to manufacturing.

Pharma Manufacturing recently spoke with Raffaele Pace, engineering vice president of Operations, Stevanato Group, to get a better understanding of how the company is implementing AI into visual inspection equipment to help drugmakers increase productivity and improve efficiency.

Q: How has visual inspection technology evolved?

A: While one hundred percent manual inspection is still considered the gold standard for detecting defects, it’s also a slow and labor-intensive process that does not match high value or volume production. In response, pharma companies began turning to automated vision inspection systems. That was the starting point — basically using cameras to take pictures and collect images.

From there, automated inspection evolved to using vision software to inspect the containers. Thanks to the advancement of these technologies over the years, as well as improvements in hardware, the industry saw an increased capacity to both collect and process data.

Overall, in terms of the history, that’s what we have been seeing: starting from the manual, going more and more towards automation and then in this automation passing from traditional rule-based algorithms (machine learning) to the willingness to start to apply deep learning models.

Q: How has deep learning been applied to vision inspection?

A: Deep learning is a subfield of machine learning, which itself is a subfield of artificial intelligence. Deep learning is concerned with algorithms, inspired by the structure and function of the brain, called artificial neural networks. The most modern models are based on convolutional neural networks and use multiple layers of connected neurons to exchange data and extract higher-level features from the raw input.

First, you have to collect and label thousands of images to work with neural networks, then the training phase can start. The system will learn and start identifying patterns, predicting whether an item is good or bad and distinguishing particles from false positives (e.g. bubbles). Potentially, we are able to classify the specific, detailed type of defects we see within the containers.

Q: What are the benefits of deep learning applications in vision inspection?

A: The first benefit is, of course, in terms of quality. The foremost priority for the pharma industry is to deliver a final product that is safe. And that’s why we do vision inspection of the product and the application throughout the supply chain.

There are also economic benefits. Deep learning models help reduce the amount of false rejects, and also the number of gray items on the production line through the machine. Usually, these grey items are re-inspected manually, which will now no longer be necessary. Therefore the entire process will become more lean, with less waste.

To summarize, deep learning enables pharma companies to reduce both the rejection rate and grey item re-inspection, and also the total cost of ownership. Thanks to the robustness of the system, you don’t need to adapt the recipe as soon as you start to have variations within your production, as is the case with current software vision systems.

Q: Can the machine actually react to changing characteristics in the products that it’s inspecting?

A: In general, continuous learning is not part of our application, due to the tight pharma regulations and need for equipment validation. The current method identified by the industry consists of freezing the model, based on a precise data set, when results are good and coherent. After the model is frozen, it is installed on the machine. Recently experts have also proposed having a physical test kit and a completely different test kit for the machine. This could be an alternative way to validate the inspection machines.

Thanks to the deep learning model’s ability to generalize the information received as input during the training phase, the model is also able to recognize defects that are similar but not identical to the ones it has been trained on. The final outcome is a system that is more robust and therefore allows for less variations in the production while still being able to recognize what is good and what is bad. This is helping a lot in terms of inspection performance — meaning low false rejection rates with an improved detection rate.

Q: Why is data quality important and what does it mean when applied to visual inspection?

A: This technology is driven by data, therefore good data is essential. All the neural network models perform well only if they are fed and trained with good data. If you have a good, well-labeled data set, then you will have very good performing models.

The data we are talking about here is images. First, in a new application for our visual inspection machines, we ensure that the inspection stations have high-resolution cameras set up together with proper lighting. This combination allows us to get high-quality images and to identify the defect — whether it be from cosmetic cracks, crimping, etc.

Going to the quantitative aspect, to train the neural network you need thousands of images to cover all the possible container and product variations. This allows us to teach the neural network to recognize all possible defects; by feeding the model with thousands of images, you simulate the real production, where millions of parameter combinations could come up. It’s good practice to implement the “data augmentation” method, that is changing training images to teach the model to generalize its predictions.

The labeling — the identification of a good or bad item or the defect classification in terms of particle, bubble, scratch, etc — is a key step in the definition of the model. Thanks to these two factors, the raw data and the labeling, then the model can be trained to give the best performance.

Q: And what about data security?

A: In the pharma industry, data safety and integrity are essential. All the operations are done in compliance with tight rules and laws, such as Cfr. 21.11. This won’t change by using deep learning.

An AI platform enables to share images, track their exchange and store them safely. This applies to our cloud-based platform - data safety and integrity are assured.

Q: So Stevanato Group launched an AI platform recently?

A: Yes, in February we released SG Vision AI, an AI platform based on Microsoft Azure that will enable us to deliver “smart” equipment compliant with strict pharmaceutical data management and security requirements while enhancing inspection performance. We offer advanced monitoring tools and a qualified team of vision and AI engineers to support our customers, delivering an accurate data analysis service from image collection to model validation.

Q: What is the future potential for AI in pharma?

A: If we look at the overall picture in the pharma industry, AI can give a broader range of benefits in terms of quality control, root cause analysis, predictive maintenance, and waste reduction, as well as optimizing the automation process. Regarding inspection, this new technology seems to give its best results when used together with standard vision algorithms and allows us to improve the quality inspection process, enhance detection performance, and reduce waste and costs.