Computer Vision and Image Analytics


Over the past few months, I’ve been working on a fascinating project with one of the world's largest pharmaceutical companies to apply SAS Viya computer vision to help identify potential quality issues on the production line as part of the validated inspection process. As I know the application of these types of AI and ML techniques are of real interest to many high-tech manufacturing organisations as part of their Manufacturing 4.0 initiatives, I thought I’d take the to opportunity to share my experiences with a wide audience, so I hope you enjoy this blog post. For obvious reasons, I can’t share specifics of the organisation or product, so please don’t ask me to. But I hope you find this article interesting and informative, and if you would like to know more about the techniques then please feel free to contact me.

Quality inspections are a key part of the manufacturing process, and while many of these inspections can be automated using a range of techniques, tests and measurements, some issues are still best identified by the human eye. These rely on operators carrying out regular reviews of high-resolution images taken as the devices flow down the production line at high speed.

Hidden Insights: Computer Vision and Image Analytics SAS

Computer vision and image analytics.

Potential loss of nearly 1 million devices

This process typically involves the inspection of a small, random sample of devices by the operator at the start of each batch and then at regular interval during the production run. This process is extremely time-consuming and, as it only involves a controlled number of sampled devices, can lead to the detection of potential quality issues in devices being delayed. This can result in rework, reinspection and potential rejection of an entire batch of items when only a very small percentage is affected. This can have a significant impact on overall equipment efficiency (often abbreviated to OEE) or increased waste, both of which are key KPIs in manufacturing.

The project I’ve been involved with is a perfect example of the above. The devices involved are manufactured to extremely high specifications, but very occasionally minor variations in the production line can result in the creation of devices that fall below the required standard. This can easily be seen on high-resolution images when reviewed by the operator.

These issues might only affect a tiny percentage of the devices or could affect all of the devices in a batch. But organizations need to fully investigate any potential issue, identify the root cause, and resolve the problem before the devices are released or manufacturing resumes. In one example, the customer was faced with the potential loss of nearly 1 million devices at a considerable cost. We were able to apply the techniques described below to review all of these devices and identify a significantly reduced subset for the operations and quality team to review before allowing them to release the remaining devices to patients.

A two-stage approach

When shown examples of the potential issues – identified by the existing review process – it was clear that these failed to reach the high standards required, even by my untrained eye. So we suggested a two-stage approach, which would allow all of the images produced to be analysed within seconds to provide a ranking score. The operators could then focus their expert review on the devices that differ most from a gold standard image or that most resemble known defective devices.

Working with a team of experts from the production line and SAS data scientists, we identified the key areas of interest on the device. We selected a "golden image" to be compared against every device image to see how closely they match. A larger set of training images included 90% good images and 10% defective images. This "oversampling" is required because the actual number of devices affected by an issue is extremely low, at less than 0.05% of the production. However, due to the hundreds of millions of devices manufactured each year, even such a small percentage means hundreds of thousands of devices can be affected and can lead to the rejection of millions more to maintain the quality of the devices delivered to the patient.

Multimillion pound investment

Having identified the golden image and training data, we then used a wide range of data analysis techniques with the images to help identify the best approach to isolating the suspect devices. These included image processing, comparison and statistical analysis, and artificial intelligence and deep learning.

I’ll share more on these techniques in a second post, but the final result is that our customer has now completed a multiyear, multimillion-pound investment in SAS and is using SAS Viya capabilities for computer vision, AI and machine learning to detect potential defects in the manufacturing of its devices. The solution delivers by subjecting the devices to 100% visual inspection.

This is part of their commitment to delivering the highest quality devices and care to the hundreds of millions of patients who rely on the life-saving medication each and every day. Click To Tweet

To learn more, please contact me or reach out to your local SAS contact, who will be delighted to help. Here are some useful links: SAS Production Quality and Statistical Process Control techniques can be found here, and more about SAS Deep Learning using neural networks here.


About Author

Andy Bayliss

Andy Bayliss is a senior technical account manager at SAS working with many of their large pharmaceutical and life science companies. In his spare time, he is a keen cyclist and is constantly planning his next cycling adventure. He can be reached at


  1. I think it'll be really interesting to see the ever broader use of AI/ML in augmenting and ultimately replacing "experienced professionals" in so many fields... great post Andy.

  2. Excellent article Andy, it has been good working with you on this and I'm looking forward to working through Phase 2 of this project distributing AI/ML throughout 2020.

  3. Dominik Strauss on

    Great story Andy, which demonstrates how analytics helps to save costs in production. Looking forward to your second post...

Leave A Reply

Back to Top