Continual Learning of Neural Networks for Realtime Wireline Cable Position Inference

1 INTRODUCTION . With the emergence of AI-powered computer vision techniques in recent years , more and more vision-based applications are being introduced into the oil fields Wan ( 2019 ) Ant ( 2019 ) . As an example , to automate the Wireline spooling process , one can mount a surveillance camera inside the cabin behind the window facing the drum , feed the live spooling video into a trained neural network and infer the so-called cable position in real time ( Fig.1 ) . This inferred cable position will then be passed to a spooling controller , which moves the spooling arm accordingly so that the cable can be laid onto the drum without gaps or crossovers Su et al . ( 2021b ) . To train the neural network , example video frames with ground truth cable position were first collected offline . The weights of the network were then learnt from these training frames to minimize the prediction error . After testing and optimization , the network was then deployed to the Wireline units . Training did not stop after the deployment , however , because the example frames in the first training process may not cover all the operational conditions ( different Wireline units , drum sizes , cable types , lighting and weather conditions , operations in daytime vs. nighttime , etc ) . To continuously improve the network performance on the out-of-distribution frames , i.e. , frames that look significantly different from those in the training set , we kept collecting new training videos to help generalize the performance of the network to various operational environments . This process is called continual , lifelong or incremental neural network training . The most straightforward setup for continual learning is to combine the new videos with all the old ones and re-train the network using the ever-increasing number of training frames Su et al . ( 2021a ) . This , however , is not a scalable solution . Disk space required to hold all the past videos increases without bound over time . Also , the time to re-train a new network increases rapidly with more frames to extract , process and learn . A naive scalable solution could be to re-train the network only on the new videos and remove all the old ones . This solution , however , does not work well . During re-training , a neural network tends to forget what it learned previously , causing large prediction error when applying the updated network on the old videos . This phenomenon is called catastrophic forgetting in the literature Kirkpatrick et al . ( 2017 ) . To help the network learn the characteristics of the new videos without forgetting the information of the old ones , continual learning techniques are usually applied . There exist three types of continual learning techniques Liu et al . ( 2020 ) : the regularization-based method that penalizes large weight changes during re-training Kirkpatrick et al . ( 2017 ) , the parameter isolation method that assigns different weights for different datasets Mallya & Lazebnik ( 2018 ) , and the replay-based method that replays some of the old information to the network together with the new data Hayes et al . ( 2020 ) Wang et al . ( 2021 ) Prabhu et al . ( 2020 ) . More descriptions of these methods will be provided in next section . One realization of the replay-based method is the REMIND network Hayes et al . ( 2020 ) . Instead of saving all the raw videos , the REMIND network compresses and stores the features of the old videos and then replays them to the network for re-training . Feature compression is done by Product Quantization ( PQ ) Jegou et al . ( 2010 ) , which clusters the features into K-means centroids and compactly represents them using the centroid indices . Although efficient in disk space usage , the original REMIND network replaces the previously stored centroids with those generated by the new data at each re-train iteration , which is not suitable for multiple re-training process . Besides , we found that the original REMIND network has memory overflow issue when the size of dataset is large . In this paper , we proposed MREMIND , which modifies the dictionary update policy of the REMIND network so the previously stored centroids won ’ t be replaced and deleted . To optimize memory allocation , we also partitioned the dataset into subsets , which enables the method to work on devices with limited RAM . Additionally , we investigated other state-of-the-art continual learning methods and compared their performance on the cable position inference problem . In summary , our contributions in this work are : 1 . We applied continual learning techniques to train neural networks for real-time vision-based cable position inference to enable Wireline auto-spooling . 2 . We modified the REMIND network with an extendable dictionary update policy and an improved memory management . 3 . We compared the accuracy and the disk space usage of multiple state-of-the-art continual learning techniques on the cable position inference problem . 2 RELATED WORKS . Continual learning solutions aim to achieve the following goals : ( 1 ) Continuously train and re-train a network to learn from new data ; ( 2 ) Keep the performance of the network on the previously seen old data ; and ( 3 ) Avoid saving all the old data in its raw form to make the solution scalable for disk space usage . Related works in this area include : • The regularization-based method . One example is the Elastic Weight Consolidation Method ( EWC ) Kirkpatrick et al . ( 2017 ) . This method adds a regularization term to the loss function to penalize the change of the weights that are sensitive for the old datasets . Here ” sensitivity ” is quantified using the Fisher information . This method is simple to implement . However , setting and tuning the penalty stiffness can be highly problem-dependent . Also , the method was reported to be vulnerable to domain shift Wang et al . ( 2021 ) Aljundi et al . ( 2017 ) . • The the parameter isolation method . This method isolates the parameters and train different datasets on different parameters in the network Mallya & Lazebnik ( 2018 ) . This method indeed can solve the catastrophic forgetting problem because the previously learnt weights won ’ t be affected by subsequent training . However , the amount of weights needed increases without bounds as more data becomes available . Therefore , it is not a scalable solution . • The replay-based method . This method tackles the catastrophic forgetting problem by replaying the old data during retraining . The old data may not in its raw form . It could be compressed , transformed , or reduced to a subset of the original data . For example , the REMIND network Hayes et al . ( 2020 ) extracted and stored features from the old data and replayed these features for network re-training . The ACAE-REMIND work Wang et al . ( 2021 ) increased the number of trainable parameters in plastic layer and introduced an auto-encoder to further enhance the inference accuracy . Wu et al . ( 2019 ) used generative adversarial network ( GAN ) to generate images of the old datasets for future replay . Interestingly , a recent paper , GDumb Prabhu et al . ( 2020 ) , shows that by greedily storing the old images and then retraining the network from scratch at each iteration , one can get similar performance compared to other existing methods . For these replay-based methods , it is important to balance the distribution of replay samples for each dataset to avoid data bias . 3 METHODS . In this section we propose a new continual learning method for wireline cable position inference task . In section 3.1 , we will define the objective of the paper . In 3.2 we first give an introduction to current replay-based continual learning method and point out the drawbacks in actual deployment . Then we introduce our proposed MREMIND method . 3.1 CONTINUAL LEARNING FOR WIRELINE AUTOMATION . Upon actual deployment , wireline cable position inference might occur huge performance drop under different environments including lightness , weather and camera position setting . In this paper , our objective is to train a neural network that has high prediction accuracy in different configurations . Data under different settings will arrive sequentially . In order to avoid catastrophic forgetting issue as well as balance inference accuracy with training time and disk space usage , we apply continual learning technique to tackle this problem . 3.2 MREMIND : MODIFED REMIND NETWORK . 3.2.1 CURRENT REMIND NETWORK . Current REMIND method divides a neural network into two parts : ( 1 ) a feature extractor , also called the encoder or the frozen layer , and ( 2 ) a decoder , also called the plastic layer Hayes et al . ( 2020 ) Wang et al . ( 2021 ) . The weights in the extractor are frozen after the first training , while those in the decoder are continuously trained on the new data iteration after iteration . In this paper , one ” iteration ” refers to one re-training of the network when a new dataset arrives . It could contain multiple training epochs . To avoid saving all the old raw videos , the REMIND network uses the frozen layer to extract the mid-level features from the old frames , then compresses and stores them into dictionaries . When a new dataset arrives , the old features are decompressed from the dictionaries and replayed to the network along with the new frames for network re-training . In this way , the network learns from the new data and keeps its performance on the old ones . Training Procedure To explain the training procedure of the REMIND network , denote Enc and Dec as the encoder and decoder of the network , respectively , Feeding an input image x to the network produces a mid-level feature ( z = Enc ( x ) ) and a predicted cable position ( ŷ = Dec ( Enc ( x ) ) ) . Additionally , we use y to denote the ground truth cable position , so that the prediction error is ŷ− y . The optimal weights of the network are trained by minimizing the squared prediction error . The training procedure is shown in Fig . 2 and is summarized in the steps below : 1 . With all the weights in the encoder and decoder set to be tunable , train the network on all images in the first dataset 1 . The trained network is the backbone pre-trained model . 2 . Apply the PQ method to compress all the mid-level features from dataset 1 . In this step , we obtain two base dictionaries representing dataset 1 . 3 . When a new dataset arrives , feed the new images into the encoder to extract features . 4 . Uniformly and randomly select the compressed old features from the previous dataset , decompress and feed them together with the new features to the plastic layer . Re-train the decoder using these combined features by minimizing the prediction error . 5 . Compress the new features , and replace the stored old features . In this step , we obtain two updated dictionaries representing the new features . Product Quantization The extracted features from the old frames are compressed and stored using the Product Quantization ( PQ ) method Jegou et al . ( 2010 ) . The PQ method clusters the features into K-means centroids , and compactly represents the original features with the centroids indices . Each batch of features , with batch size b , number of channels d , and m× n pixels on each channel , can be flatten into a 2D matrix of size ( b×m× n , d ) . The PQ method divides the d channels into s sub-sections . K-means clustering is then applied on each sub-section , resulting in K numbers of d/s-dimension centroids for each sub-section . The features can then be represented using the IDs of the closest centroids ( of integer type ) . After compression , the original features are represented by the clustered centroids and the centroid IDs that tell us which centroid each sub-feature corresponds to . For example , image a batch of original features with the size of b×m× n× d × 32 bits ( 32 bits type ) . After PQ compression , we will get ( 1 ) an integer ID dictionary of the size b×m×n× log2 K × s bits , and ( 2 ) a centroid dictionary of the size K × s× ( d/s ) × 32 ) bits ( Fig.3 ) . These two dictionaries are used to recover the features during decompression . It has been reported that the PQ method can store 50 times more features compared to raw images with the same disk space Wang et al . ( 2021 ) . We used the library developed by Faiss for implementing the PQ method Johnson et al . ( 2017 ) .

Summary: Original REMIND network compresses and stores features from old videos and replays them on the network at the time of retraining. Previously stored centroids are replaced with new ones and this is not suitable for a multiple re-training process. The authors proposed a new memory update rule to overcome catastrophic forgetting more efficiently and a strategy of resolving limited resource issues