Incremental Learning-Based Algorithm for Anomaly Detection Using Computed Tomography Data

: In a nuclear power plant (NPP), the used tools are visually inspected to ensure their integrity before and after their use in the nuclear reactor. The manual inspection is usually performed by qualiﬁed technicians and takes a large amount of time (weeks up to months). In this work, we propose an automated tool inspection that uses a classiﬁcation model for anomaly detection. The deep learning model classiﬁes the computed tomography (CT) images as defective (with missing components) or defect-free. Moreover, the proposed algorithm enables incremental learning (IL) using a proposed thresholding technique to ensure a high prediction conﬁdence by continuous online training of the deployed online anomaly detection model. The proposed algorithm is tested with existing state-of-the-art IL methods showing that it helps the model quickly learn the anomaly patterns. In addition, it enhances the classiﬁcation model conﬁdence while preserving a desired minimal performance


Introduction
The term incremental learning (IL) is usually used interchangeably with continual, lifelong, or sequential learning. It refers to a machine learning paradigm that studies how model learning occurs as new data or example(s) emerge, even from an infinite data stream. In particular, it differs from the conventional machine learning approach, such that it assumes that the training examples appear progressively over time as opposed to having the entire training dataset initially [1,2]. Thus, the past knowledge from the previous data is acquired over time and can be extended for future learning and problem solving [3,4]. This concept of incremental learning is used in different applications in various areas such as intelligent robotics, unmanned aerial vehicles, and autonomous driving [5]. Because such an application deals with a dynamic environment, it uses the online or dynamic adaptation of the model to these changes. A major challenge of incremental learning is the catastrophic forgetting or interference that occurs when a model is trained with new information, and this affects the previously learned knowledge. When controlling catastrophic forgetting, the stability-plasticity dilemma comes into play. The stability-plasticity dilemma is the extent to which an incremental learning system is plastic enough to fuse new information and the extent to which it is stable enough to avoid catastrophic interference with consolidated knowledge [2].
Incremental or continual learning techniques can be categorized into three categories: regularization-based, dynamic architectures, and complementary learning systems (CLS) and memory replay approaches, as shown in Figure 1. The regularization-based approach includes the use of knowledge distillation to enforce the similarity between the network of previously learned tasks and the current task [6]. However, this kind of method, the so-called learning without forgetting (LwF), is highly dependent on task relevance and training time. The memory-aware synapses (MAS) method uses the sensitivity of the output function to assign significant weights to the network parameters and is not loss dependent [7]. The Elastic Weight Consolidation (EWC) method is useful in the supervised and reinforcement learning space [8]. The dynamic architecture approach includes the progressive network method, which blocks any change that occurs to the network trained on previous knowledge while expanding the network's architectural properties [9]. The incremental denoising autoencoder method adds neurons for high-loss samples [10]. The model evaluation on the MNIST [11] and CIFAR-10 [12] datasets showed better performance when compared to nonincremental denoising autoencoders [2]. The network structure and weight adaptation method balances the model complexity and empirical risk minimization through network structure and weight adaptation, and the necessary model complexity is learned adaptively by the algorithm [13]. Finally, the CLS and memory replay approach includes different methods based on dual memory and complementary learning systems theory to mitigate catastrophic forgetting. Eden Beloudah et al. [14] introduced incremental learning with dual memory (IL2M) and a fine-tuning-based approach. Srivastava et al. [15] used vector quantization as a replay-based scheme to overcome catastrophic forgetting and applied it to classify chest X-ray pathologies. In this paper, a new algorithm is proposed to enhance the accuracy of existing IL methods while ensuring stable training towards a desired prediction accuracy for supervised anomaly detection using a classification model. To our knowledge, this is the first work applying a notion of continual learning for classification-based supervised anomaly detection on industrial computed tomography (CT) scans. This paper is organized as follows. Section 2 describes the materials and methods featuring the proposed incremental learning schemes including the dataset and the proposed algorithms in use. Section 3 discusses the obtained results. Finally, the conclusions and future work are outlined in Section 4.

Materials and Methods
In this work, incremental learning is applied to an automated inspection framework developed for the X-ray CT inspection of industrial maintenance tools within the nuclear industry [16]. The maintenance tools need to be properly inspected for discrepancies such as scratches and missing components, before and after use for nuclear vault inspection. This manual inspection process can last from a few minutes to months depending on the complexity of the maintenance tools and the available human resources. It is important to note that while this manual tool inspection takes place, the nuclear reactor has to remain shut down to ensure that no missing component of the tool is left behind for safety reasons. However, this outage time of the nuclear reactor comes at a cost to the nuclear power plant operators, with a possible extended outage time resulting in an even higher cost. Hence, the manual tool inspection process can lead to a loss of time, money, and resources. Therefore, an automated inspection solution, which allows for increased reactor availability or decreased outage time and a lower cost of human resources due to manual labor, would play a significant role in this field. The proposed automated tool inspection solution aims to analyze the CT scan of the maintenance tool and predict whether it is defect-free, defective, or anomalous (i.e., with missing components such as spring holders). Moreover, in practical digital industrial applications, the data acquired are dynamically increasing over time. Therefore, incremental learning comes into play by allowing the trained model to learn continually without having to train from scratch each time new data arrive. There are three major types of incremental learning, including task [3], class, and domain incremental learning. In this paper, we focused on domain incremental learning, in which new data streams can appear in the previous or new classes, and the task boundaries are unknown [17] (see Figure 2). The domain incremental learning is used to train a model in a stream across various contexts and applications [18]. It preserves past domain knowledge by enabling the trained model to combine the knowledge learned across different tasks or domains during the training phase [19]. The proposed incremental learning scheme presents a dynamic and automated training mechanism for stable prediction performance. The proposed scheme is integrated into existing continual learning frameworks for supervised anomaly detection using X-ray computed tomography images.

Experimental CT Dataset
The dataset used in this work consists of a set of CT images acquired from a case study tool used for nuclear power plant maintenance. The CT image scans were acquired using an industrial CT scanner by Diondo Gmbh [21]. The acquired dataset contained the 2D image projections that were transformed using 3D reconstructions to 2D cross-section or slice images used in the experimental dataset. Figure 3 shows an example of both the projection scan and the reconstruction slice of the nuclear power plant tool scanned in five parts due to the small size of the used scanner [22]. It is worth mentioning that because of the limited computational resources, the studied defects are introduced in the bottom part from which the training dataset is built. Each defect is scanned multiple times to consider the possible noise related to the scanning artifact (see Table 1). In addition, this allows us to have more data to feed the incremental learning tasks streamlining. The CT images of the tool were taken with complete and incomplete components. Each image had a resolution of 1500 × 750 pixels. The dataset consisted of 21 scans categorized as follows: • Defect-free scans [M1 and M2] are two reference scans of a complete tool with no missing pieces. • Defective scans [M3-M21] are scans with various missing components such as spring stoppers, an internal disk pin, spring holders, spring support components, and/or inner disk clips (see Table 1 for more details on the defect types).

Anomaly Detection Model
For supervised-based anomaly detection, classification-based models are trained to distinguish between normal (associated with the defect-free class) and anomalous (associated with the defective class) slice images. The defect-free and defective slice images were derived from all the 18 scans of our custom dataset CT data types (M1, M2, and M6-M21) depending on the presence of the defect in the slice (see Table 1). The input images were preprocessed by resizing to a shape of 32 × 32, and normalization with a mean of 0.1000 and a standard deviation of 0.2752 were used. Two different backbone architectures, ResNet18 and Multilayer Perceptron (MLP), were used to evaluate and analyze the proposed classification-based incremental learning tasks. Figure 4 shows an illustration of the classification framework.

The Proposed Thresholding-Based Algorithms
In this work, we designed two different algorithms based on the thresholding technique to ensure the optimal possible dynamic training of the classification model. The proposed thresholding scheme has two main advantages. First, it can be used as an add-on to any existing baseline algorithms. In other words, this is similar to a plug-and-play setting whereby the proposed scheme is implemented on existing baseline continual learning methods making it easy to integrate. Lastly, as each incremental task is introduced and trained, the proposed soft thresholding scheme can often enhance the model accuracy of the existing baseline results by training the model following a desired performance, which is the confidence threshold (C th ). The two proposed thresholding schemes to be applied to existing IL methods to optimize model performance are defined as follows: • Soft-thresholding-based training: The soft thresholding scheme uses all exemplars of the past data (that is, the data used previously for training) and combines them with the new data. The flowchart of the proposed scheme as shown in Figure 5 is summarized as follows. First, the new labelled scans of data are acquired. The next step is to determine whether old labelled scans of the data exist. If old data scans exist, the soft thresholding scheme will combine all the old data scans and new data scans and build a balanced dataset for training. Therefore, an equal number of image instances is represented per class for each training, validation, and testing set. If no old scans exist, only the new data scans will be used to build a balanced training set for training. If there is an existing model, the model is reloaded and used for training; otherwise, a new model is trained. The model is trained and validated using the training and validation sets, respectively, and the confidence score is obtained. The model retrains until the confidence score is greater than a specified confidence threshold (95%) or until the maximum number of times to repeat training (R max ) is achieved. The final model is saved. The entire process continues if new labeled scans of data are received. Algorithm 1 provides the proposed algorithm. • Selective soft-thresholding-based training: The selective soft thresholding scheme uses the optimal training dataset selection process to select the old data or scans to be combined with the new data during training. The optimal training dataset selection process involves selecting old scan data whose accuracy fell below the specified threshold of acc th . If no previously trained data fall within the specified threshold interval [acc th , C th ], the threshold acc th will automatically be increased gradually (e.g., by 5% each time) until at least one scan is selected to start the training process. If no optimal old data are returned, all old data are selected for training. After the selection of these old data, they are combined with the new data forming the training set of the task as shown in detail in Algorithm 2. This selection process is very important because it recognizes the previously trained data that falls outside the category of the specified accuracy threshold and selects them for further training with the model. Therefore, this saves some memory by selecting a subset of the old scan data to be trained further in combination with the new scan data. In addition, this also provides an opportunity to further train on the data in cases where the model performance was still below the desired threshold. The flowchart of the selective soft thresholding scheme is outlined in Figure 5.

Results and Discussion
The two proposed soft thresholding and selective soft thresholding algorithms were implemented using the PyTorch deep learning framework. For each experimental run, a pipeline of training sets of two classes (defect-free and defective) was built for the training of a given scan stream. These continuous training data are known as a task and consist of a batch of defect-free and defective slice images fed incrementally into the model for training. This kind of incremental learning follows the domain incremental-learning type, where the different batches of data are fed from the same predefined classes (see Figure 2). For each experimental run, the order of the task was shuffled and selected at random among the available CT scans list (see Table 1). This was carried out to observe whether the order of the task pipeline had any significant effect on the incrementally trained model performance. The reported results are the averaged performance of three experimental runs of the shuffled task pipeline for each algorithm as summarized in the different tables.

Comparison of the Proposed Soft Thresholding Schemes and the Nonincremental Scheme
To evaluate the improvement of the continual training compared to the static training, an experiment was conducted by training a classification model with incremental and nonincremental runs. The obtained performance was compared using the conventional testing accuracy and a confidence score metric defined as the minimum of the testing accuracy of the trained model on the last five tasks. Table 2 shows that the soft thresholding achieved higher accuracy as expected because the model was gradually trained compared to the nonincremental cases, where the model was tested on all the data at once. In addition, the selective soft thresholding scheme seemed to achieve better task-wise performance by obtainiing a higher confidence score of 88.07% compared to the soft thresholding scheme. The generalization of this assumption was evaluated by applying the proposed thresholding scheme to the existing incremental learning scheme method.

Performance Sensitivity Analysis Using Existing Incremental Learning Methods
The proposed scheme was integrated with some existing baseline methods that consist of four regularization-based continual learning methods which are: Elastic Weight Consolidation (EWC), Online EWC, Synaptic Intelligence (SI), and Memory-aware Synapses (MAS) [20]. The four continual learning methods were tested using the ResNet18 and multilayer perceptron (MLP) model architectures. The proposed thresholding schemes handled the batch selection in the training process. The experiments included the baseline (i.e., the original existing methods), selective (i.e., the baseline + optimal training dataset selection), soft thresholding, and the selective soft thresholding scheme. The default training hyperparameters used for the experiments are outlined in Table 3. The default regularization coefficients defined by Hsu et al. [20] were used with 100, 700, 3000, and 10,000 for the EWC, Online EWC, SI, and MAS methods, respectively. Table 3. Summary of the default hyperparameters used to implement the existing IL methods [20].

Number of Tasks
Epoch 100 (per task)

Batch size 128
Model architecture MLP and ResNet18

Loss function Cross entropy
Optimizer Adam Learning rate 0.001 Figures 6 and 7 show the obtained testing accuracy of the incrementally trained model using the MLP and Resnet18 models, respectively. The figures show the performance of the different IL baseline algorithms compared to the integrated proposed algorithms. The selective implementation denoted as (S) refers to the use of the optimal training dataset selection, and the soft thresholding scheme is denoted as (+). For instance, the different implementations of the EWC method are denoted as the baseline EWC, selective baseline EWC(S), soft thresholding EWC(+), and selective soft thresholding EWC(S+). Table 4 shows that the nonselective scheme, which comprises the baseline and the soft thresholding scheme, achieved a higher accuracy performance by the last task (T18) compared to the selective scheme for both model architectures. In addition, the soft thresholding algorithm improved most of the baseline IL methods. Overall, it achieved the highest last accuracy of 99.29% using the Resnet18 architecture. Table 5 summarizes the best achievable average accuracy and standard deviation computed from tasks T14-T18 (i.e., the average and standard deviation of the last five tasks) across all IL methods. It demonstrates that the EWC(+) method outperformed the other methods in terms of the average accuracy.    For the confidence score, Table 6 shows the obtained performance for different incremental learning schemes. The table demonstrates that the EWC method outperformed other methods specifically and achieved the highest confidence score of 98.30% using the ResNet architecture with the soft thresholding EWC(+) and baseline EWC schemes. However, Figure 8 demonstrates a drop in the performance of the EWC compared to the EWC(+) at task T6. Figure 8 shows that the EWC(+) scheme attained a more stable performance by T5, unlike the EWC scheme, which encountered a drop in performance at task 5 (T5) but recovered afterward. Overall, the incrementally trained model using the proposed framework helps in recognizing new defect patterns from new data streams while training the model only when needed. In addition, it adapts to dynamic data characteristics and size by using the selective soft thresholding scheme when the accumulated data are outside the computational resources limits. The proposed schemes help to improve the quality control and effectiveness of the industrial inspection applications [23].

Limitations
The performance comparison with existing continual learning baselines shows that the proposed soft thresholding method seems to be more adaptable for dynamic and optimal training to enhance the model prediction. However, the major limitation is the need for high-quality online data annotation preferably verified by a human in the loop framework. Finally, the algorithm has an extended (long) training time as more sequences of data or tasks are trained incrementally. Therefore, this might cause the model to overfit. A possible solution is to decrease the number of retraining repetitions to enable shorter and early stopping that exits the training once the learning starts to saturate.

Conclusions and Future Work
Incremental learning, also known as continual learning or lifelong learning, is an adaptive algorithm that learns progressively over time from a continuous stream of information. During this process, new knowledge is learned while keeping the previously learned experiences. In this work, a new soft thresholding scheme was introduced to optimize the model prediction of existing incremental learning frameworks. The obtained results show that the proposed algorithm could achieve a steady performance around the desired prediction accuracy for supervised-based anomaly detection using CT images. In the future, the proposed schemes will be tested for multiclass and/or multilabel classification tasks. Finally, they could also be adapted for reinforcement learning, where a robot learns incrementally a specific manipulation using parameter estimation based on data-driven models.

Data Availability Statement:
The data presented in this study are available on request from the corresponding author.