The rapid advancements in Machine Learning (ML) and Computer Vision (CV) have revolutionized industrial quality control, especially in pharmaceutical manufacturing, where strict safety and regulatory standards demand exceptional product quality. Traditional quality control methods—largely reliant on manual inspection—are time-consuming, error-prone, and lack the scalability required for high-throughput production. This dissertation addresses these issues by developing ML-driven techniques for anomaly detection in pharmaceutical quality control, with a focus on high-speed industrial lines. A primary challenge is detecting Out-of-Distribution (OOD) anomalies, namely defects that deviate from the standard production distribution. Traditional Computer Vision methods based on blob-analysis struggle with such anomalies because of their rigid, parameter-dependent nature. In contrast, modern deep learning approaches, which learn from extensive datasets, offer enhanced flexibility and scalability. However, deploying these models in real-time environments introduces further challenges, including dataset imbalance, strict inference time limits, and hardware constraints. The chief contribution of this thesis is the development of the novel Generative-Reconstructive-Discriminative Network (GRD-Net), engineered to achieve both accurate anomaly detection and efficient real-time processing. GRD-Net exploits the capabilities of Generative Adversarial Networks (GANs) to reconstruct defect-free images while simultaneously generating heatmaps that highlight anomalous regions. This dual-stage process improves defect localization precision and overall system accuracy, marking a significant advancement over traditional methods—particularly in detecting small and irregular defects. Benchmarking on both public and proprietary pharmaceutical datasets confirms its robustness and efficiency in real-world conditions. In parallel, the research introduces a derivative architecture, the Residual Generative Adversarial Network for Anomaly Detection (ResGANAD), specifically optimized for industrial deployment. Successfully integrated into high-speed Blow-Fill-Seal (BFS) vial inspection lines, ResGANAD detects OOD anomalies in real-time with minimal disruption to production throughput while maintaining high accuracy. Furthermore, this dissertation evaluates and adapts embedding similarity-based techniques such as PaDiM and PatchCore, which prove effective in scenarios with scarce labeled anomaly data. Although these methods traditionally rely on memory-intensive components like memory banks—limiting their scalability—the thesis proposes adaptations that reduce dependence on pre-trained networks and enhance performance in large-scale industrial settings. Extensive experimental results demonstrate the efficacy of the proposed models across a diverse range of real-world defects, including subtle anomalies that conventional inspection algorithms often overlook. Moreover, the models are rigorously tested against the stringent regulatory and safety requirements of pharmaceutical manufacturing, ensuring both high detection accuracy and real-time operational capability. In summary, this dissertation advances the application of machine learning to anomaly detection in pharmaceutical quality control. The developed systems enhance the accuracy and speed of defect detection while offering scalable solutions suitable for high-throughput industrial environments. By integrating these advanced ML techniques, manufacturers can improve product quality, reduce reliance on manual inspection, and achieve higher operational efficiency. Future work will focus on further optimizing these models, adapting them to emerging industrial processes, and incorporating explainability mechanisms to strengthen trust and regulatory compliance.
I rapidi progressi nel Machine Learning (ML) e nella Computer Vision (CV) hanno trasformato il controllo qualità industriale, specialmente nella produzione farmaceutica, dove i rigidi standard di sicurezza e le normative richiedono una qualità del prodotto eccezionale. I metodi tradizionali, basati sull’ispezione manuale, risultano lenti, soggetti a errori e non scalabili per produzioni ad alto rendimento. Questa dissertazione affronta tali problematiche sviluppando tecniche ML per il rilevamento di anomalie nel controllo qualità farmaceutico, con particolare attenzione alle linee industriali ad alta velocità. Una sfida fondamentale è il rilevamento delle anomalie Out-of-Distribution (OOD), ovvero difetti che deviano dalla distribuzione standard di produzione. I metodi classici di CV, fondati sull’analisi di blob, faticano a gestire tali difformità a causa della loro rigidità e della dipendenza da parametri. Al contrario, gli approcci di deep learning, che apprendono da ampi dataset, offrono maggiore flessibilità e scalabilità, sebbene l’impiego in ambienti real-time comporti ulteriori difficoltà, quali squilibri nei dati, tempi di inferenza stringenti e vincoli hardware. Il contributo principale di questa tesi è lo sviluppo della Generative-Reconstructive-Discriminative Network (GRD-Net), progettata per garantire un rilevamento accurato delle anomalie e un’elaborazione in tempo reale efficiente. GRD-Net sfrutta le capacità delle Generative Adversarial Networks (GANs) per ricostruire immagini prive di difetti, generando simultaneamente heatmap che evidenziano le regioni anomale. Questo processo in due fasi incrementa la precisione nella localizzazione dei difetti e l’accuratezza del sistema, rappresentando un significativo passo avanti rispetto ai metodi tradizionali, in particolare per l’individuazione di difetti piccoli e irregolari. I test effettuati su dataset farmaceutici, sia pubblici che proprietari, ne hanno confermato la robustezza in condizioni reali. Parallelamente, la ricerca introduce la Residual Generative Adversarial Network for Anomaly Detection (ResGANAD), un’architettura derivata ottimizzata per l’uso industriale. Integrata con successo nelle linee di ispezione in tempo reale dei flaconi Blow-Fill-Seal (BFS) ad alta velocità, ResGANAD rileva anomalie OOD in tempo reale, garantendo un impatto minimo sul throughput produttivo e mantenendo elevati standard di accuratezza. La dissertazione valuta inoltre tecniche basate sulla similarità degli embedding, come PaDiM e PatchCore, efficaci in scenari con pochi dati etichettati. Sebbene tali metodi si fondino su componenti memory-intensive, come le memory bank, che ne limitano la scalabilità, si propongono adattamenti per ridurre la dipendenza dalle reti pre-addestrate e migliorare le prestazioni in ambienti industriali su larga scala. Risultati sperimentali estesi dimostrano l’efficacia dei modelli proposti su una varietà di difetti reali, inclusi alcuni piccoli che spesso sfuggono agli algoritmi convenzionali. I modelli sono stati testati rigorosamente rispetto ai severi requisiti normativi e di sicurezza della produzione farmaceutica, assicurando elevata precisione e operatività in tempo reale. In sintesi, questa dissertazione amplia l’applicazione del ML nel rilevamento di anomalie per il controllo qualità farmaceutico. I sistemi sviluppati migliorano la rapidità e l’accuratezza nell’individuazione dei difetti, offrendo soluzioni scalabili per ambienti industriali ad alto rendimento. L’integrazione di tali tecniche ML consente di elevare la qualità del prodotto, ridurre la dipendenza dall’ispezione manuale e aumentare l’efficienza operativa. Il lavoro futuro si concentrerà sull’ottimizzazione dei modelli, sull’adattabilità a nuovi processi industriali e sull’introduzione di meccanismi di explainability per rafforzare la fiducia e la conformità normativa.
Machine Learning Techniques for Anomaly Detection in Pharmaceutical Quality Control
FERRARI, NICCOLO'
2025
Abstract
The rapid advancements in Machine Learning (ML) and Computer Vision (CV) have revolutionized industrial quality control, especially in pharmaceutical manufacturing, where strict safety and regulatory standards demand exceptional product quality. Traditional quality control methods—largely reliant on manual inspection—are time-consuming, error-prone, and lack the scalability required for high-throughput production. This dissertation addresses these issues by developing ML-driven techniques for anomaly detection in pharmaceutical quality control, with a focus on high-speed industrial lines. A primary challenge is detecting Out-of-Distribution (OOD) anomalies, namely defects that deviate from the standard production distribution. Traditional Computer Vision methods based on blob-analysis struggle with such anomalies because of their rigid, parameter-dependent nature. In contrast, modern deep learning approaches, which learn from extensive datasets, offer enhanced flexibility and scalability. However, deploying these models in real-time environments introduces further challenges, including dataset imbalance, strict inference time limits, and hardware constraints. The chief contribution of this thesis is the development of the novel Generative-Reconstructive-Discriminative Network (GRD-Net), engineered to achieve both accurate anomaly detection and efficient real-time processing. GRD-Net exploits the capabilities of Generative Adversarial Networks (GANs) to reconstruct defect-free images while simultaneously generating heatmaps that highlight anomalous regions. This dual-stage process improves defect localization precision and overall system accuracy, marking a significant advancement over traditional methods—particularly in detecting small and irregular defects. Benchmarking on both public and proprietary pharmaceutical datasets confirms its robustness and efficiency in real-world conditions. In parallel, the research introduces a derivative architecture, the Residual Generative Adversarial Network for Anomaly Detection (ResGANAD), specifically optimized for industrial deployment. Successfully integrated into high-speed Blow-Fill-Seal (BFS) vial inspection lines, ResGANAD detects OOD anomalies in real-time with minimal disruption to production throughput while maintaining high accuracy. Furthermore, this dissertation evaluates and adapts embedding similarity-based techniques such as PaDiM and PatchCore, which prove effective in scenarios with scarce labeled anomaly data. Although these methods traditionally rely on memory-intensive components like memory banks—limiting their scalability—the thesis proposes adaptations that reduce dependence on pre-trained networks and enhance performance in large-scale industrial settings. Extensive experimental results demonstrate the efficacy of the proposed models across a diverse range of real-world defects, including subtle anomalies that conventional inspection algorithms often overlook. Moreover, the models are rigorously tested against the stringent regulatory and safety requirements of pharmaceutical manufacturing, ensuring both high detection accuracy and real-time operational capability. In summary, this dissertation advances the application of machine learning to anomaly detection in pharmaceutical quality control. The developed systems enhance the accuracy and speed of defect detection while offering scalable solutions suitable for high-throughput industrial environments. By integrating these advanced ML techniques, manufacturers can improve product quality, reduce reliance on manual inspection, and achieve higher operational efficiency. Future work will focus on further optimizing these models, adapting them to emerging industrial processes, and incorporating explainability mechanisms to strengthen trust and regulatory compliance.File | Dimensione | Formato | |
---|---|---|---|
NiccoloFerrariPhDThesisMainA-1b.pdf
accesso aperto
Dimensione
18.28 MB
Formato
Adobe PDF
|
18.28 MB | Adobe PDF | Visualizza/Apri |
I documenti in UNITESI sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.
https://hdl.handle.net/20.500.14242/218686
URN:NBN:IT:UNIFE-218686