FedScrap: Layer-Wise Personalized Federated Learning for Scrap Detection
Abstract
:1. Introduction
- We have developed a federated steel scrap classification framework based on self-clustering, which allows each client to autonomously aggregate a personalized scrap steel classification model most relevant to them through the self-attention mechanism.
- We propose a model aggregation method based on the self-attention mechanism, which calculates the attention weights between models after serializing the client models, and aggregates personalized models according to the weights.
- We compare the proposed method with multiple personalized FL methods using multiple deep learning models on the dataset collected by ourselves. The experimental results show that the proposed method can effectively improve the classification accuracy of scrap steel under Non-IID distribution.
2. Related Work
2.1. Scrap Steel Classification
2.2. Personalized Federated Learning
3. Problem Statement
3.1. Federated Learning
3.2. Personalized FL-Based Scrap Steel Classification
4. Overview and Implementation
4.1. Overview
- Preprocessing of scrap data and local training of classification models. Due to the complex scrap detection environment, which contains a large number of stacked scrap and background information, clients need to preprocess its scrap data and extract scrap features conducive to classification. Then, clients build their own neural network models with the same structure (such as resnet18, etc.) for training on the processed data.
- Personalized aggregation of parameters based on self-attention. The server receives the model parameters trained by the clients and aggregates the personalized model for each client using self-attention. The core of self-attention is to measure the model similarity between clients, which can represent the distributed similarity between clients’ data, and then assign greater aggregate weight to those clients’ models that are more relevant to them when aggreging models for clients.
4.2. Implementation and Algorithm Description
4.2.1. Preprocessing of Scrap Data and Local Training of Classification Models
4.2.2. Personalized Model Aggregation Based on Self-Attention
- Serialize the model parameters for each client of the same layer into an input vector, denoted as for any .
- Multiply each vector w by three coefficients , , and to get three vectors: query, key, and value, that is, , and , where .
- The attention score (similarity score) is calculated for the clients by matrix multiplication, i.e., , where , which reflects the degree of similarity between the parameters.
- The attention scores were normalized using softmax and other methods, i.e., .
- Finally, the aggregated parameters are obtained by multiplying the normalized attention score by the parameter vector, i.e., , where .
Algorithm 1 Personalized model aggregation based on self-attention |
|
5. Evaluation
5.1. Set Up
- FedAvg [7], an FL classic algorithm that collects and averages model parameters across clients.
- FedProx [30], an FL method that restricts the client’s update direction to enhance the performance of the global model, has a hyperparameter for the constraint we set to 0.01.
- ICFL [12], a clustering FL algorithm that automatically clusters clients and aggregates clustering models according to the correlation between clients without setting the number of clusters.
- CPFL [13], a clustering FL algorithm that individually aggregates the personalized models associated with them for each client.
5.2. Overall Accuracy Comparison
5.3. Comparison of Accuracy Differences between Methods among Clients
6. Conclusions
Author Contributions
Funding
Data Availability Statement
Conflicts of Interest
References
- Xu, W.; Xiao, P.; Zhu, L.; Zhang, Y.; Chang, J.; Zhu, R.; Xu, Y. Classification and rating of steel scrap using deep learning. Eng. Appl. Artif. Intell. 2023, 123, 106241. [Google Scholar] [CrossRef]
- Gao, Z.; Lu, H.; Lei, J.; Zhao, J.; Guo, H.; Shi, C.; Zhang, Y. An RGB-D-Based Thickness Feature Descriptor and Its Application on Scrap Steel Grading. IEEE Trans. Instrum. Meas. 2023, 72, 5031414. [Google Scholar] [CrossRef]
- Zhang, R.; Xiong, K.; Lu, Y.; Fan, P.; Ng, D.W.K.; Letaief, K.B. Energy efficiency maximization in RIS-assisted SWIPT networks with RSMA: A PPO-based approach. IEEE J. Sel. Areas Commun. 2023, 41, 1413–1430. [Google Scholar] [CrossRef]
- Zhang, T.; Xu, C.; Lian, Y.; Tian, H.; Kang, J.; Kuang, X.; Niyato, D. When Moving Target Defense Meets Attack Prediction in Digital Twins: A Convolutional and Hierarchical Reinforcement Learning Approach. IEEE J. Sel. Areas Commun. 2023, 41, 3293–3305. [Google Scholar] [CrossRef]
- Zhang, T.; Xu, C.; Shen, J.; Kuang, X.; Grieco, L.A. How to Disturb Network Reconnaissance: A Moving Target Defense Approach Based on Deep Reinforcement Learning. IEEE Trans. Inf. Forensics Secur. 2023, 18, 5735–5748. [Google Scholar] [CrossRef]
- Zhang, T.; Xu, C.; Zou, P.; Tian, H.; Kuang, X.; Yang, S.; Zhong, L.; Niyato, D. How to mitigate DDOS intelligently in SD-IOV: A moving target defense approach. IEEE Trans. Ind. Inform. 2022, 19, 1097–1106. [Google Scholar] [CrossRef]
- McMahan, B.; Moore, E.; Ramage, D.; Hampson, S.; y Arcas, B.A. Communication-efficient learning of deep networks from decentralized data. In Proceedings of the Artificial Intelligence and Statistics, Lauderdale, FL, USA, 20–22 April 2017; pp. 1273–1282. [Google Scholar]
- Zhang, R.; Xiong, K.; Lu, Y.; Gao, B.; Fan, P.; Letaief, K.B. Joint coordinated beamforming and power splitting ratio optimization in MU-MISO SWIPT-enabled HetNets: A multi-agent DDQN-based approach. IEEE J. Sel. Areas Commun. 2021, 40, 677–693. [Google Scholar] [CrossRef]
- Zhao, Y.; Li, M.; Lai, L.; Suda, N.; Civin, D.; Chandra, V. Federated learning with non-IID data. arXiv 2018, arXiv:1806.00582. [Google Scholar] [CrossRef]
- Xu, J.; Tong, X.; Huang, S.L. Personalized Federated Learning with Feature Alignment and Classifier Collaboration. In Proceedings of the Eleventh International Conference on Learning Representations, Kigali, Rwanda, 1–5 May 2022. [Google Scholar]
- Cheng, D.; Zhang, L.; Bu, C.; Wang, X.; Wu, H.; Song, A. ProtoHAR: Prototype Guided Personalized Federated Learning for Human Activity Recognition. IEEE J. Biomed. Health Inform. 2023, 24, 3900–3911. [Google Scholar] [CrossRef]
- Yan, Y.; Tong, X.; Wang, S. Clustered Federated Learning in Heterogeneous Environment. IEEE Trans. Neural Netw. Learn. Syst. 2023, 1–14. [Google Scholar] [CrossRef]
- Wang, J.; Xu, G.; Lei, W.; Gong, L.; Zheng, X.; Liu, S. Cpfl: An effective secure cognitive personalized federated learning mechanism for industry 4.0. IEEE Trans. Ind. Inform. 2022, 18, 7186–7195. [Google Scholar] [CrossRef]
- Li, B.; Chen, S.; Yu, K. FeDDkw–Federated Learning with Dynamic Kullback–Leibler-divergence Weight. In ACM Transactions on Asian and Low-Resource Language Information Processing; Association for Computing Machinery: New York, NY, USA, 2023. [Google Scholar]
- Long, G.; Xie, M.; Shen, T.; Zhou, T.; Wang, X.; Jiang, J. Multi-center federated learning: Clients clustering for better personalization. World Wide Web 2023, 26, 481–500. [Google Scholar] [CrossRef]
- Ghosh, A.; Chung, J.; Yin, D.; Ramchandran, K. An efficient framework for clustered federated learning. Adv. Neural Inf. Process. Syst. 2020, 33, 19586–19597. [Google Scholar] [CrossRef]
- Duan, M.; Liu, D.; Ji, X.; Wu, Y.; Liang, L.; Chen, X.; Tan, Y.; Ren, A. Flexible clustered federated learning for client-level data distribution shift. IEEE Trans. Parallel Distrib. Syst. 2021, 33, 2661–2674. [Google Scholar] [CrossRef]
- Vahidian, S.; Morafah, M.; Wang, W.; Kungurtsev, V.; Chen, C.; Shah, M.; Lin, B. Efficient distribution similarity identification in clustered federated learning via principal angles between client data subspaces. In Proceedings of the AAAI Conference on Artificial Intelligence, Washington, DC, USA, 7–14 February 2023; pp. 10043–10052. [Google Scholar]
- Xu, B.; Xia, W.; Zhao, H.; Zhu, Y.; Sun, X.; Quek, T.Q. Clustered federated learning in Internet of Things: Convergence analysis and resource pptimization. IEEE Internet Things J. 2023, 11, 3217–3232. [Google Scholar] [CrossRef]
- Tu, Q.; Li, D.; Xie, Q.; Dai, L.; Wang, J. Automated Scrap Steel Grading via a Hierarchical Learning-Based Framework. IEEE Trans. Instrum. Meas. 2022, 71, 5022313. [Google Scholar] [CrossRef]
- Smirnov, N.V.; Trifonov, A.S. Deep Learning Methods for Solving Scrap Metal Classification Task. In Proceedings of the 2021 International Russian Automation Conference (RusAutoCon), Sochi, Russia, 5–11 September 2021; pp. 221–225. [Google Scholar]
- Williams, K.C.; O’Toole, M.D.; Peyton, A.J. Scrap metal classification using magnetic induction spectroscopy and machine vision. IEEE Trans. Instrum. Meas. 2023, 72, 2520211. [Google Scholar] [CrossRef]
- Diaz-Romero, D.J.; Van den Eynde, S.; Sterkens, W.; Engelen, B.; Zaplana, I.; Dewulf, W.; Goedemé, T.; Peeters, J. Simultaneous mass estimation and class classification of scrap metals using deep learning. Resour. Conserv. Recycl. 2022, 181, 106272. [Google Scholar] [CrossRef]
- Picón, A.; Ghita, O.; Whelan, P.F.; Iriondo, P.M. Fuzzy Spectral and Spatial Feature Integration for Classification of Nonferrous Materials in Hyperspectral Data. IEEE Trans. Ind. Inform. 2009, 5, 483–494. [Google Scholar] [CrossRef]
- Chen, S.; Hu, Z.; Wang, C.; Pang, Q.; Hua, L. Research on the process of small sample non-ferrous metal recognition and separation based on deep learning. Waste Manag. 2021, 126, 266–273. [Google Scholar] [CrossRef]
- Han, S.D.; Huang, B.; Ding, S.; Song, C.; Feng, S.W.; Xu, M.; Lin, H.; Zou, Q.; Boularias, A.; Yu, J. Toward fully automated metal recycling using computer vision and non-prehensile manipulation. In Proceedings of the 2021 IEEE 17th International Conference on Automation Science and Engineering (CASE), Lyon, France, 23–27 August 2021; pp. 891–898. [Google Scholar]
- Yang, Q.; Liu, Y.; Chen, T.; Tong, Y. Federated machine learning: Concept and applications. ACM Trans. Intell. Syst. Technol. (TIST) 2019, 10, 1–19. [Google Scholar] [CrossRef]
- Li, T.; Sahu, A.K.; Talwalkar, A.; Smith, V. Federated learning: Challenges, methods, and future directions. IEEE Signal Process. Mag. 2020, 37, 50–60. [Google Scholar] [CrossRef]
- Tan, A.Z.; Yu, H.; Cui, L.; Yang, Q. Towards personalized federated learning. IEEE Trans. Neural Netw. Learn. Syst. 2022, 34, 9587–9603. [Google Scholar] [CrossRef] [PubMed]
- Li, T.; Sahu, A.K.; Zaheer, M.; Sanjabi, M.; Talwalkar, A.; Smith, V. Federated optimization in heterogeneous networks. Proc. Mach. Learn. Syst. 2020, 2, 429–450. [Google Scholar]
- Karimireddy, S.P.; Kale, S.; Mohri, M.; Reddi, S.; Stich, S.; Suresh, A.T. Scaffold: Stochastic controlled averaging for federated learning. In Proceedings of the International Conference on Machine Learning, Online, 13–18 July 2020; pp. 5132–5143. [Google Scholar]
- Presotto, R.; Civitarese, G.; Bettini, C. Fedclar: Federated clustering for personalized sensor-based human activity recognition. In Proceedings of the 2022 IEEE International Conference on Pervasive Computing and Communications (PerCom), Biarritz, France, 11–15 March 2022; pp. 227–236. [Google Scholar]
- Zhang, J.; Hua, Y.; Wang, H.; Song, T.; Xue, Z.; Ma, R.; Guan, H. FedALA: Adaptive local aggregation for personalized federated learning. In Proceedings of the AAAI Conference on Artificial Intelligence, Washington, DC, USA, 7–14 February 2023; pp. 11237–11244. [Google Scholar]
Models | Mechanism | Parameters | Layers | Activation Function |
---|---|---|---|---|
LeNet-5 | Convolutional Layers | 60 k | 7 | ReLU |
ResNet-18 | Convolutional Layers | 11.7 M | 18 | ReLU |
ViT-12 | Self-Attention | 86.57 M | 12 | ReLU/Layer Normalization |
Methods | Local | FedAvg | FedProx | CPFL | ICFL | FedScrap | |
---|---|---|---|---|---|---|---|
Models | |||||||
ResNet-18 | 77.868 ± 14.88 | 97.655 ± 6.3 | 98.834 ± 2.06 | 99.583 ± 1.32 | 99.322 ± 1.43 | 99.655 ± 1.09 | |
VIT | 89.857 ± 15.7 | 98.199 ± 3.57 | 94.735 ± 10.38 | 97.776 ± 3.82 | 97.164 ± 3.35 | 98.985 ± 1.74 | |
LeNet | 80.593 ± 18.89 | 98.797 ± 10.99 | 95.5 ± 9.78 | 89.819 ± 15.6 | 94.468 ± 7.24 | 97.899 ± 2.4 |
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. |
© 2024 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
Zhang, W.; Deng, D.; Wang, L. FedScrap: Layer-Wise Personalized Federated Learning for Scrap Detection. Electronics 2024, 13, 527. https://doi.org/10.3390/electronics13030527
Zhang W, Deng D, Wang L. FedScrap: Layer-Wise Personalized Federated Learning for Scrap Detection. Electronics. 2024; 13(3):527. https://doi.org/10.3390/electronics13030527
Chicago/Turabian StyleZhang, Weidong, Dongshang Deng, and Lidong Wang. 2024. "FedScrap: Layer-Wise Personalized Federated Learning for Scrap Detection" Electronics 13, no. 3: 527. https://doi.org/10.3390/electronics13030527
APA StyleZhang, W., Deng, D., & Wang, L. (2024). FedScrap: Layer-Wise Personalized Federated Learning for Scrap Detection. Electronics, 13(3), 527. https://doi.org/10.3390/electronics13030527