# Intelligent Online Inspection of the Paste Quality of Prebaked Carbon Anodes Using an Anomaly Detection Algorithm

^{*}

## Abstract

**:**

## 1. Introduction

- The proposed method addresses the issue of online intelligent inspection for prebaked carbon anode paste. An anomaly detection method is employed to address the problem of insufficient anomalous samples in paste production, a common issue in industrial product quality inspection.
- This method provides a feasible approach to dataset construction for prebaked carbon anode paste quality control. It transforms time-series data into 2D images using the GAF technique, where each image corresponds to a pot of anode paste, enabling the application of computer vision detection algorithms for paste quality inspection.

## 2. Related Works

#### 2.1. Time-Series Anomaly Detection

#### 2.2. Image Anomaly Detection

#### 2.3. Time Series to Image Transformation

## 3. A New Method of Quality Anomaly Detection

## 4. Data Processing and Dataset

#### 4.1. Data

#### 4.2. GAF Transformation and Dataset

## 5. Result and Comparison

#### 5.1. PatchCore Algorithm

- (1)
- Feature patches extraction: the local perceptual features in the normal image will be extracted by the feature extractor to obtain the feature patches of all images.
- (2)
- Core set sampling and anomaly scoring: All feature patches are fed into the K-nearest neighbor (KNN) for core feature sampling. The core feature set obtained from the sampling will form the memory bank, which is the criterion for calculating the image anomaly score. During the test, patch features are extracted for the test sample, and the anomaly scores are calculated using the KNN and the memory bank.

#### 5.2. Model Training and Result

#### 5.3. Comparison

## 6. Conclusions

## Author Contributions

## Funding

## Data Availability Statement

## Conflicts of Interest

## References

- Beier, S.; Chen, J.J.J.; Fortin, H.; Fafard, M. FEM Analysis of the Anode Connection in Aluminium Reduction Cells. In Light Metals 2011; Stephen, J.L., Ed.; Springer: Hoboken, NJ, USA, 2011; pp. 979–984. [Google Scholar]
- Yuan, S.; Lai, Q.; Duan, X.; Wang, Q. Carbon-based materials as anode materials for lithium-ion batteries and lithium-ion capacitors: A review. J. Energy Storage
**2023**, 61, 106716. [Google Scholar] [CrossRef] - Perez, S.P.; Doval-Gandoy, J.; Ferro, A.; Silvestre, F. Quality improvement for anode paste used in electrolytic production of aluminium. In Proceedings of the Conference Record of the 2005 Industry Applications Conference, Hong Kong, China, 2–6 October 2005; pp. 523–528. [Google Scholar]
- Azari, K.; Alamdari, H.; Ammar, H.; Fafard, M.; Adams, A.; Ziegler, D. Influence of Mixing Parameters on the Density and Compaction Behavior of Carbon Anodes Used in Aluminum Production. Adv. Mater. Res.
**2011**, 409, 17–22. [Google Scholar] [CrossRef] - Wei, Y.; Jang-Jaccard, J.; Xu, W.; Sabrina, F.; Camtepe, S.; Boulic, M. LSTM-Autoencoder-Based Anomaly Detection for Indoor Air Quality Time-Series Data. IEEE Sens. J.
**2023**, 23, 3787–3800. [Google Scholar] [CrossRef] - Chadha, G.S.; Islam, I.; Schwung, A.; Ding, S.X. Deep Convolutional Clustering-Based Time Series Anomaly Detection. Sensors
**2021**, 21, 5488. [Google Scholar] [CrossRef] - Lin, S.Y.; Clarke, R.; Birke, R.; Schonborn, S.; Trigoni, N.; Roberts, S. Anomaly Detection for Time Series Using Vaelstm Hybrid Model. In Proceedings of the 2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), Barcelona, Spain, 4–8 May 2020; pp. 4322–4326. [Google Scholar]
- Li, D.; Chen, D.C.; Shi, L.; Jin, B.H.; Goh, J.; Ng, S.K. MAD-GAN: Multivariate Anomaly Detection for Time Series Data with Generative Adversarial Networks. In Proceedings of the Artificial Neural Networks and Machine Learning—ICANN 2019: Text and Time Series, Munich, Germany, 17–19 September 2019; Springer: Berlin/Heidelberg, Germany, 2019; Volume 11730, pp. 703–716. [Google Scholar]
- Niu, Z.; Yu, K.; Wu, X. LSTM-Based VAE-GAN for Time-Series Anomaly Detection. Sensors
**2020**, 20, 3738. [Google Scholar] [CrossRef] - Bashar, M.A.; Nayak, R. TAnoGAN: Time Series Anomaly Detection with Generative Adversarial Networks. In Proceedings of the 2020 IEEE Symposium Series on Computational Intelligence (SSCI), Canberra, Australia, 1–4 December 2020; pp. 1778–1785. [Google Scholar]
- Geiger, A.; Liu, D.; Alnegheimish, S.; Cuesta-Infante, A.; Veeramachaneni, K. TadGAN: Time Series Anomaly Detection Using Generative Adversarial Networks. In Proceedings of the IEEE International Conference on Big Data (Big Data), Atlanta, GA, USA, 10–13 December 2020; pp. 33–43. [Google Scholar]
- Zhan, J.; Wang, S.Q.; Ma, X.D.; Wu, C.K.; Yang, C.Q.; Zeng, D.T.; Wang, S.L. STGAT-MAD: Spatial-temporal graph attention network for multivariate time series anomaly detection. In Proceedings of the 2022 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), Singapore, 23–27 May 2022; pp. 3568–3572. [Google Scholar]
- Wang, X.; Pi, D.; Zhang, X.; Liu, H.; Guo, C. Variational transformer-based anomaly detection approach for multivariate time series. Measurement
**2022**, 191, 110791. [Google Scholar] [CrossRef] - Jain, S.; Seal, A.; Ojha, A.; Yazidi, A.; Bures, J.; Tacheci, I.; Krejcar, O. A deep CNN model for anomaly detection and localization in wireless capsule endoscopy images. Comput. Biol. Med.
**2021**, 137, 104789. [Google Scholar] [CrossRef] - Liu, Y.; Zhou, S.; Wu, H.; Han, W.; Li, C.; Chen, H. Joint optimization of autoencoder and Self-Supervised Classifier: Anomaly detection of strawberries using hyperspectral imaging. Comput. Electron. Agric.
**2022**, 198, 107007. [Google Scholar] [CrossRef] - Mathian, E.; Liu, H.W.; Fernandez-Cuesta, L.; Samaras, D.; Foll, M.; Chen, L. HaloAE: An HaloNet based Local Transformer Auto-Encoder for Anomaly Detection and Localization. arXiv
**2022**, arXiv:2208.03486. [Google Scholar] - Deng, H.; Li, X. Anomaly Detection via Reverse Distillation from One-Class Embedding. In Proceedings of the 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), New Orleans, LA, USA, 18–24 June 2022; pp. 9727–9736. [Google Scholar]
- Roth, K.; Pemula, L.; Zepeda, J.; Sch Olkopf, B.; Brox, T.; Gehler, P. Towards Total Recall in Industrial Anomaly Detection. In Proceedings of the 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), New Orleans, LA, USA, 18–24 June 2022; pp. 14318–14328. [Google Scholar]
- Bergman, L.; Cohen, N.; Hoshen, Y. Deep Nearest Neighbor Anomaly Detection. arXiv
**2020**, arXiv:2002.10445. [Google Scholar] - Cohen, N.; Hoshen, Y. Sub-Image Anomaly Detection with Deep Pyramid Correspondences. arXiv
**2021**, arXiv:2005.02357. [Google Scholar] - Ishida, K.; Takena, Y.; Nota, Y.; Mochizuki, R.; Matsumura, I.; Ohashi, G. SA-PatchCore: Anomaly Detection in Dataset with Co-Occurrence Relationships Using Self-Attention. IEEE Access
**2023**, 11, 3232–3240. [Google Scholar] [CrossRef] - Schlegl, T.; Seeböck, P.; Waldstein, S.M.; Schmidt-Erfurth, U.; Langs, G. Unsupervised Anomaly Detection with Generative Adversarial Networks to Guide Marker Discovery. In Proceedings of the Information Processing in Medical Imaging—IPMI 2017, Boone, NC, USA, 25–30 June 2017; Springer: Berlin/Heidelberg, Germany, 2017; Volume 10265, pp. 146–157. [Google Scholar]
- Zenati, H.; Foo, C.S.; Lecouat, B.; Manek, G.; Chandrasekhar, V.R. Efficient GAN-Based Anomaly Detection. arXiv
**2018**, arXiv:1802.06222. [Google Scholar] - Akcay, S.; Atapour-Abarghouei, A.; Breckon, T.P. GANomaly: Semi-Supervised Anomaly Detection via Adversarial Training. In Proceedings of the Computer Vision—ACCV 2018, Perth, Australia, 2–6 December 2018; Springer: Berlin/Heidelberg, Germany, 2018; Volume 11363, pp. 622–637. [Google Scholar]
- Dhariwal, P.; Nichol, A. Diffusion Models Beat GANs on Image Synthesis. In Proceedings of the Advances in Neural Information Processing Systems, virtual, 6–14 December 2021; Volume 34, pp. 8780–8794. [Google Scholar]
- Wyatt, J.; Leach, A.; Schmon, S.M.; Willcocks, C.G. AnoDDPM: Anomaly Detection with Denoising Diffusion Probabilistic Models using Simplex Noise. In Proceedings of the 2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops (CVPRW), New Orleans, LA, USA, 19–20 June 2022; pp. 649–655. [Google Scholar]
- Wolleb, J.; Bieder, F.; Sandkühler, R.; Cattin, P.C. Diffusion Models for Medical Anomaly Detection. In Proceedings of the Medical Image Computing and Computer Assisted Intervention—MICCAI 2022, Singapore, 18–22 September 2022; Springer: Berlin/Heidelberg, Germany, 2022; Volume 13438, pp. 35–45. [Google Scholar]
- Yang, C.; Yang, C.; Chen, Z.; Lo, N. Multivariate Time Series Data Transformation for Convolutional Neural Network. In Proceedings of the 2019 IEEE/SICE International Symposium on System Integration (SII), Paris, France, 14–16 January 2019; pp. 188–192. [Google Scholar]
- Liu, S.; Wang, S.; Hu, C.; Bi, W. Determination of alcohols-diesel oil by near infrared spectroscopy based on gramian angular field image coding and deep learning. Fuel
**2022**, 309, 122121. [Google Scholar] [CrossRef] - Lee, H.; Yang, K.; Kim, N.; Ahn, C.R. Detecting excessive load-carrying tasks using a deep learning network with a Gramian Angular Field. Autom. Constr.
**2020**, 120, 103390. [Google Scholar] [CrossRef] - Wu, Y.; Wang, B.; Yuan, R.; Watada, J. A Gramian angular field-based data-driven approach for multiregion and multisource renewable scenario generation. Inf. Sci.
**2023**, 619, 578–602. [Google Scholar] [CrossRef] - Ma, K.; Zhan, C.A.; Yang, F. Multi-classification of arrhythmias using ResNet with CBAM on CWGAN-GP augmented ECG Gramian Angular Summation Field. Biomed. Signal Process. Control
**2022**, 77, 103684. [Google Scholar] [CrossRef] - Li, X.; Kang, Y.; Li, F. Forecasting with time series imaging. Expert Syst. Appl.
**2020**, 160, 113680. [Google Scholar] [CrossRef] - Xu, L.; Zheng, L.; Li, W.; Chen, Z.; Song, W.; Deng, Y.; Chang, Y.; Xiao, J.; Yuan, B. NVAE-GAN Based Approach for Unsupervised Time Series Anomaly Detection. arXiv
**2021**, arXiv:2101.02908. [Google Scholar] - Dong, F.; Chen, S.; Demachi, K.; Yoshikawa, M.; Seki, A.; Takaya, S. Attention-based time series analysis for data-driven anomaly detection in nuclear power plants. Nucl. Eng. Des.
**2023**, 404, 112161. [Google Scholar] [CrossRef] - Oh, S.; Oh, S.; Um, T.; Kim, J.; Jung, Y. Methods of Pre-Clustering and Generating Time Series Images for Detecting Anomalies in Electric Power Usage Data. Electronics
**2022**, 11, 3315. [Google Scholar] [CrossRef] - Jiang, W.; Zhang, D.; Ling, L.; Lin, R. Time Series Classification Based on Image Transformation Using Feature Fusion Strategy. Neural Process. Lett.
**2022**, 54, 3727–3748. [Google Scholar] [CrossRef] - Wen, L.; Li, X.; Gao, L.; Zhang, Y. A New Convolutional Neural Network-Based Data-Driven Fault Diagnosis Method. IEEE Trans. Ind. Electron.
**2018**, 65, 5990–5998. [Google Scholar] [CrossRef] - Sun, S.; Sun, L.; Wang, J.; Gao, H. Fault Diagnosis of Conventional Circuit Breaker Accessories Based on Grayscale Image of Current Signal and Improved ZFNet-DRN. IEEE Sens. J.
**2023**, 23, 1343–1356. [Google Scholar] [CrossRef] - Sayed, A.N.; Himeur, Y.; Bensaali, F. From time-series to 2D images for building occupancy prediction using deep transfer learning. Eng. Appl. Artif. Intell.
**2023**, 119, 105786. [Google Scholar] [CrossRef] - Copiaco, A.; Himeur, Y.; Amira, A.; Mansoor, W.; Fadli, F.; Atalla, S.; Sohail, S.S. An innovative deep anomaly detection of building energy consumption using energy time-series images. Eng. Appl. Artif. Intell.
**2023**, 119, 105775. [Google Scholar] [CrossRef] - Tang, Y.; Zhang, X.; Huang, S.; Qin, G.; He, Y.; Qu, Y.; Xie, J.; Zhou, J.; Long, Z. Multisensor-Driven Motor Fault Diagnosis Method Based on Visual Features. IEEE Trans. Ind. Inform.
**2023**, 19, 5902–5914. [Google Scholar] [CrossRef]

**Figure 10.**The AUC-ROC curves of PatchCore (area = 0.9943), HaloAE (area = 0.9906), and TSRD (area = 0.9811).

**Figure 11.**Descriptive statistics and normality tests for test set. (

**a**) PatchCore, (

**b**) HaloAE, (

**c**) TSRD. The blue marginal rugs in the figure represent normal samples, and the red marginal rugs in the red box are anomalies.

**Figure 12.**The t-sne reduction of the data in the PatchCore model. (

**a**) T-sne for Training set, (

**b**) T-sne for Testing set.

Project | Project Content |
---|---|

Operating system | Microsoft Windows 10 |

Python environment | Python 3.8 |

Virtual environment | Anaconda3-2022.10 |

Programming software | PyCharm 2021.3.1 |

Feature Layers | Core Set Percentage | Nei. Agg. Size | Neighbors |
---|---|---|---|

2 and 3 | 10% | 5 | 3 |

Network | Wideresnet50 | Resnext101 | Densenet201 |
---|---|---|---|

AUC-ROC | 0.9811 | 0.9830 | 0.9849 |

Core Set Percentage 10% | Core Set Percentage 1% | ||
---|---|---|---|

Network | Feature Layers | (Nei. Agg. Size, Neighb., AUC-ROC) | (Nei. Agg. Size, Neighb., AUC-ROC) |

densenet201 | 2 and 3 | (3, 1, 0.9943) | (3, 1, 0.9906) |

(5, 3, 0.9849) | (5, 3, 0.9868) | ||

3 and 4 | (3, 1, 0.9774) | (3, 1, 0.9887) | |

(5, 3, 0.9887) | (5, 3, 0.9925) |

Models | Accuracy | Precision | Recall | Specificity | F1 Score |
---|---|---|---|---|---|

PatchCore | 99.10% | 83.33% | 100.0% | 99.10% | 90.91% |

HaloAE | 96.40% | 55.56% | 100.0% | 96.23% | 71.43% |

TSRD | 95.50% | 50.00% | 100.0% | 95.28% | 66.67% |

Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |

© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Li, L.; Li, Q.; Yong, W.; Zhang, S.; Yang, M.; Jiang, P.
Intelligent Online Inspection of the Paste Quality of Prebaked Carbon Anodes Using an Anomaly Detection Algorithm. *Systems* **2023**, *11*, 484.
https://doi.org/10.3390/systems11090484

**AMA Style**

Li L, Li Q, Yong W, Zhang S, Yang M, Jiang P.
Intelligent Online Inspection of the Paste Quality of Prebaked Carbon Anodes Using an Anomaly Detection Algorithm. *Systems*. 2023; 11(9):484.
https://doi.org/10.3390/systems11090484

**Chicago/Turabian Style**

Li, Laiyi, Qingzong Li, Wentao Yong, Shuwei Zhang, Maolin Yang, and Pingyu Jiang.
2023. "Intelligent Online Inspection of the Paste Quality of Prebaked Carbon Anodes Using an Anomaly Detection Algorithm" *Systems* 11, no. 9: 484.
https://doi.org/10.3390/systems11090484