Computer Vision Algorithms to Identify Manufacturing Defects With 97% Accuracy for Cerulean
Summary
ScienceSoft helped Cerulean replace an unreliable AI model with a production-ready computer vision solution that delivers 97% inspection accuracy and processes images of nicotine pouches 6 times faster than before.
About Cerulean
With over 80 years of expertise and a global presence, Cerulean is a UK-based company renowned for its precision testing and measurement equipment for the tobacco industry. Cerulean’s solutions help manufacturers ensure consistent product quality and comply with strict industry standards.
Always at the forefront of innovation, Cerulean continually explores how AI and computer vision can enhance product inspection efficiency and accuracy. One of the company’s R&D initiatives focused on automating the visual inspection and measurement of nicotine pouches. The goal was to build a system that could automatically detect pouch components and calculate key parameters (e.g., pouch width, height, cross-seam widths, and longitudinal seam offset) from images captured by industrial area-scan cameras. Accurate pouch dimensions ensure proper filling and sealing, correct seam placement prevents leaks, and monitoring offsets allows early detection of misalignment or manufacturing defects. Without precise measurements, defects can go undetected, resulting in wasted materials, regulatory issues, and customer complaints.
Before turning to ScienceSoft, Cerulean contracted another IT services provider to build the initial machine learning (ML) model for pouch image analysis. However, the model delivered by the other vendor proved unreliable in real production settings. It often failed to correctly locate key parts of the pouch, especially when seams were poorly visible or the pouch was rotated. As a result, it was impossible to accurately calculate numerical values — like pouch width, seam widths (maximum, minimum, average, and median), and longitudinal seam offset — which are essential for quality control. Additionally, the model’s processing speed was insufficient, taking approximately 12 seconds per image, which was far too slow compared to the shop floor conveyor.
Having previously worked with ScienceSoft on other successful data science initiatives, Cerulean turned to the team again to design a reliable, high-performing model capable of real-world accuracy and speed.
Designing and Training an ML Model to Achieve High Accuracy
ScienceSoft assigned a senior data scientist to lead the project. The data scientist started by analyzing the existing data patterns and edge cases to build a solid understanding of both the business requirements and the characteristics of the data. The images captured on the production line varied in quality and composition: pouches could appear rotated, unevenly lit, or partially out of frame due to camera timing or conveyor movement. In some cases, seam edges were unclear or obscured by shadows. These inconsistencies, typical in high-speed industrial imaging, had previously caused high failure rates in the old model, which struggled to generalize and often misclassified pouches or missed seams entirely.
ScienceSoft’s expert implemented a reproducible preprocessing pipeline to standardize the input format while preserving all real-world variations. This included aligning pouch orientation, standardizing image scale, and defining regions of interest to focus the model on relevant areas.
The data scientist designed a dual-model setup using YOLO (a CNN-based object detection model) and SAM (a Transformer-based segmentation model), chosen specifically for their complementary strengths and their ability to handle the characteristics of the production images. YOLO’s speed and robustness allowed it to quickly locate pouches on the conveyor, while fine-tuned SAM delivered the detailed segmentation needed for precise measurement extraction.

To achieve the highest possible accuracy, ScienceSoft’s expert proceeded with iterative model training, tuning, and evaluation. The training set included all available production images, covering low-contrast, partially rotated, and partially visible seam cases. Seam visibility was explicitly labeled, allowing the model to learn both full and partial seam patterns. The data scientist also adjusted and optimized the model’s hyperparameters — such as learning rate schedule, batch size, and confidence thresholds — to balance detection precision and speed.
At each training iteration, the data scientist evaluated the model’s performance using standard metrics such as intersection over union (IoU) to assess how closely predicted bounding boxes and masks matched actual pouch and seam areas. The data scientist analyzed the model’s errors in detail, identified common misclassification patterns (for example, missed seams in low-contrast areas or false positives near reflections), fine-tuned the model’s configurations and adjusted or augmented the training datasets to fix these issues.
Within two months, ScienceSoft’s data scientist delivered a production-ready ML model that demonstrated 97% accuracy when tested on 2,000 raw images from conveyor, along with a comprehensive evaluation report outlining testing results and clear paths for continued optimization.
Selvan Reddy, Head of Innovation and Development at Cerulean, says:
This wasn’t our first project with ScienceSoft — and once again, they didn’t disappoint. Their work on our computer vision algorithm definitely proved to us the depth of their AI and ML expertise. The team we worked with was proactive, honest, and clearly invested in the outcome. It’s rare to find an outside vendor that brings the same energy and commitment as your own team.
Key Outcomes for Cerulean
- A new, 97% accurate computer vision model for fully automated pouch segmentation and measurement, delivered within two months from project kickoff to delivery.
- 6x higher image processing speed, which improved from 12 seconds to 1.5–2 seconds per image compared to the old model.
- The ability to retain the model’s accuracy over time following the maintenance and retraining procedures documented by ScienceSoft.
- Strengthened reputation for innovation, precision, and reliability.
Technologies and Tools
Python, YOLO, SAM.