선정목록으로
Unsupervised textile defect detection using convolutional neural networks
간접 관련 패션 · (24) 패션(코오롱FnC) (17) 스펀본드 부직포(3) 자동차 인테리어 소재
기본 정보
- 저자
- DOI
- 10.48550/arxiv.2312.00224
- 저널
- arXiv (Cornell University)
- 발행년도
- 2023
- 발행기관
- Cornell University
- 피인용수
- 0
- 라이선스
- 0
- 논문 유형
- –
- 언어
- –
- 원문 페이지
- https://doi.org/10.48550/arxiv.2312.00224
- 토픽
- Textile materials and evaluations
- OpenAlex ID
- W6891943958
평가 내용
- 관련도
- 간접 관련
- 사업분야
- 패션 · (24) 패션(코오롱FnC)
- 부 분야
- (17) 스펀본드 부직포, (3) 자동차 인테리어 소재
- R&D 측면
- 공정·제조
- 확신도
- 0.90
- 근거 용어
- textile defect detection, fabric quality control, unsupervised learning, convolutional neural networks, anomaly detection
- 판단 근거
- 본 논문은 섬유(fabric)의 결함을 자동으로 검출하는 비지도 학습 기반의 CNN 알고리즘을 다루고 있습니다. 이는 코오롱인더스트리의 산업용 부직포(17), 자동차 인테리어 소재(3) 등 섬유 제품의 제조 공정 내 품질 관리(Quality Control) 시스템에 직접적으로 응용 가능한 기술입니다.
- R&D 활용 포인트
- 섬유 및 부직포 생산 라인에서 육안 검사를 대체하여 결함을 실시간으로 탐지하는 자동화된 AI 검사 시스템 구축에 활용 가능합니다.
- 평가 입력
- 본문 70,195자 중 30,032자 발췌
초록
In this study, we propose a novel motif-based approach for unsupervised textile anomaly detection that combines the benefits of traditional convolutional neural networks with those of an unsupervised learning paradigm. It consists of five main steps: preprocessing, automatic pattern period extraction, patch extraction, features selection and anomaly detection. This proposed approach uses a new dynamic and heuristic method for feature selection which avoids the drawbacks of initialization of the number of filters (neurons) and their weights, and those of the backpropagation mechanism such as the vanishing gradients, which are common practice in the state-of-the-art methods. The design and training of the network are performed in a dynamic and input domain-based manner and, thus, no ad-hoc configurations are required. Before building the model, only the number of layers and the stride are defined. We do not initialize the weights randomly nor do we define the filter size or number of filters as conventionally done in CNN-based approaches. This reduces effort and time spent on hyperparameter initialization and fine-tuning. Only one defect-free sample is required for training and no further labeled data is needed. The trained network is then used to detect anomalies on defective fabric samples. We demonstrate the effectiveness of our approach on the Patterned Fabrics benchmark dataset. Our algorithm yields reliable and competitive results (on recall, precision, accuracy and f1- measure) compared to state-of-the-art unsupervised approaches, in less time, with efficient training in a single epoch and a lower computational cost.
본문 70,195자
본문 펼치기
## Unsupervised Textile Defect Detection using Convolutional Neural Networks
Imane Koulali <sup>_∗_</sup>, M. Taner Eskil
_Department_ _of_ _Computer_ _Science_ _Engineering,_ _Işık_ _University,_ _Büyükdere_ _Ave._ _No:_ _106,_ _Maslak,_ _34398,_
_Istanbul,_ _Turkey_
Abstract
In this study, we propose a novel motif-based approach for unsupervised textile anomaly de
tection that combines the benefits of traditional convolutional neural networks with those of
an unsupervised learning paradigm. It consists of five main steps: preprocessing, automatic
pattern period extraction, patch extraction, features selection and anomaly detection. This
proposed approach uses a new dynamic and heuristic method for feature selection which
avoids the drawbacks of initialization of the number of filters (neurons) and their weights,
and those of the backpropagation mechanism such as the vanishing gradients, which are
common practice in the state-of-the-art methods. The design and training of the network
are performed in a dynamic and input domain-based manner and, thus, no ad-hoc config
urations are required. Before building the model, only the number of layers and the stride
are defined. We do not initialize the weights randomly nor do we define the filter size or
number of filters as conventionally done in CNN-based approaches. This reduces effort and
time spent on hyper-parameter initialization and fine-tuning. Only one defect-free sample
is required for training and no further labeled data is needed. The trained network is then
used to detect anomalies on defective fabric samples. We demonstrate the effectiveness of
our approach on the Patterned Fabrics benchmark dataset. Our algorithm yields reliable
and competitive results (on recall, precision, accuracy and f1-measure) compared to state
of-the-art unsupervised approaches, in less time, with efficient training in a single epoch and
a lower computational cost.
_Keywords:_ Fabric defect, Textile defect, Anomaly detection, Neural network, Cross-patch
1
similarity, Manhattan distance
1. Introduction
In the modern textile industry, defect detection is a critical stage in effective fabric quality
control. A roll of textile is priced with respect to several variables; these include the defects’
size, their number and their locations on the roll.
Defect detection has historically been carried out by human experts solely relying on
visual inspection. This type of recognition is not only time-consuming but also suffers from
the high intensity of labor and human oversight. Fatigue and inattentiveness indeed hamper
effective quality control, especially when defects are small and have a low contrast. Moreover,
these results are mostly subjective and unquantifiable. The effectiveness of this manual
approach is hence low which results in a high defect rate. Yielded results are consequently
unreliable, mainly due to the versatility of the human factor. Ergo, computerized and
automated inspection techniques to detect defects are vital.
Over the years, many methods have been put forward to address this problem. In the
literature, these approaches broadly fall under two main categories; motif-based and non
motif based approaches. In the non-motif based group, approaches can further be classified
into six categories; statistical, spectral, model-based, learning-based, structural and hybrid
methods.
Statistical methods aim to detect defective regions based on statistical properties such
as regularity, uniformity and similarity. This category of methods includes the co-occurence
matrix [1, 2], the auto-correlation metric [3], mathematical morphology [4] and fractal di
mension methods [5]. These methods are usually suitable for homogeneous textures.
Spectral-based methods are another set of approaches which detect defects in the fre
quency domain. Typical spectral-based approaches are Fourier transform [6], Gabor trans
_∗_ Corresponding author.
_Email_ _addresses:_ `imane.koulali@isikun.edu.tr` (Imane Koulali), `taner.eskil@isikun.edu.tr` (M.
Taner Eskil)
_December_ _4,_ _2023_
formation [7] and Wavelet-based methods [8]. Albeit their effectiveness, these approaches
come with a considerably high computational cost.
Model-based approaches represent the normal texture with probability distribution mod
els such as Gaussian mixture models [9]. They then consider nonconforming areas as defects
by utilizing the constructed model. Together with structural methods, these approaches are
highly data dependent and are therefore less common.
Machine learning based approaches proved to be promising for defect detection. In
these methods, features are extracted from training images and later used to distinguish
damaged areas from the defect free ones on the sample being tested. Nonetheless, most
of the methods that perform well in fabric defect detection tasks are supervised learning
approaches, they require manually labeled samples for model training which is costly and
challenging to obtain.
In the recent years, use of Deep Learning (DL) algorithms rapidly proliferated in almost
every domain, including anomaly detection in general and textile defect detection in par
ticular [10], [11], [12]. These DL based algorithms represent data with numerous levels of
abstraction by use of many processing layers. The image is passed through the pipeline
of the trained model and the segmentation is contingent on the deep features produced.
These features often outperform handmade and pre-defined feature groups. DL approaches
not only gained popularity but also became the state-of-the-art in the computer vision field
due to their feature learning capability. Among all deep learning techniques, Convolutional
Neural Networks (CNNs) have shown to be better in a plentiful of problems, including visual
object recognition and detection.
Despite the variety of neural network based architectures proposed in the literature,
common decisive steps in the great majority of CNN-based approaches are to design the
network itself and find a suitable training strategy for the designed architecture. The first
stage involves pre-configuring several hyperparameters for each layer to obtain a satisfying
network architecture, namely the number of filters along with their size and how they will be
initialized, the activation function, the learning rate and the stride. This pre-configuration is
solely guided by empirical trial and error which is ad-hoc and time-costly. Spanning the en
_December_ _4,_ _2023_
tire search space requires numerous neurons in every layer. This increases the computational
cost of the CNN and is prone to overfitting.
Most state-of-the-art CNN networks [10], [12], [13], [14], [15] rely on backpropagation to
train the network, as initially proposed by S. Linnainmaa [16], by incrementally updating
weights with respect to the partial derivative of the error. The gradient-based nature of this
algorithm, alone, comes at a price. One of its drawbacks, is that converging to meaningful
features requires multiple epochs. Indeed, should we have taken large steps, we would have
faced the risk of divergence. In addition, backpropagation is prone to the issue of vanishing
gradients. Another limitation is the fact that shallow layers’ training becomes difficult since
the gradient’s value decreases in the direction of the first layer. Since correctly distributing
and backpropagating the error to shallow layers is challenging, the quality of the features
obtained in these layers is hindered, which negatively impacts the task of feature detection.
Most works in fabric defect detection chose to utilize non-motif based approaches. Motif
based methods, nonetheless, generally have better generality. A fabric is composed of a basic
fundamental unit, called a motif [17], that is reproduced on the fabric by rules of symmetry.
These elementary motifs are considered as manipulation units by motif-based approaches.
To overcome the dependency on the presence of reliable and sufficient training data,
and by capitalizing on motif repetitiveness in fabric, we propose a competitive unsupervised
motif-based approach for fabric defect detection. This approach integrates the strengths
of the Convolutional Neural Network architecture with the advantages of an unsupervised
learning paradigm. It also isn’t subject to the limitations that are posed by backpropagation.
In our approach, both the design of the deep convolutional network architecture and
its training are performed based solely on observations in the input domain, without any
ad-hoc configurations. Before the model is built, we only define the number of layers and
the stride. We don’t define the filter size, number of filters and neither do we initialize
the weights randomly as conventionally done in CNNs, which reduces the time and effort
spent on hyper-parameter initialization. For every convolutional layer, neurons are created
and initialized on a need basis as features are gradually discovered from the input domain,
and until the sufficient number of features is reached. We also do not require any labeled
_December_ _4,_ _2023_
defective samples for training. Therefore, our approach enables fast and efficient training
with low computational cost and high detectability. It yields reliable results and has a high
accuracy rate.
The remaining sections are organized as follows. Section 2 describes the related work,
with a focus on unsupervised methods. In section 3, the proposed approach is described in
detail. The experimental setup and implementation details are provided in section 4 . In
section 5, we demonstrated the experimental results of our approach. Finally, in section 6
we conclude by summarizing the content of this paper and discussing future work.
2. Related work
With the recent years’ success of CNNs, these networks have been widely used in the
computer vision field in general, and in object detection and image segmentation tasks,
in particular. These approaches are particularly suitable for these applications and have
yielded revolutional results due to their ability to automatically extract useful features from
data without the need for hand-crafted features. CNN-based methods have been used both
for fabric defect classification and detection as well.
Several successful network architectures in other detection and classification tasks have
been adapted and utilized for fabric defects’ detection and classification. For instance,
J.Jing et al. (2017) [18] proposed a modified AlexNet for yarn-dyed fabric defect detection,
H. Zhang et al. (2018) [19] introduced a defect location algorithm based on YOLO and Liu
et al. (2019) [20] implemented a computational efficient CNN-based framework (named as
YOLO-LFD) that uses K-means reduction in feature dimensions and provided a compression
of YOLO-v2 [21].
Wei et al. (2019) [22] proposed a hybrid approach that uses CNN with compressed
sensing for defect classification, based on small sample sizes. The reported accuracy of the
implemented approach is 97.9%.
Wu et al. (2020) [23] suggested an automated composite interpolating feature pyramid
(CI-FPN) approach, with deformable convolution filters, for fabric defect detection. This
method uses a cascaded guided region proposal network (CG-RPN) to sort the detected
_December_ _4,_ _2023_
defective regions. The approach was tested on the FBDF dataset and its accuracy reached
80.4% accuracy.
Jeyaraj et al. (2020) [24] presented a ResNet512-based CNN for textile defect detection.
The classification accuracy and precision reported on the TILDA dataset are, respectively,
96.5% and 98.5%. Wen et al. (2020) [25] implemented a PETM-CNN algorithm which
consists of a Patch Extractor algorithm (PE) and a Triplet Metric CNN (TM-CNN) module
that predicts patches’ labels. Their method was mainly designed for the detection of minor
defects and achieved 79.32% accuracy.
Jin et al. (2020) [10] proposed Mobile-Unet, a CNN-based method for fabric defect de
tection, where they replaced the encoding part of U-net [26] with MobileNetV2 [27] Their
implemented method is efficient as it achieves 99.75% and 98.80% accuracy on the YID
and FID benchmark datasets, respectively. The approach is compared with FCN [13], Seg
Net [14], U-Net [15], PTIP [12] on the same fabric datasets and achieves the best performance
both in terms of accuracy and of intersection over union metric.
Due to the need for automatic methods for fabric defect detection, in order to better
tackle the needs of the textile industry, many unsupervised approaches have been proposed.
Since our method is an unsupervised method, we mainly focus on comparing our results with
previous unsupervised approaches. As expected, supervised approaches naturally achieve
better performances than the unsupervised methods, but at the expense of computational
and time complexity, especially in the training phase. Although unsupervised approaches
may achieve a comparable recall score with respect to supervised approaches, their precision
and f1-score tend to be lower. In the following, we outline some of the state-of-the-art
unsupervised approaches developed for fabric defect detection over the years. We later
compare their performance against that of our approach in the Results section 5 .
H. Ngan et al. (2005) [8] developed Wavelet preprocessed golden image subtraction
(WGIS), a Wavelet-transform based method for fabric defect detection. A first-level ap
proximation is extracted with Haar WT, then GIS is applied on the approximated subimage
to detect defects.
H. Ngan and G. Pang (2006) [28] introduced a new application of Bollinger Bands (BB)
_December_ _4,_ _2023_
for patterned fabric defect detection, with the concept of the moving average. This method
is efficient, it nonetheless fails to detect small defects and defects with only light color
differences from the background.
H. Ngan and G. Pang (2007) [29] proposed a fabric defect-detection method based on
regularity. This method builds on enhancing and segmenting defective regions through mov
ing averages and standard deviations. The method’s strong suit is its simplicity. However,
it is not as successful in detecting defects near the borders.
V. Asha et al. (2011) [7] utilized texture periodicity and Gabor kernels to analyze faulty
blocks by utilizing Ward’s clustering. The most important limitation of this technique is
that it cannot be used to validate defect-free images.
Anitha et al. (2013) [30] proposed a method that can succeed in characteristic extraction,
by analyzing cloth defect images using Gabor wavelet network and an independent compo
nent. This approach is only valid for patterned fabric containing a parallelogram, rectangle,
square or a hexagonal shape. These types of fabric patterns are the most common in the tex
tile domain, they are hence easy to learn. On the contrary, other less common and irregular
shapes along with non-uniform brightness and low contrast raise an unanswered challenge.
M. Ng et al. (2014) [31] suggested an approach based on image decomposition (ID). The
model decomposes the image into a cartoon structure that contains defective areas of the
input image and a texture structure.
C. Tsang et al. (2016) [32] introduced the Elo rating method (ER). This approach uses
an Elo point matrix to match between partitions of standard size from the input image.
Strong defects result in high Elo points whereas light defects result in low Elo points. This
method has a drawback in Netting Multiple and Hole defects.
G. Hu et al. (2015) [33] proposed an unsupervised approach for defect detection us
ing Fourier analysis and Wavelet shrinkage. The gradient distribution of the input image’s
Fourier spectrum is analyzed and components representing defect-free regions are eliminated
using Discrete Fourier Transform (DFT) and zero-masking. As a result, the Inverse Fourier
Transform (IDFT) contains almost only defect-free information. The Fourier restored resid
ual image is then denoised using Discrete Wavelet Transform (DWT). Reconstructions from
_December_ _4,_ _2023_
the approximation and wavelet coefficients are thresholded which results in two binary fil
tered images, containing respectively low-frequency information and high-frequency infor
mation of the defect. Fusion is then performed to merge these two images and obtain a
final segmentation of the defect for the input image. The advantage of this method is that
it requires no reference images and performs well on plain textile. However, changes in
illumination, scale or orientation of the input images result in poor results.
J. Zhou et al. (2016) [34] introduced a fully unsupervised fabric defect detection method
by using local patch approximation. The first step of their approach is the extraction of
overlapping patches from the input image without distinguishing between defect-free and
defective patches. After that, a threshold is set on the Euclidian distance between every
patch and the data center which allows to cast out outlier patches, while only keeping
defect-free patches in a dictionary. Following that, an abnormality map is constructed by
subtracting patches previously stored from the input image, then segmentation is performed
on the output in order to obtain a binary image of defective areas. Similarly to the previous
approach, this method does not require reference images. However, due to this, the recall
rate is sacrificed in favor of the detection rate which leads to a high false detection rate.
A. A. Hamdi et al. (2018) [35] proposed an automatic unsupervised patterned fabric
defect detection algorithm that uses standard division filtering and k-means clustering. In
this approach, the filtering operation highlights the defected area using a small window
while the clustering is used to classify the different defected blocks in fabric images. While
this method achieves good accuracy, many preprocessing steps are necessary to obtain good
results. Indeed, changes in contrast, histogram equalization along with two different types
of filtering are applied to images to ensure a good performance.
More recently, there has been a growing interest in unsupervised deep learning and neural
networks-based approaches which combine the advantages that deep learning offers along
with the benefits of the unsupervised paradigm.
Y. Li et al. (2016) [36] proposed a defect detection system using Fisher Criterion-based
Stacked Denoising Auto-Encoders (FCSDA) to classify fabric patches into defect-free and
defective regions. They gathered a dataset of both categories and divided the images into
_December_ _4,_ _2023_
patches of the same size while manually labeling them in order to train the FCSDA, which
consists of four hidden layers and a softmax output layer. A set of patches is classified
through the FCSDA and the residual between the reconstructed image and the defective
patch is calculated. Then, the defect is located through thresholding. The residual error for
the output layer is computed and it is iterated for other layers using the fisher criterion as
a loss function for the SDA. This method can reach a good detection accuracy, especially
on plain fabric. Nonetheless, the pretraining subprocess is very time-consuming due to
the complexity of the FCSDA framework. Also, this method requires that each Fabric
be photographed from different angles. Additionally, several hyper-parameters should be
initialized such as the learning rate and the number of neurons per layer.
Seker et al. (2017) [37] implemented a deep learning method for fabric defect detection
using autoencoders. They focused on tuning the hyperparameters of the autoencoder-based
model in order to improve feature extraction and get better classification results. Their
method showcased a high detection accuracy. However, their dataset was created manually
under ideal and perfect shooting conditions. Furthermore, this method requires tuning many
hyperparameters and only works on woven fabrics.
S. Mei et al. (2018) [38] proposed an unsupervised fabric defect detection model based
on Multi-Scale Convolutional Denoising Auto-Encoder networks (MSCDAE). Patches of
different sizes are randomly extracted and every pixel is later characterized based on its
local neighborhood. The model is trained on defect-free samples. Hence, the filters in
the trained model react differently to defective patches than to defect-free patches, large
response vs. low, respectively. Thus, by measuring the residual between the response and
the original image, defective areas can be detected after gathering results from the top of the
pyramid layers. This method achieves good results on simple fabrics but fails to correctly
detect defects on complex textures. Additionally, several preprocessing steps are required
such as illumination normalization, and noise corruption of the patches.
L. Liu et al. (2018) [39] introduced a novel fabric defect classification method using
Extreme Learning Machines (ELM) based on a single hidden layer feedforward network
algorithm. In their approach, defect segmentation was divided into four steps, namely feature
_December_ _4,_ _2023_
extraction, ELM classifier training, Bayesian probability fusion and defect segmentation.
Albeit the great performance of this method on common woven fabrics, it can’t yield good
results on other fabric types and textures.
G. Hu et al. (2019) [40] presented a method for detecting the defects using a Deep Con
volutional Generative Adversarial Network (DCGAN) and ConvNet models. This approach
first consists in creating a query from the defected image’s space and subtracting it from
the original image. Then, defect occurrence probabilities are calculated. This is followed by
several steps to increase the accuracy rate. Although this method follows an unsupervised
scheme, it needs defect free fabric images in order to train the network model. Moreover,
both generating a reconstructed image and calculating defect probabilities require significant
computational power.
H. Tian and F. Li (2019) [41] proposed an iterative autoencoder-based approach with
cross-patch similarity. For every testing patch, this method finds the similar non-defective
patches and weighs their corresponding latent variables to modify the original latent variable
of the patch. It then detects defected areas from the reconstruction residual with a decoder.
This method, however, requires several iterations to converge.
The main contributions of our work are:
1. We only need one defect-free sample per fabric type in our training phase, the diffi
culties of finding sufficient defective samples are thus avoided without performing any
data augmentation;
2. We don’t necessitate pictures of different angles in our defect detection scheme;
3. We avoided applying any preprocessing steps to our images, except for histogram
equalization;
4. Our unsupervised training does not have large computational or time requirements
and no pretraining is needed;
5. We reduced the number of hyperparameters in our approach compared to classical
CNN methods, in order to avoid hyper-parameter tuning which is time-consuming;
6. Our training is performed without the backpropagation mechanism which allows us
_December_ _4,_ _2023_
to converge to meaningful features in a single epoch and in less time than other deep
learning based approaches;
7. Only one hidden layer is usually enough to achieve comparable results and no random
initialization of weights is done;
8. Our method achieves an accuracy that is as high as the state-of-the-art methods with
higher recall, precision and f1-score.
3. Methodology
Figure 1: Schematic description of anomaly detection stages
Our approach consists of five main steps, which can be organized in three main phases :
- The first phase corresponds to steps carried out before training, namely preprocessing
(section 3.1. ), automatic pattern period extraction (section 3.2. ) and patch extraction
(section 3.3. ).
- The second phase corresponds to training. After patch extraction, training is done in
an unsupervised manner and mainly consists of the features’ selection step (section
3.4. ).
- The last phase, which is testing, corresponds to the anomaly detection step (section
3.5. ).
Figure 1 shows the overall detection scheme of our approach.
_December_ _4,_ _2023_
_3.1._ _Preprocessing_
Fabric images’ acquisition is usually performed with digital cameras that may suffer
from poor contrast, which impacts the detection. To mitigate these undesirable effects, the
contrast of the input images needs to be adjusted.
We have tested several contrast enhancement approaches like gamma correction, linear
adjustment, adaptive histogram equalization and histogram equalization. The simple his
togram equalization yielded the best results in terms of final scores of our detection approach.
It is hence used for both training and testing images.
Once histogram equalization is completed, we divide the pixel values by 255 in order to
normalize them between [0,1], followed by data standardization as shown in Equation (1)
and Equation (2).
_I_ _←_ _I_ _−_ _µ_ (1)
_I_ _←_ <sup>_<u>I</u>_</sup> (2)
_σ_
With _µ_ and _σ_ being the mean and the standard deviation of _I_, respectively.
_3.2._ _The_ _period_ _of_ _the_ _pattern_
In order to detect defects correctly, the determining the patch size of the patches is
critical. Extracting the period of the pattern from the input image has proven to be powerful
for the analysis of defective images. Defects can be detected in an easier way if the input
image is divided into patches that have the same size following the periodicity.
In order to obtain the period for the input image, we calculate the row-wise average and
the column-wise average of the intensity values of the image. Let _I_ be a fabric image of size
_W_ _x_ _H_, the averages are then obtained byEquation (3) and Equation (4) below.
_I_ ( _k, j_ ) ; _k_ = 1 : _W_ (3)
_December_ _4,_ _2023_
<u>1</u>
_R_ ( _k_ ) =
_W_
_W_
_j_ =1
<u>1</u>
_C_ ( _k_ ) =
_H_
_H_
_i_ =1
_I_ ( _k, i_ ) ; _k_ = 1 : _H_ (4)
Using auto-correlation on each of the two obtained vectors allows us to extract the period
along each of these directions by measuring the distances between the successive peaks.
Finally, taking the median of these distances has proven to be a good way to get the final
periodicity value. These steps are illustrated in Figure 2.
Figure 2: (a) Box-patterned defect-free image; (b) Row-wise average vector; (c) Column-wise average
vector; (d) Auto-correlation for the row direction; (e) Successive peaks detection
_3.3._ _Extraction_ _of_ _the_ _patches_
Given a _W_ _x_ _H_ input image _I_ _,_ _p_ _x_ _p_ patches are cropped from the image _I_ where the
patch size _p_ corresponds to the period found in the previous section. This patch size will be
_December_ _4,_ _2023_
Figure 3: Illustration of the patch extraction step with overlapping division
referred to as the _filter_ _window_ _size_ or the _filter_size_, it corresponds to the receptive field
of the neural network.
As shown in Figure 3, these patches are extracted and stored in a row by row manner,
using overlapping division. Patches thus share partial regions with their neighbors in column
and rows directions. Let _o_ be the stride parameter that controls the overlap, the total
number of patches in image I can be calculated using Equation (3) :
_._
- _<u>H</u>_ _<u>−</u>_ _<u>p</u>_
_o_
(3)
_Npatches_ =
- _<u>W</u>_ _<u>−</u>_ _<u>p</u>_
_o_
In the end, an array of shape _(Npatches,_ _p_ _x_ _p)_ is obtained for every input image. In training,
each of the patches extracted from the training image(s) is a candidate for the feature
selection step that is detailed in section 3.4 .
In the testing phase, patches are extracted the same way and are used for image segmen
tation (anomalous vs. defect-free). This stage will be explained in section 3.5 .
Classifying a pixel by taking local neighborhood information into consideration has
proven to be more robust than using a single pixel at a time. Nonetheless, the size of
_December_ _4,_ _2023_
this neighborhood is data dependent. In our approach, the neighborhood size which cor
responds to the filter window size gets larger as we progress towards deeper layers, which
allows us to capture features at different scales, and hereby detect defects of different scales
later on, if need be. Layers can be added on a need basis, depending on the input domain.
For deeper layers, patches are extracted from the feature maps obtained by correlating
the features of the previous layer with the training reference image. This is illustrated in
lines 4 to 6 of the algorithm in Figure 4, and detailed in section 3.4..
In some cases, some of these extracted patches do not contain any meaningful informa
tion. Therefore, before training and features selection, we start by performing a variance
based elimination in order to trim useless patches. If the variance of the pixels in a patch
is inferior to a defined contrast threshold, the patch is discarded. Otherwise, it is kept as a
candidate for the next step which is filters selection.
Finally, these patches are shuffled to avoid feature selection being biased by the patches’
position in the input image and to ensure that every data patch creates an independent
impact on the weights.
After this step, we obtain a matrix _P_ of shape _(Nusefulpatches,_ _p_ _x_ _p)_ containing all of the
useful extracted patches that features will be selected from.
_3.4._ _Selection_ _of_ _the_ _features_
The training of our network mainly consists of this feature selection step. After this step
is complete, the filter weights are deemed non-trainable and are used in the detection of
anomalies step detailed in section 3.5 and no additional training is performed. Both the
training and testing phases are shown in Figure 4
We do not provide the number of filters at any point, neither in model building nor in
training. Features are dynamically selected progressively based on similarity calculation,
depending on the input domain, following the filter discovery scheme performed by T. Erkoç
and T. Eskil, An unsupervised approach for filter discovery in convolutional neural networks
(under review).
As a consequence, the only parameter that needs to be set is a similarity threshold.
_December_ _4,_ _2023_
Figure 4: Illustration of the architecture of our network. An example with two layers. Note : More layers
can similarly be added on a need basis - depending on the input domain - and connected in the same way.
The selection of features starts by calling the function _TrainLayer_ shown in Figure 5. This
function takes the current Layer _L_ and an array _I_ containing training images as inputs.
Layers are initially empty. The very first patch _P_ 0 for every layer is always stored as
the first feature _F_ 0, since no filters exist at this point. Supporters _C_ 0 are the number of
samples that contribute to the extracted feature, and they count as 1 for this newly added
feature _F_ 0.
For every other candidate patch _P_ _i_, we calculate the similarity between this patch and all
previously saved feature(s) by using dot product(s). These values are stored in a similarity
array _S_ . What interests us the most is the feature _F_ _j_ that is most similar to our candidate
patch, so we find the maximum value of the calculated similarity scores, _S_ _j_ . These similarity
_December_ _4,_ _2023_
scores are in the [0,1] interval, and so is our similarity threshold.
If _S_ _j_ is lower than a similarity threshold, it means that the candidate patch is not similar
enough to any of the already saved features and it needs to be saved as a new feature of
the current layer since it contains new information that was not encountered so far. A new
filter is thus created, and its supporter count is set to _C_ _j_ = 1 .
On the other hand, if _S_ _j_ is higher than the similarity threshold, it means that we already
saved a similar feature _F_ _j_ . In this case, _P_ _i_ becomes a supporter of _F_ _j_ . Its supporters count
_C_ _j_ is thus incremented and the weights are updated accordingly.
_Fj_ = _Fj_ + ∆ (6)
_Cj_ = _Cj_ + 1 (7)
with : ∆= ( _Pi_ _−_ _Fj_ ) _/_ ( _Cj_ + 1)
When all patches are processed, feature selection for the input layer is completed. For
the input layer, the input image’s patches are rawly fed to the training step. However, in
order to add other deeper layers, extracted features of the previous layer are correlated with
the previous input image and this correlation result is stored in _I_ .
The correlation performed is a cross-correlation with symmetrical boundary conditions
that outputs a 2D array of the same size as the input image. Following that, _stride_ _x_ _stride_
downsampling is performed on this image which serves as the new _I_ input for the _TrainLayer_
function.
Downsampling is performed by slicing the feature maps with respect to the _stride_ . It
corresponds to taking elements with a step of _stride_ every time, across the height and width
dimensions, from the array containing the feature maps. For instance, if the _stride_ parameter
is set to 2, this would correspond to taking every other pixel from the image, both in the
column and row directions. Every time, we would take one pixel, skip the other, and then
take the next pixel, etc. In the end, we would have an image that has half the width
and half the height of the original image. As a result, performing patch extraction on the
_December_ _4,_ _2023_
downsampled feature maps using the same initial _filter_size_, would be as if we were doing
patch extraction with an effective window twice as wide on the original image.
Let _L_ be our current layer, _L-1_ the previous layer and _s_ the stride. The effective window
size (on the original image) for layer _L_ after downsampling, albeit using the same filter width
for patch extraction can be expressed as shown in Equation (4) :
_Window_ _ _size_ _L_ = _Window_ _ _size_ _L−_ 1 _. s_ (4)
After the features of the input layer are correlated with the input image and downsam
pled, feature extraction for deeper layers is then carried the same way, repeating all the
steps mentioned in this section.
In the above designed scheme, it is assumed that the features selected in the previous
section only capture defect-free information from the training image(s). It is therefore neces
sary to cast out any defective patches before feature selection to ensure the filters discovered
do not contain abnormal elements. Training should hereby be done on defect-free images.
_3.5._ _Detection_ _of_ _anomalies_
_3.5.1._ _Defect_ _probability_ _map_
On the account of training on defect-free samples only, patches selected as features
strictly contain defect-free information. Intuitively, the difference between these features
and patches extracted from the testing image can be used as a clue for defect identification
on the input image. Indeed, a distance metric, such as Manhattan distance, can be used to
highlight this difference in order to detect anomalies.
The Manhattan distance between two patches _A_ and _B_ of the same height and weight
_p_ is calculated by :
_d_ ( _A, B_ ) = <sup>�</sup> _i_ <sup>_p_</sup> =1
- _pj_ =1 <sup>_|aij_</sup> <sup>_−_</sup> <sup>_bij|_</sup> (8)
The output of this measure is normalized to fall in the [0,1] interval. In this case, the
distance score obtained is inversely similar to the similarity score used in training. It can
be regarded as a dissimilarity score.
_December_ _4,_ _2023_
Figure 5: Algorithm for the feature selection step
_December_ _4,_ _2023_
Thereupon, we can introduce an anomaly threshold to label patches as either anomalous
or anomaly-free. Here again, we focus on the highest similarity value obtained which corre
sponds to the lowest distance in this case. Another cut-off value intervenes at this stage to
decide if a patch is defective or not. This value will be referred to as the _anomaly_ _threshold_ .
If the distance score is lower than the _anomaly_ _threshold_, it means that the patch is very
similar to one of our features and hence is not an anomaly. On the contrary, if this score is
higher than the _anomaly_ _threshold_, it indicates that the patch is not similar enough to any
of our saved filters and that the probability of this patch being defective is high. This patch
is therefore labeled as anomalous.
Different defect probabilities are affected to the different pixels in the defective patch.
Probability information is ponderously distributed in a way that it is the highest for the
central pixel and the lowest in the patch’s boundaries. The weight of every pixel in the
patch is determined by a two-dimensional symmetric Gaussian kernel such as :
<u>1</u> _G_ ( _i,_ _j_ ) = 2 _πσ_ <sup>2</sup> <sup>_exp_</sup> _−_ <sup>_<u>i</u>_</sup> <sup>2</sup> 2 <sup><u>+</u></sup> _σ_ <sup>2</sup> <sup>_<u>j</u>_</sup> <sup>2</sup>
(9)
Due to the overlapping division used in patch extraction, every single pixel is included in
many patches, at different positions in every patch and every time with different neighbors.
Additionally, every layer adds anomalies to construct the final anomaly output. As previ
ously mentioned, the window size grows as we progress towards deeper layers, proportionally
to the stride parameter.
In the end, we obtain a final defect probability image is obtained where the value of
every pixel indicates the certainty of that pixel’s defectiveness. The higher that value, the
more certain we are of that pixel being anomalous.
_3.5.2._ _Defect_ _segmentation_
After we obtain an image containing defect-probability information, this image needs to
be binarized in order to get a proper anomaly segmentation. For such a binarization, finding
the best threshold value is critical.
Maximum two-dimensional entropy [42] was chosen for this step because it takes neigh
borhood information into consideration, as opposed to the global thresholding methods.
_December_ _4,_ _2023_
Local relative entropy measures the difference of the brightness of a pixel from the mean
brightness of its neighborhood:
- If the brightness of a pixel is similar to its neighbours - this is usually the case when
a pixel and its neighborhood belong to the same class (background class vs. anomaly
class) - the local relative entropy is small.
- On the other hand, if the brightness of a pixel is very different from that of its neighbors
- this is the case when the pixel is either noise or an edge pixel - the local relative
entropy is high.
Given a _n_ _x_ _n_ neighborhood with _L_ distinct grayscale intensity levels, the mean grayscale
intensity level value of this neighborhood is :
( _n−_ 1) _/_ 2
_j_ = _−_ ( _n−_ 1) _/_ 2
_I_ ( _x, y_ ) = <sup><u>1</u></sup>
_n_ <sup>2</sup>
( _n−_ 1) _/_ 2
_i_ = _−_ ( _n−_ 1) _/_ 2
_I_ ( _x_ + _i, y_ + _j_ ) (10)
The joint probability of pixel pairs ( _i,_ _j_ ) = ( _I_ ( _x, y_ ) _,_ _I_ ( _x, y_ )) is _pij_ ( _i,_ _j_ = 1 _,_ 2 _,_ _...,_ _L−_ 1).
The entropy _H_ _B_ for the background region with intensity less than _(s,_ _t)_ and the
entropy _H_ _A_ for the anomaly with intensity higher than _(s,_ _t)_ are represented as :
- _<u>pij</u>_
_P_ 1
- _<u>pij</u>_
_P_ 2
(11)
(12)
log
log
- _<u>pij</u>_
_P_ 1
- _<u>pij</u>_
_P_ 2
with : _P_ 1 = <sup>�</sup> _i_ <sup>_s_</sup> =0 <sup>_−_</sup> <sup>1</sup>
and : _P_ 2 = <sup>�</sup> _i_ <sup>_L_</sup> = <sup>_−_</sup> _s_ <sup>1</sup>
_HB_ ( _s, t_ ) = <sup>�</sup> <sup>_s_</sup> _i_ =0 <sup>_−_</sup> <sup>1</sup>
- _t−_ 1
_j_ =0 <sup>_pij_</sup>
_HA_ ( _s, t_ ) = <sup>�</sup> <sup>_L_</sup> _i_ = <sup>_−_</sup> _s_ <sup>1</sup>
- _L−_ 1
_j_ = _t_ <sup>_pij_</sup>
- _t−_ 1
_j_ =0
- _L−_ 1
_j_ = _t_
Then, the total entropy of the image _H_ _I_ is :
_HI_ = _HB_ + _HA_ (13)
The ideal threshold vector is _(s*,_ _t*)_ that satisfies :
_H_ ( _s∗,_ _t∗_ ) = _max {HI_ ( _s, t_ ) _}_ (14)
Finally, opening is applied to the image to remove noise from the image, if any, while
smoothing the border of the anomaly result.
_December_ _4,_ _2023_
4. Experiments
_4.1._ _Dataset_
Our experiments were performed on the Patterned Fabric dataset [43] provided by the
Industrial Automation Research Laboratory, Dept. of Electrical and Electronic Engineering
of the University of Hong Kong. This dataset contains images of three kinds of patterns :
dot-patterned, box-patterned and star-patterned. There are 25 defect-free samples and 25
defective samples per fabric type including broken end, hole, netting multiple, thick bar and
thin bar (5 samples from each defect type). These defect types are shown in Figure 8.
_4.2._ _Experimental_ _setup_
_4.2.1._ _Training_ _and_ _testing_ _sets_
We used both Box-patterned and Star-patterned sub-datasets in order to showcase our
results.
Training was performed on one defect-free sample per fabric type and testing was done
on the remaining images (defect-free and defective). Training was completed in 11 seconds
for the Star-patterned defect-free sample and in 10 seconds for the Box-patterned defect-free
sample.
_4.2.2._ _Preprocessing_ _and_ _patch_ _extraction_
- No data augmentation technique was applied for either of the datasets;
- Following the steps mentioned in section 3.2 . The pattern periods for the Box
patterned and Star-patterned fabric types were found to be, respectively, 26 x 24 and
21 x 16. These are shown in Figure 6. Considering that we are using square patches
for our approach, we took the maximum of the period on the row direction and that on
the column direction and added 1 to it to make it an odd number if it wasn’t already.
This resulted in a _filter_size_ of 27 for Box-patterned and 21 for Star-patterned;
- In both training and testing,
_December_ _4,_ _2023_
– patches were extracted in a row by row manner as explained in section 3.3 with
an overlapping of 1 pixel in both row and column directions;
– the contrast threshold for useless patches’ elimination prior to features selection
was set to 0;
Figure 6: (a) Defect-free Box-patterned sample with 26 x 24 period ; (b) Defect-free Star-patterned sample
with 21 x 16 period.
_4.2.3._ _Anomaly_ _threshold_ _determination_
In order to choose the appropriate anomaly threshold and to make sure our anomaly
detection will only capture defective patches, we registered the response of the network to
the defect-free sample training was performed on. For every pixel of the training image,
we saved the minimum distance value (the distance to the closest feature). Following that,
the maximum of these values across all pixels was taken as the threshold for the anomaly
detection phase described in section 3.5 .
_December_ _4,_ _2023_
_4.2.4._ _Network_ _structure_
Experiments were conducted with a network of one layer. One epoch is enough to train
the layer and no further training is needed on the filters’ weights after the feature selection
step explained in section 3.4., showcased by the algorithm in Figure 5. As soon as features
are selected, their weights are deemed non-trainable and are later on used in the anomaly
detection step. Figure 7 shows the details of the model that was built for experiments.
Figure 7: Overall Architecture for the Training and Testing phases of the Network used in the experiments.
_4.3._ _Performance_ _measurement_ _metrics_
Ground-truth defect masks are available in the dataset. Those ground-truth images were
used for the evaluation of the performance of our approach. Examples of these ground truth
images are shown in Figure 8.
Each pixel in the results is then classified as either TP, TN, FP or FN by comparing it
to the ground truth image with:
- _TP_ _(true_ _positives)_ _:_ number of defective pixels that are correctly identified as defec
tive;
_December_ _4,_ _2023_
- _TN_ _(true_ _negatives)_ _:_ number of defect-free pixels that are correctly identified as
defect-free;
- _FP_ _(false_ _positives)_ _:_ number of defect-free pixels that are incorrectly identified as
defective;
- _FN_ _(false_ _negatives)_ _:_ number of defective pixels that are incorrectly identified as
defect-free.
After that, the _True_ _positive_ _rate_ _(TPR),_ _True_ _negative_ _rate_ _(TNR),_ _False_ _negative_ _rate_
_(FNR),_ _False_ _positive_ _rate_ _(FPR),_ _Positive_ _predictive_ _value_ _(PPV),_ _Accuracy_ _(ACC)_ and
_F1-score_ _(F1)_ evaluation metrics are computed. These metrics respectively correspond to
the equations from Equation (15) to Equation (21).
_<u>TP</u>_
_TPR or_ _Recall_ = (15)
_TP_ + _FN_
_<u>TN</u>_
_TNR or_ _Selectivity_ = (16)
_FP_ + _TN_
_<u>FN</u>_
_FNR or_ _Missed detection rate_ = (17)
_TP_ + _FN_
_<u>FP</u>_
_FPR or_ _False alarm rate_ = (18)
_FP_ + _TN_
_<u>TP</u>_
_PPV_ _or_ _Precision_ = (19)
_TP_ + _FP_
_<u>TP</u>_ <u>+</u> _<u>TN</u>_
_ACC_ _or_ _DSR_ = (20)
_TP_ + _TN_ + _FP_ + _FN_
_F_ 1 = 2 _._ <sup>_<u>Precision . Recall</u>_</sup> (21)
_Precision_ + _Recall_
_December_ _4,_ _2023_
Figure 8: Illustration of Box-patterned and Star-patterned samples with their ground-truth images. (a)
Broken End; (b) Hole; (c) Netting multiple; (d) Thick Bar and (e) Thin Bar.
5. Results and discussion
Illustrations of the anomaly detection output can be seen in Figure 9. The corresponding
scores of the experiments run with the above mentioned parameters will be explained in
detail in section 5.2.
_December_ _4,_ _2023_
Figure 9: Examples of anomaly detection results on the Box-patterned and Star-patterned samples : (a)
input image; (b) ground truth image; (c) weighted defect probability map after anomaly detection; (d)
final binarized result after 2D Max Entropy.
_December_ _4,_ _2023_
_5.1._ _Features_ _selected_
The number of features extracted essentially depends on the fabric type. The average
number of filters selected in training with threshold =0.7 was 320 on the Box-patterned
reference image and 451 on the Star-patterned reference image.
Examples of obtained features for both Fabric types can be seen in Figure 10. We can
see that all learned filters correspond to intuitive representations of the input domain and
exhaustively represent the fabric textures in their different variations.
Figure 10: Illustration of features extracted from the two training samples used, Box-patterned and Star
patterned.
_December_ _4,_ _2023_
_5.2._ _Performance_ _evaluation_
Our model’s performance by defect type and by fabric type is summarized, for the Box
patterned samples and the Star-patterned samples, by the scores respectively displayed in
Table 1 and Table 2. We showcase the performance of our proposed approach compared
to the other approaches that used the unsupervised learning paradigm. The methods were
compared on the same benchmark Star-patterned fabric samples and are shown in tables
from Table 2 to Table 7, where the best scores are highlighted in bold. The approaches
we compare to are (in chronological order) Wavelet Golden Image Subtraction (WGIS) [8],
Bollinger Bands (BB) [28], Regular Bands (RB) [29], Image Decomposition (ID) [31], Elo
Rating method (ER) [32], Stacked Denoising Auto-Encoder (SDAE) [36], Fisher Criterion
Based Stacked Denoising Auto-Encoder (FCSDA) [36], Multi-Scale Convolutional Denoising
Auto-Encoder (MSCDAE) [38] and Cross-Patch Similarity Auto-encoder (CPSAE) [41] .
<u>Table</u> <u>1:</u> _<u>Overall</u>_ <u>scores</u> <u>on</u> <u>the</u> _<u>Box-patterned</u>_ <u>fabric</u> <u>type</u> <u>per</u> <u>defect</u> <u>type</u>
Defect type DSR Recall Precision F1-score
Broken End 0.98 0.81 0.54 0.65
Hole 0.99 0.37 0.63 0.47
Netting Multiple 0.98 0.41 0.42 0.42
Thick Bar 0.98 0.90 0.67 0.77
Thin Bar 0.97 0.58 0.25 0.35
Defect-free 1.00 N/A N/A N/A
Overall 0.98 0.70 0.52 0.60
Our method achieves the best overall detection performance as presented in Table 2
across all other methods. In Table 3 to Table 7, it can be seen that our approach achieves
the highest scores and hence performs far better than the other approaches on most defect
types with a high accuracy rate and higher recall, precision and f1-score. Moreover, all
defect-free images were detected correctly for both fabric types.
_December_ _4,_ _2023_
<u>Table</u> <u>2:</u> _<u>Overall</u>_ <u>scores</u> <u>on</u> <u>the</u> _<u>Star-patterned</u>_ <u>fabric</u> <u>type</u>
Method DSR Recall Precision F1-score
WGIS 0.96 0.01 0.01 0.01
BB 0.98 0.11 0.27 0.15
RB 0.98 0.10 0.37 0.15
ID 0.98 0.81 0.40 0.50
ER 0.99 0.33 0.20 0.25
SDAE 0.98 0.38 0.32 0.31
FCSDA 0.99 0.64 0.47 0.52
MSCDAE 0.98 0.30 0.32 0.30
CPSAE 0.99 0.66 0.50 0.55
Ours 0.99 0.85 0.71 0.77
<u>Table</u> <u>3:</u> <u>Scores</u> <u>for</u> <u>the</u> _<u>Broken</u>_ _<u>End</u>_ <u>defect</u> <u>type</u> <u>on</u> _<u>Star-patterned</u>_ <u>fabric</u> <u>type</u>
Method DSR Recall Precision F1-score
WGIS 0.96 0.00 0.00 0.00
BB 0.98 0.03 0.03 0.03
RB 0.99 0.05 0.08 0.06
ID 0.98 0.76 0.18 0.29
ER 0.98 0.09 0.07 0.08
SDAE 0.99 0.74 0.24 0.36
FCSDA 0.99 0.70 0.25 0.37
MSCDAE 0.99 0.35 0.25 0.29
CPSAE 0.99 0.77 0.40 0.53
Ours 0.99 0.85 0.40 0.54
_December_ _4,_ _2023_
Table 4: <u>Scores</u> <u>for</u> <u>the</u> _<u>Hole</u>_ <u>defect</u> <u>type</u> <u>on</u> _<u>Star-patterned</u>_ <u>fabric</u> type
Method DSR Recall Precision F1-score
WGIS 0.96 0.00 0.00 0.00
BB 0.99 0.03 0.08 0.04
RB 0.99 0.07 0.26 0.11
ID 0.97 0.72 0.33 0.46
ER 0.98 0.24 0.12 0.16
SDAE 0.99 0.31 0.20 0.24
FCSDA 0.99 0.11 0.14 0.12
MSCDAE 0.99 0.36 0.28 0.32
CPSAE 0.99 0.71 0.40 0.51
Ours 0.99 0.81 0.49 0.62
Table 5: Scores <u>for</u> <u>the</u> _<u>Netting</u>_ _<u>Multiple</u>_ <u>defect</u> <u>type</u> <u>on</u> _<u>Star-patterned</u>_ fabric type
Method DSR Recall Precision F1-score
WGIS 0.95 0.01 0.01 0.01
BB 0.98 0.12 0.37 0.18
RB 0.98 0.15 0.48 0.23
ID 0.99 0.82 0.57 0.67
ER 0.98 0.16 0.13 0.14
SDAE 0.98 0.08 0.21 0.12
FCSDA 0.99 0.14 0.32 0.20
MSCDAE 0.98 0.34 0.45 0.39
CPSAE 0.99 0.61 0.62 0.62
Ours 0.99 0.90 0.64 0.75
_December_ _4,_ _2023_
Table 6: Scores <u>for</u> <u>the</u> _<u>Thick</u>_ _<u>Bar</u>_ <u>defect</u> <u>type</u> <u>on</u> _<u>Star-patterned</u>_ <u>fabric</u> type
Method DSR Recall Precision F1-score
WGIS 0.93 0.04 0.05 0.05
BB 0.97 0.31 0.63 0.41
RB 0.97 0.20 0.77 0.31
ID 0.99 0.94 0.80 0.87
ER 0.97 0.70 0.55 0.61
SDAE 0.99 0.70 0.94 0.80
FCSDA 0.99 0.63 0.98 0.77
MSCDAE 0.96 0.16 0.36 0.22
CPSAE 0.97 0.45 0.56 0.50
Ours 0.99 0.81 0.91 0.86
Table 7: <u>Scores</u> <u>for</u> <u>the</u> _<u>Thin</u>_ _<u>Bar</u>_ <u>defect</u> <u>type</u> <u>on</u> _<u>Star-patterned</u>_ <u>fabric</u> type
Method DSR Recall Precision F1-score
WGIS 0.95 0.00 0.00 0.00
BB 0.99 0.07 0.22 0.10
RB 0.99 0.03 0.28 0.06
ID 0.95 0.82 0.14 0.24
ER 0.97 0.45 0.13 0.20
SDAE 0.98 0.31 0.22 0.25
FCSDA 0.98 0.57 0.34 0.43
MSCDAE 0.98 0.32 0.26 0.29
CPSAE 0.99 0.74 0.50 0.60
Ours 0.99 0.81 0.91 0.86
_December_ _4,_ _2023_
On the Thick Bar and Thin Bar defect types, only the ID method has a better recall rate
but at the cost of a lower precision (much lower on the Thin Bar defect type). With a rather
close recall rate, and a much higher precision, our method achieves a good compromise
between precision and recall which is showcased by a comparable f1 score on the Thick Bar
defect type and a considerably higher f1-score on the Thin Bar defect type.
To visually distinguish the effectiveness of our approach, we plot the ROC curve and the
Precision-Recall curves on both Box-patterned and Star-patterned fabric types in Figure 11
and Figure 12. It can be noticed that the chosen value in the anomaly threshold determina
tion in section 4.2.d., namely 0.5, is the one that gives the best trade-off between Recall
and Precision and between Recall and FPR.
Figure 11: Precision-Recall and ROC curve on the Box-patterned fabric type with 0.7 as a training threshold
and different thresholds for anomaly detection (with a step of 0.1).
_5.3._ _The_ _effect_ _of_ _parameters_
When the similarity threshold is too small (below 0.5), fewer patches are selected as
features in training. This results in an under fitting on the training data. Consequently,
false negatives increase in the anomaly detection phase. When this threshold is too large
(usually 0.75 or higher), it leads to overfitting the training data. This increases the number
of false positives in anomaly detection.
When the anomaly threshold is too high compared to the threshold, fewer patches of
the input testing image are labeled as defective. This leads to an increase of false negatives.
_December_ _4,_ _2023_
Figure 12: Precision-Recall and ROC curve on the Star-patterned fabric type with 0.7 as a training threshold
and different thresholds for anomaly detection (with a step of 0.1).
On the other hand, if this threshold is much lower than the similarity threshold, this causes
false positives to increase since more patches are deemed defective.
When the filter size is smaller than the pattern period, the selected features fail to capture
sufficient discriminative information for representing fabric textures. Moreover, when this
filter size is smaller than the defect size in particular, the model’s ability to distinguish
defects declines. On the contrary, when the filter size is larger than the pattern period,
selected features end up containing more complex texture information and this also affects
the model’s performance negatively. The impact of all these parameters is illustrated in
Figure 13.
_5.4._ _Analysis_ _of_ _the_ _computational_ _cost_
To further showcase the efficiency of our algorithm, it is compared against the other
deep-learning based methods that have been used for fabric defect detection.
Table 8 summarizes the required time for training of the DCGAN, MSCDAE and SDAE,
taken from [40] and [36] compared against ours. Our method is the least costly and only
takes 11 seconds for training.
Additionally, the consumption of computing resources and training time can be quantified
by the number of parameters (trainable parameters). Table 9 shows a comparison of model
efficiency of our method against the state-of-the-art CNN-based methods that have been
_December_ _4,_ _2023_
Figure 13: Illustration of the impact of the parameters: threshold, anomaly threshold and filter size.
used for fabric anomaly detection, namely FCN [13], SegNet [14], U-Net [15], PTIP [12]
and Mobile U-Net [10]. As shown in Table 9, our model only uses only one layer to achieve
the results reported and has approximately 1/10000 fewer parameters than the method that
has the least number of parameters while the other methods have more than four times as
many parameters. As explained in section 3.4. the number of filters in our approach is not
a user-set parameter, but is rather dynamic and is found with respect to the input domain
(here, the fabric type). The number of features dynamically found for Box-patterned and
Star-patterned was, respectively, 320 and 451, as reported in section 5.1 . The number of
parameters reported for our method in Table 9 is the highest, which is that of training on
the Star-patterned fabric type.
_December_ _4,_ _2023_
<u>Table</u> <u>8:</u> <u>Time</u> <u>performance</u> <u>comparison</u>
DCGAN MSCDAE SDAE FCSDAE Ours
No. of layers 15 9 4 8 1
Specifications of
computer used
Xeon E5-2640 processor and
32GB memory, NVIDIA
Tesla P4 GPU using CUDA
8.0, Python 3.6 with of
TensorFlow
Intel i5 processor
3.2 GHz and 8.0
GB memory,
MATLAB R2012B
Intel
i7-6820HQ
2.70GHz and
32GB memory
Training time (s) 840.6 169.8 162 296.9 11
<u>Table</u> <u>9:</u> <u>Comparison</u> <u>of</u> <u>model</u> <u>efficiency</u>
FCN SegNet U-Net PTIP Mobile-UNet Ours
No. of layers 38 36 26 10 9 1
No. of parameters 18.6M 29.4M 31.1M 7.15M 4.6M 451
6. Conclusions
We proposed a novel motif-based approach for fabric defect detection. Thanks to its dy
namic and input domain-based filter selection, our method is the first unsupervised method
to capitalize on the strengths of convolutional neural networks without the limitations posed
by the backpropagation mechanism while saving time and effort on the initialiazition of hy
perparameters and their fine-tuning. Our approach doesn’t require labeled data or defective
samples for training. By training on only one reference image per fabric type and converging
in only one epoch, it achieves far better results than the state-of-the-art unsupervised meth
ods on all defect types on recall, precision and f1-measure. Furthermore, it allows efficient
training with a lower computational cost and in less time, compared to the most efficient
_December_ _4,_ _2023_
CNN-based approaches.
The proposed approach requires a defect-free reference image per fabric type for training.
In the future, we intend to perform automatic elimination of defective patches based on the
number of supporters that indicates the frequency of observations, rather than using only
defect free images for training.
7. Acknowledgments
This research is part of project “Competitive Deep Learning with Convolutional Neural
Networks", grant number 118E293, supported by The Support Programme for Scientific
and Technological Research Projects (1001) of The Scientific and Technological Research
Council of Turkey (TÜBİTAK).
References
[1] S. Zhigang, B. Mingde, L. Yesong, Textural Fabric Defect Detection using Adaptive Quantized Gray
level Co-occurrence Matrix and Support Vector Description Data, Information Technology Journal 11
(2012) 673–685. doi: `[10.3923/itj.2012.673.685](http://dx.doi.org/10.3923/itj.2012.673.685)` .
[2] A. A. Hamdi, M. S. Sayed, M. M. Fouad, M. M. Hadhoud, Fully automated approach for patterned
fabric defect detection, in: 2016 Fourth International Japan-Egypt Conference on Electronics, Com
munications and Computers (JEC-ECC), 2016, pp. 48–51. doi: `[10.1109/JEC-ECC.2016.7518965](http://dx.doi.org/10.1109/JEC-ECC.2016.7518965)` .
[3] S. wu Zhu, H.-Y. Hao, P. Li, M. hong Shi, H. Qi, Fabric Defects Segmentation Approach Based
on Texture Primitive, 2007 International Conference on Machine Learning and Cybernetics 3 (2007)
1596–1600. doi: `[10.1109/ICMLC.2007.4370400](http://dx.doi.org/10.1109/ICMLC.2007.4370400)` .
[4] K. L. Mak, P. Peng, K. F. C. Yiu, Fabric defect detection using morphological filters, Image and Vision
Computing 27 (2009) 1585–1592. doi: `[10.1016/j.imavis.2009.03.007](http://dx.doi.org/10.1016/j.imavis.2009.03.007)` .
[5] H. Bu, J. Wang, X. Huang, Fabric defect detection based on multiple fractal features and support vector
data description, Eng. Appl. Artif. Intell. 22 (2009) 224–235. doi: `[10.1016/j.engappai.2008.05.006](http://dx.doi.org/10.1016/j.engappai.2008.05.006)` .
[6] P. Sengottuvelan, A. Wahi, A. Shanmugam, Automatic fault analysis of textile fabric using imaging
systems, Research Journal of Applied Sciences3 1 (2008) 26–31. URL: [https://medwelljournals.com/](https://medwelljournals.com/abstract/?doi=rjasci.2008.26.31)
[abstract/?doi=rjasci.2008.26.31.](https://medwelljournals.com/abstract/?doi=rjasci.2008.26.31)
[7] V. Asha, N. U. Bhajantri, P. Nagabhushan, Automatic Detection of Texture Defects Using Texture
Periodicity and Gabor Wavelets, Communications in Computer and Information Science 157 (2012)
548–553. doi: `[10.1007/978-3-642-22786-8\_69](http://dx.doi.org/10.1007/978-3-642-22786-8_69)` .
_December_ _4,_ _2023_
[8] H. Ngan, G. Pang, S. Yung, M. Ng, Wavelet based methods on patterned fabric defect detection,
Pattern Recognit. 38 (2005) 559–576. doi: `[10.1016/j.patcog.2004.07.009](http://dx.doi.org/10.1016/j.patcog.2004.07.009)` .
[9] P. Li, H. Zhang, J. Jing, R. Li, J. Zhao, Fabric defect detection based on multi-scale wavelet transform
and Gaussian mixture model method, The Journal of The Textile Institute 106 (2015) 587–592. doi: `[10.](http://dx.doi.org/10.1080/00405000.2014.929790)`
`[1080/00405000.2014.929790](http://dx.doi.org/10.1080/00405000.2014.929790)` .
[10] J. Jing, Z. Wang, M. Rätsch, H. B. Zhang, Mobile-Unet: An efficient convolutional neural net
work for fabric defect detection:, Textile Research Journal (2020) 004051752092860. doi: `[10.1177/](http://dx.doi.org/10.1177/0040517520928604)`
`[0040517520928604](http://dx.doi.org/10.1177/0040517520928604)` .
[11] J.-F. Jing, H. Ma, Yarn-dyed fabric defect detection based on convolutional neural network, in:
International Conference on Graphic and Image Processing, 2019. doi: `[10.1117/12.2524202](http://dx.doi.org/10.1117/12.2524202)` .
[12] J.-F. Jing, H. Ma, H. Zhang, Automatic fabric defect detection using a deep convolutional neural
network, Coloration Technology 135 (2019) 213–223. doi: `[10.1111/cote.12394](http://dx.doi.org/10.1111/cote.12394)` .
[13] E. Shelhamer, J. Long, T. Darrell, Fully convolutional networks for semantic segmentation, 2015 IEEE
Conference on Computer Vision and Pattern Recognition (CVPR) (2015) 3431–3440. doi: `[10.1109/](http://dx.doi.org/10.1109/TPAMI.2016.2572683)`
`[TPAMI.2016.2572683](http://dx.doi.org/10.1109/TPAMI.2016.2572683)` .
[14] V. Badrinarayanan, A. Kendall, R. Cipolla, SegNet: A Deep Convolutional Encoder-Decoder Archi
tecture for Image Segmentation, IEEE Transactions on Pattern Analysis and Machine Intelligence 39
(2017) 2481–2495. doi: `[10.17863/CAM.17966](http://dx.doi.org/10.17863/CAM.17966)` .
[15] T. Falk, D. Mai, R. Bensch, Ö. Çiçek, A. Abdulkadir, Y. Marrakchi, A. Böhm, J. Deubner, Z. Jäckel,
K. Seiwald, A. Dovzhenko, O. Tietz, C. D. Bosco, S. Walsh, D. Saltukoglu, T. L. Tay, M. Prinz,
K. Palme, M. Simons, I. Diester, T. Brox, O. Ronneberger, U-Net: deep learning for cell counting,
detection, and morphometry, Nature Methods 16 (2018) 67–70. doi: `[10.1038/s41592-018-0261-2](http://dx.doi.org/10.1038/s41592-018-0261-2)` .
[16] S. Linnainmaa, Taylor expansion of the accumulated rounding error, BIT 16 (1976) 146–160. doi: `[https:](http://dx.doi.org/https://doi.org/10.1007/BF01931367)`
`[//doi.org/10.1007/BF01931367](http://dx.doi.org/https://doi.org/10.1007/BF01931367)` .
[17] H. Ngan, G. Pang, N. Yung, Motif-based defect detection for patterned fabric, Pattern Recognit. 41
(2008) 1878–1894. doi: `[10.1016/j.patcog.2007.11.014](http://dx.doi.org/10.1016/j.patcog.2007.11.014)` .
[18] J. Jing, A. Dong, P. Li, Yarn-dyed fabric defect classification based on convolutional neural network,
in: International Conference on Digital Image Processing, 2017. doi: `[10.1117/12.2281978](http://dx.doi.org/10.1117/12.2281978)` .
[19] H. Zhang, L. Zhang, P. Li, D. Gu, Yarn-dyed fabric defect detection with yolov2 based on deep
convolution neural networks, 2018 IEEE 7th Data Driven Control and Learning Systems Conference
(DDCLS) (2018) 170–174. doi: `[10.1109/DDCLS.2018.8516094](http://dx.doi.org/10.1109/DDCLS.2018.8516094)` .
[20] Z. Liu, J. Cui, C. Li, M. Wei, Y. Yang, Fabric defect detection based on lightweight neural network,
in: PRCV, 2019. doi: `[10.1007/978-3-030-31654-9_45](http://dx.doi.org/10.1007/978-3-030-31654-9_45)` .
[21] J. Redmon, A. Farhadi, Yolo9000: Better, faster, stronger, 2017 IEEE Conference on Computer Vision
_December_ _4,_ _2023_
and Pattern Recognition (CVPR) (2017) 6517–6525. doi: `[10.1109/CVPR.2017.690](http://dx.doi.org/10.1109/CVPR.2017.690)` .
[22] B. Wei, K. Hao, X.-S. Tang, Y. Ding, A new method using the convolutional neural network with
compressive sensing for fabric defect classification based on small sample sizes, Textile Research Journal
89 (2019) 3539 - 3555. doi: `[10.1177/0040517518813656](http://dx.doi.org/10.1177/0040517518813656)` .
[23] Y. Wu, X. Zhang, F. Fang, Automatic fabric defect detection using cascaded mixed feature pyramid
with guided localization, Sensors (Basel, Switzerland) 20 (2020). doi: `[10.3390/s20030871](http://dx.doi.org/10.3390/s20030871)` .
[24] P. R. Jeyaraj, E. R. S. Nadar, Effective textile quality processing and an accurate inspection system
using the advanced deep learning technique, Textile Research Journal 90 (2020) 971 - 980. doi: `[10.](http://dx.doi.org/10.1177/0040517519884124)`
`[1177/0040517519884124](http://dx.doi.org/10.1177/0040517519884124)` .
[25] Z. Wen, Q. Zhao, L. Tong, Cnn-based minor fabric defects detection, International Journal of Clothing
Science and Technology (2020). doi: `[10.1108/ijcst-11-2019-0177](http://dx.doi.org/10.1108/ijcst-11-2019-0177)` .
[26] T. Falk, D. Mai, R. Bensch, Ö. Çiçek, A. Abdulkadir, Y. Marrakchi, A. Böhm, J. Deubner, Z. Jäckel,
K. Seiwald, A. Dovzhenko, O. Tietz, C. D. Bosco, S. Walsh, D. Saltukoglu, T. L. Tay, M. Prinz,
K. Palme, M. Simons, I. Diester, T. Brox, O. Ronneberger, U-net: deep learning for cell counting,
detection, and morphometry, Nature Methods 16 (2018) 67–70. doi: `[10.1038/s41592-018-0261-2](http://dx.doi.org/10.1038/s41592-018-0261-2)` .
[27] M. Sandler, A. G. Howard, M. Zhu, A. Zhmoginov, L.-C. Chen, Mobilenetv2: Inverted residuals and
linear bottlenecks, 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition (2018)
4510–4520. doi: `[10.1109/CVPR.2018.00474](http://dx.doi.org/10.1109/CVPR.2018.00474)` .
[28] H. Y. Ngan, G. K. H. Pang, Novel method for patterned fabric inspection using Bollinger bands,
Optical Engineering 45 (2006). doi: `[10.1117/1.2345189](http://dx.doi.org/10.1117/1.2345189)` .
[29] H. Ngan, G. Pang, Regularity Analysis for Patterned Texture Inspection, IEEE Transactions on
Automation Science and Engineering 6 (2009) 131–144. doi: `[10.1109/TASE.2008.917140](http://dx.doi.org/10.1109/TASE.2008.917140)` .
[30] S. Anitha, V. Radha, Evaluation of Defect Detection in Textile Images Using Gabor Wavelet Based
Independent Component Analysis and Vector Quantized Principal Component Analysis, in: Fourth
International Conference on Signal and Image Processing 2012, Lecture Notes in Electrical Engineering,
volume 222 of _(ICSIP_ _2012)_, Springer, India, 2012, pp. 433–442. doi: `[10.1007/978-81-322-1000-9\](http://dx.doi.org/10.1007/978-81-322-1000-9_41)`
`[_41](http://dx.doi.org/10.1007/978-81-322-1000-9_41)` .
[31] M. Ng, H. Ngan, X. Yuan, W. Zhang, Patterned Fabric Inspection and Visualization by the Method of
Image Decomposition, IEEE Transactions on Automation Science and Engineering 11 (2014) 943–947.
doi: `[10.1109/TASE.2014.2314240](http://dx.doi.org/10.1109/TASE.2014.2314240)` .
[32] C. S. C. Tsang, H. Ngan, G. Pang, Fabric inspection based on the Elo rating method, Pattern Recognit.
51 (2016) 378–394. doi: `[10.1016/j.patcog.2015.09.022](http://dx.doi.org/10.1016/j.patcog.2015.09.022)` .
[33] G.-H. Hu, Q.-H. Wang, G.-H. Zhang, Unsupervised Defect Detection in Textiles based on Fourier
Analysis and Wavelet Shrinkage, Applied Optics 54 (2015). doi: `[10.1364/AO.54.002963](http://dx.doi.org/10.1364/AO.54.002963)` .
_December_ _4,_ _2023_
[34] J. Zhou, J. Wang, Unsupervised Fabric Defect Segmentation using Local Patch Approximation, Journal
of the Textile Institute 107 (2016) 1–10. doi: `[10.1080/00405000.2015.1131440](http://dx.doi.org/10.1080/00405000.2015.1131440)` .
[35] A. A. Hamdi, M. S. Sayed, M. M. Fouad, M. M. Hadhoud, Unsupervised Patterned Fabric Defect
Detection using Texture Filtering and K-Means Clustering, in: International Conference on Innovative
Trends in Computer Engineering (ITCE), 2018. doi: `[10.1109/ITCE.2018.8316611](http://dx.doi.org/10.1109/ITCE.2018.8316611)` .
[36] Y. Li, W. Zhao, J. Pan, Deformable Patterned Fabric Defect Detection with Fisher Criterion-Based
Deep Learning, IEEE Transactions on Automation Science and Engineering 14 (2017) 1256–1264.
doi: `[10.1109/TASE.2016.2520955](http://dx.doi.org/10.1109/TASE.2016.2520955)` .
[37] A. Şeker, A. G. Yüksek, Stacked Autoencoder Method for Fabric Defect, Cumhuriyet Science Journal
38 (2017) 342–342. doi: `[10.17776/cumuscij.300261](http://dx.doi.org/10.17776/cumuscij.300261)` .
[38] S. Mei, Y. Wang, G. Wen, Automatic Fabric Defect Detection with a Multi-Scale Convolutional
Denoising Autoencoder Network Model, Sensors 18 (2018). doi: `[10.3390/s18041064](http://dx.doi.org/10.3390/s18041064)` .
[39] L. Liu, J. Zhang, X. Fu, L. Liu, Q. Huang, Unsupervised Segmentation and ELM for Fabric Defect
Image Classification, Multimedia Tools and Applications 78 (2019) 12421–12449. doi: `[10.1007/s11042-](http://dx.doi.org/10.1007/s11042-018-6786-7)`
`[018-6786-7](http://dx.doi.org/10.1007/s11042-018-6786-7)` .
[40] G. Hu, J. Huang, Q. Wang, Unsupervised Fabric Defect Detection Based on a Deep Convolu
tional Generative Adversarial Network, Textile Research Journal 90 (2019) 247–270. doi: `[10.1177/](http://dx.doi.org/10.1177/0040517519862880)`
`[0040517519862880](http://dx.doi.org/10.1177/0040517519862880)` .
[41] H. Tian, F. Li, Autoencoder-Based Fabric Defect Detection with Cross- Patch Similarity, 2019 16th
International Conference on Machine Vision Applications (MVA) (2019) 1–6. doi: `[10.23919/MVA.2019.](http://dx.doi.org/10.23919/MVA.2019.8758051)`
`[8758051](http://dx.doi.org/10.23919/MVA.2019.8758051)` .
[42] A. S. Abutaleb, Automatic thresholding of gray-level pictures using two-dimensional entropy, Computer
Vision, Graphics, and Image Processing 47 (1989) 22–32. doi: `[10.1016/0734-189X(89)90051-0](http://dx.doi.org/10.1016/0734-189X%0x2889%0x2990051-0)` .
[43] [dataset] Henry Y.T. Ngan, G. K. Pang, Patterned Fabric database, 2009. URL: [https://ytngan.](https://ytngan.wordpress.com/codes/)
[wordpress.com/codes/.](https://ytngan.wordpress.com/codes/)
_December_ _4,_ _2023_
섹션 본문
섹션 본문이 없습니다.
참고문헌
참고문헌 정보가 없습니다.