Next Article in Journal
A Digital Signal Processing-Based Multi-Channel Acoustic Emission Acquisition System with a Simplified Analog Front-End
Previous Article in Journal
Oxygen Uptake Prediction for Timely Construction Worker Fatigue Monitoring Through Wearable Sensing Data Fusion
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

GCAFlow: Multi-Scale Flow-Based Model with Global Context-Aware Channel Attention for Industrial Anomaly Detection

1
College of Computer Science and Cyber Security, Chengdu University of Technology, Chengdu 610059, China
2
School of Mechanical and Electrical Engineering, Chengdu University of Technology, Chengdu 610059, China
*
Author to whom correspondence should be addressed.
Sensors 2025, 25(10), 3205; https://doi.org/10.3390/s25103205
Submission received: 2 April 2025 / Revised: 16 May 2025 / Accepted: 18 May 2025 / Published: 20 May 2025
(This article belongs to the Section Industrial Sensors)

Abstract

:
In anomaly detection tasks, labeled defect data are often scarce. Unsupervised learning leverages only normal samples during training, making it particularly suitable for anomaly detection tasks. Among unsupervised methods, normalizing flow models have shown distinct advantages. They allow precise modeling of data distributions and enable direct computation of sample log-likelihoods. Recent work has largely focused on feature fusion strategies. However, most of the flow-based methods emphasize spatial information while neglecting the critical role of channel-wise features. To address this limitation, we propose GCAFlow, a novel flow-based model enhanced with a global context-aware channel attention mechanism. In addition, we design a hierarchical convolutional subnetwork to improve the probabilistic modeling capacity of the flow-based framework. This subnetwork supports more accurate estimation of data likelihoods and enhances anomaly detection performance. We evaluate GCAFlow on three benchmark anomaly detection datasets, and the results demonstrate that it consistently outperforms existing flow-based models in both accuracy and robustness. In particular, on the VisA dataset, GCAFlow achieves an image-level AUROC of 98.2% and a pixel-level AUROC of 99.0%.

1. Introduction

As a fundamental technical methodology, anomaly detection (AD) serves critical roles across diverse fields, with the primary objective of identifying samples that significantly deviate from established normal patterns, including financial fraud detection [1], violence detection [2], medical diagnosis [3], network anomaly detection [4], and industrial defect detection [5]. Within the realm of industrial manufacturing, defect detection, as an essential branch of anomaly detection, is of tremendous significance for increasing product quality, optimizing production processes, and boosting production efficiency. Nevertheless, challenges remain in defect detection, the most prominent of which are the diversity of defect types and the sparsity of data. In real industrial production environments, defects manifest unpredictably with high morphological variability, making it impractical to compile comprehensive datasets encompassing all potential defect categories.
In view of the foregoing issues, recent research has increasingly focusing on unsupervised anomaly detection (UAD) methods. Traditional supervised learning relies on large volumes of labeled defective samples. Alternatively, unsupervised methods require only normal samples for training. They identify anomalous instances by detecting deviations from the learned distribution patterns, effectively performing out-of-distribution (OOD) detection. As a result, unsupervised anomaly detection (UAD) provides significant benefits in industrial defect detection. It reduces dependence on costly annotations and improves generalization to unseen defect types.
In recent years, normalizing flows have been widely used in unsupervised anomaly detection [6,7,8,9,10,11,12]. As a class of generative models with precise probability modeling capabilities, normalizing flows construct bijective transformations from complex data distributions to simple tractable distributions (e.g., Gaussian distributions) via reversible neural networks. Pioneering work by DifferNet [6] integrated multi-resolution image scaling with feature extraction and flow-based density estimation. Similarly, CS-Flow [9] detects image defects by combining a fully convolutional network with a cross-scaled flow, and MSFlow uses fusion flow to exchange multi-scale perceptions. Despite notable progress in feature fusion, these flow-based models typically concentrate on spatial information and neglect the critical channel dimension. We noticed that [13,14] incorporated a channel attention mechanism into their architecture, resulting in improved anomaly detection performance. Building on this insight, we have designed a channel attention module and insert it within our flow model. Concurrently, we modify the model’s subnetwork to bolster its distribution-modeling capabilities. In summary, our contributions are threefold:
  • We modify the subnetwork in the flow model to refine its probability estimation by hierarchical convolution and inverted bottleneck.
  • We propose a global context-aware (GCA) channel attention mechanism and insert it into the flow-based model to optimize anomaly detection and localization.
  • We conduct extensive experiments and GCAFlow performs well on the MvTeC AD, VisA, and BTAD benchmark datasets.

2. Related Work

2.1. Unsupervised Anomaly Detection

Existing approaches to unsupervised anomaly detection can be broadly categorized into three groups: reconstruction-based methods, embedding similarity-based methods, and flow-based methods.
Reconstruction-based anomaly detection methods rely on models trained exclusively on normal samples to accurately reconstruct normal regions. In contrast, poor reconstruction in abnormal regions leads to significantly higher reconstruction errors, which serve as indicators of anomalies. Most methods use generative models (e.g., auto-encoders [15], variational encoders [16], GANs [17], and diffusion models [18]) to predict anomalies and localize anomalous regions. VAE is trained by maximizing the evidence lower bound (ELBO) while optimizing the reconstruction error and KL divergence. However, this lower bound can be quite slack, leading to suboptimal modeling of complex data distributions. GAN-based methods learn the distribution of normal data through adversarial training, in which a generator produces synthetic normal samples, and anomalies are detected by reconstruction errors. Nevertheless, these methods are prone to mode collapse during training, which limits their robustness. Recently, diffusion models [19,20] have emerged as a powerful tool for anomaly detection tasks. RealNet [21] achieves efficient encoding and reconstruction of normal data by combining a key component, Strength-controllable Diffusion Anomaly Synthesis (SDAS), with other key components, and distinguishing reconstruction errors from anomalies.
Similarity-based embedding methods [22,23,24,25] aim to identify anomalies by learning low-dimensional representations of normal samples and quantifying deviations in the embedding space. PaDiM [24] and PatchCore [25] use CNNs pre-trained on ImageNet [26] to extract the embedded representation of a local patch in an image. The former measures the degree of abnormality by fitting a multivariate Gaussian distribution and computing the Mahalanobis distance, whereas the latter uses k-nearest-neighbor search to quantify the distance between patches in the embedding space and utilize this as an anomaly score. However, as the local patch approach may overlook the global context information of the image, it is prone to misinterpretation for images with complicated structures or variable backgrounds. In addition, embedding methods exhibit heightened sensitivity to noise and sample distribution imbalance, potentially compromising the stability and generalization of anomaly scoring mechanisms.

2.2. Normalizing Flows

Normalizing flows [27] are a class of generative models based on invertible transformations. They map complex data distributions to simple prior distributions (e.g., Gaussian) through a sequence of learnable bijective mappings. Superficially, the transformation process in normalizing flows may appear similar to that of diffusion models. Both aim to transform complex data distributions into simpler ones. However, diffusion models [28,29] rely on a stochastic process. They gradually add noise to data during the forward process and generate samples through a learned reverse denoising procedure. In contrast, normalizing flows use deterministic and bijective transformations. While diffusion models often achieve impressive sample quality, they typically require hundreds of denoising steps during generation. Normalizing flows, on the other hand, support tractable likelihood estimation, which serves as a valuable probabilistic measure for anomaly detection tasks. In an unsupervised learning context, normalizing flows can effectively identify anomalous samples by learning the probability distribution of normal data, making them particularly well suited for unsupervised anomaly detection tasks. In order to achieve the bijective transformation (i.e., invertibility) of normalizing flows, researchers have made various attempts. Notably, the design of the affine coupling layers [30,31] has been instrumental in ensuring both invertibility and computational efficiency. Furthermore, Glow [32] extends the capability of normalizing flows by using invertible 1 × 1 convolutions to generalize arbitrary channel-wise permutations.

2.3. Flow-Based Methods for UAD

Normalizing flows have attracted growing interest for anomaly detection and our method is developed within this framework.
DifferNet [6] pioneered an anomaly detection approach that integrates feature extractors with normalizing flows. The model resizes input images to three different scales, extracts features using a feature extractor, and then feeds these features to the normalizing flow to estimate their likelihood.
CFLOW [8], grounded in the conditional normalizing flow framework, collaborates with a multi-scale generative decoder to explicitly estimate the likelihood of encoded features. Additionally, it introduces spatial prior information through positional encodings, enhancing the model’s ability to localize anomalous regions.
CS-Flow [9] advances the field by integrating fully convolutional networks with cross-scale normalizing flows. It constructs a multi-scale feature pyramid to extract hierarchical image features and applies cross-scale flows to model inter-scale relationships. By processing feature maps at multiple resolutions in parallel, CS-Flow effectively captures global structures along with fine-grained details, yielding precise likelihood estimation.
Despite its effectiveness, CS-Flow’s cross-scale information interaction demands significant computational resources and memory. To alleviate this problem, MSFlow [10] proposes asymmetric parallel flows and more lightweight fusion flow modules, achieving more efficient information exchange.

2.4. Attention Mechanisms

The core idea of the channel attention mechanism is to allow the model to dynamically emphasize different channels of the input, rather than treating all channels equally through uniform averaging. By integrating the channel attention mechanism, models adaptively assign varying weights to input features based on their significance. This approach improves the focus on task-relevant information and boosts both overall performance and generalization ability.
The SE Block [33] extracts global channel information through global average pooling and uses a fully connected two-layer network to generate channel attention weights. These weights are then applied to reweight the input features, enhancing the representational capacity of the model across different channels.
The CBAM Block [34] extends the SE Block by incorporating spatial attention. It first extracts channel attention using global average pooling and max pooling, and then computes spatial attention via convolution. This dual attention mechanism enhances the feature information along both the channel and spatial dimensions.
GCNet [35] proposes a more efficient channel attention mechanism by simplifying NLNet [36], which models global context and captures long-range dependencies through spatial attention. Furthermore, by integrating the SE Block, GCNet optimizes feature recalibration, resulting in better performance in tasks such as object detection and segmentation while preserving computational efficiency.
The ECA layer [37] refines the SE Block by removing fully connected layers and adopting 1D convolution to capture local cross-channel interactions. This modification reduces both parameter complexity and computational overhead while preserving the model’s ability to adaptively recalibrate channel-wise feature responses, leading to a more efficient and effective attention mechanism.

3. Methods

3.1. Theoretical Background of Normalizing Flows

Normalizing flows are a class of probabilistic generative models based on reversible transformations. They employ the change of variables theorem to transform complex data distributions into simple prior distributions through a sequence of invertible mappings. Specifically, given a complex random variable x = p X ( x ) and a simpler latent variable z = p Z ( z ) , the data density can be written as
p X ( x ) = p Z ( z ) det z x
where z x denotes the Jacobi matrix of the transformation, which describes the local scale changes during the transformation from one distribution to the other. The absolute value of the determinant, det | z x | , denotes the absolute volume change under this mapping. The log-likelihood of image features can be estimated from p Z ( z ) by
log p X ( x ) = log p Z ( z ) + log det z x
Model training typically minimizes the negative log-likelihood. Accordingly, maximizing the data log-likelihood log p X ( x ) can be formulated as
max p X ( x ) min log p Z ( z ) log det J f 1 ( x ) .
det J f 1 ( x ) = d e t z x
where J f 1 ( x ) represents the Jacobian of the reversed normalizing flow. In practical applications, a single invertible transformation is usually insufficient; hence, the flow model must be implemented by stacking numerous layers of invertible transformations. Figure 1 illustrates the process of this cascade transformation. The formula can be expressed as below (5).
x = f ( z ) = f K f K 1 f 1 ( z ) z = f 1 ( x ) = f 1 1 f 2 1 f K 1 ( x )
As illustrated, ensuring the reversibility of the flow model is crucial. A widely adopted solution is the affine coupling layer [30,31], which maintains invertibility and enables efficient computation of the Jacobian determinant. Input variables x are split along the channel dimension, and an affine transformation is applied to only one subset of channels. This design maintains the invertibility of the overall mapping. The calculation process for this transformation is as follows:
x 1 , x 2 = split ( x )
x = x 2 exp ( s ( x 1 ) ) + t ( x 1 )
x = x 2 exp ( s ( x ) ) + t ( x )
y = concat ( x , x )
where s ( · ) , t ( · ) are affine parameters, which are implemented by subnet.

3.2. Overview

The detailed structure of GCAFlow is shown in Figure 2. Each input image is processed by the feature extractor to generate three sets of feature maps. After being 2× downsampled by average pooling, the three feature maps are separately fed into the Multi-scale Asymmetric Hierarchical Flows module. This module encodes their intrinsic properties and consists of different numbers of stacked H-Flow blocks in each branch. Moreover, to compensate for the inability of hierarchical convolution to capture the absolute positions of feature vectors, each H-Flow block incorporates positional encoding as a conditional input. Next, FusionAttnFlow deeply fuses the features while efficiently integrating channel information via the global context-aware (GCA) mechanism. Finally, the model separately processes them based on the requirements of detection and localization tasks, producing the final anomaly detection map.

3.3. Feature Extractor

Similar to the prevailing normalizing flow methods, GCAFlow requires a single pass through a feature extractor. In our implementation, we adopt the pre-trained WideResNet-50 [38] as a multi-scale feature extractor. Although its final layer captures high-level semantics, exclusive reliance on that output risks losing important textural and structural details. To address this, we extract features from the first three layers. These three sets of features are subsequently used as inputs for GCAFlow training in a sequential manner.

3.4. Hierarchical Convolutional Subnetwork

The architecture of the affine coupling layer ensures the invertibility of normalizing flow models. Consequently, designing the subnetworks within the affine coupling layer to improve their feature extraction capability and enable a more effective transformation from complex distributions to simple ones is a critical challenge. Previous flow models [7,8,9,10,39] have focused on optimizing overall architectures but continue to rely on stacks of 1 × 1 or 3 × 3 convolutions in their subnetworks, which limits their distribution-modeling capability.
To overcome this limitation, we introduce a novel hierarchical flow (H-Flow), as illustrated in Figure 3. It still adopts the affine coupling layer; however, its subnetwork is implemented using a hierarchical convolutional subnetwork.
In a hierarchical convolutional subnetwork, the 5 × 5 convolutional kernel is employed for spatial feature extraction due to its ability to capture a wider range of local information. Owing to its extended receptive field, this kernel can detect texture details and local patterns at elevated levels. Instead of batch normalization, which relies on batch statistics, we use layer normalization (LayerNorm) to normalize channel activations for each sample independently. LayerNorm stabilizes neuron input distributions, mitigates gradient vanishing and explosion, and accelerates convergence. Moreover, by normalizing the scale variations introduced by 5 × 5-kernel outputs, LayerNorm reduces sensitivity to distributional shifts and further enhances training stability and efficiency. Drawing inspiration from [40,41,42], we adopt an inverted bottleneck structure. In this design, the initial 1 × 1 convolution facilitates cross-channel information exchange and expands the channel dimension, allowing the flow-based model to acquire higher-dimensional features. Subsequently, a 1 × 1 convolution restores the channel count to match the input, thereby preserving the reversibility of the flow model.
This hierarchical structure extracts fine-grained spatial details and enables channel-wise feature transformations, thereby bolstering the model’s distribution-modeling capacity. Furthermore, we conducted experiments in Section 4.5 to evaluate the impact of various convolutional kernel sizes and different channel expansion factors on the overall model performance.

3.5. Global Context-Aware Module

ECA [37] experimentally proved that the SE Block [33] can damage information integrity by first reducing the dimensionality and then enhancing it when extracting the channel information. Instead, utilizing 1D convolution not only alleviates this issue but also substantially increases computational efficiency. Motivated by this finding, we propose an improved channel attention module that efficiently integrates channel information without sacrificing the integrity of global feature representations.
The proposed module first facilitates cross-channel information interaction via a 1 × 1 convolution, flexibly modeling cross-channel dependencies. Then, a softmax function is applied to compute global spatial attention weights, which are then multiplied with the input via matrix multiplication to extract enriched global channel information. Subsequently, a 1D convolution followed by a sigmoid activation generates the final channel attention weights. Finally, these weights are multiplied with the original input, yielding global semantic information while effectively filtering out redundant features. Figure 4 illustrates the workflow of the GCA module. According to [37], for a channel dimension of C, the kernel size k of the convolution 1D should be adaptive, giving it the flexibility to capture different ranges of channel dependencies. This kernel size is computed through the formula
k = ψ ( C ) = log 2 ( C ) γ + b γ odd
where t o d d indicates the closest odd number. We set γ to 2 and b to 1. We embed the GCA module into FusionAttnFlow (Section 3.6) to improve the model’s ability to extract contextual information.

3.6. FusionAttnFlow

Fusion flow [10] has been shown to effectively integrate multi-scale information, promoting efficient information sharing. It retains the affine coupling layer structure introduced in RealNVP [31] while receiving inputs from three different scales. These multi-scale features are then integrated using a fusion strategy inspired by HRNet [43]. On this basis, we feed the fused features into the GCA module to extract channel attention. Ultimately, it outputs three feature maps that retain their original shapes. Figure 5 illustrates the architecture of FusionAttnFlow.
The three inputs are maps that are first downsampled to a unified spatial resolution using average pooling (AP). These downsampled maps are concatenated to capture the local information through the 3 × 3 convolution in the bottleneck structure. Given that feature maps at different scales contribute unequally to the final anomaly map, it is both reasonable and effective to assign adaptive weights to different channels. To this end, we employ the GCA module to extract channel weights. Finally, the fused feature map is divided into three segments along the channel dimension. Each segment is upsampled to its original resolution via bilinear interpolation and then combined through element-wise addition to produce the final fused output.

3.7. Anomaly Score Generation

The flow framework employs multiple flow blocks to map the true data distribution—defined as the distribution of the dataset—onto a standard normal distribution. The negative log-likelihood (NLL) function output of this process can be used as a defect score map. During the training process, the NLL function for normal samples should tend towards or equal zero, whereas for abnormal samples it should deviate from zero. This is because abnormal samples do not conform to the distribution characteristics of normal samples, resulting in a departure from a zero NLL function. Through this approach, we can filter out samples that do not conform to the distribution of normal samples, thus obtaining an anomaly score map for abnormal samples.
During the anomaly score production phase, the three multi-scale likelihood maps are initially upsampled to match the dimensions of the input image and subsequently merged through element-wise addition to obtain the probability map. According to [10], leveraging multiplicative computation for image-level anomaly detection more effectively mitigates noise, while additive aggregation for pixel-level anomaly localization facilitates the detection of anomalies at various scales. Therefore, the final computation formula is as follows:
P sum = i = 1 3 P i
P mul = i = 1 3 P i
S p = max ( P s u m ) P s u m ;
s i = 1 K 1 K top K ( max ( P m u l ) P m u l ) ,
S p , S i represents the final image-level and pixel-level anomaly scores. topK denotes the largest K values; it is robust against both noise and small anomaly regions.

4. Experiments

4.1. Dataset

MvTec AD (anomaly detection) [5] is a widely used benchmark dataset for unsupervised industrial anomaly detection. It comprises more than 15 types of industrial products, categorized into object categories and five texture categories. The training set consists of 3629 defect-free images, whereas the test set includes 1725 images, encompassing both faulty and defect-free samples.
Current experimental results on the MvTec AD indicate that the AUROC metric has nearly reached saturation. To further advance the field of anomaly detection, the VisA dataset [44] was introduced in 2022. This dataset also adopts a self-supervised learning approach, encompassing 12 distinct categories and comprising a total of 10,821 images, including 9621 normal samples and 1200 anomalous samples.
To evaluate the generalizability of our method, we further conducted experiments on the BeanTech Anomaly Detection (BTAD) dataset [45], which consists of 2830 images collected from three types of industrial products.

4.2. Evaluation Indicators

In anomaly detection tasks, the AUROC (area under the receiver operating characteristic curve) is widely used as an evaluation metric. In this study, we calculate both the image-level AUROC (I-AUROC) and the pixel-level AUROC (P-AUROC) to assess the performance of anomaly detection and the accuracy of anomaly localization. For each dataset, the overall performance of the model is comprehensively evaluated by computing the average image-level AUROC and the average pixel-level AUROC across all categories.

4.3. Implementation Details

We begin by resizing the input images to 512 × 512 and then use WideResNet-50 [38] pre-trained on ImageNet-1K [26] to extract multi-level features. To boost computational efficiency, we downsample the features via average pooling and process the resulting feature maps with three multi-scale asymmetric normalization flows. We also incorporate 2D positional encodings as conditional information into all flow blocks and employ a FusionAttnFlow after the final block to enable cross-scale information exchange. Unless otherwise specified, our training strategy follows a one-class approach, where the model is trained exclusively on data from a single class, closely resembling industrial production scenarios. During training, we adopt the Adam optimizer with an initial learning rate of 1 × 10−4 and train for 100 epochs with a batch size of 16. All experiments were run on an NVIDIA GeForce RTX 4090 GPU.

4.4. Comparisons with Other Methods

In the experiments, we compared GCAFlow with state-of-the-art anomaly detection methods on the MvTec AD, VisA, and BTAD datasets.
The experimental results on the VisA dataset, as shown in Table 1 and Table 2, demonstrate that the proposed method achieves state-of-the-art performance in both image-level anomaly detection and pixel-level anomaly localization tasks. Specifically, in the image-level anomaly detection task, the proposed method attains an average AUROC of 98.2%, significantly surpassing all existing approaches, including the flow-based models MSFlow (97.7%) and Fastflow (82.2%). Similarly, in the pixel-level anomaly detection task, the proposed method achieves the highest average AUROC of 99.0%, outperforming the current best methods, PathCore (98.8%) and MSFlow (98.8%). These results indicate that, compared to existing flow-based approaches, the proposed method exhibits superior accuracy and robustness, and achieves the overall best performance among all compared methods, providing a more advanced solution for anomaly detection tasks.
Table 3 and Table 4 report the performance of our method on image-level anomaly detection and pixel-level localization tasks on the MvTec AD dataset, showing superior results across multiple categories and demonstrating strong generalization and anomaly detection capabilities. In terms of image-level AUROC results, our approach achieves state-of-the-art performance in several categories (e.g., Carpet, Leather, Tile) and attains a total average score of 99.7%, either matching or slightly surpassing the best-performing methods. For pixel-level AUROC evaluation, our method also achieves the best results in multiple categories (e.g., Carpet, Leather, Capsule) and reaches a total average score of 98.4%, approaching the highest reported performance (98.8%). Compared to existing approaches, our method demonstrates competitive results in categories with complex backgrounds (e.g., Cable, Screw) while maintaining overall robustness. In summary, the detection performance on the VisA dataset is inferior to that on MvTec, primarily because the defect regions in the VisA dataset are relatively small, making the detection task more challenging.
Our method also exhibits impressive performance on the BTAD dataset. As shown in Table 5, it ranks first among the listed methods in terms of both average image-level AUROC and average pixel-level AUROC. Remarkably, GCAFlow achieves high accuracy after training for only 10 epochs, underscoring its strong potential for anomaly detection tasks.
We compared the model size and inference latency of two flow-based models with high accuracy. As can be seen from Figure 6, GCAFlow is significantly smaller (51.6%) in terms of model size compared to CS-flow (1100 MB). Although its model size is slightly larger (32.7%) than MSFlow (401 MB), its inference latency is almost the same as MSFlow, with a difference of only 4 ms. Considering the excellent performance of GCAFlow in anomaly detection tasks, it achieves a good balance between accuracy and model efficiency.

4.5. Ablation Study

To comprehensively evaluate the detection performance of our model, we conducted extensive ablation studies on the VisA dataset to investigate the impact of key design components.
The Effect of Different Kernel Sizes in Hierarchical Convolutional Subnetwork. In our subnetwork architecture, the first convolutional layer is typically designed with a larger kernel to expand the receptive field and capture more comprehensive spatial context information. In this experiment, we conducted a comparative analysis on the impact of different kernel sizes, with the experimental results summarized in Table 6. The results indicate that a 3 × 3 convolution kernel performs exceptionally well for image-level anomaly detection. This can be attributed to the small and often indistinguishable nature of the defects, where local features are more informative than global context. Consequently, a smaller kernel is more effective at capturing the key features necessary to enhance overall detection performance. On the other hand, for pixel-level localization, both 5 × 5 and 7 × 7 convolution kernels yield scores approaching 99, as their larger receptive fields enable the integration of broader contextual information at each pixel. This broader context facilitates discrimination between subtle anomalies and background noise, thereby achieving precise localization. Taken together, a 5 × 5 convolution kernel appears to offer an optimal trade-off, delivering strong performance in both image-level detection and pixel-level localization. Effect of Varying Channel Expansion Factors in Hierarchical Convolutional Subnetwork. In this study, we analyze how varying the channel expansion multiplier within the subnetworks affects the flow model’s ability to map features. To achieve this, experiments were conducted using different expansion factors, denoted as α . Table 7 reveals that the model attains its best detection performance when α = 4, suggesting that an appropriately tuned channel expansion can improve the model’s anomaly detection performance.
Impact of Different Attention Mechanisms in FusionAttnFlow. To investigate the impact of different attention mechanisms on the distribution modeling capability of flow-based models, we substituted the GCA module in the FusionAttnFlow structure with the SE Block and ECA layer and conducted experiments. The experimental results, reported in Table 8, show that the GCA module significantly enhances the model’s anomaly detection performance, outperforming the other attention mechanisms.

4.6. Visualization Results

We visualize the anomaly localization by overlaying the final output of GCAFlow’s anomaly score map with the original image. Figure 7 and Figure 8 show the visualization results of GCAFlow on the MvTec AD, VisA, and BTAD datasets.

5. Discussion and Conclusions

Benefiting from the powerful distribution mapping capability of normalizing flows, the method has demonstrated exceptional performance in anomaly detection tasks. To address the limitation of existing flow-based frameworks that primarily focus on spatial information while neglecting channel-wise features, we propose GCAFlow, a novel module that incorporates global context-aware channel attention. Furthermore, to enhance the probabilistic modeling capability of the flow-based framework, we design a hierarchical convolutional subnetwork. Ablation studies indicate that the channel attention module significantly improves model performance. Extensive experiments on the VisA, MvTec AD, and BTAD datasets fully validate the robustness and high accuracy of GCAFlow in industrial anomaly detection scenarios.
However, flow-based models usually need to train a separate model for each category in practical applications, due to the fact that the distributional differences between different categories can interfere with model training. Therefore, in future work we would like to explore a flow-based model that can handle all categories uniformly, thus further promoting the development and application in the field of anomaly detection.

Author Contributions

Conceptualization, L.L. and C.L.; methodology, L.L.; software, L.L. and Y.G.; validation, B.C. and H.Y.; formal analysis, C.L.; supervision, C.L. and B.C.; visualization, Y.G. and H.Y. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by the National Key Research and Development Program of China, grant number 2022YFC3003202.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The datasets used in this study are all publicly accessible. MvTec AD is accessed through https://www.mvtec.com/company/research/datasets/mvtec-ad (accessed on 2 January 2025), VisA is accessed through https://amazon-visual-anomaly.s3.us-west-2.amazonaws.com/VisA_20220922.tar (accessed on 4 January 2025) and BTAD is accessed through https://avires.dimi.uniud.it/papers/btad/btad.zip (accessed on 14 May 2025).

Conflicts of Interest

The authors declare no conflicts of interest.

Abbreviations

The following abbreviations are used in this manuscript:
GCAGlobal context-aware
ADAnomaly detection
UADUnsupervised anomaly detection
H-FlowHierarchical flow
NLLNegative log-likelihood

References

  1. Fu, K.; Cheng, D.; Tu, Y.; Zhang, L. Credit card fraud detection using convolutional neural networks. In Proceedings of the International Conference on Neural Information Processing, Kyoto, Japan, 16–21 October 2016; Springer: Berlin/Heidelberg, Germany, 2016; pp. 483–490. [Google Scholar]
  2. Wu, P.; Liu, J.; Shi, Y.; Sun, Y.; Shao, F.; Wu, Z.; Yang, Z. Not only look, but also listen: Learning multimodal violence detection under weak supervision. In Proceedings of the Computer Vision—ECCV 2020: 16th European Conference, Glasgow, UK, 23–28 August 2020; Proceedings, Part XXX 16. Springer: Berlin/Heidelberg, Germany, 2020; pp. 322–339. [Google Scholar]
  3. Liu, Y.; Fan, L.; Zhang, C.; Zhou, T.; Xiao, Z.; Geng, L.; Shen, D. Incomplete multi-modal representation learning for Alzheimer’s disease diagnosis. Med. Image Anal. 2021, 69, 101953. [Google Scholar] [CrossRef] [PubMed]
  4. Xiao, C.; Xu, X.; Lei, Y.; Zhang, K.; Liu, S.; Zhou, F. Counterfactual graph learning for anomaly detection on attributed networks. IEEE Trans. Knowl. Data Eng. 2023, 35, 10540–10553. [Google Scholar] [CrossRef]
  5. Bergmann, P.; Fauser, M.; Sattlegger, D.; Steger, C. MVTec AD–A comprehensive real-world dataset for unsupervised anomaly detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Long Beach, CA, USA, 15–20 June 2019; pp. 9592–9600. [Google Scholar]
  6. Rudolph, M.; Wandt, B.; Rosenhahn, B. Same same but differnet: Semi-supervised defect detection with normalizing flows. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, Virtual, 5–9 January 2021; pp. 1907–1916. [Google Scholar]
  7. Milković, F.; Posilović, L.; Medak, D.; Subašić, M.; Lončarić, S.; Budimir, M. FRAnomaly: Flow-based rapid anomaly detection from images. Appl. Intell. 2024, 54, 3502–3515. [Google Scholar] [CrossRef]
  8. Gudovskiy, D.; Ishizaka, S.; Kozuka, K. Cflow-ad: Real-time unsupervised anomaly detection with localization via conditional normalizing flows. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, Waikoloa, HI, USA, 3–8 January 2022; pp. 98–107. [Google Scholar]
  9. Rudolph, M.; Wehrbein, T.; Rosenhahn, B.; Wandt, B. Fully convolutional cross-scale-flows for image-based defect detection. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, Waikoloa, HI, USA, 3–8 January 2022; pp. 1088–1097. [Google Scholar]
  10. Zhou, Y.; Xu, X.; Song, J.; Shen, F.; Shen, H.T. Msflow: Multiscale flow-based framework for unsupervised anomaly detection. IEEE Trans. Neural Netw. Learn. Syst. 2024, 36, 2437–2450. [Google Scholar] [CrossRef] [PubMed]
  11. Zhong, J.; Song, Y. UniFlow: Unified Normalizing Flow for Unsupervised Multi-Class Anomaly Detection. Information 2024, 15, 791. [Google Scholar] [CrossRef]
  12. Tailanian, M.; Pardo, Á.; Musé, P. U-flow: A u-shaped normalizing flow for anomaly detection with unsupervised threshold. J. Math. Imaging Vis. 2024, 66, 678–696. [Google Scholar] [CrossRef]
  13. Song, C.; Li, Z.; Li, Y.; Zhang, H.; Jiang, M.; Hu, K.; Wang, R. Research on blast furnace tuyere image anomaly detection, based on the local channel attention residual mechanism. Appl. Sci. 2023, 13, 802. [Google Scholar] [CrossRef]
  14. Simões, F.; Kowerko, D.; Schlosser, T.; Battisti, F.; Teichrieb, V. Attention modules improve image-level anomaly detection for industrial inspection: A differnet case study. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, Waikoloa, HI, USA, 3–8 January 2024; pp. 8246–8255. [Google Scholar]
  15. Sakurada, M.; Yairi, T. Anomaly detection using autoencoders with nonlinear dimensionality reduction. In Proceedings of the MLSDA 2014 2nd Workshop on Machine Learning for Sensory Data Analysis, Gold Coast, Australia, 2 December 2014; pp. 4–11. [Google Scholar]
  16. An, J.; Cho, S. Variational autoencoder based anomaly detection using reconstruction probability. Spec. Lect. IE 2015, 2, 1–18. [Google Scholar]
  17. Schlegl, T.; Seeböck, P.; Waldstein, S.M.; Langs, G.; Schmidt-Erfurth, U. f-AnoGAN: Fast unsupervised anomaly detection with generative adversarial networks. Med. Image Anal. 2019, 54, 30–44. [Google Scholar] [CrossRef] [PubMed]
  18. Ho, J.; Jain, A.; Abbeel, P. Denoising diffusion probabilistic models. Adv. Neural Inf. Process. Syst. 2020, 33, 6840–6851. [Google Scholar]
  19. Xiao, C.; Gou, Z.; Tai, W.; Zhang, K.; Zhou, F. Imputation-based time-series anomaly detection with conditional weight-incremental diffusion models. In Proceedings of the 29th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, Long Beach, CA, USA, 6–10 August 2023; pp. 2742–2751. [Google Scholar]
  20. Zhang, H.; Wang, Z.; Wu, Z.; Jiang, Y.G. Diffusionad: Denoising diffusion for anomaly detection. arXiv 2023, arXiv:2303.08730. [Google Scholar]
  21. Zhang, X.; Xu, M.; Zhou, X. Realnet: A feature selection network with realistic synthetic anomaly for anomaly detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Seattle, WA, USA, 16–22 June 2024; pp. 16699–16708. [Google Scholar]
  22. Cohen, N.; Hoshen, Y. Sub-image anomaly detection with deep pyramid correspondences. arXiv 2020, arXiv:2005.02357. [Google Scholar]
  23. Yi, J.; Yoon, S. Patch svdd: Patch-level svdd for anomaly detection and segmentation. In Proceedings of the Asian Conference on Computer Vision, Kyoto, Japan, 30 November–4 December 2020. [Google Scholar]
  24. Defard, T.; Setkov, A.; Loesch, A.; Audigier, R. Padim: A patch distribution modeling framework for anomaly detection and localization. In Proceedings of the International Conference on Pattern Recognition, Shanghai, China, 15–17 October 2021; Springer: Berlin/Heidelberg, Germany, 2021; pp. 475–489. [Google Scholar]
  25. Roth, K.; Pemula, L.; Zepeda, J.; Schölkopf, B.; Brox, T.; Gehler, P. Towards total recall in industrial anomaly detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, New Orleans, LA, USA, 18–24 June 2022; pp. 14318–14328. [Google Scholar]
  26. Deng, J.; Dong, W.; Socher, R.; Li, L.-J.; Li, K.; Li, F.-F. Imagenet: A large-scale hierarchical image database. In Proceedings of the 2009 IEEE Conference on Computer Vision and Pattern Recognition, Miami, FL, USA, 20–25 June 2009; pp. 248–255. [Google Scholar]
  27. Papamakarios, G.; Nalisnick, E.; Rezende, D.J.; Mohamed, S.; Lakshminarayanan, B. Normalizing flows for probabilistic modeling and inference. J. Mach. Learn. Res. 2021, 22, 1–64. [Google Scholar]
  28. Xiao, C.; Jiang, X.; Du, X.; Yang, W.; Lu, W.; Wang, X.; Chetty, K. Boundary-enhanced time series data imputation with long-term dependency diffusion models. Knowl.-Based Syst. 2025, 310, 112917. [Google Scholar] [CrossRef]
  29. Dhariwal, P.; Nichol, A. Diffusion models beat gans on image synthesis. Adv. Neural Inf. Process. Syst. 2021, 34, 8780–8794. [Google Scholar]
  30. Dinh, L.; Krueger, D.; Bengio, Y. Nice: Non-linear independent components estimation. arXiv 2014, arXiv:1410.8516. [Google Scholar]
  31. Dinh, L.; Sohl-Dickstein, J.; Bengio, S. Density estimation using real nvp. arXiv 2016, arXiv:1605.08803. [Google Scholar]
  32. Kingma, D.P.; Dhariwal, P. Glow: Generative flow with invertible 1 × 1 convolutions. Adv. Neural Inf. Process. Syst. 2018, 31, 10236–10245. [Google Scholar]
  33. Hu, J.; Shen, L.; Sun, G. Squeeze-and-excitation networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA, 18–22 June 2018; pp. 7132–7141. [Google Scholar]
  34. Woo, S.; Park, J.; Lee, J.Y.; Kweon, I.S. Cbam: Convolutional block attention module. In Proceedings of the European Conference on Computer Vision (ECCV), Munich, Germany, 8–14 September 2018; pp. 3–19. [Google Scholar]
  35. Cao, Y.; Xu, J.; Lin, S.; Wei, F.; Hu, H. Gcnet: Non-local networks meet squeeze-excitation networks and beyond. In Proceedings of the IEEE/CVF International Conference on Computer Vision Workshops, Seoul, Republic of Korea, 27–28 October 2019. [Google Scholar]
  36. Wang, X.; Girshick, R.; Gupta, A.; He, K. Non-local neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA, 18–22 June 2018; pp. 7794–7803. [Google Scholar]
  37. Wang, Q.; Wu, B.; Zhu, P.; Li, P.; Zuo, W.; Hu, Q. ECA-Net: Efficient channel attention for deep convolutional neural networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Seattle, WA, USA, 13–19 June 2020; pp. 11534–11542. [Google Scholar]
  38. He, K.; Zhang, X.; Ren, S.; Sun, J. Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Las Vegas, NV, USA, 27–30 June 2016; pp. 770–778. [Google Scholar]
  39. Yu, J.; Zheng, Y.; Wang, X.; Li, W.; Wu, Y.; Zhao, R.; Wu, L. Fastflow: Unsupervised anomaly detection and localization via 2d normalizing flows. arXiv 2021, arXiv:2111.07677. [Google Scholar]
  40. Sandler, M.; Howard, A.; Zhu, M.; Zhmoginov, A.; Chen, L.C. Mobilenetv2: Inverted residuals and linear bottlenecks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, Salt Lake City, UT, USA, 18–22 June 2018; pp. 4510–4520. [Google Scholar]
  41. Tan, M.; Le, Q. Efficientnet: Rethinking model scaling for convolutional neural networks. In Proceedings of the International Conference on Machine Learning, Long Beach, CA, USA, 9–15 June 2019; pp. 6105–6114. [Google Scholar]
  42. Liu, Z.; Mao, H.; Wu, C.Y.; Feichtenhofer, C.; Darrell, T.; Xie, S. A convnet for the 2020s. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, New Orleans, LA, USA, 18–24 June 2022; pp. 11976–11986. [Google Scholar]
  43. Yu, C.; Xiao, B.; Gao, C.; Yuan, L.; Zhang, L.; Sang, N.; Wang, J. Lite-hrnet: A lightweight high-resolution network. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, Nashville, TN, USA, 20–25 June 2021; pp. 10440–10450. [Google Scholar]
  44. Zou, Y.; Jeong, J.; Pemula, L.; Zhang, D.; Dabeer, O. Spot-the-difference self-supervised pre-training for anomaly detection and segmentation. In Proceedings of the European Conference on Computer Vision, Tel Aviv, Israel, 23–27 October 2022; Springer: Berlin/Heidelberg, Germany, 2022; pp. 392–408. [Google Scholar]
  45. Mishra, P.; Verk, R.; Fornasier, D.; Piciarelli, C.; Foresti, G.L. VT-ADL: A vision transformer network for image anomaly detection and localization. In Proceedings of the 2021 IEEE 30th International Symposium on Industrial Electronics (ISIE), Kyoto, Japan, 20–23 June 2021; pp. 1–6. [Google Scholar]
  46. Zavrtanik, V.; Kristan, M.; Skočaj, D. Draem-a discriminatively trained reconstruction embedding for surface anomaly detection. In Proceedings of the IEEE/CVF International Conference on Computer Vision, Montreal, BC, Canada, 11–17 October 2021; pp. 8330–8339. [Google Scholar]
  47. Ristea, N.C.; Madan, N.; Ionescu, R.T.; Nasrollahi, K.; Khan, F.S.; Moeslund, T.B.; Shah, M. Self-supervised predictive convolutional attentive block for anomaly detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, New Orleans, LA, USA, 18–24 June 2022; pp. 13576–13586. [Google Scholar]
  48. Deng, H.; Li, X. Anomaly detection via reverse distillation from one-class embedding. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, New Orleans, LA, USA, 18–24 June 2022; pp. 9737–9746. [Google Scholar]
  49. Liu, Z.; Zhou, Y.; Xu, Y.; Wang, Z. Simplenet: A simple network for image anomaly detection and localization. In Proceedings of the IEEE/CVF conference on Computer Vision and Pattern Recognition, Vancouver, BC, Canada, 17–24 June 2023; pp. 20402–20411. [Google Scholar]
Figure 1. The flow model maps a complex distribution to a simple distribution. f is an invertible function, and f 1 represents its inverse function.
Figure 1. The flow model maps a complex distribution to a simple distribution. f is an invertible function, and f 1 represents its inverse function.
Sensors 25 03205 g001
Figure 2. Anomaly detection pipeline of GCAFlow. The subnetwork in the H-Flow adopts hierarchical convolution. In FusionAttnFlow, in addition to performing feature fusion, we incorporate the global context-aware (GCA) module to extract channel-wise attention. PostProcess includes different aggregation strategies for anomaly detection and anomaly localization to generate high-quality anomaly maps.
Figure 2. Anomaly detection pipeline of GCAFlow. The subnetwork in the H-Flow adopts hierarchical convolution. In FusionAttnFlow, in addition to performing feature fusion, we incorporate the global context-aware (GCA) module to extract channel-wise attention. PostProcess includes different aggregation strategies for anomaly detection and anomaly localization to generate high-quality anomaly maps.
Sensors 25 03205 g002
Figure 3. The detailed structure of an H-Flow, where Norm uses layernorm, and PWconv is a 1 × 1 convolution.
Figure 3. The detailed structure of an H-Flow, where Norm uses layernorm, and PWconv is a 1 × 1 convolution.
Sensors 25 03205 g003
Figure 4. The structure of the GCA module, where PWconv represents 1 × 1 convolution, also known as point-wise convolution.
Figure 4. The structure of the GCA module, where PWconv represents 1 × 1 convolution, also known as point-wise convolution.
Sensors 25 03205 g004
Figure 5. The structure of FusionAttnFlow, where identity represents a no-op transformation that preserves the input.
Figure 5. The structure of FusionAttnFlow, where identity represents a no-op transformation that preserves the input.
Sensors 25 03205 g005
Figure 6. Comparison of model size and inference latency.
Figure 6. Comparison of model size and inference latency.
Sensors 25 03205 g006
Figure 7. Visualization results of anomaly localization on the VisA and BTAD datasets. The top three rows display the results on the VisA dataset, and the bottom row displays the results on the BTAD dataset.
Figure 7. Visualization results of anomaly localization on the VisA and BTAD datasets. The top three rows display the results on the VisA dataset, and the bottom row displays the results on the BTAD dataset.
Sensors 25 03205 g007
Figure 8. Visualization results of anomaly localization on the MvTec AD dataset.
Figure 8. Visualization results of anomaly localization on the MvTec AD dataset.
Sensors 25 03205 g008
Table 1. Image-level AUROC (%) for various anomaly detection methods on VisA. The best results are in bold, and the second-best results are underlined.
Table 1. Image-level AUROC (%) for various anomaly detection methods on VisA. The best results are in bold, and the second-best results are underlined.
MethodSPADE
[22]
DRAEM
[46]
PathCore
[25]
RealNet
[21]
Fastflow
[39]
MSFlow
[10]
Ours
candle91.091.898.696.192.898.398.4
capusle61.474.781.693.271.29696.8
cashew97.895.197.397.891.098.698.2
chewinggum85.894.899.199.991.499.699.4
fryum88.697.496.297.188.699.699.6
macaroni195.297.297.599.898.397.698.2
macaroni287.985.078.195.286.389.492.3
pcb172.147.698.598.577.49998.9
pcb250.789.897.397.661.997.898.5
pcb390.592.097.999.174.399.899
pcb483.198.699.699.780.998.299.8
pipe_fryum81.110099.899.972.098.899.5
Average82.188.795.197.882.297.798.2
Table 2. Pixel-level AUROC (%) for various anomaly detection methods on VisA. The best results are in bold, and the second-best results are underlined.
Table 2. Pixel-level AUROC (%) for various anomaly detection methods on VisA. The best results are in bold, and the second-best results are underlined.
MethodSPADE
[22]
DRAEM
[46]
PathCore
[25]
RealNet
[21]
Fastflow
[39]
MSFlow
[10]
Ours
candle97.996.699.599.194.999.499.4
capusle60.798.599.598.775.399.799.7
cashew86.483.598.998.391.499.198.8
chewinggum98.696.899.199.898.699.499.3
fryum96.787.293.896.297.392.794.5
macaroni196.299.999.899.997.399.899.8
macaroni287.599.299.199.689.299.699.6
pcb166.988.799.999.775.299.899.8
pcb271.191.399.098.067.399.299.2
pcb395.198.099.298.894.899.399.4
pcb489.096.898.698.689.998.599.1
pipe_fryum81.885.899.199.287.399.199.2
Average85.693.598.898.888.298.899.0
Table 3. Image-level AUROC (%) for various anomaly detection methods on MvTec AD. The best results are in bold, and the second-best results are underlined.
Table 3. Image-level AUROC (%) for various anomaly detection methods on MvTec AD. The best results are in bold, and the second-best results are underlined.
MethodDRAEM
[46]
SSPCAB
[47]
RD4AD
[48]
PatchCore
[25]
Simplenet
[49]
CS-Flow
[9]
MSFlow
[10]
Ours
Carpet97.098.298.998.799.7100100100
Grid99.910010098.299.799.099.899.8
Leather100100100100100100100100
Tile99.610099.398.799.8100100100
Wood99.199.599.299.210010010099.8
Average.textuer99.199.599.599.099.899.810099.9
Bottle99.298.410010010099.8100100
Cable91.896.995.099.599.999.199.599.6
Capsule98.599.396.398.197.797.199.299.3
Hazelnt10010099.910010099.6100100
Metal_Nut98.710010010010099.1100100
Pill98.999.896.696.699.098.699.699.4
Screw93.997.997.098.198.297.697.897.9
Toothbrush10010099.510099.791.910099.6
Transistor93.192.996.710010099.3100100
Zipper10010098.598.899.999.7100100
Average.Object97.498.598.099.199.598.299.699.6
Total.average98.098.998.599.199.698.799.799.7
Table 4. Pixel-level AUROC (%) for various anomaly detection methods on MvTec AD. The best results are in bold, and the second-best results are underlined.
Table 4. Pixel-level AUROC (%) for various anomaly detection methods on MvTec AD. The best results are in bold, and the second-best results are underlined.
MethodDRAEM
[46]
SSPCAB
[47]
RD4AD
[48]
PatchCore
[25]
Simplenet
[49]
CS-Flow
[9]
MSFlow
[10]
Ours
Carpet95.595.098.999.198.295.299.499.4
Grid99.799.599.398.798.894.499.499.4
Leather98.699.599.499.399.289.399.799.7
Tile99.299.395.695.997.090.798.298.0
Wood96.496.895.395.194.591.297.196.2
Average.texture97.998.097.797.697.592.298.898.5
Bottle99.198.898.798.698.088.599.098.8
Cable94.796.097.498.597.696.198.598.1
Capsule94.393.198.798.998.998.199.199.2
Hazelnut99.799.898.998.797.996.198.798.7
Metal_Nut99.598.997.398.498.896.099.399.2
Pill97.697.598.297.698.695.898.899.1
Screw97.699.899.699.499.398.399.199.4
Toothbrush98.198.199.198.798.597.498.598.4
Transistor90.987.092.596.497.696.398.394.0
Zipper98.899.098.298.998.995.899.299.1
Average.object97.096.897.998.498.495.898.898.4
Total.average97.397.297.898.198.194.698.898.4
Table 5. Image-level AUROC (%) and pixel-level AUROC (%) for various anomaly detection methods on BTAD. The best results are in bold.
Table 5. Image-level AUROC (%) and pixel-level AUROC (%) for various anomaly detection methods on BTAD. The best results are in bold.
MethodPatch-SVDD [23]RealNet [21]MSFlow [10]Ours
Category 0195.7/91.6100.0/98.299.8/96.899.8/97.0
Category 0272.1/93.688.6/96.391.4/97.492.7/97.5
Category 0382.1/91.099.6/99.499.3/99.499.6/99.5
Average83.3/92.196.1/97.996.8/97.897.3/98.0
Table 6. Results of different kernel sizes K on the VisA dataset. The best results are highlighted in bold.
Table 6. Results of different kernel sizes K on the VisA dataset. The best results are highlighted in bold.
I-AUROCP-AUROC
K 3 × 35 × 57 × 73 × 35 × 57 × 7
candle98.298.298.799.499.499.4
capsule97.296.696.198.699.799.6
cashew98.697.797.998.498.999.1
chewinggum99.599.299.699.499.399.3
fryum99.499.899.793.894.194.2
macaroni198.498.197.699.899.799.8
macaroni290.590.590.799.699.699.6
pcb199.299.198.799.899.899.8
pcb298.698.998.898.999.399.3
pcb398.198.698.699.399.399.4
pcb499.899.899.899.099.099.0
pipe_fryum99.299.699.099.299.299.2
Average98.0598.0097.9398.7698.9498.97
Table 7. Results of different channel expansion factors α on the VisA dataset. The best results are highlighted in bold.
Table 7. Results of different channel expansion factors α on the VisA dataset. The best results are highlighted in bold.
I-AUROCP-AUROC
α 12341234
candle98.398.398.298.299.499.499.499.4
capsule95.896.99696.699.699.699.799.7
cashew97.89898.397.799.298.898.998.9
chewinggum99.299.299.299.299.399.499.499.3
fryum98.699.799.299.893.794.193.594.1
macaroni198.297.198.398.199.799.799.799.7
macaroni288.989.289.890.599.599.699.699.6
pcb198.898.898.899.199.899.899.899.8
pcb298.798.398.698.999.298.999.299.3
pcb398.698.398.598.699.399.399.499.3
pcb499.899.899.899.899999999.0
pipe_fryum99.299.499.799.699999999.2
Average97.6597.7597.8798.0098.8998.8898.8898.94
Table 8. Results of different channel attention mechanisms on the VisA dataset. The best results are highlighted in bold.
Table 8. Results of different channel attention mechanisms on the VisA dataset. The best results are highlighted in bold.
I-AUROCP-AUROC
AMSEBlockECAOursSEBlockECAOurs
candle98.498.498.499.499.299.4
capusle96.496.496.899.799.799.7
cashew98.398.498.298.898.798.8
chewinggum99.399.699.499.499.399.4
fryum99.599.799.693.793.894.5
macaroni198.098.598.299.799.899.8
macaroni2991.791.492.399.699.699.6
pcb198.898.898.999.899.899.8
pcb298.898.298.599.299.299.2
pcb398.798.899.099.499.499.4
pcb499.899.899.898.99999.1
fryum99.399.299.599.199.199.2
Average98.0798.1098.2198.8898.8998.99
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Liao, L.; Lu, C.; Gao, Y.; Yu, H.; Cai, B. GCAFlow: Multi-Scale Flow-Based Model with Global Context-Aware Channel Attention for Industrial Anomaly Detection. Sensors 2025, 25, 3205. https://doi.org/10.3390/s25103205

AMA Style

Liao L, Lu C, Gao Y, Yu H, Cai B. GCAFlow: Multi-Scale Flow-Based Model with Global Context-Aware Channel Attention for Industrial Anomaly Detection. Sensors. 2025; 25(10):3205. https://doi.org/10.3390/s25103205

Chicago/Turabian Style

Liao, Lin, Congde Lu, Yujie Gao, Hao Yu, and Biao Cai. 2025. "GCAFlow: Multi-Scale Flow-Based Model with Global Context-Aware Channel Attention for Industrial Anomaly Detection" Sensors 25, no. 10: 3205. https://doi.org/10.3390/s25103205

APA Style

Liao, L., Lu, C., Gao, Y., Yu, H., & Cai, B. (2025). GCAFlow: Multi-Scale Flow-Based Model with Global Context-Aware Channel Attention for Industrial Anomaly Detection. Sensors, 25(10), 3205. https://doi.org/10.3390/s25103205

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop