원시데이터 수집 시스템
선정목록으로

A Double Self-Supervised Model for Pitting Detection on Ball Screws

간접 관련 엔지니어링 플라스틱 · (23) 컴파운드 (10) 아라미드(17) 스펀본드 부직포

기본 정보

저자
  1. Xiaoming Wang — School of Optical-Electrical and Computer Engineering, University of Shanghai for Science and Technology, Shanghai, China
  2. Yongxiong Wang — School of Optical-Electrical and Computer Engineering, University of Shanghai for Science and Technology, Shanghai, China
  3. Zhiqun Pan — School of Optical-Electrical and Computer Engineering, University of Shanghai for Science and Technology, Shanghai, China
  4. Guangpeng Wang — School of Optical-Electrical and Computer Engineering, University of Shanghai for Science and Technology, Shanghai, China
  5. Junfan Chen — Intelligent science and technology, University of Shanghai for Science and Technology, Shanghai, China
DOI
10.1109/access.2024.3382209
저널
IEEE Access
발행년도
2024
발행기관
Institute of Electrical and Electronics Engineers
피인용수
1
라이선스
cc-by-nc-nd
논문 유형
–
언어
–
원문 페이지
https://doi.org/10.1109/access.2024.3382209
토픽
Gear and Bearing Dynamics Analysis
OpenAlex ID
W4393241227

평가 내용

관련도
간접 관련
사업분야
엔지니어링 플라스틱 · (23) 컴파운드
부 분야
(10) 아라미드, (17) 스펀본드 부직포
R&D 측면
분석·모델링
확신도
0.70
근거 용어
Defect detection, Self-supervised learning, Ball Screw Drive, Pitting detection, Deep learning
판단 근거
본 논문은 볼 스크류 구동 장치의 피팅(pitting) 결함을 탐지하기 위한 딥러닝 모델 연구로, 코오롱인더스트리의 직접적인 제품은 아니나 산업용 부품의 품질 관리 및 결함 분석 기술로서 공정 자동화와 품질 보증에 응용 가능합니다.
R&D 활용 포인트
산업용 섬유(아라미드, 타이어코드)나 엔지니어링 플라스틱 제품의 제조 공정 중 발생하는 미세 결함(표면 손상, 불량)을 자동 검출하는 비전 검사 시스템 고도화에 활용 가능합니다.
평가 입력
본문 54,944자 중 30,032자 발췌

초록

Automatic detection of pitting on Ball Screw Drive (BSD) is essential to ensure normal production activities. However, the scarcity of defective samples and precisely labeled data poses a significant challenge. To address this, we propose an efficient double self-supervised model that operates at both the image and pixel levels, aiming to construct a high-performance model trained with defect-free data for detecting unknown defects in BSD images. By incorporating global and local information and extracting features at multiple hierarchical levels, the model's generalization performance is enhanced. The image-level self-supervised representation is first learned by classifying normal images from the PasteNoise, a data augmentation approach by pasting noise patches at random locations in normal images. Meanwhile, the pixel-level self-supervised representation is learned by segmenting the noise patch to locate abnormal regions. Then, we introduce a novel feature masking strategy in a masking and prediction task for accurate defect localization. In addition, we use Histogram of Oriented Gradients (HOG) features with local contrast normalization as prediction targets to capture local shapes and appearances to improve the robustness of the model. The proposed method achieves competitive receiver operating characteristic curves of 97.42 (image-level) and 94.57 (pixel-level) on the BSD dataset. In experiments on the MVTec AD, the proposed model shows good performance, indicating the broad adaptability of our approach.

본문 54,944자

본문 펼치기
Date of publication xxxx 00, 0000, date of current version xxxx 00, 0000. _Digital Object Identifier 10.1109/ACCESS.2023.0322000_ ## A Double Self-supervised Model for Pitting Detection on Ball Screws XIAOMING WANG <sup>1</sup>, YONGXIONG WANG <sup>1</sup> *,ZHIQUN PAN <sup>1</sup>,GUANGPENG WANG <sup>1</sup>, and JUNFAN CHEN <sup>2</sup> 1School of Optical-Electrical and Computer Engineering, University of Shanghai for Science and Technology, Shanghai, 200093, China (e-mail: wangxm7909@126.com; wyxiong@usst.edu.cn;panzhiqun@139.com;wgpeng880221@126.com) 2intelligent science and technology, University of Shanghai for Science and Technology, Shanghai, 200093, China (e-mail:2754626732@qq.com) Corresponding author: Yongxiong Wang (e-mail: wyxiong@usst.edu.cn). This work was supported by the Natural Science Foundation of Shanghai under Grant 22ZR1443700. ABSTRACT Automatic detection of pitting on Ball Screw Drive (BSD) is essential to ensure normal production activities. However, the scarcity of defective samples and precisely labeled data poses a significant challenge. To address this, we propose an efficient double self-supervised model that operates at both the image and pixel levels, aiming to construct a high-performance model trained with defect-free data for detecting unknown defects in BSD images. By incorporating global and local information and extracting features at multiple hierarchical levels, the model’s generalization performance is enhanced. The imagelevel self-supervised representation is first learned by classifying normal images from the PasteNoise, a data augmentation approach by pasting noise patches at random locations in normal images. Meanwhile, the pixel-level self-supervised representation is learned by segmenting the noise patch to locate abnormal regions. Then, we introduce a novel feature masking strategy in a masking and prediction task for accurate defect localization. In addition, we use Histogram of Oriented Gradients (HOG) features with local contrast normalization as prediction targets to capture local shapes and appearances to improve the robustness of the model. The proposed method achieves competitive receiver operating characteristic curves of 97.42 (imagelevel) and 94.57 (pixel-level) on the BSD dataset. In experiments on the MVTec AD, the proposed model shows good performance, indicating the broad adaptability of our approach. INDEX TERMS Convolutional neural network, Defect detection, Deep learning, Histogram of Oriented Gradients, Self-supervised learning I. INTRODUCTION ALL screw drive is a commonly used mechanical device for rotational motion transmission [1], mainly consisting # B of a ball screw, guide rail, and drive mechanism. It is also one of the components most susceptible to wear. Over time, the rolling elements induce material fatigue on the spindle, ultimately leading to small wear on the spindle’s surface, called pittings (Figure 1). These pittings can lead to high roughness of machined parts and unstable processing accuracy. Traditional methods rely mainly on manual inspection, which is inefficient and vulnerable to human interference. At the same time, mechanical wear is a gradual process. The conventional force signal, ultrasonic signal, vibration signal, current signal, and acoustic emission signal are indirect signals that are not sensitive to minor wear. Recently, BSD images taken by observing holes are used for defect detection. The new approach is convenient, low-cost, and online. Subsequently, the automatic detection system based on BSD images gradually became a research focus. FIGURE 1. Examples of spindle pittings. In recent years, computer vision has achieved remarkable results in many automatic detections [2]–[4]. Deep learning methods, especially Convolutional Neural Networks (CNN), frequently appear in industrial production applications [5], [6]. However, in highly automated production scenarios, where the yield rate of products is particularly high, collecting defect samples is time-consuming. In addition, since defects are generated by uncontrolled factors in the production process, the forms of defects are various, and it is difficult to collect complete defective samples of various forms. To reduce overdependence on data annotations, many selfsupervised methods solving different proxy tasks have been widely studied [7]–[10]. DeVries et al. [11] randomly cut areas of input images to reduce overfitting and improve the generalization ability of convolutional neural networks. Li et al. [9] propose a data augmentation strategy, which cuts image patches and then pastes them to random locations in the image to simulate real defects, but the trimmed patches are only a rough approximation of real defects. Pittings in the BSD [12] inspection are typically irregular and subtle(Figure 2), which is a challenge for the detection task. The differences in pitting on BSD between normal and anomaly patterns are often finegrained as defective areas might be small and subtle in highresolution images. However, most self-supervised methods have poor generalization due to focus on object-centered natural images. Thus, it is essential for self-supervised representation learning to define an appropriate pretext task in pitting detection. FIGURE 2. The initial pitting area is small, and compared to the high-resolution BSD image, the pitting is still less evident after magnification of 9 times. In this work, we first build a self-supervised framework that learns image representations by distinguishing anomaly data from normal data at image-level. We propose a novel proxy classification task that distinguishes between normal data and data augmented by PasteNoise. PasteNoise augmented samples are generated using a Perlin noise generator [13] along with an anomaly source image, which remains unrelated to the input image. Compared with common pseudo anomaly patches, such as rectangles or polygons, the texture of the noise patch is more natural, and the shape transformation is more diverse. Although we cannot obtain the real defects, experiments show that representations learned by detecting noise patches generalize well to detecting real defects. Moreover, masking the input image is one of the most popular augmentations used in transformer-based autoencoders [14], [15]. Self-supervised learning with masking shows more scalability when combined with ViT [15], [16]. However, self-supervised learning networks with naive masking do not work well in CNNs because masked inputs generate parasitic edges and distort the balance between global and local features [17]. Inspired by the focal mask [18], we introduce a new mask module, which avoids distorting the balance among features. High-level features are randomly masked to overcome the parasitic edge problem. We construct the second selfsupervised framework by introducing the masking method into the convolutional network to improve the performance in detecting subtle defects. We specifically select HOG features with local contrast normalization and cheap computational overhead as the predictive target at pixel-level, further improving the robustness of the model. The self-supervised learning network with masking makes the model learn to find subtle differences between normal and defective images and generalizes better to real defects. The image-level self-supervised task and the pixel-level self-supervised task are both important methods in unsupervised learning. The image-level task contributes to learning image-level representation and data augmentation, while the pixel-level task focuses on image segmentation and pixellevel annotation, allowing models to achieve more finegrained image understanding. Two self-supervised learning strategies play a crucial role in addressing data annotation challenges, improving model generalization, and enhancing robustness. We integrate both into a unified network model, enabling the model to learn multi-level feature representations and comprehensively capture the semantic and detailed information in images. The model combines global and local information for a thorough and accurate understanding of images, effectively adapting to data from various domains or tasks. The main contributions of our study are as follows: 1) We propose a double self-supervised learning detection model for BSD defect detection. At image-level, we utilize data augmentation to construct a proxy task, which facilitates learning self-supervised representations by distinguishing data with anomaly patterns from normal data. At pixel-level, we design a new masking feature pattern for the self-supervised training strategy to improve the model generalization ability. After masking the high-level features, the network is guided to learn the detail representations of the image by predicting HOG features. 2) We propose a novel data augmentation method called PasteNoise that creates visually coherent anomaly patches with varying degrees of detail and smoothness. Experiments show the effectiveness of PasteNoise in detecting unknown defects. 3) Our model achieves 97.42 image-level detection AUC and 94.57 pixel-level localization AUC on BSD data, outperforming current state-of-the-art models and meeting the requirements of industrial scenarios. Experiments on MVTec 2 VOLUME 11 2023 AD show that our approach achieves SOTA performance, confirming the proposed method’s generalizability. The structure of the remaining sections in this paper is as follows. The latest research on defect detection and data augmentation is stated in Section II. The proposed network model is introduced in Section III. Extensive experiments and analysis are conducted in Section IV. Finally, Section V provides the conclusion for the article. II. RELATED WORKS _A._ _DEFECT DETECTION METHODS_ In the field of industrial production, machine learning has been applied to analyze industrial images for defect detection. Background subtraction [19] is a popular defect detection method. The background is subtracted from the image while preserving defects and random noise [20]. However, these methods are susceptible to the position and noise of the image. In recent years, deep learning has developed rapidly in computer visual fields. Since the first CNN LeNet [21] was proposed, several excellent networks have been designed, such as Alex [22], VGG [23], Inception [24], ResNet [25], etc. The remarkable achievements of CNNs in various computer vision tasks have led to their gradual application in the field of defect detection. In [26], bilinear class activation maps are utilized to optimize the detect defection model. Cross-domain and domain adaptation methods are adopted to detect ball screw faults [27]. Although computer vision has been successfully applied in defect detection, most of the work is limited by training datasets. Insufficient diverse annotated data and an imbalance between normal and defective samples can cause the model’s performance to decline when facing unknown scenarios or variations. To mitigate reliance on the dataset, anomaly detection, trained solely on normal images, is widely used in defect detection [9], [10]. Reconstruction is the most common method for anomaly detection. However, generative adversarial networks sometimes construct anomaly samples that are very similar to normal samples, which affects the network to distinguish anomaly samples. By reconstructing the masked filtering, Ristea et al. [7] use pretext tasks to learn object representations in self-supervised learning. Li et al. [9] obtain deep representations by reconstructing randomly pasted parts. Cao et al. [28] optimizes the feature distributions of normal and abnormal data separately, effectively alleviating the problem of overfitting abnormal features. Due to imprecise boundary descriptions, anomaly scores may unexpectedly exhibit low values [28]. To alleviate excessive generalization of anomalies, synthetic anomalies are introduced in Draem [10], Cutpaste [9], and DAF [29]. Unlike these methods, the proposed dual self-supervised model incorporates two selfsupervised tasks, extracting features from different scales and perspectives. Multi-level feature representations are enabled to be learned by the model and anomalies are distinguished more accurately from normal samples. Additionally, we overlay noise patches as an anomaly on the normal image. Various defect features are extracted in training by randomly masking defective patches on images, and normal image representations are learned simultaneously. Our patch-based model performs better, as shown in Section IV-D. _B._ _DATA AUGMENTATIONS_ Defect detection methods synergize with data augmentations to improve model robustness by generating diverse abnormal samples. Data augmentation is a critical way to avoid model overfitting. When the data set has some apparent characteristics, such as the images being basically taken in the same scene, employing technologies like Cutout [11] and its variants [9], [30]–[32] can aid the model in avoiding the learning of irrelevant information unrelated to the target task. Cutout [11] introduces irregularities by randomly masking out some rectangular portions of an input image with zero or other uniform values. In Random Erasing [31], the length and width of the erased area and the replacement value of the pixel value in the area are random. In CutMix [30], a new training sample is created by combining two or more input images in such a way that parts of each image are visible in the combined image. Mixup [32] works by taking a weighted average of the two images according to a certain ratio. Cutpaste [9] is a simple data augmentation method that randomly cuts a patch and pastes it at a random position of the original image. In anomaly detection, self-supervised networks learn the irregularities introduced by data augmentations to generalize the representation of defects. In this work, we learn representations by classifying normal data from PasteNoise during training, which is a straightforward and practical data augmentation strategy. PasteNoise is used to generate more natural and diverse abnormal samples for training. The model’s generalization capability is enhanced, resulting in precise recognition of unseen anomalies in detection. III. METHOD In this section, we introduce a double self-supervised learning model combined with PasteNoise data augmentation and a mask-and-predict task, as shown in Figure 3. The backbone network is modified based on the lightweight ResNet-18 [25] with 18 weight layers, including 17 convolutional layers and a fully connected layer. Feature maps are extracted by 17 convolutional layers, as shown in Table 1, and then they enter two streams of the network. One stream is a 3-layer multilayer perceptron (MLP) projection head and a fully connected layer with the cross-entropy loss ( _LCE_ ), which is used to measure the classification loss in self-supervised learning with PasteNoise. The other stream sequentially passes through the masked split convolution module (MSCM), channel attention module (CAM), and HOG decoder. At last, our network is equipped with a mean-squared error loss ( _LMSE_ ) that minimizes the reconstruction error between the original HOG and the predicted feature. Next, the network structure is explained in detail from the perspective of two self-supervised tasks. Self-supervised learning with PasteNoise is described in section III-A. Selfsupervised learning with HOG and masked features is intro VOLUME 11 2023 3 FIGURE 3. The overview of the double self-supervised model architecture. Anomaly images generated by PasteNoise, along with input images, are fed into a Convolutional Neural Network (CNN). The extracted feature maps are directed into two branches. (a)Through a Multi-Layer Perceptron (MLP) and a Fully Connected layer (FC), image-level classification predictions are generated. Our model acquires high-level semantic information within the images by minimizing the prediction loss _LCE_ . (b) Following the masking process in the Masked Split Convolution Module (MSCM), a Channel Attention Module (CAM) is utilized to scale the channel weights. Subsequently, an HOG decoder maps the feature maps back to a one-dimensional vector representing Histogram of Oriented Gradients (HOG). By minimizing the similarity loss _LMSE_ between the extracted HOG features from the input image. TABLE 1. Architecture of backbone network. L _ayername_ O _utputsize_ L _ayerstructure_ Conv1 128 _×_ 128 7 _×_ 7 _,_ 64 _,_ stride 2 3 _×_ 3 max pool, stride 2 - 3 _×_ 3 _,_ 64 Conv2_x 64 _×_ 64 3 _×_ 3 _,_ 64 - 3 _×_ 3 _,_ 128 Conv3_x 32 _×_ 32 3 _×_ 3 _,_ 128 - 3 _×_ 3 _,_ 256 Conv4_x 16 _×_ 16 3 _×_ 3 _,_ 256 - 3 _×_ 3 _,_ 512 Conv5_x 8 _×_ 8 3 _×_ 3 _,_ 512 _×_ 2 _×_ 2 _×_ 2 _×_ 2 duced in section III-B. Additionally, we give a brief description of the anomaly score in section III-C. _A._ _SELF-SUPERVISED LEARNING WITH PASTENOISE_ In this section, we present a novel pretext task for learning self-supervised representations by predicting PasteNoise augmentation and constructing a one-class classifier. We insert an MLP projector between the backbone network and the classifier for better transferability [33]. Therefore, the image-level self-supervised learning sub-network includes a feature extractor _f_ ( _·_ ), an MLP projector _g_ ( _·_ ) and a classifier _W_ . Given the input image _x_, the outputs _Fx_ = _f_ ( _x_ ) of CNN is a 512-dimensional 8×8 feature map. _Fx_ is mapped into a projection vector g = _g_ ( _Fx_ ) by an MLP. The MLP consists of two fully connected layers. In the MLP projector, the hidden feature dimension is set to 512. Input images consist of the original image _x_ and the image augmented with PasteNoise. The objective function for the self-supervised task is defined as: _Fx_ = _f_ ( _x, PN_ ( _x_ )) (1) _LCE_ = BCE ( _W_ _· g_ ( _Fx_ ) _,_ (0 _,_ 1)) (2) where _x_ is the normal image. PN denotes covering a noise patch on the normal image. BCE is a binary cross-entropy function. PasteNoise. Since the shape of true anomalies is unpredictable, we expect to generate anomalies outside the normal distribution of characteristics. Following [10], a noise image with various anomaly shapes is first generated by the Perlin noise generator [13]. And then a random anomaly map (Figure 4 _Mp_ ) is obtained after binarizing the noise image by a threshold. The mask map (Figure 4 _M_ ) preserves the largest 4 VOLUME 11 2023 masked region from _Mp_ . The anomaly texture source image (Figure 4 _Ie_ ) is selected from an image dataset that is different from the input image distribution. RandomAugment [34] is applied by three random augmentation methods from the set (Autocontrast, Posterize, Solarize, Sharpness, ChangeBrightness, ChangeColor). Finally, an anomalous image (Figure 4 _Is_ ) is generated, where the mask region is filled with a linear combination of the augmented image _Ie_ and an anomaly-free image (Figure 4 _I_ ) with a ratio factor _α_ randomly chosen between [0.5,1]. The above operation can be formulated as follows: _Is_ = (1 _−_ _M_ ) _⊙_ _I_ + _α_ ( _M_ _⊙_ _I_ ) + (1 _−_ _α_ )( _M_ _⊙_ _Ie_ ) (3) Here, _⊙_ presents the element-wise multiplication operation. This algorithm for generating anomalous images has the following benefits. Random Perlin noise is more irregular and closer to real anomalous. The diversity of anomaly images is increased by introducing the hyperparameter _α_ . _B._ _SELF-SUPERVISED LEARNING WITH HOG AND_ _MASKED FEATURES_ In the second self-supervised learning, we construct a maskand-predict task. This self-supervised sub-network includes a feature extractor _f_ ( _·_ ) shared with the classification task in section III-A, a masked split convolutional module _ε_ ( _·_ ), a channel attention module _ϕ_ ( _·_ ), and an HOG decoder _h_ ( _·_ ). Here we utilize Mean Squared Error (MSE) loss to minimize the distance between the original HOG features and the predicted HOG as follows: _Hx_ = _h_ ( _ϕ_ ( _ε_ ( _Fx_ ))) (4) _LMSE_ = MSE ( _Hx,_ H ( _x, PN_ ( _x_ ))) (5) where _x_ is a normal data. _Fx_ is expressed by Equation 1. _Hx_ presents the predicted HOG. H means extracting HOG features from images. MSE is an MSE loss function. Next, we will show MSCM, CAM, and HOG decoder in detail. 1) Masked Split Convolution Module (MSCM) CNN is widely utilized in various computer vision tasks. In CNN training, image features are continually abstracted from low to high levels. However, as Sabour et al. [35] stated, CNN lacks the global arrangement ability for local features. To address this, we employ MSCM, aiming to leverage contextual information to predict masked feature information. This compels the model to learn the global structure of local features for high-precision reconstruction results. Specifically, MSCM conducts expansion, split, convolution, and fusion operations on the feature maps extracted by the CNN network. During training, the model learns to reconstruct the masked information, while providing useful features to locate and understand anomalies. We show the MSCM module in Figure 5. The input feature _Y_ _∈_ R <sup>_w×h×c_</sup> is expanded, and the dilation factor is _d_, where _c_ is the number of input channels, and _w_ and _h_ are the width and height of the input feature map, respectively. We aim to predict the spatial location of input feature _Y_ . Therefore, we add _d_ zero pixels around the input feature. The feature map is expanded to ( _w_ + 2 _d_ ) _×_ ( _h_ + 2 _d_ ). Four sub-feature maps of size _w × h_ are taken from four vertices, _Ki_ _∈_ R <sup>_w×h×c_</sup> _, ∀i_ _∈{_ 1 _,_ 2 _,_ 3 _,_ 4 _}_ . Convolution operations are performed on these sub-feature maps to learn the input spatial location information by predicting the masked portion. Because of the same size, the spatial dimension of the module output feature is the same as the input feature. In the MSCM, the configurable super-parameter is only the expansion rate _d_, which is set to 2. Subsequently, we express MSCM with the following formulas: _Ki_ = _Si_ [ _F_ pad( _Y_ )] (6) where _F_ pad and _Si_ represent padding and splitting operations, respectively. _F_ ( _·_ ) is convolution, and _σ_ denotes the sigmoid activation function. 2) Channel Attention Module (CAM) The output features of the Mask Splitting Convolution Module are partially masked, which may impact the activation ratio between channels. To enhance the modeling ability of MSCM and find the importance of different channels, we introduce SE [36] module into the network. SE is a channel attention module (CAM), and the structure is shown in Figure 6. CAM recalibrates the previously obtained features through three operations, Squeeze, Excitation, and Reweight. The Squeeze operation is to perform feature compression along the spatial dimension, turning each two-dimensional feature channel into a real number, using a global average pooling completed. The second is the Excitation operation, a mechanism similar to gates in recurrent neural networks. Weights are generated for each feature channel via a parameter _w_, which is learned to explicitly model the correlation between feature channels. The scale factor _s_ _∈_ R <sup>1</sup> <sup>_×_</sup> <sup>1</sup> <sup>_×c_</sup> is the core of CAM and can be expressed by Equation 8. _s_ = _σ_ ( _W_ 2 _· δ_ ( _W_ 1 _· Z_ )) (8) where _δ_ represents the ReLU function, _σ_ refers to the sigmoid function, and _Z_ _∈_ R <sup>_h×w×c_</sup> is the input descriptor. _W_ 1 _∈_ R <sup>(</sup> <sup>_c/r_</sup> <sup>)</sup> <sup>_×c_</sup> and _W_ 2 _∈_ R <sup>_c×_</sup> <sup>(</sup> <sup>_c/r_</sup> <sup>)</sup> denote the weights of two fully connected layers, a dimensionality reduction layer with a reduction ratio _r_ and a dimensionality increasing layer. The last is a Reweight operation, which weights _s_ to the previous features by multiplying channel by channel, rescaling the original features in the channel dimension. _Y_ out = _σ_ 4 _i_ =1 _F_ ( _Ki_ ) (7) VOLUME 11 2023 5 _Mp_ _<mark>I</mark>_ (1-M) _<mark>I</mark>_ _e_ _M_ Mmax ×(1-α) ×α _Is_ FIGURE 4. Simulated PasteNoise anomaly generation process. The binary anomaly mask _Mp_ is generated from binarized Perlin noise. Mask _M_ preserves the largest masked area from _Mp_ . The anomalous region is sampled from _Ie_ and placed on the anomaly-free image _I_ to generate the anomalous image _Is_ . k1 <mark>F2</mark> conv k2 Fpad <u>split</u> <u>sigmoid</u> ### Y d Y out <u>split</u> d <u>sigmoid</u> <mark>F3</mark> k3 <mark>F4</mark> k4 conv FIGURE 5. Masked Split Convolution Module (MSCM). 3) HOG Decoder We introduce the HOG decoder to perform the inverse operation of encoding, extracting HOG features from the feature map, aligning with our prediction target. The backbone network employed in this paper is Resnet18 [25], featuring a small number of layers and relatively few parameters. Consequently, we construct a simple regression unit composed of two convolution layers and regress the feature image to a one-dimensional vector representing HOG in Table 2. These parameters of the regression unit are continuously corrected by HOG loss function as Equation 5. TABLE 2. Architecture of HOG decoder. Layer Kernel Shape Kernel Number Stride Output Conv 3×3 64 1 MaxPool 2×2 32 2 32×32 Conv 3×3 32 1 MaxPool 2×2 16 2 16×16 Flatten 4096 Linear 3780 _C._ _ANOMALY SCORE_ The Mahalanobis distance [37] can be used for anomaly detection, which needs to calculate the boundary threshold from the data center with normal data and then determine the point is an anomaly if it is a point from the center of the data set that exceeds the threshold. Similar to [38], we compute the Mahalanobis distance as the anomaly score. Mahalanobis distance is an effective method for calculating the similarity between two unknown sample sets. Unlike Euclidean distance, it considers the relationship between various properties and is scale-independent. For a given test datum x, the Mahalanobis distance is defined as follows: where _µ_ and _S_ <sup>_−_</sup> <sup>1</sup> are the vector mean and covariance matrix, respectively, learned from the training data. For each sample, the anomaly score can be obtained by Equation 9. If the anomaly score exceeds the threshold _θ_, the pixel is classified as an anomaly point. In the experimental section, the Receiver Operating Characteristic (ROC) [39] metric is computed by varying the threshold _θ_ . IV. EXPERIMENTS The experimental setup is first described in this section, including the dataset and experimental detail. Then, we demon _M_ ( _x_ ) = ~~�~~ ( _x −_ _µ_ ) <sup>_T_</sup> _S_ <sup>_−_</sup> <sup>1</sup> ( _x −_ _µ_ ) (9) 6 VOLUME 11 2023 h×w×c GAP FC+ReLU FC+Sigmoid 1×1×C 1×1×C/r 1×1×C FIGURE 6. Architecture of the channel attention module (CAM). h×w×c strate the effectiveness of our approach on the BSD data and MVTec AD, separately. We compare our approach with several state-of-the-art models. Finally, various aspects of the proposed method are explored through ablation experiments. _A._ _EXPERIMENTAL SETUP_ BSD dataset [12]. This dataset comprises 1,104 images, including 710 normal images and 394 images with defects. These images are recorded by a camera system, which is a standard Raspberry Pi V2 microcontroller camera. The original photos are 1130x460 and a small number of about 2000×1000. Finally, 631 normal images are randomly divided into the training set. The rest 79 normal images and 394 defective images form the test set. MVTec AD dataset [39]. The MVTec AD dataset is aimed at anomaly detection, which provides multi-object and multidefect real-world images. It contains 5,354 color images divided into five texture categories and ten object categories. Each category includes a set of training images without defects and a set of images with various defects as well as defect-free images. For the MVTec AD dataset, the training set comprises 3,629 images, all of which are normal images. In the test set, there are 1,725 images, including 467 normal images and 1,258 abnormal images. Evaluation Metrics. Following prior works, we in-depth study model performance from both detection and localization perspectives. For anomaly detection, the area under the receiver operation characteristic (AUC) is taken as the evaluation metric. For anomaly localization, AUC is selected to evaluate the pixel-level localization result. Experimental details. These experiments are conducted on the workstation with two INTEL XEON E5-2678 CPUs and two GeForce RTX 2080S GPUs (8GB). We implement our models in Python 3.7 and PyTorch 1.6. All images are resized to 256×256. We adopt ResNet-18 [25] as a backbone in our model. In experiments, we use the SGD optimizer with a base learning rate of 0.03, the momentum of 0.9, and weight decay of 0.00003. We train 800 epochs with a batch size of 32. TABLE 3. Detection and localization performances on BSD data. For comparison, we report image-level detection and pixel-level localization AUCs of CutPaste [9], and SSPCAB [7]. Method Image-level AUC Pixel-level AUC CutPaste [9] 95.63 93.89 SSPCAB [7] 95.82 94.01 Ours 97.42 94.57 _B._ _DEFECT DETECTION ON BSD DATASET_ We conduct anomaly detection and localization experiments leveraging our representations trained with a double selfsupervised model. We use visual heatmaps to highlight the region-predicted anomaly for accurate localization of defects. We compare with two recent works, including CutPaste [9] and SSPCAB [7]. Using the same backbone network (ResNet18) helps eliminate the impact of differences in network structures, ensuring a fair comparison. Identical basic configurations, including hyperparameters, learning rates, optimizers, etc., contribute to the reliability and repeatability of the comparison. The CutPaste [9] method shows high performance in image anomaly detection. It utilizes a technique of cutting images and pasting them into different positions to construct negative samples. However, such operations may lead to overfitting, particularly when the model is trained on smaller datasets. In SSPCAB [7], a self-supervised predictive module is integrated with masked convolution kernels and channel attention mechanisms to enhance features. We utilize two self-supervised learning tasks simultaneously to acquire comprehensive feature representations across various levels, encompassing both global and local characteristics. This strategy enables us to effectively capture both semantic understanding and intricate details within images. In Table 3, we report the detection and localization performance on the BSD dataset. Our method achieves an imagelevel detection AUC of 97.42 and a pixel-level localization AUC of 94.57, outperforming CutPaste [9] and SSPCAB [7]. As shown in Figure 7, the proposed method can locate the pittings more accurately than other methods. We note that BSD images have similar backgrounds, fixed local attributes, high resolution, and relatively stable tex VOLUME 11 2023 7 TABLE 4. Comparison of image-level detection AUC with state-of-the-art methods on MVTec AD. The best result is bold. UStuCategory Tea [40] patchCutpaste [9] SSPCAB [7] CDO [28] ours SVDD [41] object texture bottle 93.10 98.60 98.30 98.60 100.00 100.00 cable 81.80 90.30 80.60 82.90 97.43 95.60 capsule 96.80 76.70 96.20 98.10 91.78 85.84 hazelnut 96.50 92.00 97.30 98.30 98.21 99.64 metal nut 94.20 94.00 99.30 99.60 98.53 96.48 pill 96.10 86.10 92.40 95.30 94.35 95.23 screw 94.20 81.30 86.30 90.80 82.97 81.88 toothbrush 93.30 100.00 98.30 98.80 89.17 99.72 transistor 66.60 91.50 95.50 96.50 94.54 96.71 zipper 95.10 97.90 99.40 99.10 97.74 98.90 average 90.77 90.84 94.36 95.80 94.47 95.00 carpet 87.90 92.90 93.10 90.70 97.75 97.19 grid 95.20 94.60 99.90 99.90 96.49 98.07 leather 94.50 90.90 100.00 100.00 100.00 100.00 tile 94.60 97.80 93.40 94.00 98.77 99.86 wood 91.10 96.50 98.60 99.20 99.04 99.03 average 92.66 94.54 97.00 96.76 98.41 98.83 all average 91.40 92.07 95.24 96.12 95.78 96.28 TABLE 5. Comparison of pixel-level localization AUC with state-of-the-art methods on MVTec AD. The best result is bold. patchCategory CutPaste [9] PaDiM [42] CDO [28] Ours SVDD [41] object texture bottle 98.10 97.60 98.10 98.99 96.64 cable 96.80 90.00 95.80 96.71 96.83 capsule 95.80 97.40 98.30 98.50 97.72 hazelnut 97.50 97.30 97.70 98.94 98.03 metal nut 98.00 93.10 96.70 97.18 96.48 pill 95.10 95.70 94.70 96.86 97.30 screw 95.70 96.70 97.40 98.31 98.32 toothbrush 98.10 98.10 98.70 98.70 97.45 transistor 97.00 93.00 97.20 87.50 97.28 zipper 95.10 99.30 98.20 98.42 97.73 average 96.72 95.82 97.28 97.01 97.38 carpet 92.60 98.30 98.90 98.78 98.79 grid 96.20 97.50 94.90 97.49 96.54 leather 97.40 99.50 99.10 99.05 99.10 tile 91.40 90.50 91.20 95.52 95.54 wood 90.80 95.50 93.60 96.04 95.38 average 93.68 96.26 95.54 97.38 97.07 all average 95.71 95.97 96.70 97.13 97.28 tures in corresponding regions of the images, which can be classified as texture categories. Compared with the texture category on the MVTec AD dataset, the general 99+ AUC, the reduced performance on BSD data could be explained by contaminated images. The examples can be seen in Figure 8, where some contaminated regions are close to the anomaly image distribution. Our method detects anomalous features in these contaminated regions, which are difficult to distinguish from real anomaly regions. _C._ _COMPARISON WITH STATE-OF-THE-ART MODELS ON_ _MVTEC AD DATASET_ Our method is evaluated on the challenging MVTec anomaly detection dataset. We use image-level AUC for evaluating anomaly detection. At the same time, for localization accuracy, the pixel-level AUC is used for anomaly localization. Anomaly Detection. In Table 4, we report the detection performance compared with state-of-the-art models on MVTec AD, including patch-level SVDD [41], uninformed students [40], cut-paste self-supervised learning (Cutpaste) [9], selfsupervised predictive convolutional block (SSPCAB) [7], and CDO [28]. The proposed method outperforms recent anomaly detection methods, achieving the best AUC in 5 out of 15 classes and achieving the best average AUC. Anomaly Localization. Table 5 compares our method to the recent state-of-the-art on the task of pixel-level anomaly detection. Our method achieves comparable results to these well-performing methods, patch-level SVDD [41], CutPaste [9], PaDiM [42] and CDO [28] with ResNet-18 [25]. The proposed method achieves a significant improvement in anomaly localization accuracy. _D._ _ABLATION STUDY_ Prediction target type. We explore the impact of two different prediction targets in self-supervised learning with masked features in Table 6. RGB is an image representation method 8 VOLUME 11 2023 FIGURE 7. Visual comparisons with state-of-the-art methods on the BSD dataset. Rows (a)-(d) represent input images, and results predicted by the following methods: our proposed method, SSPCAB [7], and CutPaste [9]. The green masks are true anomalous pixels and the red regions are located by the corresponding method. based on color channels, suitable for tasks that involve consideration of color. HOG is a feature descriptor method based on image gradients, primarily used to capture texture and shape information in images. It exhibits strong descriptive capabilities for the edges and contours of objects. Compared to HOG features, regressing RGB values produces a slight drop of about -0.5 for image classification. RGB as a target has a potential downside of over-fitting to high-frequency details and local statistics, which play an insignificant role in the interpretation of image content. HOG contributes to capturing features with strong representation from high-level semantic specialties and focuses on obtaining the texturerelated representation of images. As a result, HOG with local-contrast normalization is more robust to overfit highfrequency details [43]. TABLE 6. “HOG” and “RGB” present HOG features and pixels as prediction targets in the masked self-supervised task, respectively. RGB HOG Image-level AUC Pixel-level AUC ✓ 94.63 93.55 ✓ 95.16 93.75 Double self-supervised learning tasks. We evaluate the effect of two self-supervised learning tasks in the BSD dataset in Table 7. We note that self-supervised learning of representations with noise patches achieves decent results alone. Selfsupervised learning of spatial representation with masked features, using HOG as the prediction target, is also a distillation mode and can obtain a detection effect (95.16 detection AUC and 93.75 localization AUC). Interestingly, when these two self-supervised tasks are integrated into the same backbone network model, a better detection effect (97.42 detection AUC and 94.57 localization AUC) is achieved than when used alone. Integrating dual self-supervised tasks at both image and pixel levels enables the network to extract multi-level abstract features. This enhances the model’s robustness to noise or complex environments, resulting in more reliable and versatile representations. TABLE 7. "HOG" denotes HOG features as prediction targets in the masked self-supervised task. "NP" means the self-supervised task with noise patches. HOG NP Image-level AUC Pixel-level AUC ✓ 95.16 93.75 ✓ 96.08 94.02 ✓ ✓ 97.42 94.57 Anomaly patterns. We study the performance of representations trained by patching diverse patches to normal images, such as scar, normal, scar+normal, and noise patch. Scar patch, which is proposed in [9] for anomaly detection, is a scar-like thin rectangular box filled with an image patch. Normal patch denotes the patch that is cut from the input image. Noise patches generated by the Berlin noise generator in Section III-A have random and disorderly features while maintaining a uniform distribution at a specific scale. Combining with "Scar" enhances the diversity of synthesized anomalies, which help the model comprehend and learn to handle unknown anomaly patterns. With a finer-gained detection task to leverage scar and noise patch together augmentation, we achieve the best detection (97.42 AUC) and localization (94.57 AUC) performance. We show samples from considered augmentations patches in Figure 9 and report the detection and localization AUCs in Table 8. As shown in Figure 10, the accurate localization of defects is achieved by training with the anomaly pattern "Noise + Scar". TABLE 8. Detect performance trained with various patch combinations. Patch type Image-level AUC Pixel-level AUC Scar patch 95.49 94.23 Normal patch 95.43 93.89 Scar + Normal patch 96.04 94.53 Noise patch 97.19 93.85 Noise + Scar patch 97.42 94.57 Different Mask types. We explored the impact of other masking methods on our model, including "No", "Dropout", and "Mask". The detection results are shown in Table 9. We observe that "MSCM" brings about performance improvements with a 0.78 image-level AUC and a 1.33 pixel-level AUC. In contrast, "Dropout" is a technique that randomly zeros elements in the feature maps during the model training process, aiming to introduce randomness to prevent overfitting. However, this random zeroing might lead to incomplete information transmission with limited training data. In some cases, it performs worse than not using any feature map masking (i.e., "No"). On the other hand, "Mask" simulates the VOLUME 11 2023 9 Image GroundTruth Heatmap Predicted mask Localization result FIGURE 8. The original image contains contaminated areas that are difficult to mark in the ground-truth maps, which causes a discrepancy between the ground-truth and the predicted mask map. (a)Normal (c)Scar patch (b) Normal patch (d)Noise patch FIGURE 9. Visualization of normal and augmented normal samples. absence of partial information by applying a binary mask to the input feature map. However, the effectiveness of "Mask" may be influenced by the specific task and data distribution. As shown in Figure 11, MSCM demonstrates good localization accuracy, whereas "Dropout" shows more errors in predictions. These masking strategies play a certain role in improving detection effectiveness, although the effects are relatively modest. In future research, we aim to enhance the efficacy of masking methods by adjusting parameters, introducing new techniques, or combining them with other advanced approaches. TABLE 9. Detection results of different mask types. "No" means not to mask the feature map. "Dropout" presents to randomly set the elements in the feature map to zero with a probability of 0.5, "Mask" denotes a rectangle to mask the feature map, and the masking rate is 50%. "MSCM" is our masking strategy described in Section III-B. Mask type Image-level AUC Pixel-level AUC No 96.75 93.05 Dropout 96.45 92.86 Mask 96.84 93.24 MSCM 97.42 94.57 V. CONCLUSION In this paper, we propose a double self-supervised model for BSD defect detection. A noise generator is utilized to generate synthetic abnormal images with random and disordered characteristics. The diversity of training samples is enhanced. Then, self-supervised proxy tasks are constructed at both the image and pixel levels. These tasks have a positive effect on solving the problem of difficult or expensive data labeling and improving the performance of the model on vision tasks. Pitting defects on BSD surface can be effectively identified in complex production scenarios (97.42 imagelevel AUC and 94.57 pixel-level AUC). The proposed model outperforms state-of-the-art anomaly detection models on real BSD datasets by +2.0 image-level AUC and +0.56 pixellevel AUC. The proposed model is optimized from multiple perspectives (textured natural PasteNoise, multi-view feature representation optimization) for improving network performance. The self-supervised learning model for defect detection is an effective method in industrial production, improving detection accuracy and reducing reliance on manual labeling or defect data. In practical applications, the limitations of the proposed method include the following several aspects. Firstly, the proposed model focuses on classification and localization tasks, and segmentation accuracy needs improvement. In future work, it is essential to further research and optimize defect pixel-level segmentation tasks. This involves adjusting the network architecture to extract features for inferring defect positions and utilizing defect features (size, shape, color) to better differentiate specific categories. Secondly, it is observed that the accuracy of locating small and inconspicuous defects is lower in complex backgrounds. Further research on the precise localization of subtle and inconspicuous anomalies should also be conducted in future work. REFERENCES [1] A. Kamalzadeh, D. J. Gordon, and K. Erkorkmaz, ‘‘Robust compensation of elastic deformations in ball screw drives,’’ _International_ _Journal_ _of_ _Machine Tools and Manufacture_, vol. 50, no. 6, pp. 559–574, 2010. [2] W. Zhang, X. Li, and Q. Ding, ‘‘Deep residual learning-based fault diagno sis method for rotating machinery,’’ _ISA transactions_, vol. 95, pp. 295–305, 2019. [3] X. Li, W. Zhang, and Q. Ding, ‘‘Deep learning-based remaining useful life estimation of bearings using multi-scale feature extraction,’’ _Reliability_ _engineering & system safety_, vol. 182, pp. 208–218, 2019. [4] S. Saifullah and R. Dreżewski, ‘‘Non-destructive egg fertility detection in incubation using svm classifier based on glcm parameters,’’ _Procedia_ _Computer Science_, vol. 207, p. 3248–3257, 2022. [5] M. S. Hossain, M. Al-Hammadi, and G. Muhammad, ‘‘Automatic fruit classification using deep learning for industrial applications,’’ _IEEE Trans-_ _actions on Industrial Informatics_, vol. 15, no. 2, pp. 1027–1034, 2018. [6] Q. Xuan, Z. Chen, Y. Liu, H. Huang, G. Bao, and D. Zhang, ‘‘Multiview generative adversarial network and its application in pearl classification,’’ 10 VOLUME 11 2023 FIGURE 10. Visual comparisons of different anomaly patterns. The green masks are true anomalous pixels and the red regions are located by the corresponding method. component surface defect dataset,’’ _arXiv e-prints_, pp. arXiv–2103, 2021. [13] K. Perlin, ‘‘An image synthesizer,’’ _ACM_ _Siggraph_ _Computer_ _Graphics_, vol. 19, no. 3, pp. 287–296, 1985. [14] C. Wei, H. Fan, S. Xie, C.-Y. Wu, A. Yuille, and C. Feichtenhofer, ‘‘Masked feature prediction for self-supervised visual pre-training,’’ in _Proceedings_ _of the IEEE/CVF Conference on Computer Vision and Pattern Recognition_, pp. 14668–14678, 2022. [15] K. He, X. Chen, S. Xie, Y. Li, P. Dollár, and R. Girshick, ‘‘Masked au toencoders are scalable vision learners,’’ in _Proceedings of the IEEE/CVF_ _Conference_ _on_ _Computer_ _Vision_ _and_ _Pattern_ _Recognition_, pp. 16000– 16009, 2022. [16] A. Baevski, W.-N. Hsu, Q. Xu, A. Babu, J. Gu, and M. Auli, ‘‘data2vec: A general framework for self-supervised learning in speech, vision and language,’’ in _Proceedings of the 39th International Conference on Machine_ _Learning_, pp. 1298–1312, PMLR, 2022. [17] L. Jing, J. Zhu, and Y. LeCun, ‘‘Masked siamese convnets,’’ _arXiv preprint_ _arXiv:2206.07700_, 2022. [18] M. Assran, M. Caron, I. Misra, P. Bojanowski, F. Bordes, P. Vincent, A. Joulin, M. Rabbat, and N. Ballas, ‘‘Masked siamese networks for label-efficient learning,’’ in _Computer Vision–ECCV 2022: 17th European_ _Conference, Tel Aviv, Israel, October 23–27, 2022, Proceedings, Part XXXI_, pp. 456–473, Springer, 2022. [19] A. H. Pratomo, W. Kaswidjanti, A. S. Nugroho, and S. Saifullah, ‘‘Parking FIGURE 11. Visual comparisons of different mask types. Rows (a)-(e) represent input images, and results predicted by the following mask types: MSCM, Mask, No, and Dropout respectively. The green masks are true anomalous pixels and the red regions are located by the corresponding method. _IEEE_ _Transactions_ _on_ _Industrial_ _Electronics_, vol. 66, no. 10, pp. 8244– 8252, 2018. [7] N.-C. Ristea, N. Madan, R. T. Ionescu, K. Nasrollahi, F. S. Khan, T. B. Moeslund, and M. Shah, ‘‘Self-supervised predictive convolutional attentive block for anomaly detection,’’ in _Proceedings of the IEEE/CVF Con-_ _ference_ _on_ _Computer_ _Vision_ _and_ _Pattern_ _Recognition_, pp. 13576–13586, 2022. [8] Y. Fei, C. Huang, C. Jinkun, M. Li, Y. Zhang, and C. Lu, ‘‘Attribute restora tion framework for anomaly detection,’’ _IEEE Transactions on Multimedia_, pp. 116–127, 2020. [9] C.-L. Li, K. Sohn, J. Yoon, and T. Pfister, ‘‘Cutpaste: Self-supervised learning for anomaly detection and localization,’’ in _Proceedings_ _of_ _the_ _IEEE/CVF_ _Conference_ _on_ _Computer_ _Vision_ _and_ _Pattern_ _Recognition_, pp. 9664–9674, 2021. [10] V. Zavrtanik, M. Kristan, and D. Skočaj, ‘‘Draem-a discriminatively trained reconstruction embedding for surface anomaly detection,’’ in _Proceedings_ _of the IEEE International Conference on Computer Vision_, pp. 8330–8339, 2021. [11] T. DeVries and G. W. Taylor, ‘‘Improved regularization of convolutional neural networks with cutout,’’ _arXiv preprint arXiv:1708.04552_, 2017. [12] T. Schlagenhauf, M. Landwehr, and J. Fleischer, ‘‘Industrial machine tool detection system using background subtraction and hsv color segmentation,’’ _Bulletin_ _of_ _Electrical_ _Engineering_ _and_ _Informatics_, vol. 10, no. 6, pp. 3211–3219, 2021. [20] V. Rebuffel, S. Sood, and B. Blakeley, ‘‘Defect detection method in digital radiography for porosity in magnesium castings,’’ _Materials_ _Evaluation,_ _ECNDT_, 2006. [21] Y. LeCun, L. Bottou, Y. Bengio, and P. Haffner, ‘‘Gradient-based learning applied to document recognition,’’ _Proceedings of the IEEE_, vol. 86, no. 11, pp. 2278–2324, 1998. [22] A. Krizhevsky, I. Sutskever, and G. E. Hinton, ‘‘Imagenet classification with deep convolutional neural networks,’’ _Advances in neural information_ _processing systems_, vol. 25, pp. 1097–1105, 2012. [23] K. Simonyan and A. Zisserman, ‘‘Very deep convolutional networks for large-scale image recognition,’’ in _3rd_ _International_ _Conference_ _on_ _Learning_ _Representations_, Computational and Biological Learning Society, 2015. [24] C. Szegedy, W. Liu, Y. Jia, P. Sermanet, S. Reed, D. Anguelov, D. Erhan, V. Vanhoucke, and A. Rabinovich, ‘‘Going deeper with convolutions,’’ in _Proceedings_ _of_ _the_ _IEEE_ _conference_ _on_ _computer_ _vision_ _and_ _pattern_ _recognition_, pp. 1–9, 2015. [25] K. He, X. Zhang, S. Ren, and J. Sun, ‘‘Deep residual learning for image recognition,’’ in _Proceedings_ _of_ _the_ _IEEE_ _conference_ _on_ _computer_ _vision_ _and pattern recognition_, pp. 770–778, 2016. [26] C. Hu and Y. Wang, ‘‘An efficient convolutional neural network model based on object-level attention mechanism for casting defect detection on radiography images,’’ _IEEE Transactions on Industrial Electronics_, vol. 67, no. 12, pp. 10922–10930, 2020. [27] M. Azamfar, X. Li, and J. Lee, ‘‘Intelligent ball screw fault diagnosis using a deep domain adaptation methodology,’’ _Mechanism and Machine Theory_, vol. 151, p. 103932, 2020. [28] Y. Cao, X. Xu, Z. Liu, and W. Shen, ‘‘Collaborative discrepancy opti VOLUME 11 2023 11 mization for reliable image anomaly localization,’’ _IEEE Transactions on_ _Industrial Informatics_, pp. 1–10, 2023. [29] Y. Cai, D. Liang, D. Luo, X. He, X. Yang, and X. Bai, ‘‘A discrepancy aware framework for robust anomaly detection,’’ _IEEE Transactions on Industrial_ _Informatics_, pp. 1–10, 2023. [30] S. Yun, D. Han, S. J. Oh, S. Chun, J. Choe, and Y. Yoo, ‘‘Cutmix: Regularization strategy to train strong classifiers with localizable features,’’ in _Proceedings_ _of_ _the_ _IEEE/CVF_ _international_ _conference_ _on_ _computer_ _vision_, pp. 6023–6032, 2019. [31] Z. Zhong, L. Zheng, G. Kang, S. Li, and Y. Yang, ‘‘Random erasing data augmentation,’’ in _Proceedings_ _of_ _the_ _AAAI_ _conference_ _on_ _artificial_ _intelligence_, vol. 34, pp. 13001–13008, 2020. [32] H. Zhang, M. Cisse, Y. Dauphin, and D. Lopez-Paz, ‘‘mixup: Beyond em pirical risk management,’’ in _Proc. 6th Int. Conf. Learn. Represent.(ICLR)_, pp. 1–13, 2018. [33] Y. Wang, S. Tang, F. Zhu, L. Bai, R. Zhao, D. Qi, and W. Ouyang, ‘‘Revis iting the transferability of supervised pretraining: an mlp perspective,’’ in _Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern_ _Recognition_, pp. 9183–9193, 2022. [34] E. D. Cubuk, B. Zoph, J. Shlens, and Q. V. Le, ‘‘Randaugment: Practical automated data augmentation with a reduced search space,’’ in _Proceedings_ _of_ _the_ _IEEE/CVF_ _conference_ _on_ _computer_ _vision_ _and_ _pattern_ _recognition_ _workshops_, pp. 702–703, 2020. [35] S. Sabour, N. Frosst, and G. E. Hinton, ‘‘Dynamic routing between capsules,’’ in _Proceedings_ _of_ _Neural_ _Information_ _Processing_ _Systems_, pp. 3859–3869, 2017. [36] J. Hu, L. Shen, and G. Sun, ‘‘Squeeze-and-excitation networks,’’ in _2018_ _IEEE_ _Conference_ _on_ _Computer_ _Vision_ _and_ _Pattern_ _Recognition,_ _CVPR_ _2018,_ _Salt_ _Lake_ _City,_ _UT,_ _USA,_ _June_ _18-22,_ _2018_, pp. 7132–7141, Computer Vision Foundation / IEEE Computer Society, 2018. [37] P. C. Mahalanobis, ‘‘On the generalized distance in statistics,’’ _Sankhy¯a:_ _The Indian Journal of Statistics, Series A (2008-)_, vol. 80, pp. S1–S7, 2018. [38] O. Rippel, P. Mertens, and D. Merhof, ‘‘Modeling the distribution of normal data in pre-trained deep features for anomaly detection,’’ in _2020_ _25th International Conference on Pattern Recognition (ICPR)_, pp. 6726– 6733, IEEE, 2021. [39] P. Bergmann, M. Fauser, D. Sattlegger, and C. Steger, ‘‘Mvtec ad–a com prehensive real-world dataset for unsupervised anomaly detection,’’ in _Proceedings of the IEEE/CVF conference on computer vision and pattern_ _recognition_, pp. 9592–9600, 2019. [40] P. Bergmann, M. Fauser, D. Sattlegger, and C. Steger, ‘‘Uninformed stu dents: Student-teacher anomaly detection with discriminative latent embeddings,’’ in _Proceedings_ _of_ _the_ _IEEE/CVF_ _Conference_ _on_ _Computer_ _Vision and Pattern Recognition_, pp. 4183–4192, 2020. [41] J. Yi and S. Yoon, ‘‘Patch svdd: Patch-level svdd for anomaly detection and segmentation,’’ in _Proceedings of the Asian Conference on Computer_ _Vision_, 2020. [42] T. Defard, A. Setkov, A. Loesch, and R. Audigier, ‘‘Padim: a patch dis tribution modeling framework for anomaly detection and localization,’’ in _International Conference on Pattern Recognition_, pp. 475–489, Springer, 2021. [43] C. Ledig, L. Theis, F. Huszár, J. Caballero, A. Cunningham, A. Acosta, A. Aitken, A. Tejani, J. Totz, Z. Wang, _et al._, ‘‘Photo-realistic single image super-resolution using a generative adversarial network,’’ in _Proceedings of_ _the IEEE conference on computer vision and pattern recognition_, pp. 4681– 4690, 2017. XIAOMING WANG received the B.S. degree from Shanghai University of Electric Power, Shanghai, China, and the M.S. degree from Shanghai JiaoTong University, Shanghai, China. She is currently working toward the Ph.D. degree in control engineering with the University of Shanghai for Science and Technology, Shanghai, China. Her research interests include computer vision and applications of deep learning. YONGXIONG WANG received his B.S. degree from Harbin Engineering University, Harbin, China. He received his M.S. and Ph.D. degrees from Shanghai JiaoTong University, Shanghai, China. He is a professor in University of Shanghai for Science and Technology now. His research interests include the computer vision and intelligent robot. ZHIQUN PAN received the B.E. degree from Ludong University, Yantai, China, in 2018. He is currently pursuing the Ph.D. degree with the School of Optical-Electrical and Computer Engineering, University of Shanghai for Science and Technology, Shanghai, China. His current research interests include deep learning, computer vision, face analysis, weakly supervised learning, and domain adaptation. GUANGPENG WANG received his B.S. degree from Liaoning University of Technology, Jinzhou, China. He received his M.S. degree from Shandong University of Science and Technology, Qingdao,China. He is currently working toward the Ph.D. degree in Control science and engineering at University of Shanghai for Science and Technology, Shanghai, China. His research interests include the computer vision and applications of deep learning. JUNFAN CHEN is currently working toward the Bachelor degree in intelligent science and technology at University of Shanghai for Science and Technology, Shanghai, China. His research interests include the computer vision and applications of deep learning. 12 VOLUME 11 2023

섹션 본문 69문단 · 37,504자

(제목 없음)

1Automatic detection of pitting on Ball Screw Drive (BSD) is essential to ensure normal production activities.However, the scarcity of defective samples and precisely labeled data poses a significant challenge.To address this, we propose an efficient double self-supervised model that operates at both the image and pixel levels, aiming to construct a high-performance model trained with defect-free data for detecting unknown defects in BSD images.By incorporating global and local information and extracting features at multiple hierarchical levels, the model's generalization performance is enhanced.The image-level self-supervised representation is first learned by classifying normal images from the PasteNoise, a data augmentation approach by pasting noise patches at random locations in normal images.Meanwhile, the pixel-level self-supervised representation is learned by segmenting the noise patch to locate abnormal regions.Then, we introduce a novel feature masking strategy in a masking and prediction task for accurate defect localization.In addition, we use Histogram of Oriented Gradients (HOG) features with local contrast normalization as prediction targets to capture local shapes and appearances to improve the robustness of the model.The proposed method achieves competitive receiver operating characteristic curves of 97.42 (imagelevel) and 94.57(pixel-level) on the BSD dataset.In experiments on the MVTec AD, the proposed model shows good performance, indicating the broad adaptability of our approach.INDEX TERMS Convolutional neural network, defect detection, deep learning, histogram of oriented gradients, self-supervised learning.

I. INTRODUCTION

2Ball screw drive is a commonly used mechanical device for rotational motion transmission [1], mainly consisting of a ball screw, guide rail, and drive mechanism.It is also one of the components most susceptible to wear.Over time, the rolling elements induce material fatigue on the spindle, ultimately leading to small wear on the spindle's surface, called pitting (Figure 1).These pittings can lead to high roughness of machined parts and unstable processing accuracy.Traditional methods rely mainly on manual inspection, which is inefficient and vulnerable to human interference.At the same time, mechanical wear is a gradual process.The conventional force signal, ultrasonic signal, The associate editor coordinating the review of this manuscript and approving it for publication was Chaker Larabi .vibration signal, current signal, and acoustic emission signal are indirect signals that are not sensitive to minor wear.Recently, BSD images taken by observing holes are used for defect detection.The new approach is convenient, low-cost, and online.Subsequently, the automatic detection system based on BSD images gradually became a research focus.

3In recent years, computer vision has achieved remarkable results in many automatic detections [2], [3], [4].Deep learning methods, especially Convolutional Neural Networks (CNN), frequently appear in industrial production applications [5], [6].However, in highly automated production scenarios, where the yield rate of products is particularly high, collecting defect samples is time-consuming.In addition, since defects are generated by uncontrolled factors in the production process, the forms of defects are various, and it is difficult to collect complete defective samples of various forms.

4To reduce overdependence on data annotations, many self-supervised methods solving different proxy tasks have been widely studied [7], [8], [9], [10].DeVries and Taylor [11] randomly cut areas of input images to reduce overfitting and improve the generalization ability of convolutional neural networks.Li et al. [9] propose a data augmentation strategy, which cuts image patches and then pastes them to random locations in the image to simulate real defects, but the trimmed patches are only a rough approximation of real defects.Pittings in the BSD [12] inspection are typically irregular and subtle(Figure 2), which is a challenge for the detection task.The differences in pitting on BSD between normal and anomaly patterns are often fine-grained as defective areas might be small and subtle in high-resolution images.However, most self-supervised methods have poor generalization due to a focus on object-centered natural images.Thus, it is essential for self-supervised representation learning to define an appropriate pretext task in pitting detection.

FIGURE 2.

5The initial pitting area is small, and compared to the high-resolution BSD image, the pitting is still less evident after magnification of 9 times.

6In this work, we first construct a self-supervised framework that learns image representations by distinguishing anomaly data from normal data at image-level.We propose a novel proxy classification task that distinguishes between normal data and data augmented by PasteNoise.PasteNoise augmented samples are generated using a Perlin noise generator [13] along with an anomaly source image, which remains unrelated to the input image.Compared with common pseudo anomaly patches, such as rectangles or polygons, the texture of the noise patch is more natural, and the shape transformation is more diverse.Although we cannot obtain real defects, experiments show that representations learned by detecting noise patches generalize well to detecting real defects.

7Moreover, masking the input image is one of the most popular augmentations used in transformer-based autoencoders [14], [15].Self-supervised learning with masking shows more scalability when combined with ViT [15], [16].However, self-supervised learning networks with naive masking do not work well in CNNs because masked inputs generate parasitic edges and distort the balance between global and local features [17].Inspired by the focal mask [18], we introduce a new mask module, which avoids distorting the balance among features.High-level features are randomly masked to overcome the parasitic edge problem.We construct the second self-supervised framework by introducing the masking method into the convolutional network to improve the performance in detecting subtle defects.We specifically select HOG features with local contrast normalization and cheap computational overhead as the predictive target at pixel-level, further improving the robustness of the model.The self-supervised learning network with masking makes the model learn to find subtle differences between normal and defective images and generalizes better to real defects.

8The image-level self-supervised task and the pixellevel self-supervised task are both important methods in unsupervised learning.The image-level task contributes to learning image-level representation and data augmentation, while the pixel-level task focuses on image segmentation and pixel-level annotation, allowing models to achieve more fine-grained image understanding.Two self-supervised learning strategies play a crucial role in addressing data annotation challenges, improving model generalization, and enhancing robustness.We integrate both into a unified network model, enabling the model to learn multi-level feature representations and comprehensively capture the semantic and detailed information in images.The model combines global and local information for a thorough and accurate understanding of images, effectively adapting to data from various domains or tasks.

9The main contributions of our study are as follows:

101) We propose a double self-supervised learning detection model for BSD defect detection.At image-level, we utilize data augmentation to construct a proxy task, which facilitates learning self-supervised representations by distinguishing data with anomaly patterns from normal data.At pixellevel, we design a new masking feature pattern for the self-supervised training strategy to improve the model generalization ability.After masking the high-level features, the network is guided to learn the detail representations of the image by predicting HOG features.

112) We propose a novel data augmentation method called PasteNoise that creates visually coherent anomaly patches with varying degrees of detail and smoothness.Experiments show the effectiveness of PasteNoise in detecting unknown defects.

123) Our model achieves 97.42 image-level detection AUC and 94.57pixel-level localization AUC on BSD data, outperforming current state-of-the-art models and meeting the requirements of industrial scenarios.Experiments on MVTec AD show that our approach achieves SOTA performance, confirming the proposed method's generalizability.

13The structure of the remaining sections in this paper is as follows.The latest research on defect detection and data augmentation is stated in Section II.The proposed network model is introduced in Section III.Extensive experiments and analysis are conducted in Section IV.Finally, Section V provides the conclusion for the article.

II. RELATED WORKS A. DEFECT DETECTION METHODS

14In the field of industrial production, machine learning has been applied to analyze industrial images for defect detection.Background subtraction [19] is a popular defect detection method.The background is subtracted from the image while preserving defects and random noise [20].However, these methods are susceptible to the position and noise of the image.In recent years, deep learning has developed rapidly in computer visual fields.Since the first CNN LeNet [21] was proposed, several excellent networks have been designed, such as Alex [22], VGG [23], Inception [24], ResNet [25], etc.The remarkable achievements of CNNs in various computer vision tasks have led to their gradual application in the field of defect detection.In [26], bilinear class activation maps are utilized to optimize the detect defection model.Cross-domain and domain adaptation methods are adopted to detect ball screw faults [27].

15Although computer vision has been successfully applied in defect detection, most of the work is limited by training datasets.Insufficient diverse annotated data and an imbalance between normal and defective samples can cause the model's performance to decline when facing unknown scenarios or variations.To mitigate reliance on the dataset, anomaly detection, trained solely on normal images, is widely used in defect detection [9], [10].Reconstruction is the most common method for anomaly detection.However, generative adversarial networks sometimes construct anomaly samples that are very similar to normal samples, which affects the network's ability to distinguish anomaly samples.By reconstructing the masked filtering, Ristea et al. [7] use pretext tasks to learn object representations in self-supervised learning.Li et al. [9] obtain deep representations by reconstructing randomly pasted parts.Cao et al. [28] optimizes the feature distributions of normal and abnormal data separately, effectively alleviating the problem of overfitting abnormal features.Due to imprecise boundary descriptions, anomaly scores may unexpectedly exhibit low values [28].To alleviate excessive generalization of anomalies, synthetic anomalies are introduced in Draem [10], CutPaste [9], and DAF [29].Unlike these methods, the proposed dual self-supervised model incorporates two self-supervised tasks, extracting features from different scales and perspectives.Multi-level feature representations are enabled to be learned by the model and anomalies are distinguished more accurately from normal samples.Additionally, we overlay noise patches as an anomaly on the normal image.Various defect features are extracted in training by randomly masking defective patches on images, and normal image representations are learned simultaneously.Our patch-based model performs better, as shown in Section IV-D.

B. DATA AUGMENTATIONS

16Defect detection methods synergize with data augmentations to improve model robustness by generating diverse abnormal samples.Data augmentation is a critical way to avoid model overfitting.When the data set has some apparent characteristics, such as the images being basically taken in the same scene, employing technologies like Cutout [11] and its variants [9], [30], [31], [32] can aid the model in avoiding the learning of irrelevant information unrelated to the target task.Cutout [11] introduces irregularities by randomly masking out some rectangular portions of an input image with zero or other uniform values.In Random Erasing [31], the length and width of the erased area and the replacement value of the pixel value in the area are random.In CutMix [30], a new training sample is created by combining two or more input images in such a way that parts of each image are visible in the combined image.Mixup [32] works by taking a weighted average of the two images according to a certain ratio.CutPaste [9] is a simple data augmentation method that randomly cuts a patch and pastes it at a random position of the original image.

17In anomaly detection, self-supervised networks learn the irregularities introduced by data augmentations to generalize the representation of defects.In this work, we learn representations by classifying normal data from PasteNoise during training, which is a straightforward and practical data augmentation strategy.PasteNoise is used to generate more natural and diverse abnormal samples for training.The model's generalization capability is enhanced, resulting in precise recognition of unseen anomalies in detection.

III. METHOD

18In this section, we introduce a double self-supervised learning model combined with PasteNoise data augmentation and a mask-and-predict task, as shown in Figure 3.The backbone network is modified based on the lightweight ResNet-18 [25] with 18 weight layers, including 17 convolutional layers and a fully connected layer.Feature maps are extracted by 17 convolutional layers, as shown in Table 1, and then they enter two streams of the network.One stream is a 3-layer multilayer perceptron (MLP) projection head and a fully connected layer with the cross-entropy loss (L CE ), which is used to measure the classification loss in self-supervised learning with PasteNoise.The other stream sequentially passes through the masked split convolution module (MSCM), channel attention module (CAM), and HOG decoder.At last, our network is equipped with a mean-squared error loss (L MSE ) that minimizes the reconstruction error between the original HOG and the predicted feature.

19Next, the network structure is explained in detail from the perspective of two self-supervised tasks.Self-supervised learning with PasteNoise is described in section III-A.Self-supervised learning with HOG and masked features is introduced in section III-B.Additionally, we give a brief description of the anomaly score in section III-C.

A. SELF-SUPERVISED LEARNING WITH PASTENOISE

20In this section, we present a novel pretext task for learning self-supervised representations by predicting PasteNoise augmentation and constructing a one-class classifier.

21We insert an MLP projector between the backbone network and the classifier for better transferability [33].Therefore, the image-level self-supervised learning sub-network includes a feature extractor f (•), an MLP projector g(•), and a classifier W .Given the input image x, the outputs F x = f (x) of CNN is a 512-dimensional 8×8 feature map.F x is mapped into a projection vector g = g(F x ) by an MLP.The MLP consists of two fully connected layers.In the MLP projector, the hidden feature dimension is set to 512.Input images consist of the original image x and the image augmented with PasteNoise.The objective function for the self-supervised task is defined as:

22(1)

23where x is the normal image.PN denotes covering a noise patch on the normal image.BCE is a binary cross-entropy function.

24PasteNoise: Since the shape of true anomalies is unpredictable, we expect to generate anomalies outside the normal distribution of characteristics.Following [10], a noise image with various anomaly shapes is first generated by the Perlin noise generator [13].And then a random anomaly map (Figure 4 M p ) is obtained after binarizing the noise image by a threshold.The mask map (Figure 4 M ) preserves the largest masked region from M p .The anomaly texture source image (Figure 4 I e ) is selected from an image dataset that is different from the input image distribution.RandomAugment [34] is applied by three random augmentation methods from the set (Autocontrast, Posterize, Solarize, Sharpness, ChangeBrightness, ChangeColor).Finally, an anomalous image (Figure 4 I s ) is generated, where the mask region is filled with a linear combination of the augmented image I e and an anomaly-free image (Figure 4 I ) with a ratio factor α randomly chosen between [0.5,1].The above operation can be formulated as follows:

25Here, ⊙ presents the element-wise multiplication operation.This algorithm for generating anomalous images has the following benefits.Random Perlin noise is more irregular and closer to real anomalous.The diversity of anomaly images is increased by introducing the hyperparameter α.

B. SELF-SUPERVISED LEARNING WITH HOG AND MASKED FEATURES

26In the second self-supervised learning task, we construct a mask-and-predict task.This self-supervised sub-network includes a feature extractor f (•) shared with the classification task in Section III-A, a masked split convolutional module ε(•), a channel attention module ϕ(•), and an HOG decoder h(•).Here we utilize Mean Squared Error (MSE) loss to minimize the distance between the original HOG features and the predicted HOG as follows:

27where x is a normal data.F x is expressed by Equation 1. H x presents the predicted HOG.H means extracting HOG features from images.MSE is an MSE loss function.

28Next, we will show MSCM, CAM, and HOG decoder in detail.

1) MASKED SPLIT CONVOLUTION MODULE (MSCM)

29CNN is widely utilized in various computer vision tasks.In CNN training, image features are continually abstracted from low to high levels.However, as Sabour et al. [35] stated, CNN lacks the global arrangement ability for local features.To address this, we employ MSCM, aiming to leverage contextual information to predict masked feature information.This compels the model to learn the global structure of local features for high-precision reconstruction results.Specifically, MSCM conducts expansion, split, convolution, and fusion operations on the feature maps extracted by the CNN network.During training, the model learns to reconstruct the masked information, while providing useful features to locate and understand anomalies.

30We show the MSCM module in Figure 5.The input feature Y ∈ R w×h×c is expanded, and the dilation factor is d, where c is the number of input channels, and w and h are the width and height of the input feature map, respectively.

31We aim to predict the spatial location of input feature Y .Therefore, we add d zero pixels around the input feature.The feature map is expanded to (w + 2d) × (h + 2d).Four sub-feature maps of size w × h are taken from four vertices, K i ∈ R w×h×c , ∀i ∈ {1, 2, 3, 4}.Convolution operations are performed on these sub-feature maps to learn the input spatial location information by predicting the masked portion.Because of the same size, the spatial dimension of the module output feature is the same as the input feature.In the MSCM, the configurable super-parameter is only the expansion rate d, which is set to 2. Subsequently, we express MSCM with the following formulas:

32where F pad and S i represent padding and splitting operations, respectively.F(•) is convolution, and σ denotes the sigmoid activation function.

2) CHANNEL ATTENTION MODULE (CAM)

33The output features of the Mask Splitting Convolution Module are partially masked, which may impact the activation ratio between channels.To enhance the modeling ability of MSCM and find the importance of different channels, we introduce the SE module [36] into the network.SE is a channel attention module (CAM), and the structure is shown in Figure 6.CAM recalibrates the previously obtained features through three operations, Squeeze, Excitation, and Reweight.The Squeeze operation is to perform feature compression along the spatial dimension, turning each two-dimensional feature channel into a real number, using a global average pooling completed.The second is the Excitation operation, a mechanism similar to gates in recurrent neural networks.Weights are generated for each feature channel via a parameter w, which is learned to explicitly model the correlation between feature channels.The scale factor s ∈ R 1×1×c is the core of CAM and can be expressed by Equation 8.

34where δ represents the ReLU function, σ refers to the sigmoid function, and Z ∈ R h×w×c is the input descriptor.W 1 ∈ R (c/r)×c and W 2 ∈ R c×(c/r) denote the weights of two fully connected layers, a dimensionality reduction layer with a reduction ratio r and a dimensionality increasing layer.The last is a Reweight operation, which weights s to the previous features by multiplying channel by channel, rescaling the original features in the channel dimension.

3) HOG DECODER

35We introduce the HOG decoder to perform the inverse operation of encoding, extracting HOG features from the feature map, aligning with our prediction target.The backbone network employed in this paper is ResNet18 [25], featuring a small number of layers and relatively few parameters.Consequently, we construct a simple regression unit composed of two convolution layers and regress the feature image to a one-dimensional vector representing HOG in Table 2.These parameters of the regression unit are continuously corrected by the HOG loss function as Equation 5.

C. ANOMALY SCORE

36The Mahalanobis distance [37] can be used for anomaly detection, which needs to calculate the boundary threshold from the data center with normal data and then determine the point is an anomaly if it is a point from the center of the data set that exceeds the threshold.Similar to [38], we compute the Mahalanobis distance as the anomaly score.Mahalanobis distance is an effective method for calculating the similarity between two unknown sample sets.Unlike Euclidean distance, it considers the relationship between various properties and is scale-independent.For a given test datum x, the Mahalanobis distance is defined as follows:

37where µ and S −1 are the vector mean and covariance matrix, respectively, learned from the training data.For each sample, the anomaly score can be obtained by Equation 9.If the anomaly score exceeds the threshold θ, the pixel is classified as an anomaly point.In the experimental section, the Receiver Operating Characteristic (ROC) [39] metric is computed by varying the threshold θ.

IV. EXPERIMENTS

38The experimental setup is first described in this section, including the datasets and experimental details.Then, we demonstrate the effectiveness of our approach on the BSD dataset and the MVTec AD dataset separately.We compare our approach with several state-of-the-art models.Finally, various aspects of the proposed method are explored through ablation experiments.

A. EXPERIMENTAL SETUP

39BSD dataset [12]: This dataset comprises 1,104 images, including 710 normal images and 394 images with defects.These images are recorded by a camera system, which is a standard Raspberry Pi V2 microcontroller camera.The original photos are 1130 × 460 and a small number of about 2000×1000.Finally, 631 normal images are randomly divided into the training set.The rest 79 normal images and 394 defective images form the test set.

40MVTec AD dataset [39]: The MVTec AD dataset is aimed at anomaly detection, which provides multi-object and multidefect real-world images.It contains 5,354 color images divided into five texture categories and ten object categories.Each category includes a set of training images without defects and a set of images with various defects as well as defect-free images.For the MVTec AD dataset, the training set comprises 3,629 images, all of which are normal images.In the test set, there are 1,725 images, including 467 normal images and 1,258 abnormal images.

41Evaluation Metrics: Following prior works, we in-depth study model performance from both detection and localization perspectives.For anomaly detection, the area under the receiver operation characteristic (AUC) is taken as the evaluation metric.For anomaly localization, AUC is selected to evaluate the pixel-level localization result.

42Experimental Details: These experiments are conducted on the workstation with two INTEL XEON E5-2678 CPUs and two GeForce RTX 2080S GPUs (8GB).We implement our models in Python 3.7 and PyTorch 1.6.All images are resized to 256×256.We adopt ResNet-18 [25] as a backbone in our model.In experiments, we use the SGD optimizer with a base learning rate of 0.03, the momentum of 0.9, and weight decay of 0.00003.We train 800 epochs with a batch size of 32.

TABLE 3.

43Detection and localization performances on BSD data.For comparison, we report image-level detection and pixel-level localization AUCs of CutPaste [9], and SSPCAB [7].

B. DEFECT DETECTION ON BSD DATASET

44We conduct anomaly detection and localization experiments leveraging our representations trained with a double selfsupervised model.We use visual heatmaps to highlight the region-predicted anomaly for accurate localization of defects.

45We compare with two recent works, including CutPaste [9] and SSPCAB [7].Using the same backbone network (ResNet18) helps eliminate the impact of differences in network structures, ensuring a fair comparison.Identical basic configurations, including hyperparameters, learning rates, optimizers, etc., contribute to the reliability and repeatability of the comparison.The CutPaste [9] method shows high performance in image anomaly detection.It utilizes a technique of cutting images and pasting them into different positions to construct negative samples.However, such operations may lead to overfitting, particularly when the model is trained on smaller datasets.In SSPCAB [7], a self-supervised predictive module is integrated with masked convolution kernels and channel attention mechanisms to enhance features.We utilize two self-supervised learning tasks simultaneously to acquire comprehensive feature representations across various levels, encompassing both global and local characteristics.This strategy enables us to effectively capture both semantic understanding and intricate details within images.

46In Table 3, we report the detection and localization performance on the BSD dataset.Our method achieves an image-level detection AUC of 97.42 and a pixel-level localization AUC of 94.57, outperforming CutPaste [9] and SSPCAB [7].As shown in Figure 7, the proposed method can locate the pittings more accurately than other methods.We note that BSD images have similar backgrounds, fixed local attributes, high resolution, and relatively stable textures in corresponding regions of the images, which can be classified as texture categories.Compared with the texture category on the MVTec AD dataset, which generally achieves 99+ AUC, the reduced performance on BSD data could be explained by contaminated images.The examples can be seen in Figure 8, where some contaminated regions are close to the anomaly image distribution.Our method detects anomalous features in these contaminated regions, which are difficult to distinguish from real anomaly regions.

C. COMPARISON WITH STATE-OF-THE-ART MODELS ON MVTEC AD DATASET

47Our method is evaluated on the challenging MVTec anomaly detection dataset.We use image-level AUC for evaluating anomaly detection.At the same time, for localization accuracy, the pixel-level AUC is used for anomaly localization.

48Anomaly Detection: In Table 4, we report the detection performance compared with state-of-the-art models on MVTec AD, including patch-level SVDD [41], uninformed students [40], cut-paste self-supervised learning (CutPaste) [9], selfsupervised predictive convolutional block (SSPCAB) [7], and CDO [28].The proposed method outperforms recent anomaly detection methods, achieving the best AUC in 5 out of 15 classes and achieving the best average AUC.

49Anomaly Localization: Table 5 compares our method to the recent state-of-the-art on the task of pixel-level anomaly detection.Our method achieves comparable results to these well-performing methods, patch-level SVDD [41], CutPaste [9], PaDiM [42] and CDO [28] with ResNet-18 [25].The proposed method achieves a significant improvement in anomaly localization accuracy.

D. ABLATION STUDY

50Prediction Target Type: We explore the impact of two different prediction targets in self-supervised learning with masked features in Table 6.RGB is an image representation method based on color channels, suitable for tasks that involve consideration of color.HOG is a feature descriptor method based on image gradients, primarily used to capture texture and shape information in images.It exhibits strong descriptive capabilities for the edges and contours of objects.Compared to HOG features, regressing RGB values produces a slight drop of about -0.5 for image classification.RGB as a target has a potential downside of over-fitting to high-frequency details and local statistics, which play an insignificant role in the interpretation of image content.HOG contributes to capturing features with strong representation from high-level semantic specialties and focuses on obtaining the texture-related representation of images.As a result, HOG with local-contrast normalization is more robust to overfit high-frequency details [43].

51Double Self-Supervised Learning Tasks: We evaluate the effect of two self-supervised learning tasks on the BSD dataset in Table 7.We note that self-supervised learning of representations with noise patches achieves decent results alone.Self-supervised learning of spatial representation with masked features, using HOG as the prediction target, TABLE 6. ''HOG'' and ''RGB'' present HOG features and pixels as prediction in the masked self-supervised task, respectively.TABLE 7. ''HOG'' denotes HOG features as prediction targets in the masked self-supervised task.''NP'' means the self-supervised task with noise patches. is also a distillation mode and can obtain a detection effect (95.16 detection AUC and 93.75 localization AUC).Interestingly, when these two self-supervised tasks are integrated into the same backbone network model, a better detection effect (97.42 detection AUC and 94.57localization AUC) is achieved than when used alone.Integrating dual self-supervised tasks at both image and pixel levels enables the network to extract multi-level abstract features.This enhances the model's robustness to noise or complex environments, resulting in more reliable and versatile representations.

52Anomaly Patterns: We study the performance of representations trained by patching diverse patches to normal images, such as scar, normal, scar+normal, and noise patch.Scar patch, which is proposed in [9] for anomaly detection, is a scar-like thin rectangular box filled with an image patch.Normal patch denotes the patch that is cut from the input image.Noise patches generated by the Berlin noise generator in Section III-A have random and disorderly features while maintaining a uniform distribution at a specific scale.Combining with ''Scar'' enhances the diversity of synthesized anomalies, which help the model comprehend and learn to handle unknown anomaly patterns.With a finer-gained detection task to leverage scar and noise patch together augmentation, we achieve the best detection (97.42 AUC) and localization (94.57AUC) performance.We show samples from considered augmentations patches in Figure 9 and report the detection and localization AUCs in Table 8.As shown in Figure 10, the accurate localization of defects is achieved by training with the anomaly pattern ''Noise + Scar''.Different Mask Types: We explored the impact of other masking methods on our model, including ''No'', ''Dropout'', and ''Mask''.The detection results are shown in Table 9.We observe that ''MSCM'' brings about performance improvements with a 0.78 image-level AUC and a 1.33 pixellevel AUC.In contrast, ''Dropout'' is a technique that randomly zeros elements in the feature maps during the model training process, aiming to introduce randomness to prevent overfitting.However, this random zeroing might lead to incomplete information transmission with limited training data.In some cases, it performs worse than not using any feature map masking (i.e., ''No'').On the other hand, ''Mask'' simulates the absence of partial information by applying a binary mask to the input feature map.However, TABLE 9. Detection results of different mask types.''No'' means not to mask the feature map.''Dropout'' presents to randomly set the elements in the feature map to zero with a probability of 0.5, ''Mask'' denotes a rectangle to mask the feature map, and the masking rate is 50%.''MSCM'' is our masking strategy described in Section III-B. the effectiveness of ''Mask'' may be influenced by the specific task and data distribution.As shown in Figure 11, MSCM demonstrates good localization accuracy, whereas ''Dropout'' shows more errors in predictions.

53These masking strategies play a certain role in improving detection effectiveness, although the effects are relatively modest.In future research, we aim to enhance the efficacy of masking methods by adjusting parameters, introducing new techniques, or combining them with other advanced approaches.

V. CONCLUSION

54In this paper, we propose a double self-supervised model for BSD defect detection.A noise generator is utilized to generate synthetic abnormal images with random and disordered characteristics.The diversity of training samples is enhanced.Then, self-supervised proxy tasks are constructed at both the image and pixel levels.These tasks have a positive effect on solving the problem of difficult or expensive data labeling and improving the performance of the model on vision tasks.Pitting defects on BSD surfaces can be effectively identified in complex production scenarios (97.42 image-level AUC and 94.57pixel-level AUC).The proposed model outperforms state-of-the-art anomaly detection models on real BSD datasets by +2.0 imagelevel AUC and +0.56 pixel-level AUC.The proposed model is optimized from multiple perspectives (textured natural PasteNoise, multi-view feature representation optimization) for improving network performance.The self-supervised learning model for defect detection is an effective method in industrial production, improving detection accuracy and reducing reliance on manual labeling or defect data.

55In practical applications, the limitations of the proposed method include the following several aspects.Firstly, the proposed model focuses on classification and localization tasks, and segmentation accuracy needs improvement.In future work, it is essential to further research and optimize defect pixel-level segmentation tasks.This involves adjusting the network architecture to extract features for inferring defect positions and utilizing defect features (size, shape, color) to better differentiate specific categories.Secondly, it is observed that the accuracy of locating small and inconspicuous defects is lower in complex backgrounds.Further research on the precise localization of subtle and inconspicuous anomalies should also be conducted in future work.

FIGURE 1 .

56FIGURE 1. Examples of spindle pittings.

FIGURE 3 .

57FIGURE 3. The overview of the double self-supervised model architecture.Anomaly images generated by PasteNoise, along with input images, are fed into a Convolutional Neural Network (CNN).The extracted feature maps are directed into two branches.(a)Through a Multi-Layer Perceptron (MLP) and a Fully Connected layer (FC), image-level classification predictions are generated.Our model acquires high-level semantic information within the images by minimizing the prediction loss L CE .(b) Following the masking process in the Masked Split Convolution Module (MSCM), a Channel Attention Module (CAM) is utilized to scale the channel weights.Subsequently, an HOG decoder maps the feature maps back to a one-dimensional vector representing Histogram of Oriented Gradients (HOG).By minimizing the similarity loss L MSE between the extracted HOG features from the input image.

FIGURE 4 .FIGURE 5 .

58FIGURE 4. Simulated PasteNoise anomaly generation process.The binary anomaly mask M p is generated from binarized Perlin noise.Mask M preserves the largest masked area from M p .The anomalous region is sampled from I e and placed on the anomaly-free image I to generate the anomalous image I s .

FIGURE 6 .

59FIGURE 6. Architecture of the channel attention module (CAM).

FIGURE 7 .

60FIGURE 7.Visual comparisons with state-of-the-art methods on the BSD dataset.Rows (a)-(d) represent input images, and results predicted by the following methods: our proposed method, SSPCAB[7], and CutPaste[9].The green masks are true anomalous pixels and the red regions are located by the corresponding method.

FIGURE 8 .

61FIGURE 8.The original image contains contaminated areas that are difficult to mark in the ground-truth maps, which causes a discrepancy between the ground-truth and the predicted mask map.

FIGURE 9 .

62FIGURE 9. Visualization of normal and augmented normal samples.

FIGURE 10 .

63FIGURE 10.Visual comparisons of different anomaly patterns.The green masks are true anomalous pixels and the red regions are located by the corresponding method.

FIGURE

64FIGURE Visual comparisons of different mask types.Rows (a)-(e) represent input images, and results predicted by the following mask types: MSCM, Mask, No, and Dropout respectively.The green masks are true anomalous pixels and the red regions are located by the corresponding method.

TABLE 1 .

65Architecture of backbone network.

TABLE 2 .

66Architecture of HOG decoder.

TABLE 4 .

67Comparison of image-level detection AUC with state-of-the-art methods on MVTec AD.The best result is bold.

TABLE 5 .

68Comparison of pixel-level localization AUC with state-of-the-art methods on MVTec AD.The best result is bold.

TABLE 8 .

69Detect performance trained with various patch combinations.

참고문헌 37건

  1. On the generalized distance in statistics 1936
  2. An image synthesizer ACM SIGGRAPH Computer Graphics · ACM SIGGRAPH · 1985 10.1145/325165.325247
  3. Robust compensation of elastic deformations in ball screw drives International Journal of Machine Tools and Manufacture · Elsevier BV · 2010 10.1016/j.ijmachtools.2010.03.001
  4. Going deeper with convolutions 2015 10.1109/cvpr.2015.7298594
  5. Gradient-based learning applied to document recognition Proceedings of the IEEE · Institute of Electrical and Electronics Engineers · 1998 10.1109/5.726791
  6. Deep Residual Learning for Image Recognition 2016 10.1109/cvpr.2016.90
  7. Improved Regularization of Convolutional Neural Networks with Cutout arXiv (Cornell University) · Cornell University · 2017 10.48550/arxiv.1708.04552
  8. Squeeze-and-Excitation Networks 2018 10.1109/cvpr.2018.00745
  9. Automatic Fruit Classification Using Deep Learning for Industrial Applications IEEE Transactions on Industrial Informatics · Institute of Electrical and Electronics Engineers · 2018 10.1109/tii.2018.2875149
  10. Deep learning-based remaining useful life estimation of bearings using multi-scale feature extraction Reliability Engineering & System Safety · Elsevier BV · 2018 10.1016/j.ress.2018.11.011
  11. Multiview Generative Adversarial Network and Its Application in Pearl Classification IEEE Transactions on Industrial Electronics · Institute of Electrical and Electronics Engineers · 2018 10.1109/tie.2018.2885684
  12. Deep residual learning-based fault diagnosis method for rotating machinery ISA Transactions · Elsevier BV · 2018 10.1016/j.isatra.2018.12.025
  13. MVTec AD — A Comprehensive Real-World Dataset for Unsupervised Anomaly Detection 2019 10.1109/cvpr.2019.00982
  14. Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network 2017 10.1109/cvpr.2017.19
  15. CutMix: Regularization Strategy to Train Strong Classifiers With Localizable Features 2019 10.1109/iccv.2019.00612
  16. An Efficient Convolutional Neural Network Model Based on Object-Level Attention Mechanism for Casting Defect Detection on Radiography Images IEEE Transactions on Industrial Electronics · Institute of Electrical and Electronics Engineers · 2020 10.1109/tie.2019.2962437
  17. Random Erasing Data Augmentation Proceedings of the AAAI Conference on Artificial Intelligence · Association for the Advancement of Artificial Intelligence · 2020 10.1609/aaai.v34i07.7000
  18. Intelligent ball screw fault diagnosis using a deep domain adaptation methodology Mechanism and Machine Theory · Elsevier BV · 2020 10.1016/j.mechmachtheory.2020.103932
  19. Uninformed Students: Student-Teacher Anomaly Detection With Discriminative Latent Embeddings 2020 10.1109/cvpr42600.2020.00424
  20. Randaugment: Practical automated data augmentation with a reduced search space 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPRW) · 2020 10.1109/cvprw50498.2020.00359
  21. Patch SVDD: Patch-Level SVDD for Anomaly Detection and Segmentation Lecture notes in computer science · Springer Science+Business Media · 2021 10.1007/978-3-030-69544-6_23
  22. Attribute Restoration Framework for Anomaly Detection IEEE Transactions on Multimedia · Institute of Electrical and Electronics Engineers · 2020 10.1109/tmm.2020.3046884
  23. PaDiM: A Patch Distribution Modeling Framework for Anomaly Detection and Localization Lecture notes in computer science · Springer Science+Business Media · 2021 10.1007/978-3-030-68799-1_35
  24. Modeling the Distribution of Normal Data in Pre-Trained Deep Features for Anomaly Detection 2022 26th International Conference on Pattern Recognition (ICPR) · 2021 10.1109/icpr48806.2021.9412109
  25. CutPaste: Self-Supervised Learning for Anomaly Detection and Localization 2021 10.1109/cvpr46437.2021.00954
  26. Parking detection system using background subtraction and HSV color segmentation Bulletin of Electrical Engineering and Informatics · Institute of Advanced Engineering and Science (IAES) · 2021 10.11591/eei.v10i6.3251
  27. Self-Supervised Predictive Convolutional Attentive Block for Anomaly Detection 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) · 2022 10.1109/cvpr52688.2022.01321
  28. Industrial machine tool component surface defect dataset Data in Brief · Elsevier BV · 2021 10.1016/j.dib.2021.107643
  29. DRÆM – A discriminatively trained reconstruction embedding for surface anomaly detection 2021 IEEE/CVF International Conference on Computer Vision (ICCV) · 2021 10.1109/iccv48922.2021.00822
  30. Masked Siamese ConvNets arXiv (Cornell University) · Cornell University · 2022 10.48550/arxiv.2206.07700
  31. Revisiting the Transferability of Supervised Pretraining: an MLP Perspective 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) · 2022 10.1109/cvpr52688.2022.00897
  32. Masked Feature Prediction for Self-Supervised Visual Pre-Training 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) · 2022 10.1109/cvpr52688.2022.01426
  33. Masked Siamese Networks for Label-Efficient Learning Lecture notes in computer science · Springer Science+Business Media · 2022 10.1007/978-3-031-19821-2_26
  34. Non-Destructive Egg Fertility Detection in Incubation Using SVM Classifier Based on GLCM Parameters Procedia Computer Science · Elsevier BV · 2022 10.1016/j.procs.2022.09.383
  35. Masked Autoencoders Are Scalable Vision Learners 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) · 2022 10.1109/cvpr52688.2022.01553
  36. Collaborative Discrepancy Optimization for Reliable Image Anomaly Localization IEEE Transactions on Industrial Informatics · Institute of Electrical and Electronics Engineers · 2023 10.1109/tii.2023.3241579
  37. A Discrepancy Aware Framework for Robust Anomaly Detection IEEE Transactions on Industrial Informatics · Institute of Electrical and Electronics Engineers · 2023 10.1109/tii.2023.3318302