Sergio Villanueva López
Current Organizations / Institutes
The organizations/institutes from the scholar's latest article
Sergio Villanueva López has a total of 2 co-authors. Here are the top co-authors by number of shared publications:
- Emilio Soria-Olivas
IDAL, Intelligent Data Analysis Laboratory, Escola Tècnica Superior d’Enginyeria, Universitat de València, 46100 Valencia, Spain
7 shared publications - Manuel Sánchez-Montañés
GNB, Department of Computer Science, Universidad Autónoma de Madrid, 28049 Madrid, Spain
7 shared publications
Latest Publications
- Open Access
- 4 November 2026
- Published by MDPI AG in Electronics
- Vol. 15 (21) , 5109
PC-Reg: Modeling Spatial Dependencies for Logical Anomaly Detection
In industrial visual inspection, individual components may look normal even when their arrangement or quantity is incorrect. For example, a cable may be plugged into the wrong slot of a connector, although every part in the image is intact. These logical anomalies are difficult for methods such as PatchCore, which score image regions independently, while the vision-language pipelines that can reason about them are slow and costly to deploy on a production line. In this work, we present Positional Contextual Regression (PC-Reg), which is a method that learns from defect-free images how each region relates to its surroundings, without gradient-based training. A frozen vision backbone provides the patch features, and a closed-form ridge regression at each grid position predicts every patch feature from its neighbors; the Mahalanobis distance of the prediction residual, calibrated per position, measures how far a region departs from its expected context. The attention of the backbone weights the neighbors, and a complementary score captures the content of the four image quadrants. With one fixed configuration across 32 categories of MVTec LOCO AD, MVTec AD, and VisA, the combined method, PC-RegDual, reaches 85.7%, 98.8%, and 92.6% AUROC (87.5%, 99.0%, and 93.5% with a larger backbone). On the same features, it outperforms a nearest-neighbor baseline that follows PatchCore on MVTec LOCO AD by 5.3 percentage points overall and by 14.6 percentage points on logical anomalies, and it outperforms PaDiM and a mean-subtraction baseline on all three benchmarks. Diagnostic feature-space tests show that PC-Reg responds to broken spatial relationships that independent patch scoring misses, and an evaluation on production-line images (BTAD) gives results comparable to the best baselines. On a consumer GPU, fitting takes about 5 s per category (72 s on one CPU core) and inference 55 ms per image, with deterministic output and no external services, so new products can be set up in minutes on local hardware.
- 4 November 2026
- Published by MDPI AG in Electronics
- Vol. 15 (21) , 5109
Open AccessPC-Reg: Modeling Spatial Dependencies for Logical Anomaly Detection
In industrial visual inspection, individual components may look normal even when their arrangement or quantity is incorrect. For example, a cable may be plugged into the wrong slot of a connector, although every part in the image is intact. These logical anomalies are difficult for methods such as PatchCore, which score image regions independently, while the vision-language pipelines that can reason about them are slow and costly to deploy on a production line. In this work, we present Positional Contextual Regression (PC-Reg), which is a method that learns from defect-free images how each region relates to its surroundings, without gradient-based training. A frozen vision backbone provides the patch features, and a closed-form ridge regression at each grid position predicts every patch feature from its neighbors; the Mahalanobis distance of the prediction residual, calibrated per position, measures how far a region departs from its expected context. The attention of the backbone weights the neighbors, and a complementary score captures the content of the four image quadrants. With one fixed configuration across 32 categories of MVTec LOCO AD, MVTec AD, and VisA, the combined method, PC-RegDual, reaches 85.7%, 98.8%, and 92.6% AUROC (87.5%, 99.0%, and 93.5% with a larger backbone). On the same features, it outperforms a nearest-neighbor baseline that follows PatchCore on MVTec LOCO AD by 5.3 percentage points overall and by 14.6 percentage points on logical anomalies, and it outperforms PaDiM and a mean-subtraction baseline on all three benchmarks. Diagnostic feature-space tests show that PC-Reg responds to broken spatial relationships that independent patch scoring misses, and an evaluation on production-line images (BTAD) gives results comparable to the best baselines. On a consumer GPU, fitting takes about 5 s per category (72 s on one CPU core) and inference 55 ms per image, with deterministic output and no external services, so new products can be set up in minutes on local hardware.
- Open Access
- 30 September 2026
- Published by MDPI AG in Electronics
- Vol. 15 (19) , 4486
Cleaning Contaminated Reference Sets for Few-Shot Visual Anomaly Detection
Few-shot anomaly detectors for industrial inspection typically use between five and 20 reference images to learn what a normal part looks like. These images are assumed to be defect-free, which is not 100% guaranteed on an actual production line. This makes the reference set a potential point of failure: if an image of a defective part ends up among the references, the detector will silently accept similar defects. First, we quantify this degradation using 35 categories from the public datasets MVTec AD, VisA, BTAD, and MVTec LOCO. We show that replacing just three of 10 reference images with defective parts results in a loss of 1.8 percentage points of AUROC on average, and up to 3.0 depending on the dataset. This represents a substantial loss for an industrial anomaly detection system. Second, we present an unsupervised audit algorithm that identifies which reference images are likely defective, and requires no training. The audit is a one-time preprocessing step that evaluates the internal consistency of the reference set before it is used for inspection. Each image is compared to the rest of the references, scored based on its most atypical region, and flagged when that score stands out. A technician can then remove, review, or recapture the flagged images before the system is deployed on the production line. We show that recapture recovers more than half of the accuracy lost due to contamination, and if there are no truly defective images, it does not degrade the system’s performance. Our method is intended for memory-bank detectors built from a handful of references, where an isolated part with a structural or textural defect can slip into the set. It runs in seconds on CPU, makes its decisions at the image level independently of the anomaly detection algorithm used, and can be easily incorporated into existing systems. The code and results are publicly available.
- 30 September 2026
- Published by MDPI AG in Electronics
- Vol. 15 (19) , 4486
Open AccessCleaning Contaminated Reference Sets for Few-Shot Visual Anomaly Detection
Few-shot anomaly detectors for industrial inspection typically use between five and 20 reference images to learn what a normal part looks like. These images are assumed to be defect-free, which is not 100% guaranteed on an actual production line. This makes the reference set a potential point of failure: if an image of a defective part ends up among the references, the detector will silently accept similar defects. First, we quantify this degradation using 35 categories from the public datasets MVTec AD, VisA, BTAD, and MVTec LOCO. We show that replacing just three of 10 reference images with defective parts results in a loss of 1.8 percentage points of AUROC on average, and up to 3.0 depending on the dataset. This represents a substantial loss for an industrial anomaly detection system. Second, we present an unsupervised audit algorithm that identifies which reference images are likely defective, and requires no training. The audit is a one-time preprocessing step that evaluates the internal consistency of the reference set before it is used for inspection. Each image is compared to the rest of the references, scored based on its most atypical region, and flagged when that score stands out. A technician can then remove, review, or recapture the flagged images before the system is deployed on the production line. We show that recapture recovers more than half of the accuracy lost due to contamination, and if there are no truly defective images, it does not degrade the system’s performance. Our method is intended for memory-bank detectors built from a handful of references, where an isolated part with a structural or textural defect can slip into the set. It runs in seconds on CPU, makes its decisions at the image level independently of the anomaly detection algorithm used, and can be easily incorporated into existing systems. The code and results are publicly available.
- Open Access
- 22 July 2026
- Published by MDPI AG in Machine Learning and Knowledge Extraction
- Vol. 8 (7) , 219
Memory Pollution in Multi-Product Visual Anomaly Detection: Diagnosis and Mitigation
Memory-bank methods such as PatchCore are widely used in industrial quality control for visual anomaly detection since they require no training, are fast to deploy and achieve strong accuracy. However, they are memory-intensive. Furthermore, a single production line typically involves different products or cameras, so using a single anomaly detection method with a shared nearest-neighbor memory bank is attractive since it simplifies deployment and makes new products easy to add. Nevertheless, embeddings from different products/cameras can interfere during retrieval, causing what we call “memory pollution”. In this work, we study this effect through a new diagnostic framework, which involves: (1) a new metric, the wrong-neighbor rate (WNR), which measures how often a query’s nearest neighbor belongs to a different product; (2) an empirically validated phenomenon, “oracle inversion”, where querying only the product’s own data can underperform the shared bank under a fixed memory budget; (3) a first-order analytical model of the WNR, which predicts how pollution grows with product count and memory budget; and (4) a minimal training-free router that removes the effect of memory pollution. Our results show that our system performs robustly across different datasets and backbones, with up to 25× memory reduction, which makes our framework attractive for industrial applications.
- 22 July 2026
- Published by MDPI AG in Machine Learning and Knowledge Extraction
- Vol. 8 (7) , 219
Open AccessMemory Pollution in Multi-Product Visual Anomaly Detection: Diagnosis and Mitigation
Memory-bank methods such as PatchCore are widely used in industrial quality control for visual anomaly detection since they require no training, are fast to deploy and achieve strong accuracy. However, they are memory-intensive. Furthermore, a single production line typically involves different products or cameras, so using a single anomaly detection method with a shared nearest-neighbor memory bank is attractive since it simplifies deployment and makes new products easy to add. Nevertheless, embeddings from different products/cameras can interfere during retrieval, causing what we call “memory pollution”. In this work, we study this effect through a new diagnostic framework, which involves: (1) a new metric, the wrong-neighbor rate (WNR), which measures how often a query’s nearest neighbor belongs to a different product; (2) an empirically validated phenomenon, “oracle inversion”, where querying only the product’s own data can underperform the shared bank under a fixed memory budget; (3) a first-order analytical model of the WNR, which predicts how pollution grows with product count and memory budget; and (4) a minimal training-free router that removes the effect of memory pollution. Our results show that our system performs robustly across different datasets and backbones, with up to 25× memory reduction, which makes our framework attractive for industrial applications.
- Open Access
- 13 May 2026
- Published by MDPI AG in Electronics
- Vol. 15 (10) , 2077
RGB Ensemble Strategies for Unsupervised Industrial Anomaly Detection on the AutoVI Dataset
Real automotive inspection lines need robust defect detection under cluttered backgrounds, fluctuating illumination, and operator-introduced clutter, conditions under which fully supervised pipelines are rarely feasible because defective samples are scarce and heterogeneous. We address this gap with a deployment-oriented study of unsupervised anomaly detection (UAD) on AutoVI, a public automotive benchmark, and we go beyond running existing detectors in three ways. First, we establish unified RGB and pseudo-depth baselines for seven UAD models under a single calibration and evaluation policy that combines threshold-agnostic metrics (AUROC, AP), operational metrics (TPR at fixed TNR), and pixel-level sPRO/AUsPRO under a 5% false-positive budget. Second, we show that a plug-and-play late fusion of independently calibrated RGB detectors consistently recovers pixel-level localization that no single model achieves, with no extra training and no architectural change; effects are large (Cohen’s on every flagged improvement) and statistically significant across three seeds. Third, we report an actionable negative result: combining RGB with monocular pseudo-depth through the same fusion scheme degrades rather than improves localization, and we trace the failure to the relative nature of estimated depth interacting with a parameter-free aggregator. Ablations on the fusion operator, ensemble size, and calibration support these findings, and the released calibrated artifacts make the comparison reproducible on other MVTec-style benchmarks.- 13 May 2026
- Published by MDPI AG in Electronics
- Vol. 15 (10) , 2077
Open AccessRGB Ensemble Strategies for Unsupervised Industrial Anomaly Detection on the AutoVI Dataset
Real automotive inspection lines need robust defect detection under cluttered backgrounds, fluctuating illumination, and operator-introduced clutter, conditions under which fully supervised pipelines are rarely feasible because defective samples are scarce and heterogeneous. We address this gap with a deployment-oriented study of unsupervised anomaly detection (UAD) on AutoVI, a public automotive benchmark, and we go beyond running existing detectors in three ways. First, we establish unified RGB and pseudo-depth baselines for seven UAD models under a single calibration and evaluation policy that combines threshold-agnostic metrics (AUROC, AP), operational metrics (TPR at fixed TNR), and pixel-level sPRO/AUsPRO under a 5% false-positive budget. Second, we show that a plug-and-play late fusion of independently calibrated RGB detectors consistently recovers pixel-level localization that no single model achieves, with no extra training and no architectural change; effects are large (Cohen’s on every flagged improvement) and statistically significant across three seeds. Third, we report an actionable negative result: combining RGB with monocular pseudo-depth through the same fusion scheme degrades rather than improves localization, and we trace the failure to the relative nature of estimated depth interacting with a parameter-free aggregator. Ablations on the fusion operator, ensemble size, and calibration support these findings, and the released calibrated artifacts make the comparison reproducible on other MVTec-style benchmarks. - Open Access
- 24 April 2026
- Published by MDPI AG in Preprints.org
RGB Ensemble Strategies for Unsupervised Industrial Anomaly Detection on the AutoVI Dataset
Automotive inspection in real production lines requires robust detection of rare and diverse 2 defects. Fully supervised methods are often unfeasible because defective samples are scarce 3 and heterogeneous. This work benchmarks recent unsupervised anomaly detection (UAD) 4 methods on AutoVI, a real industrial dataset covering six automotive inspection tasks 5 with challenging lighting, cluttered backgrounds, and multiple viewpoints. We establish 6 RGB and pseudo-depth baselines for seven UAD models under a unified training and 7 evaluation protocol, training exclusively on defect-free samples with z-score calibration for 8 fair comparison. On top of these baselines we study late-fusion ensembles that combine 9 complementary detectors within RGB and across modalities, at both image-score and pixel- 10 map level, reporting AUROC, AP, TPR@TNR, and pixel-level sPRO/AUsPRO at 5% false 11 positive rate. The main finding is that RGB-only late-fusion ensembles consistently improve 12 pixel-level localization, often recovering defect coverage where all individual models fail. 13 Combining RGB with monocular pseudo-depth through the same scheme, by contrast, 14 does not yield systematic gains and is highly sensitive to the quality of the estimated depth 15 channel. These results, validated with statistical significance testing across three random 16 seeds, provide practical guidance for composing UAD pipelines in automotive inspection.
- 24 April 2026
- Published by MDPI AG in Preprints.org
Open AccessRGB Ensemble Strategies for Unsupervised Industrial Anomaly Detection on the AutoVI Dataset
Automotive inspection in real production lines requires robust detection of rare and diverse 2 defects. Fully supervised methods are often unfeasible because defective samples are scarce 3 and heterogeneous. This work benchmarks recent unsupervised anomaly detection (UAD) 4 methods on AutoVI, a real industrial dataset covering six automotive inspection tasks 5 with challenging lighting, cluttered backgrounds, and multiple viewpoints. We establish 6 RGB and pseudo-depth baselines for seven UAD models under a unified training and 7 evaluation protocol, training exclusively on defect-free samples with z-score calibration for 8 fair comparison. On top of these baselines we study late-fusion ensembles that combine 9 complementary detectors within RGB and across modalities, at both image-score and pixel- 10 map level, reporting AUROC, AP, TPR@TNR, and pixel-level sPRO/AUsPRO at 5% false 11 positive rate. The main finding is that RGB-only late-fusion ensembles consistently improve 12 pixel-level localization, often recovering defect coverage where all individual models fail. 13 Combining RGB with monocular pseudo-depth through the same scheme, by contrast, 14 does not yield systematic gains and is highly sensitive to the quality of the estimated depth 15 channel. These results, validated with statistical significance testing across three random 16 seeds, provide practical guidance for composing UAD pipelines in automotive inspection.
- Open Access
- 17 April 2026
- Published by Elsevier in SSRN Electronic Journal
PC-Reg: Modeling Spatial Dependencies for Training-Free Anomaly Detection
Detecting logical anomalies in industrial visual inspection often requires capturing relationships between components, not just local appearance [1]. In manufacturing settings, defects such as missing parts, incorrect counts, or misplaced components cannot be identified by examining individual regions in isolation, which limits patch-independent methods such as PatchCore [2]. Recent vision-language-model pipelines [3] can address such cases, but they typically rely on multi-model systems that are costly to run and harder to deploy on production lines.We introduce PC-Reg (Positional Contextual Regression), a training-free method that predicts each patch feature from its spatial neighborhood using closed-form ridge regression, and scores anomalies through the Mahalanobis distance of the prediction residual.We also introduce two complementary extensions: CLS-attention gating, which leverages the global saliency encoded in the CLS token to weight spatial neighbors, and a compositional branch that captures image-level distributional shifts through global average pooling. The two branches are fused via 𝑧-score normalization into a dual score (PC-RegDual).Evaluated on 32 categories across three benchmarks with a DINOv3-ViT-H+/16 backbone, PC-RegDual achieves 87.5% AUROC on MVTec LOCO AD, 98.6% on MVTec AD, and 92.4% on VisA, with statistically significant improvements over the patch-independent baseline. With the lighter ViT-L/16 backbone, the entire pipeline fits in about two minutes per category on CPU and runs inference at ∼41 ms per image on a consumer GPU, over 700× faster than VLM-based alternatives, making it suitable for inline industrial inspection without specialized hardware.
- 17 April 2026
- Published by Elsevier in SSRN Electronic Journal
Open AccessPC-Reg: Modeling Spatial Dependencies for Training-Free Anomaly Detection
Detecting logical anomalies in industrial visual inspection often requires capturing relationships between components, not just local appearance [1]. In manufacturing settings, defects such as missing parts, incorrect counts, or misplaced components cannot be identified by examining individual regions in isolation, which limits patch-independent methods such as PatchCore [2]. Recent vision-language-model pipelines [3] can address such cases, but they typically rely on multi-model systems that are costly to run and harder to deploy on production lines.We introduce PC-Reg (Positional Contextual Regression), a training-free method that predicts each patch feature from its spatial neighborhood using closed-form ridge regression, and scores anomalies through the Mahalanobis distance of the prediction residual.We also introduce two complementary extensions: CLS-attention gating, which leverages the global saliency encoded in the CLS token to weight spatial neighbors, and a compositional branch that captures image-level distributional shifts through global average pooling. The two branches are fused via 𝑧-score normalization into a dual score (PC-RegDual).Evaluated on 32 categories across three benchmarks with a DINOv3-ViT-H+/16 backbone, PC-RegDual achieves 87.5% AUROC on MVTec LOCO AD, 98.6% on MVTec AD, and 92.4% on VisA, with statistically significant improvements over the patch-independent baseline. With the lighter ViT-L/16 backbone, the entire pipeline fits in about two minutes per category on CPU and runs inference at ∼41 ms per image on a consumer GPU, over 700× faster than VLM-based alternatives, making it suitable for inline industrial inspection without specialized hardware.
- Open Access
- 2 April 2026
- Published by MDPI AG in Preprints.org
Memory Pollution in Multi-Product Anomaly Detection: Diagnosis and Resolution
In multi-product industrial inspection, maintaining one memory bank per product yields costs that scale linearly with the number of product types. A shared bank with a fixed memory budget is more practical, but mixing embeddings from different products introduces inter-product interference. We call this memory pollution: nearest-neighbor queries retrieve features from other products, and budget allocations optimized on isolated banks degrade once retrieval is shared. Across 15 MVTec AD products, a per-product oracle allocator underperforms uniform allocation by 1.6 percentage points (pp) at 18 MB, and the wrong-neighbor rate (WNR) reaches 38% at 2.9 MB. We address this with a training-free router based on mean-embedding prototypes that identifies the product before nearest-neighbor search. The router adds 0.06 MB and achieves perfect top-1 accuracy over 30 product types (MVTec AD, VisA, BTAD). With routing, the performance gap across five allocation strategies shrinks to at most 1 pp. Top 1 routing with uniform allocation improves image-level area under the ROC curve (AUROC) from 90.8% to 91.1% at 18 MB. Coreset selection and clustering further provide 16× memory reduction with less than 1 pp AUROC loss. All components are training-free and operate on frozen DINOv3 features.
- 2 April 2026
- Published by MDPI AG in Preprints.org
Open AccessMemory Pollution in Multi-Product Anomaly Detection: Diagnosis and Resolution
In multi-product industrial inspection, maintaining one memory bank per product yields costs that scale linearly with the number of product types. A shared bank with a fixed memory budget is more practical, but mixing embeddings from different products introduces inter-product interference. We call this memory pollution: nearest-neighbor queries retrieve features from other products, and budget allocations optimized on isolated banks degrade once retrieval is shared. Across 15 MVTec AD products, a per-product oracle allocator underperforms uniform allocation by 1.6 percentage points (pp) at 18 MB, and the wrong-neighbor rate (WNR) reaches 38% at 2.9 MB. We address this with a training-free router based on mean-embedding prototypes that identifies the product before nearest-neighbor search. The router adds 0.06 MB and achieves perfect top-1 accuracy over 30 product types (MVTec AD, VisA, BTAD). With routing, the performance gap across five allocation strategies shrinks to at most 1 pp. Top 1 routing with uniform allocation improves image-level area under the ROC curve (AUROC) from 90.8% to 91.1% at 18 MB. Coreset selection and clustering further provide 16× memory reduction with less than 1 pp AUROC loss. All components are training-free and operate on frozen DINOv3 features.