The potential of machine learning: visual quality control in the pharmaceutical industry

Pharmaceutical manufacturing is subject to strict regulatory requirements to guarantee product quality and patient safety. There are processes to which this applies specifically, such as a 100% quality control of each product once filled into syringes, vials or ampoules. The aim is to detect product defects, anomalies or even contamination and sort these out.

There are three methods for quality control: Manual visual inspection by humans, semi-automatic visual inspection with machine support and fully automatic visual inspection by machines. In the fully automatic method, multiple cameras capture product images from various angles. Real-time software analyzes the data, identifying and rejecting defective products. However, technical limitations and strict requirements can lead to the incorrect identification of good products as defective, known as False Rejects, necessitating a second inspection to differentiate once more between good and bad. For pharmaceutical companies, this resource-intensive process creates annual costs in the millions.

The role of machine learning

Learning systems can map human expertise and reflect it in a technical structure. A rough distinction is made in machine learning between supervised and unsupervised learning methods. In unsupervised learning, data records are presented without being classified beforehand. The learning system attempts to recognise patterns, groupings or similar structures, but receives no "reward" for learned content. The learning process is therefore difficult to influence as it is based purely on observation.

In supervised learning, on the other hand, datasets are classified. Relevant information about the data is already available before the learning process, providing the learning system with "rewards" for correctly learned content and making it possible to control learning behaviour.

Accordingly, “supervised learning methods” offer opportunities for visual inspection. Inspection specialists pre-classify images, to teach the system a better decision-making. This approach offers significant advantages, e.g. the difference between acceptable product variations and not-acceptable product variations, especially for products that are difficult to inspect. While the mathematical principles of learning systems have been known for years, their industrial application is now feasible due to advancements in processing power and microelectronics.

How machine learning is revolutionising visual inspection

To optimise visual inspection, an edge device builds the bride to the machine, supporting systematic data acquisition and storage as well as efficient neural network operation by providing sufficient computational power. Once relevant image data is recorded, it is classified with software support.

When inspection experts log into the classification solution, they can subdivide the images into smaller labelling tasks and assign them to labelling experts. The labelling experts classify image sets, contributing to the training of neural networks. This involves dividing image sets into subsets for training the model's node weights and layers. The model learns image characteristics and patterns that ultimately lead to the neural network's decision. The statistically independent test dataset evaluates the network's ability to classify unknown images, resulting in a model capable of making correct decisions based on accurate image characteristics. In addition to the parameters of the training and test-set distribution, there are numerous other parameters that together span a hyperdimensional parameter space. The iterative work and knowledge of the data experts includes model training and in-depth model and data analysis. In all cases, the stored real image data sets are only a snapshot of effects that might happen during production and are by all means not sufficient to train a robust and reliable AI model. Furthermore, the AI model must be supported by a much larger amount of data so that representativeness of effects that might occur in production is given – in all of its variations. This data is created artificially within the data science process using generative artificial intelligence. This expanded database is used throughout the training and testing of the AI model and is leading to reliable decision-making and robustness to counteract product or primary packaging variations.

Model development is controlled with the help of this knowledge and ultimately leads to a high-quality model that also fulfils regulatory requirements of the pharmaceutical industry. Eventually, human knowledge is made accessible to inspection machines by documenting it through the active classification task and binding it into a technical structure. This interweaving of human and machine knowledge ensures a better decision with minimised False Reject Rates. Machine learning represents a quantum leap for the visual inspection task. Lower configuration effort, improved and stable inspection performance and high scaling potential are just three aspects that show that visual inspection in the pharmaceutical industry will change dramatically in the near future.

Check out our other blog posts to deep dive into the world of AI!

Article written by Dr. Mario Holl, Managing Director at InspectifAI

Read more about...

AI in Pharma: A new era of innovation

Pharma companies must digitize their business models holistically on a long-term basis to be at the forefront of innovation and achieve the digital maturity - and AI can help!

Read more!

Open Innovation is also about to be AI-driven

Generative AI can give employees superpowers to work more productively and creatively. CEOs must not leave this development to chance, but must make it a top priority!

Read more!

Back to top
Back to top