Meta-Learning-Based LSTM-Autoencoder for Low-Data Anomaly Detection in Retrofitted CNC Machine Using Multi-Machine Datasets
Abstract
1. Introduction
2. Related Work
3. Background
3.1. Long Short-Term Memory Autoencoder (LSTM-AE)
3.2. Model-Agnostic Meta-Learning (MAML)
4. Multi-Machine-Based MAML LSTM-AE
4.1. Multi-Machine Data Collection and Preprocessing
4.2. Multi-Machine-Based Task Construction
4.2.1. Multi-Machine Task Sequence Normalization
4.2.2. Input Data Normalization
4.2.3. Metadata Statistics
4.3. MAML-Based LSTM-AE Anomaly Detection Model
4.3.1. Meta-Training
4.3.2. Meta-Testing
5. Experiments
5.1. Experimental Setup
5.2. Experiment 1: Compare Performance with the Baseline Model in a Low-Data Situation
Experiment 1 Results
5.3. Experiment 2: Evaluation of Generalization Under Equipment Change
Experiment 2 Results
6. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- Kolla, S.S.V.; Lourenço, D.M.; Kumar, A.A.; Plapper, P. Retrofitting of legacy machines in the context of Industrial Internet of Things (IIoT). Procedia Comput. Sci. 2022, 200, 62–70. [Google Scholar] [CrossRef]
- Alqoud, A.; Schaefer, D.; Milisavljevic-Syed, J. Industry 4.0: A systematic review of legacy manufacturing system digital retrofitting. Manuf. Rev. 2022, 9, 32. [Google Scholar] [CrossRef]
- Ilari, S.; Di Carlo, F.; Ciarapica, F.E.; Bevilacqua, M. Machine Tool Transition from Industry 3.0 to 4.0: A comparison Between old machine retrofitting and the purchase of new machines from a triple bottom line perspective. Sustainability 2021, 13, 10441. [Google Scholar] [CrossRef]
- Schüppstuhl, T.; Tracht, K.; Roßmann, J. (Eds.) Tagungsband des 4. Kongresses Montage Handhabung Industrieroboter; Springer: Berlin, Germany, 2019. [Google Scholar]
- Di Carlo, F.; Mazzuto, G.; Bevilacqua, M.; Ciarapica, F.E. Retrofitting a process plant in an Industry 4.0 perspective for improving safety and maintenance performance. Sustainability 2021, 13, 646. [Google Scholar] [CrossRef]
- Anomaly Detection in Industrial Sensors: A Machine Learning-Driven Approach to Predictive Maintenance. Available online: https://www.researchgate.net/publication/386441949_Anomaly_Detection_in_Industrial_Sensors_A_Machine_Learning-Driven_Approach_to_Predictive_Maintenance (accessed on 29 May 2025).
- AI-Enabled Anomaly Detection in Industrial Systems: A New Era in Predictive Maintenance. Available online: https://www.researchgate.net/publication/386443676_AI-Enabled_Anomaly_Detection_in_Industrial_Systems_A_New_Era_in_Predictive_Maintenance (accessed on 29 May 2025).
- Shiva, K.; Etikani, P.; Venkata, V.; Mittal, A.; Dave, A.; Kanchetti, D.; Thakkar, D.; Munirathnam, R. Anomaly Detection in Sensor Data with Machine Learning Predictive Maintenance for Industrial Systems. J. Electr. Syst. 2024, 20, 454–462. [Google Scholar]
- Holtz, D.; Kaymakci, C.; Leuthe, D.; Wenninger, S.; Sauer, A. A data-efficient active learning architecture for anomaly detection in industrial time series data. Flex. Serv. Manuf. J. 2025, 1, 1–32. [Google Scholar] [CrossRef]
- Pietrangeli, I.; Mazzuto, G.; Ciarapica, F.E.; Bevilacqua, M. Smart Retrofit: An innovative and sustainable solution. Machines 2023, 11, 523. [Google Scholar] [CrossRef]
- Abdallah, M.; Joung, B.G.; Lee, W.J.; Mousoulis, C.; Raghunathan, N.; Shakouri, A.; Sutherland, J.W.; Bagchi, S. Anomaly Detection and Inter-Sensor Transfer Learning on Smart Manufacturing Datasets. Sensors 2023, 23, 486. [Google Scholar] [CrossRef]
- Maschler, B.; Pham, T.T.H.; Weyrich, M. Regularization-based continual learning for anomaly detection in discrete manufacturing. Procedia CIRP 2021, 104, 452–457. [Google Scholar] [CrossRef]
- Maschler, B.; Knödel, T.; Weyrich, M. Towards deep industrial transfer learning for anomaly detection on time series data. In Proceedings of the 2021 26th IEEE International Conference on Emerging Technologies and Factory Automation (ETFA), Vasteras, Sweden, 7–10 September 2021; pp. 1–8. [Google Scholar] [CrossRef]
- Li, E.; Bedi, S.; Melek, W. Anomaly detection in three-axis CNC machines using LSTM networks and transfer learning. Int. J. Adv. Manuf. Technol. 2023, 127, 5185–5198. [Google Scholar] [CrossRef]
- Peixoto, J.; Sousa, J.; Carvalho, R.; Soares, M.; Cardoso, R.; Reis, A. Anomaly detection with a LSTM autoencoder using InfluxDB. In Flexible Automation and Intelligent Manufacturing: Establishing Bridges for More Sustainable Manufacturing Systems; Silva, F.J.G., Ferreira, L.P., Sá, J.C., Pereira, M.T., Pinto, C.M.A., Eds.; Springer Nature: Cham, Switzerland, 2024; pp. 69–76. [Google Scholar] [CrossRef]
- Shin, Y.; Na, K.Y.; Kim, S.E.; Kyung, E.J.; Choi, H.G.; Jeong, J. LSTM-Autoencoder based detection of time-series noise signals for water supply and sewer pipe leakages. Water 2024, 16, 2631. [Google Scholar] [CrossRef]
- Homayouni, H.; Ghosh, S.; Ray, I.; Gondalia, S.; Duggan, J.; Kahn, M.G. An autocorrelation-based LSTM-Autoencoder for anomaly detection on time-series data. In Proceedings of the 2020 IEEE International Conference on Big Data (Big Data), Virtual Event, 10–13 December 2020; pp. 5068–5077. [Google Scholar] [CrossRef]
- Berahmand, K.; Daneshfar, F.; Salehi, E.S.; Li, Y.; Xu, Y. Autoencoders and their applications in machine learning: A survey. Artif. Intell. Rev. 2024, 57, 28. [Google Scholar] [CrossRef]
- Safonova, A.; Ghazaryan, G.; Stiller, S.; Main-Knorn, M.; Nendel, C.; Ryo, M. Ten deep learning techniques to address small data problems with remote sensing. Int. J. Appl. Earth Obs. Geoinf. 2023, 125, 103569. [Google Scholar] [CrossRef]
- Zhuang, F.; Qi, Z.; Duan, K.; Xi, D.; Zhu, Y.; Zhu, H.; Xiong, H.; He, Q. A comprehensive survey on transfer learning. Proc. IEEE 2021, 109, 43–76. [Google Scholar] [CrossRef]
- Deng, C.; Wu, Q.; Miao, J.; Lu, S.; Xie, L. Meta-transfer learning for predicting position-dependent milling stability across varying overhang lengths under limited experimental data. J. Manuf. Process. 2025, 149, 43–56. [Google Scholar] [CrossRef]
- Chen, Y.; Xu, X.; Liu, C. Few-shot meta transfer learning-based damage detection of composite structures. Smart Mater. Struct. 2024, 33, 025027. [Google Scholar] [CrossRef]
- Song, W.; Wu, D.; Shen, W.; Boulet, B. Meta-learning based early fault detection for rolling bearings via few-shot anomaly detection. arXiv 2023, arXiv:2204.12637. [Google Scholar] [CrossRef]
- Li, C.; Li, S.; Feng, Y.; Gryllias, K.; Gu, F.; Pecht, M. Small data challenges for intelligent prognostics and health management: A review. Artif. Intell. Rev. 2024, 57, 214. [Google Scholar] [CrossRef]
- Sanchez-Londono, D.; Barbieri, G.; Fumagalli, L. Smart retrofitting in maintenance: A systematic literature review. J. Intell. Manuf. 2022, 34, 1–19. [Google Scholar] [CrossRef]
- Xu, Z.; Selvaraj, V.; Min, S. State identification of a 5-axis ultra-precision CNC machine tool using energy consumption data assisted by multi-output densely connected 1D-CNN model. J. Intell. Manuf. 2024, 35, 147–160. [Google Scholar] [CrossRef]
- Selvaraj, V.; Min, S. Real-time fault identification system for a retrofitted ultra-precision CNC machine from equipment’s power consumption data: A case study of an implementation. Int. J. Precis. Eng. Manuf. Green Technol. 2022, 10, 925–941. [Google Scholar] [CrossRef]
- Selvaraj, V.; Xu, Z.; Min, S. Intelligent operation monitoring of an ultra-precision CNC machine tool using energy data. Int. J. Precis. Eng. Manuf. Green Technol. 2022, 10, 59–69. [Google Scholar] [CrossRef]
- Çekik, R.; Turan, A. Deep learning for anomaly detection in CNC machine vibration data: A RoughLSTM-based approach. Appl. Sci. 2025, 15, 3179. [Google Scholar] [CrossRef]
- Demetgul, M.; Zheng, Q.; Tansel, I.N.; Fleischer, J. Monitoring the misalignment of machine tools with autoencoders after they are trained with transfer learning data. Int. J. Adv. Manuf. Technol. 2023, 128, 3357–3373. [Google Scholar] [CrossRef]
- Chang, B.R.; Tsai, H.F.; Mo, H.Y. Ensemble meta-learning-based robust chipping prediction for wafer dicing. Electronics 2024, 13, 1802. [Google Scholar] [CrossRef]
- Yao, M.; Tao, D.; Qi, P.; Gao, R. Rethinking discrepancy analysis: Anomaly detection via meta-learning powered dual-source representation differentiation. IEEE Trans. Autom. Sci. Eng. 2024, 22, 8579–8592. [Google Scholar] [CrossRef]
- Sakoe, H.; Chiba, S. Dynamic programming algorithm optimization for spoken word recognition. IEEE Trans. Acoust. Speech Signal Process. 1978, 26, 43–49. [Google Scholar] [CrossRef]
- Cuturi, M.; Blondel, M. Soft-DTW: A differentiable loss function for time-series. In Proceedings of the International Conference on Machine Learning, Sydney, Australia, 6–11 August 2017; pp. 894–903. [Google Scholar]
Related Research | Methodology | Target System and Approach | Limitations |
---|---|---|---|
Selvaraj et al. (2023) [26,27,28] | Anomaly scoring metric (Mahalanobis Distance) | Retrofitted 5-axis CNC machine | Anomaly detection studies were conducted after sufficient data was collected, so the issue of data acquisition timeframe was not addressed. |
Çekik & Turan. (2025) [29] | RoughLSTM | Retrofitted 5-axis CNC machine | Relies on expert-labeled vibration data, making the collection of large, balanced datasets both time-consuming and resource-intensive |
Li, Bedi & Melek. (2023) [14] | LSTM-AE + Transfer Learning | Low-data situations in 5-axis CNC machine | Uncertainty in model generalization due to single-source-single-target transfer learning approach |
Demetgul et al. (2023) [30] | LSTM-AE + Transfer Learning + Data Augmentation | Low-data situations in 3-axis CNC machine | Only normal data was collected, and anomaly data had to be synthetically generated from experimental test platforms. |
Chang et al. (2023) [31] | MAML | Low-data situations in wafer dicing machine | Requires sufficient and well-distributed data, and experiments showed poor prediction accuracy when training data is limited |
Yao et al. (2025) [32] | AuoDual | Unlabeled data situations in five large-scale real-world industries | Few anomalous samples can destabilize representation learning, degrading detection performance |
Proposed work | LSTM-AE | Unlabeled and low-data situations in retrofitted 5-axis CNC machines | Requires data from multiple identical 5-axis machines, making it difficult to generalize to industrial sites |
Category | Columns | Contents | Example |
---|---|---|---|
Machine info | MACHINE_CODE | Machine code | M001 |
Operation info | OCCUR_DATE | Data timestamp | YYYY.MM.DD hh:mm:ss |
MACHINE_MODE | Machine mode | MEMORY (Auto) | |
OPERATE_MODE | Operation status | OPERATE ALARM EMEGENCY IDLE STOP SUSPEND | |
MACHINE_STATUS | Machine operational state | STOP (0) | |
RUNNING (1) | |||
ALARM (2) | |||
OFF (3) | |||
Process info | PROSSED_QTY | Processed product count (until level) | 14,934 (14,934th product) |
Sensor data | LOAD 1–5 | Axis load values | 1.757644 |
Anomaly info | ALARM_CODE | Anomaly alarm code | SV040: Servo position error |
SV041: Servo following error | |||
SV045: Motor overload | |||
SV049: Servo delay | |||
SV060: Axis parameter error |
Machine | Column | Sample Count | Mean | Std |
---|---|---|---|---|
M001 | LOAD_1 | 900,598 (2704 sequences) | 0.50542456 | 0.10112762 |
LOAD_2 | 900,598 (2704 sequences) | 0.44761983 | 0.12700728 | |
LOAD_3 | 900,598 (2704 sequences) | 0.59069705 | 0.17027938 | |
LOAD_4 | 900,598 (2704 sequences) | 0.36839223 | 0.09298372 | |
LOAD_5 | 900,598 (2704 sequences) | 0.61748427 | 0.1081329 | |
M002 | LOAD_1 | 709,840 (2131 sequences) | 0.59514379 | 0.1574048 |
LOAD_2 | 709,840 (2131 sequences) | 0.40344976 | 0.20567667 | |
LOAD_3 | 709,840 (2131 sequences) | 0.53153394 | 0.2277552 | |
LOAD_4 | 709,840 (2131 sequences) | 0.2220627 | 0.14370497 | |
LOAD_5 | 709,840 (2131 sequences) | 0.4302011 | 0.1505984 | |
M003 | LOAD_1 | 523,476 (1572 sequences) | 0.54203787 | 0.09018785 |
LOAD_2 | 523,476 (1572 sequences) | 0.52382211 | 0.10038 | |
LOAD_3 | 523,476 (1572 sequences) | 0.51152321 | 0.10031709 | |
LOAD_4 | 523,476 (1572 sequences) | 0.51351772 | 0.11441465 | |
LOAD_5 | 523,476 (1572 sequences) | 0.5131019 | 0.19326683 | |
M004 | LOAD_1 | 1,103,229 (3313 sequences) | 0.43255012 | 0.06768404 |
LOAD_2 | 1,103,229 (3313 sequences) | 0.49672249 | 0.06791739 | |
LOAD_3 | 1,103,229 (3313 sequences) | 0.50904567 | 0.07837191 | |
LOAD_4 | 1,103,229 (3313 sequences) | 0.52217536 | 0.09814365 | |
LOAD_5 | 1,103,229 (3313 sequences) | 0.5320233 | 0.17759579 | |
M005 | LOAD_1 | 1,154,844 (3468 sequences) | 0.44928078 | 0.10224675 |
LOAD_2 | 1,154,844 (3468 sequences) | 0.39194564 | 0.16300031 | |
LOAD_3 | 1,154,844 (3468 sequences) | 0.52487395 | 0.11619587 | |
LOAD_4 | 1,154,844 (3468 sequences) | 0.49783855 | 0.1232668 | |
LOAD_5 | 1,154,844 (3468 sequences) | 0.39670919 | 0.0879473 | |
M006 (Retrofitted Machine) | LOAD_1 | 364,635 (1095 sequences) | 0.55664807 | 0.08672394 |
LOAD_2 | 364,635 (1095 sequences) | 0.39203232 | 0.16062026 | |
LOAD_3 | 364,635 (1095 sequences) | 0.61901911 | 0.11195613 | |
LOAD_4 | 364,635 (1095 sequences) | 0.41580323 | 0.10295453 | |
LOAD_5 | 364,635 (1095 sequences) | 0.48648136 | 0.09712615 |
Category | Mathematical Condition | Description | Usage |
---|---|---|---|
Normal | = 0 | No alarm events in the cycle (all ALARM_CODE are NULL) | Used for training and evaluation |
Minor Anomaly | Some alarm events occurred, but fewer than 50% of the entries are non-NULL | Can be used for threshold tuning or semi-supervised training | |
Anomaly | ≥ 0.5 | More than 50% of entries are non-NULL ALARM_CODE | Used for evaluation only |
Category | Parameter | Value |
---|---|---|
Model Architecture | Model type | LSTM Autoencoder |
Input dimension | Automatically determined | |
Hidden layer dimension | 128 | |
Latent-space dimension | 64 | |
Number of LSTM layers | 2 | |
Dropout rate | 0.2 | |
Training Parameters | Learning rate | 0.0001 |
Epochs | 100 | |
Batch size | 64 | |
Training/validation split | 0.8/0.2 | |
Early-stopping patience | 20 | |
Gradient clipping threshold | 1.0 | |
Data Preprocessing | Sequence length | 333 |
Production-cycle length | 333 | |
Normalization method | z-score | |
Anomaly detection threshold | Thresholding method | Statistical (mean + std dev) |
Thresholding multiplier | 3 |
Category | Performance Metrics | Contents |
---|---|---|
Anomaly Detection Performance | Confusion matrix | TP (True Positive), FP (False Positive), FN (False Negative), TN (True Negative) |
Accuracy | ||
Precision | ||
Recall | ||
F1-score | ||
Reconstruction Performance | Reconstruction error | The mean squared error between the input and its reconstruction |
Model | Accuracy | Precision | Recall | F1-Score | TP | FP | TN | FN |
---|---|---|---|---|---|---|---|---|
Basic LSTM-AE | 0.8413 | 1.0000 | 0.1111 | 0.2000 | 207 | 0 | 5 | 40 |
Transfer learning | 0.9405 | 0.9412 | 0.7111 | 0.8101 | 205 | 2 | 32 | 13 |
Single-machine-based MAML LSTM-AE | 0.8517 | 0.8462 | 0.2444 | 0.3793 | 205 | 2 | 11 | 34 |
Proposed multi-machine-based MAML LSTM-AE | 0.9802 | 0.9000 | 1.0000 | 0.9474 | 202 | 5 | 45 | 0 |
Model | Dataset | Time per Epoch (min) | Total Training Time (100 Epochs) | Avg. Inference Time (ms/Sample) |
---|---|---|---|---|
Basic LSTM | M006 (364,635 samples, 1095 sequences) | ≈2 | ≈3.3 h | ≈0.2 |
Single-task MAML | M006 (364,635 samples, 1095 sequences) | ≈3 | ≈5 h | ≈0.2 |
Transfer Learning (Pretrain/Fine-tune) | Pretrain: M005 (1,154,844 samples, 3468 sequences) Fine-tune: M006 | Pretrain ≈ 6.5 Fine-tune ≈ 2 | ≈14.1 h | ≈0.2 |
Multi-task MAML (Pretrain/Fine-tune) | Pretrain: M001–M005 (≈4,491,987 samples, 13,188 sequences) Fine-tune: M006 | Pretrain ≈ 20 Fine-tune ≈ 3 | ≈38.3 h | ≈0.2 |
Model | Accuracy | Precision | Recall | F1-Score | TP | FP | TN | FN |
---|---|---|---|---|---|---|---|---|
Single-machine-based MAML LSTM-AE | 0.8315 | 1.0000 | 0.2373 | 0.3836 | 286 | 0 | 45 | 14 |
Proposed Multi-machine-based MAML LSTM-AE | 0.9813 | 0.9219 | 1.0000 | 0.9593 | 203 | 5 | 0 | 59 |
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. |
© 2025 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
Woo, J.-M.; Ju, S.-H.; Sung, J.-H.; Seo, K.-M. Meta-Learning-Based LSTM-Autoencoder for Low-Data Anomaly Detection in Retrofitted CNC Machine Using Multi-Machine Datasets. Systems 2025, 13, 534. https://doi.org/10.3390/systems13070534
Woo J-M, Ju S-H, Sung J-H, Seo K-M. Meta-Learning-Based LSTM-Autoencoder for Low-Data Anomaly Detection in Retrofitted CNC Machine Using Multi-Machine Datasets. Systems. 2025; 13(7):534. https://doi.org/10.3390/systems13070534
Chicago/Turabian StyleWoo, Ji-Min, Seong-Hyeon Ju, Jin-Hyeon Sung, and Kyung-Min Seo. 2025. "Meta-Learning-Based LSTM-Autoencoder for Low-Data Anomaly Detection in Retrofitted CNC Machine Using Multi-Machine Datasets" Systems 13, no. 7: 534. https://doi.org/10.3390/systems13070534
APA StyleWoo, J.-M., Ju, S.-H., Sung, J.-H., & Seo, K.-M. (2025). Meta-Learning-Based LSTM-Autoencoder for Low-Data Anomaly Detection in Retrofitted CNC Machine Using Multi-Machine Datasets. Systems, 13(7), 534. https://doi.org/10.3390/systems13070534