Visual Inspection and its challenges

Visual inspection is a proven test method that detects cosmetic and particulate defects in the packaging and content of pharmaceutical products using a system of very high-resolution cameras that capture both still and motion images of the product from different angles.

These images are analyzed by a specialized operator or by one or more computers using suitable data processing algorithms, in the case of Automatic Visual Inspection, to identify samples with irregularities and highlight the presence of foreign bodies, inclusions, cracks in the container or foreign particulate defects in the product itself.

This test method is widely recommended and accepted by the European, American and Japanese Pharmacopoeias and can be used to inspect 100% of the production of an industrial line. However, it is still considered a probabilistic and non-deterministic test because the ability to detect a specific defect is influenced by multiple factors, including the color and opalescence of the product and the container, the position of the product at the time the images are taken, the presence of shadows that can create ambiguous situations, and so on. This applies to both when image control is performed by a human operator and when computer algorithms analyze the data.




Neural networks and the future of visual inspection

Neural networks offer significant assistance in overcoming these problems, increasing the precision of the visual inspection tests, and reducing the influence of external variables. Artificial Intelligence (AI) can significantly improve the performance of a visual inspection machine, improving its efficiency in terms of test speed, accuracy, and repeatability, drastically reducing the number of false negatives

It is particularly beneficial to apply neural networks to visual inspection because the testing machine “learns” from its mistakes (machine learning) and becomes more reliable as it learns. Unlike a traditional Automatic Visual Inspection machine, an automation system using the capabilities of AI does not use algorithms based on rigid parameters, but analyzes the images in a flexible manner, using a large set of data that it examines in sequence. In this way, the machine autonomously calibrates the parameters necessary to provide the result, adapting its analysis to the specific situation. This significantly increases its accuracy and reliability in inspecting all products with ambiguous situations that, if tested automatically, would inevitably be identified as non-compliant.

But can AI truly deliver such results? While the answer to this question is apparently simple, it can open very broad perspectives. AI uses a series of sample images that it analyzes and then identifies as either “compliant” or “non-compliant.” The machine indicates the level of certainty with which it has decided to include the image in either category, and if this level is too low, it signals that it is unable to identify the image with sufficient precision. A human operator then saves and analyzes these images of uncertain identification and determines whether the products in question should be considered compliant or not.

The neural network is retrained once the unclear images have been catalogued by the human operator. This increases its data repository and improves its ability to evaluate the characteristics of the product and determine conformity. In this way, the machine learns from experience. Over time, it provides increasingly reliable results as its data repository grows.

There are numerous advantages to applying neural networks to visual inspection:

  • Test results are fast, reliable, and repeatable.

  • Using neural networks significantly reduces the need for human intervention. The only phases in which an operator needs to intervene are cataloguing the images identified as unclear by the machine and subsequent retraining. Over time, the need for these operations decreases, because the machine becomes better able to make its own evaluations.

  • Neural networks gradually work better as their repository of catalogued images grows and the machine is retrained. However, they can determine with precision whether an image is compliant or not already based on a small database (containing about one hundred images for each classification category).

  • Thanks to its flexibility and the ability to self-calibrate the parameters used for the result, Artificial Intelligence can be very precise with a decrease in false rejections.

  • Thanks to its ability to learn from its errors, AI is particularly effective when used to visually inspect complex products such as freeze-dried products and blow fill seal (BFS)

  • Visual inspection using AI can be combined with traditional approaches, depending on your needs and the types of product to be tested. Some products can be analyzed using neural networks and others using the traditional method or, alternatively, products can be analyzed using both technologies in sequence, first to detect more macroscopic defects (e.g., cracks in the ampoule) before deepening the analysis using the neural network.

The application of neural networks to visual inspection is a fundamental horizon of development for this type of technology. Bonfiglioli Engineering can provide you with all the tools you need to implement this type of inspection, increasing the accuracy and reliability of visual inspection tests.

Connect with Bonfiglioli Engineering Visual Inspection experts for specific queries.


We are not just a machine manufacturer. We are your trusted partner for packaging integrity testing and analysis through feasibility studies, technical expertise, validation packages, product handling and custom-built solutions.

Get in touch