{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,1,3]],"date-time":"2026-01-03T06:45:32Z","timestamp":1767422732521,"version":"build-2065373602"},"reference-count":57,"publisher":"MDPI AG","issue":"8","license":[{"start":{"date-parts":[[2025,7,30]],"date-time":"2025-07-30T00:00:00Z","timestamp":1753833600000},"content-version":"vor","delay-in-days":0,"URL":"https:\/\/creativecommons.org\/licenses\/by\/4.0\/"}],"funder":[{"name":"Serbian Ministry of Science, Technological Development and Innovation","award":["00101957 2025 13440 003 000 620 021","01-50\/295","451-03-137\/2025-03\/200156"],"award-info":[{"award-number":["00101957 2025 13440 003 000 620 021","01-50\/295","451-03-137\/2025-03\/200156"]}]}],"content-domain":{"domain":[],"crossmark-restriction":false},"short-container-title":["Future Internet"],"abstract":"<jats:p>This study presents a lightweight autoencoder-based approach for anomaly detection in digit recognition using federated learning on resource-constrained embedded devices. We implement and evaluate compact autoencoder models on the ESP32-CAM microcontroller, enabling both training and inference directly on the device using 32-bit floating-point arithmetic. The system is trained on a reduced MNIST dataset (1000 resized samples) and evaluated using EMNIST and MNIST-C for anomaly detection. Seven fully connected autoencoder architectures are first evaluated on a PC to explore the impact of model size and batch size on training time and anomaly detection performance. Selected models are then re-implemented in the C programming language and deployed on a single ESP32 device, achieving training times as short as 12 min, inference latency as low as 9 ms, and F1 scores of up to 0.87. Autoencoders are further tested on ten devices in a real-world federated learning experiment using Wi-Fi. We explore non-IID and IID data distribution scenarios: (1) digit-specialized devices and (2) partitioned datasets with varying content and anomaly types. The results show that small unmodified autoencoder models can be effectively trained and evaluated directly on low-power hardware. The best models achieve F1 scores of up to 0.87 in the standard IID setting and 0.86 in the extreme non-IID setting. Despite some clients being trained on corrupted datasets, federated aggregation proves resilient, maintaining high overall performance. The resource analysis shows that more than half of the models and all the training-related allocations fit entirely in internal RAM. These findings confirm the feasibility of local float32 training and collaborative anomaly detection on low-cost hardware, supporting scalable and privacy-preserving edge intelligence.<\/jats:p>","DOI":"10.3390\/fi17080343","type":"journal-article","created":{"date-parts":[[2025,7,30]],"date-time":"2025-07-30T14:00:41Z","timestamp":1753884041000},"page":"343","update-policy":"https:\/\/doi.org\/10.3390\/mdpi_crossmark_policy","source":"Crossref","is-referenced-by-count":2,"title":["Lightweight Anomaly Detection in Digit Recognition Using Federated Learning"],"prefix":"10.3390","volume":"17","author":[{"ORCID":"https:\/\/orcid.org\/0009-0008-6676-2389","authenticated-orcid":false,"given":"Anja","family":"Tanovi\u0107","sequence":"first","affiliation":[{"name":"Faculty of Technical Sciences, University of Novi Sad, 21000 Novi Sad, Serbia"}]},{"ORCID":"https:\/\/orcid.org\/0000-0002-1727-1670","authenticated-orcid":false,"given":"Ivan","family":"Mezei","sequence":"additional","affiliation":[{"name":"Faculty of Technical Sciences, University of Novi Sad, 21000 Novi Sad, Serbia"}]}],"member":"1968","published-online":{"date-parts":[[2025,7,30]]},"reference":[{"key":"ref_1","first-page":"800","article-title":"Tensorflow lite micro: Embedded machine learning for tinyml systems","volume":"3","author":"David","year":"2021","journal-title":"Proc. Mach. Learn. Syst."},{"key":"ref_2","doi-asserted-by":"crossref","first-page":"96892","DOI":"10.1109\/ACCESS.2023.3294111","article-title":"A Comprehensive Survey on TinyML","volume":"11","author":"Abadade","year":"2023","journal-title":"IEEE Access"},{"key":"ref_3","doi-asserted-by":"crossref","first-page":"1","DOI":"10.1145\/3661820","article-title":"A Review on the emerging technology of TinyML","volume":"56","author":"Tsoukas","year":"2024","journal-title":"ACM Comput. Surv."},{"key":"ref_4","doi-asserted-by":"crossref","first-page":"1","DOI":"10.1145\/3583683","article-title":"Intelligence at the Extreme Edge: A Survey on Reformable TinyML","volume":"55","author":"Rajapakse","year":"2023","journal-title":"ACM Comput. Surv."},{"key":"ref_5","doi-asserted-by":"crossref","first-page":"818","DOI":"10.1126\/science.adw7713","article-title":"Cutting AI Down to Size","volume":"387","author":"Ravindran","year":"2025","journal-title":"Science"},{"key":"ref_6","doi-asserted-by":"crossref","first-page":"68","DOI":"10.1145\/3608473","article-title":"Is TinyML Sustainable?","volume":"66","author":"Prakash","year":"2023","journal-title":"Commun. ACM"},{"key":"ref_7","unstructured":"Vu, T.H., Tu, N.H., Huynh-The, T., Lee, K., Kim, S., Voznak, M., and Pham, Q.V. (2025). Integration of TinyML and LargeML: A Survey of 6G and Beyond. arXiv."},{"key":"ref_8","doi-asserted-by":"crossref","first-page":"101063","DOI":"10.1016\/j.iot.2024.101063","article-title":"Anomaly detection based on artificial intelligence of things: A systematic literature mapping","volume":"25","author":"Trilles","year":"2024","journal-title":"Internet Things"},{"key":"ref_9","first-page":"187","article-title":"Lightweight Unsupervised Model for Anomaly Detection on Microcontroller Platforms","volume":"21","author":"Le","year":"2024","journal-title":"J. Marit. Res."},{"key":"ref_10","doi-asserted-by":"crossref","first-page":"1","DOI":"10.1109\/LSENS.2024.3463977","article-title":"Modified Overcomplete Autoencoder for Anomaly Detection Based on TinyML","volume":"8","author":"Yap","year":"2024","journal-title":"IEEE Sens. Lett."},{"key":"ref_11","unstructured":"Geyer, R.C., Klein, T., and Nabi, M. (2017). Differentially private federated learning: A client level perspective. arXiv."},{"key":"ref_12","doi-asserted-by":"crossref","first-page":"1","DOI":"10.1561\/2200000083","article-title":"Advances and Open Problems in Federated Learning","volume":"14","author":"Kairouz","year":"2021","journal-title":"Found. Trends\u00ae Mach. Learn."},{"key":"ref_13","doi-asserted-by":"crossref","first-page":"24","DOI":"10.1109\/IOTM.004.2100182","article-title":"Federated learning for the internet of things: Applications, challenges, and opportunities","volume":"5","author":"Zhang","year":"2022","journal-title":"IEEE Internet Things Mag."},{"key":"ref_14","doi-asserted-by":"crossref","first-page":"17","DOI":"10.1109\/SR.2025.3548547","article-title":"Tiny Federated Learning for Constrained Sensors: A Systematic Literature Review","volume":"2","author":"Prazeres","year":"2025","journal-title":"IEEE Sens. Rev."},{"key":"ref_15","doi-asserted-by":"crossref","first-page":"112342","DOI":"10.1109\/ACCESS.2022.3216007","article-title":"A review of neural networks for anomaly detection","volume":"10","author":"Brandao","year":"2022","journal-title":"IEEE Access"},{"key":"ref_16","doi-asserted-by":"crossref","first-page":"756","DOI":"10.1007\/s12596-023-01147-4","article-title":"A survey of anomaly detection techniques","volume":"53","author":"Ghamry","year":"2024","journal-title":"J. Opt."},{"key":"ref_17","doi-asserted-by":"crossref","unstructured":"Carannante, G., Dera, D., Aminul, O., Bouaynaya, N.C., and Rasool, G. (2022, January 4\u20137). Self-assessment and robust anomaly detection with bayesian deep learning. Proceedings of the 2022 25th International Conference on Information Fusion (FUSION), Link\u00f6ping, Sweden.","DOI":"10.23919\/FUSION49751.2022.9841358"},{"key":"ref_18","unstructured":"Denouden, T., Salay, R., Czarnecki, K., Abdelzad, V., Phan, B., and Vernekar, S. (2018). Improving reconstruction autoencoder out-of-distribution detection with Mahalanobis distance. arXiv."},{"key":"ref_19","unstructured":"Ruff, L., Vandermeulen, R.A., Franks, B.J., M\u00fcller, K.R., and Kloft, M. (2020). Rethinking assumptions in deep anomaly detection. arXiv."},{"key":"ref_20","doi-asserted-by":"crossref","first-page":"111484","DOI":"10.1016\/j.comnet.2025.111484","article-title":"A Survey on anomaly detection in IoT: Techniques, challenges, and opportunities with the integration of 6G","volume":"270","author":"Haider","year":"2025","journal-title":"Comput. Netw."},{"key":"ref_21","doi-asserted-by":"crossref","first-page":"23406","DOI":"10.1109\/ACCESS.2024.3365349","article-title":"A Machine Learning-Oriented Survey on Tiny Machine Learning","volume":"12","author":"Capogrosso","year":"2024","journal-title":"IEEE Access"},{"key":"ref_22","doi-asserted-by":"crossref","unstructured":"Zeeshan, M. (2024). Efficient Deep Learning Models for Edge IOT Devices-A Review. Authorea Prepr.","DOI":"10.36227\/techrxiv.172254372.21002541\/v1"},{"key":"ref_23","doi-asserted-by":"crossref","first-page":"5435","DOI":"10.1007\/s11042-024-20523-1","article-title":"Optimized Convolutional Neural Network at the IoT edge for image detection using pruning and quantization","volume":"84","author":"Naveen","year":"2025","journal-title":"Multimed. Tools Appl."},{"key":"ref_24","unstructured":"Ghamari, S., Ozcan, K., Dinh, T., Melnikov, A., Carvajal, J., Ernst, J., and Chai, S. (2021). Quantization-guided training for compact tinyml models. arXiv."},{"key":"ref_25","first-page":"11711","article-title":"Mcunet: Tiny deep learning on iot devices","volume":"33","author":"Lin","year":"2020","journal-title":"Adv. Neural Inf. Process. Syst."},{"key":"ref_26","doi-asserted-by":"crossref","unstructured":"Kim, D., Yang, H., Chung, M., Cho, S., Kim, H., Kim, M., Kim, K., and Kim, E. (2018, January 23\u201325). Squeezed convolutional variational autoencoder for unsupervised anomaly detection in edge device industrial internet of things. Proceedings of the 2018 International Conference on Information and Computer Technologies (ICICT), DeKalb, IL, USA.","DOI":"10.1109\/INFOCT.2018.8356842"},{"key":"ref_27","doi-asserted-by":"crossref","unstructured":"Givnan, S., Chalmers, C., Fergus, P., Ortega-Martorell, S., and Whalley, T. (2022). Anomaly detection using autoencoder reconstruction upon industrial motors. Sensors, 22.","DOI":"10.3390\/s22093166"},{"key":"ref_28","doi-asserted-by":"crossref","unstructured":"Bratu, D.V., Ilinoiu, R.\u015e.T., Cristea, A., Zolya, M.A., and Moraru, S.A. (2022, January 17\u201320). Anomaly Detection Using Edge Computing AI on Low Powered Devices. Proceedings of the IFIP International Conference on Artificial Intelligence Applications and Innovations, Crete, Greece.","DOI":"10.1007\/978-3-031-08333-4_8"},{"key":"ref_29","doi-asserted-by":"crossref","first-page":"17660","DOI":"10.1109\/JIOT.2022.3157532","article-title":"Exploring scalable, distributed real-time anomaly detection for bridge health monitoring","volume":"9","author":"Moallemi","year":"2022","journal-title":"IEEE Internet Things J."},{"key":"ref_30","doi-asserted-by":"crossref","unstructured":"Luo, T., and Nagarajan, S.G. (2018, January 20\u201324). Distributed anomaly detection using autoencoder neural networks in WSN for IoT. Proceedings of the 2018 IEEE International Conference on Communications (ICC), Kansas City, MO, USA.","DOI":"10.1109\/ICC.2018.8422402"},{"key":"ref_31","unstructured":"Kwon, Y.D., Li, R., Venieris, S.I., Chauhan, J., Lane, N.D., and Mascolo, C. (2023). TinyTrain: Resource-aware task-adaptive sparse training of DNNs at the data-scarce edge. arXiv."},{"key":"ref_32","doi-asserted-by":"crossref","first-page":"1250","DOI":"10.1109\/TCAD.2024.3484354","article-title":"On-Device Training of Fully Quantized Deep Neural Networks on Cortex-M Microcontrollers","volume":"44","author":"Deutel","year":"2025","journal-title":"IEEE Trans. Comput.-Aided Des. Integr. Circuits Syst."},{"key":"ref_33","doi-asserted-by":"crossref","unstructured":"Ren, H., Anicic, D., and Runkler, T.A. (2021, January 18\u201322). Tinyol: Tinyml with online-learning on microcontrollers. Proceedings of the 2021 International Joint Conference on Neural Networks (IJCNN), Shenzhen, China.","DOI":"10.1109\/IJCNN52387.2021.9533927"},{"key":"ref_34","doi-asserted-by":"crossref","unstructured":"Abbasi, S., Famouri, M., Shafiee, M.J., and Wong, A. (2021). OutlierNets: Highly compact deep autoencoder network architectures for on-device acoustic anomaly detection. Sensors, 21.","DOI":"10.3390\/s21144805"},{"key":"ref_35","doi-asserted-by":"crossref","first-page":"107484","DOI":"10.1016\/j.future.2024.107484","article-title":"Small models, big impact: A review on the power of lightweight Federated Learning","volume":"162","author":"Qi","year":"2024","journal-title":"Future Gener. Comput. Syst."},{"key":"ref_36","doi-asserted-by":"crossref","unstructured":"Kopparapu, K., Lin, E., Breslin, J.G., and Sudharsan, B. (2022, January 21\u201325). Tinyfedtl: Federated transfer learning on ubiquitous tiny iot devices. Proceedings of the 2022 IEEE International Conference on Pervasive Computing and Communications Workshops and Other Affiliated Events (PerCom Workshops), Pisa, Italy.","DOI":"10.1109\/PerComWorkshops53856.2022.9767250"},{"key":"ref_37","doi-asserted-by":"crossref","first-page":"102189","DOI":"10.1016\/j.inffus.2023.102189","article-title":"Federated learning for IoT devices: Enhancing TinyML with on-board training","volume":"104","author":"Ficco","year":"2024","journal-title":"Inf. Fusion"},{"key":"ref_38","doi-asserted-by":"crossref","unstructured":"Niki\u0107, V., Bortnik, D., Luki\u0107, M., Vukobratovi\u0107, D., and Mezei, I. (2024). Lightweight Digit Recognition in Smart Metering System Using Narrowband Internet of Things and Federated Learning. Future Internet, 16.","DOI":"10.3390\/fi16110402"},{"key":"ref_39","doi-asserted-by":"crossref","unstructured":"Ren, H., Anicic, D., and Runkler, T.A. (2023, January 18\u201323). TinyReptile: TinyML with federated meta-learning. Proceedings of the 2023 International Joint Conference on Neural Networks (IJCNN), Gold Coast, Australia.","DOI":"10.1109\/IJCNN54540.2023.10191845"},{"key":"ref_40","doi-asserted-by":"crossref","first-page":"109805","DOI":"10.1016\/j.patcog.2023.109805","article-title":"Fast deep autoencoder for federated learning","volume":"143","year":"2023","journal-title":"Pattern Recognit."},{"key":"ref_41","doi-asserted-by":"crossref","first-page":"289","DOI":"10.1109\/MNET.2024.3469988","article-title":"Federated Learning on 5G Edge for Industrial Internet of Things","volume":"39","author":"Liu","year":"2025","journal-title":"IEEE Netw."},{"key":"ref_42","doi-asserted-by":"crossref","unstructured":"Reis, M.J. (2025). Edge-FLGuard: A Federated Learning Framework for Real-Time Anomaly Detection in 5G-Enabled IoT Ecosystems. Appl. Sci., 15.","DOI":"10.3390\/app15126452"},{"key":"ref_43","doi-asserted-by":"crossref","first-page":"100068","DOI":"10.1016\/j.csa.2024.100068","article-title":"Federated learning-based intrusion detection system for the internet of things using unsupervised and supervised deep learning models","volume":"3","author":"Pranggono","year":"2025","journal-title":"Cyber Secur. Appl."},{"key":"ref_44","doi-asserted-by":"crossref","unstructured":"Ochiai, H., Nishihata, R., Tomiyama, E., Sun, Y., and Esaki, H. (2023, January 23\u201326). Detection of global anomalies on distributed iot edges with device-to-device communication. Proceedings of the Twenty-Fourth International Symposium on Theory, Algorithmic Foundations, and Protocol Design for Mobile Networks and Mobile Computing, Washington, DC, USA.","DOI":"10.1145\/3565287.3616528"},{"key":"ref_45","unstructured":"Ai-Thinker Technology Co., Ltd. (2025, May 23). ESP32-CAM Schematic Diagram. Available online: https:\/\/docs.ai-thinker.com\/_media\/esp32\/docs\/esp32_cam_sch.pdf."},{"key":"ref_46","doi-asserted-by":"crossref","first-page":"2278","DOI":"10.1109\/5.726791","article-title":"Gradient-based learning applied to document recognition","volume":"86","author":"LeCun","year":"1998","journal-title":"Proc. IEEE"},{"key":"ref_47","doi-asserted-by":"crossref","unstructured":"Cohen, G., Afshar, S., Tapson, J., and van Schaik, A. (2017, January 14\u201319). EMNIST: Extending MNIST to handwritten letters. Proceedings of the 2017 International Joint Conference on Neural Networks (IJCNN), Anchorage, AK, USA.","DOI":"10.1109\/IJCNN.2017.7966217"},{"key":"ref_48","unstructured":"Mu, N., and Gilmer, J. (2019). MNIST-C: A Robustness Benchmark for Computer Vision. arXiv."},{"key":"ref_49","unstructured":"TensorFlow (2025, May 23). TensorFlow Datasets. Available online: https:\/\/www.tensorflow.org\/datasets."},{"key":"ref_50","unstructured":"TensorFlow (2025, June 03). EarlyStopping Callback. Available online: https:\/\/www.tensorflow.org\/api_docs\/python\/tf\/keras\/callbacks\/EarlyStopping."},{"key":"ref_51","unstructured":"Abadi, M., Barham, P., Chen, J., Chen, Z., Davis, A., Dean, J., Devin, M., Ghemawat, S., Irving, G., and Isard, M. (2016, January 2\u20134). {TensorFlow}: A system for {Large-Scale} machine learning. Proceedings of the 12th USENIX Symposium on Operating Systems Design and Implementation (OSDI 16), Savannah, GA, USA."},{"key":"ref_52","unstructured":"McMahan, B., Moore, E., Ramage, D., Hampson, S., and y Arcas, B.A. (2017, January 20\u201322). Communication-efficient learning of deep networks from decentralized data. Proceedings of the 20th International Conference on Artificial Intelligence and Statistics, Fort Lauderdale, FL, USA."},{"key":"ref_53","first-page":"49","article-title":"Security of federated learning: Attacks, defensive mechanisms, and challenges","volume":"36","author":"Benmalek","year":"2022","journal-title":"Rev. Des Sci. Technol. L\u2019Inf.-S\u00e9rie RIA Rev. D\u2019Intelligence Artif."},{"key":"ref_54","unstructured":"Alsulaimawi, Z. (2024). Federated Learning with Anomaly Detection via Gradient and Reconstruction Analysis. arXiv."},{"key":"ref_55","unstructured":"Allouah, Y., Guerraoui, R., Gupta, N., Jellouli, A., Rizk, G., and Stephan, J. (2024). Adaptive gradient clipping for robust federated learning. arXiv."},{"key":"ref_56","doi-asserted-by":"crossref","unstructured":"Zhang, Z., Cao, X., Jia, J., and Gong, N.Z. (2022, January 14\u201318). Fldetector: Defending federated learning against model poisoning attacks via detecting malicious clients. Proceedings of the 28th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, Washington, DC, USA.","DOI":"10.1145\/3534678.3539231"},{"key":"ref_57","doi-asserted-by":"crossref","unstructured":"Tanovi\u0107, A., and Mezei, I. (2024, January 13\u201317). Embedded Parallel K-Means Algorithm Evaluation on ESP32 Across Various Memory Allocations. Proceedings of the 2024 IEEE East-West Design & Test Symposium (EWDTS), Yerevan, Armenia.","DOI":"10.1109\/EWDTS63723.2024.10873639"}],"container-title":["Future Internet"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/www.mdpi.com\/1999-5903\/17\/8\/343\/pdf","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2025,10,9]],"date-time":"2025-10-09T18:19:07Z","timestamp":1760033947000},"score":1,"resource":{"primary":{"URL":"https:\/\/www.mdpi.com\/1999-5903\/17\/8\/343"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2025,7,30]]},"references-count":57,"journal-issue":{"issue":"8","published-online":{"date-parts":[[2025,8]]}},"alternative-id":["fi17080343"],"URL":"https:\/\/doi.org\/10.3390\/fi17080343","relation":{},"ISSN":["1999-5903"],"issn-type":[{"type":"electronic","value":"1999-5903"}],"subject":[],"published":{"date-parts":[[2025,7,30]]}}}