Next Article in Journal
3D Object Detection System in Scattering Medium Environment
Previous Article in Journal
Virtual Inertia Methods for Supporting Frequency Stabilisation in Autonomous AC/DC Microgrids
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Federated Learning-Based Equipment Fault-Detection Algorithm

1
College of Mathematics and Computer, Jilin Normal University, Siping 136000, China
2
School of Information Engineering, Jilin Engineering Vocational College, Siping 136000, China
3
School of Computer Science and Technology, Harbin University of Science and Technology, Harbin 150080, China
*
Author to whom correspondence should be addressed.
Electronics 2025, 14(1), 92; https://doi.org/10.3390/electronics14010092 (registering DOI)
Submission received: 2 December 2024 / Revised: 23 December 2024 / Accepted: 24 December 2024 / Published: 29 December 2024

Abstract

:
To address the issue of imbalanced distribution in equipment fault data, this paper proposes an improved FedAvg aggregation algorithm. By dynamically adjusting aggregation weights, it ensures the adaptability of fault data weights across different distribution dimensions during the aggregation process. The algorithm first introduces a contribution mechanism and then combines the contribution degree of each client with the weight of their dataset for model aggregation, resulting in the FedAvg-ContribData algorithm. Experimental data demonstrate that, compared to FedAvg and FedAvg-Data algorithms, our proposed algorithm improves accuracy by 39.7% and 7.9%, precision by 40.4% and 9.1%, recall rate by 41.0% and 7.8%, and F1 score by 46.6% and 9.3%.

1. Introduction

With the development of Industry 4.0 and Internet of Things (IoT) technologies, intelligent devices are playing an increasingly important role in the manufacturing industry. Numerous experts and scholars have conducted extensive research on the reliability and stability of these devices [1,2,3,4,5,6,7,8,9], gradually establishing a smart operation and maintenance system based on condition monitoring. The literature [1] proposes a bearing-fault diagnosis method based on thermal imaging, utilizing thermal imaging under different working conditions combined with Artificial Neural Network (ANN) and Convolutional Neural Network (CNN) for fault diagnosis. The literature [4] introduces a TL-Densenet-GAP-FCM (Transfer Learning Dense Network with Global Average Pooling and Fuzzy c-Means) model for bearing-fault diagnosis, which reduces the need for training samples. The literature [5] proposes a method for fault diagnosis in industrial processes based on multi-layer hypergraph convolutional neural networks, improving the detection accuracy of certain fault datasets. The literature [8] presents an intelligent fault-detection and classification scheme for smart grids based on deep neural networks, effectively detecting and classifying faults in the grid.
Federated learning [10,11,12,13,14] can effectively protect data privacy and security, reduce the risk of data leakage, overcome the issue of data silos [11,12], alleviate the burden on central servers, and improve data utilization. The literature [13] proposes a hierarchical federated-learning framework for collaborative detection of construction quality defects, utilizing robots as edge clients to coordinate the inspection of construction quality. The literature [14] designs a traffic-detection model training scheme under federated learning and a model update scheme for recognizing novel abnormal traffic based on honeypots, enhancing model robustness, improving the ability to identify abnormal traffic, and continuously improving the detection performance for novel abnormal traffic.
Federated learning does not achieve ideal results when addressing the issue of imbalanced data distribution. The FedAvg [15] algorithm does not fully consider the differences between the data from each client in its average aggregation method. When faced with an unbalanced data distribution, it may not effectively aggregate the data, leading to a decline in model performance. The FedAvg-Data algorithm aggregates data according to their weight, assigning different weights to the data from different clients. However, determining the weight solely based on the size or importance of the data may overlook other important characteristics of the data, which could prevent the model’s performance from reaching the desired level. To tackle the problem of unbalanced fault-data distribution, this paper proposes an improved FedAvg aggregation algorithm. The algorithm enhances the multi-dimensional consideration mechanism during aggregation, incorporates more complex scenario-related factors, and fully considers the impact of client datasets on the model, achieving more rational results in handling data heterogeneity issues.
The contributions of this paper are as follows:
(1) A “contribution degree” strategy is proposed. By calculating the contribution degree of each client, the weights are adjusted according to the size of the client’s contribution, thereby making more effective use of limited and unbalanced fault data.
(2) Combining the contribution degree with the weight of its dataset, the FedAvg-ContribData (Federated Averaging–Contribution Data) algorithm is proposed. The weights of the datasets are dynamically adjusted, based on factors such as dataset size and category distribution, more accurately reflecting the actual impact of the data on global model training, thereby improving the accuracy and generalization ability of the global model.

2. Problem Analysis and Mathematical Modeling

2.1. Problem Analysis

In the equipment fault dataset, there is a significant imbalance in the number of different types of fault data. Common fault types may have a very large volume of data, while rare fault types (such as hydraulic cylinder-rod surface scratches) are scarce. Rare fault data account for less than 1% of the total data volume, whereas common fault data constitute the majority, forming a long-tail distribution. This imbalance causes the statistical characteristics of the dataset to be heavily biased towards common faults, leading to overfitting. The model may exhibit high accuracy on the training set but perform poorly on test sets containing rare faults, due to the weak signal of unique features in the presence of overwhelming noise from common fault features, resulting in a significant decline in performance.
Because the data of common faults dominate the training process, their characteristics have a greater influence on the model parameter updates. The model devotes substantial effort to optimizing the recognition of common faults, neglecting the features of specific faults. Due to the model’s insufficient learning of the essential characteristics of specific faults, it fails to accurately identify data types of specific faults.

2.2. Mathematical Modeling

In federated learning, there are N clients represented as C = {C1, C2, …, CN}, where each client Ci has an associated dataset Di with a size of ni.
L ( θ ) = i = 1 N n i n L i ( θ )
n = i = 1 N n i
L i ( θ ) = 1 n i ( x , y ) D i y l o g ( y ^ ) + ( 1 y ) l o g ( 1 y ^ )
y ^ = f ( x ; ( θ )
In Formula (1), the global loss function is represented as L ( θ ) , where n is the sum of the sizes of the datasets from all N clients. The local loss function for client C i , based on its local dataset D i and model parameters θ , is denoted as L i ( θ ) .
Formula (3) describes the client’s local loss function, where y represents the true label, y ^ is the predicted label, f = ( x ; θ ) is the learning model, x is the input data, and θ are the model parameters.
In this paper, the algorithm employs Stochastic Gradient Descent (SGD) to update local parameters on the client side. The formula for updating local parameters on the client side is given by
θ i t + 1 = θ t τ L i ( θ t )
θ t = i = 1 N p i t θ i t
p i t + 1 = η n i n + φ r i t R t
R t = i = 1 N r i t
Equation (5) represents the local-parameter update formula for client i. The updated local parameters for client i at iteration t are denoted as θ i t + 1 . Here, t indicates the iteration count, θ t represents the global model parameters sent by the central server to each client, L i ( θ t ) is the local gradient computed by client i, and τ is the learning rate.
Equation (6) provides the global model update formula. The aggregation coefficient for client i at iteration t is represented by p i t .
Equation (7) defines the formula for the weighting coefficients used in the global model fusion. η represents the weighting factor based on dataset weights, and φ represents the weighting factor based on client contribution. r i t is the accuracy of client i at iteration t, and R t is the sum of accuracies across all clients at iteration t.

3. Algorithm Design and Analysis

The algorithm is mainly composed of data preprocessing, feature extraction and model training. Data preprocessing improves the quality and consistency of data by cleaning, sorting and converting the original data. Feature extraction extracts valuable information from preprocessed data, and improves model training efficiency and prediction ability with feature transformation and selection. Model training is the core of the whole algorithm. By using optimization algorithms and adjusting parameters, the performance of the model in accuracy, stability, generalization ability and other dimensions is continuously improved, so that the model can better adapt to complex data environments and diverse practical application scenarios. The algorithm flow is shown in Figure 1.

3.1. Data Preprocessing

Data preprocessing is a crucial link in data analysis and machine learning. By artificially expanding the data set, the diversity of training data is increased, and the model is exposed to more variations during training, so as to improve data quality and consistency, and enhance the generalization ability of the model. Data preprocessing and data enhancement are the key steps to ensure the efficient and accurate operation of the model, and are of great significance for improving the performance of the model. Figure 2 is the technical roadmap of data pre-processing. The specific steps are as follows:
Step 1: Gather data from various clients, analyze the dataset size, and allocate it into training and testing.
Step 2: Resize images to match the input dimensions expected by the model to ensure compatibility.
Step 3: Apply horizontal flipping to images with a specific chance to promote the model’s ability to recognize features from various directions, enhancing its resilience.
Step 4: Randomly rotate images to mimic various viewpoints, assisting the model in acquiring a more diverse set of features.
Step 5: Convert images into PyTorch’s tensor format to streamline model processing and computation.

3.2. Feature Extraction

The process of feature extraction involves choosing the most indicative information, condensing data volume, and minimizing computing intricacy. Utilizing identified typical attributes enhances the model’s capacity to conform to diverse image fluctuations, markedly boosting its efficiency and ability to generalize in areas like categorization and identification. The technology roadmap for extracting features is depicted in Figure 3, including these distinct phases:
(1) Convolutional Layer: extracts characteristics from the given image.
(2) Batch Normalization Layer: standardizes the features map output produced by the convolutional layer.
(3) Activation Function Layer: employs an activation function to induce non-linearity, leading to a non-linear alteration of the feature mappings.
(4) Max Pooling Layer: chooses the highest value to be produced from the pooling window, thus shrinking the size and size of the feature map.
(5) Adaptive Average Pooling Layer: transforms a feature map from any dimension into a feature map of a set size.
(6) Fully Connected Layer: applies a linear transformation to the input features through a weight matrix and bias term, transforming features from one space to another.
(7) Output Layer: maps the input units to N output units, where N is the number of classes for classification.

3.3. Model Training

Model training occupies a core position in the entire algorithm system and has a crucial impact on the effectiveness and practicality of the algorithm. Through model training, the model can be optimized, its structure and parameters adjusted, improving from an initial to an optimal state to fit the data; it aids in performance enhancement, strengthens generalization ability, and improves the accuracy and stability of predictions and classifications, providing assurance for applications; it uncovers data value, reveals hidden relationships and patterns, and promotes knowledge innovation; and it adapts to complex scenarios, handling diverse data and different task requirements. Figure 4 shows the flowchart of model training, with the following specific steps:
Step 1: The central server sends the global model to all clients.
Step 2: Each client uses the received global model to conduct model training based on the preprocessed local dataset.
Step 3: Clients return the trained local sub-model parameters to the central server.
Step 4: The central server collects all model parameters sent by the clients, calculates the contribution of each client from the previous round, and uses FedAvg-ContribData to aggregate and update the global model.
Step 5: The central server sends the updated global model to all clients.
Step 6: After receiving the updated global model, clients continue training on their local data to obtain new sub-models, while outputting four evaluation metrics.
Step 7: Determine whether the maximum number of iterations has been reached. If yes, output the best accuracy, precision, recall, and F1 score. If no, send the trained local sub-model parameters back to the central server for further iteration.
The algorithm in this paper improves the performance of the model by making the data more consistent with the assumptions of the model through operations such as normalization during data preprocessing. The original evaluation criteria only considered the size of the dataset, and a contribution mechanism was incorporated into it. By designing a calculation method for contribution and dataset weights, the aggregation proportion of each dataset is optimized. Moreover, the dynamic adaptability of the evaluation criteria has been enhanced. As new clients continue to join and the data environment changes, the contribution mechanism can automatically adjust the proportion of each client to ensure that the entire evaluation system remains sensitive to the latest data situation at all times, avoiding evaluation bias caused by client updates.

4. Simulation Experiment Data Analysis

4.1. Experimental Environment

The experimental environment used in this experiment includes an AMD Ryzen 7 5800H eight-core processor, an NVIDIA GeForce RTX 3060 graphics card, 16 GB DDR4 memory, and a fast 512 GB PCIe NVMe SSD solid-state drive, running on Windows 11 Home Basic 64-bit operating system.
This experiment uses the PyTorch framework to develop the neural network model, and the specific version is 1.13.0. To enhance the function or performance of the experimental environment, modules such as “torchvision. transforms”, “torchvision. datasets”, “torch. utils. data. DataLoader” and “PIL. ImageFile” have been imported.
Table 1 shows the setting of the experimental super parameters in this paper. The data set is divided into training set, test set and verification set, according to 7:2:1.
Figure 5 shows the structure of the convolutional network in this paper, which is mainly divided into two parts: feature extraction and classification. The feature extraction part consists of convolutional layer, batch normalization layer, activation function layer and maximum pooling layer. Among them, the convolutional layer1 has an input of 3 channels and an output of 64 channels, a convolutional kernel size of (11 × 11), a step size of 4, and a padding of 2. When the feature extraction is completed, it enters into the adaptive average pooling layer, which converts the feature map of any size into a feature map of (6 × 6) size. The classification part consists of full link layer, batch normalization layer and activation function layer. Among them, the input of the full link layer is 256 × 6 × 6, and the output is 4096. Finally, it enters the output layer, the input is 4096, and the number of output nodes is num_classes, i.e., the number of classified categories.

4.2. Experimental Results

In this study, the algorithm was evaluated using three distinct datasets: the NEU dataset [16] from Northeastern University (steel surface defects), the DAGM2007 dataset [17] (automatic guided-vehicle surface defects), and the GC10-DET dataset [18] (ten common metal surface defects). The aim was to enhance the identification and classification capabilities for equipment faults by leveraging the unique characteristics and patterns of each dataset.
To thoroughly and comprehensively assess model performance, a variety of aggregation strategies were employed for systematic comparative analysis. These strategies included the classic FedAvg aggregation algorithm (basic averaging to construct a global model), the FedAvg-Data aggregation algorithm (which incorporates the size of each client’s dataset during aggregation and performs weighted aggregation based on dataset scale), and the FedAvg-ContribData aggregation algorithm proposed in this paper.
The evaluation process focused on several core performance indicators: accuracy, precision, recall, and F1 score. Accuracy was used to measure the overall predictive capability of the model. Precision assessed the accuracy level of the model in predicting positive classes. Recall highlighted the model’s ability to recognize positive class samples. The F1 score, calculated as the harmonic mean of precision and recall, proved particularly effective in addressing class imbalance issues and provided a comprehensive assessment of the model’s performance.
Table 2 presents the performance of the algorithm in this paper, FedAvg, and FedAvg-Data across multiple key evaluation metrics, including accuracy, precision, recall, and F1 score. Additionally, the table details the relative improvement rates of the proposed algorithm over the other two algorithms for each evaluation metric, providing comprehensive and intuitive data support for assessing and comparing the performance of each algorithm.
(1)
Accuracy
From the table, it can be observed that the accuracies of FedAvg, FedAvg-Data, and FedAvg-ContribData are 49.7%, 81.5%, and 89.4%, respectively. The FedAvg-ContribData algorithm demonstrated markedly enhanced predictive proficiency over its two counterparts.
In the face of imbalanced data distributions, the averaging aggregation method adopted by FedAvg has limitations, and struggles to ensure accuracy; FedAvg-Data’s dataset weighting method overlooks the data quality and variety of each client, resulting in poorer results; and FedAvg-ContribData, merging dataset weights with a contribution–contribution analysis process, enhances performance. In contrast to FedAvg and FedAvg-Data, its respective rates of accuracy enhancement stand at 39.7% and 7.9%.
(2)
Precision
Precision percentages for FedAvg, FedAvg-Data, and FedAvg-ContribData stand at 50.7%, 82.0%, and 91.1%, in that order. The proposed algorithm significantly improves accuracy in predicting positive class samples compared to the other two algorithms.
FedAvg fails to adequately consider the characteristics of data from different clients, leading to confusion between positive and negative class samples and resulting in lower precision; FedAvg-Data assigns weights based on dataset size, which somewhat accounts for data imbalance and improves the model’s accuracy in predicting positive classes, but this approach does not emphasize the importance of the datasets; FedAvg-ContribData combines multiple consideration mechanisms, capturing positive class features more precisely and distinguishing between positive and negative class samples with greater accuracy, achieving relative improvements of 40.4% and 9.1%, compared to FedAvg and FedAvg-Data, respectively.
(3)
Recall
The recall rates of FedAvg, FedAvg-Data, and FedAvg-ContribData are 42.5%, 75.7%, and 83.5%, respectively. It is evident that our proposed algorithm significantly improves the ability to identify positive class samples, compared to the other two algorithms.
FedAvg’s average aggregation method misses a large amount of positive class sample information, resulting in poor recall of positive class samples; FedAvg-Data only assigns weights based on dataset size, without fully considering the importance of the datasets, leading to the neglect of some crucial data, which affects the overall performance of the model; FedAvg-ContribData dynamically adjusts the weights by combining dataset size with the value of client data, more comprehensively mining the features of positive class samples in the data. Compared to FedAvg and FedAvg-Data, it improves by 41.0% and 7.8%, respectively.
(4)
F1 Score
The F1 scores for FedAvg, FedAvg-Data, and FedAvg-ContribData are 37.4%, 74.7%, and 84.0% respectively. It is evident that the algorithm proposed in this paper significantly enhances the balanced performance between precision and recall, compared to the other two algorithms.
FedAvg performs poorly in both precision and recall, resulting in a low F1 score and poor overall performance; FedAvg-Data assigns weights based on the size or importance of the dataset, which considers data imbalance, to some extent, but still fails to fully account for the complex characteristics of client data, leading to limited improvements in precision and recall and failing to optimize the overall model performance; FedAvg-ContribData combines multiple consideration mechanisms such as contribution degree and dataset weight, achieving a better balance between precision and recall, with improvements of 46.6% and 9.3%, compared to FedAvg and FedAvg-Data, respectively.
In summary, FedAvg-ContribData demonstrates superior performance in handling complex data-distribution scenarios, making it more suitable for application scenarios with high requirements for comprehensive model performance.
Figure 6 illustrates a comparison between the original image and feature maps generated by different algorithms. Specifically, Figure 6A presents the original image, serving as a reference for subsequent algorithm feature-map analyses. Figure 6B showcases the feature map produced by the FedAvg algorithm. It is evident that this feature map primarily reflects the basic shape of the image. Visually, its structure appears relatively simple, and it contains limited information, indicating a weaker capability to capture detailed image information.
Figure 6C displays the feature map generated by the FedAvg-Data algorithm. Compared to the feature maps from the FedAvg algorithm, those from the FedAvg-Data algorithm are more complex. These feature maps not only include edge information, but also present more detailed content, to some extent. This suggests that the FedAvg-Data algorithm can extract richer image information, particularly in terms of edge detection and detail capture.
Figure 6D shows the feature map generated by the algorithm proposed in this article. These feature maps exhibit even greater complexity, containing not only edge and texture information similar to those in the FedAvg-Data algorithm feature maps, but also depicting local shapes and patterns. The algorithm presented in this paper can capture the intrinsic structure and detailed features of images more comprehensively and deeply during feature extraction. Consequently, the feature maps generated by this algorithm more effectively represent image content, offering richer and more valuable clues for subsequent image classification or recognition tasks. This enhances the accuracy and reliability of these tasks.
Through the analysis of these four types of images (the original image and feature maps generated by three different algorithms), it is clear that there are differences in image feature extraction among the algorithms, with the one proposed in this paper having significant advantages in the richness and effectiveness of feature representation.
Figure 7 illustrates the performance of each algorithm across various evaluation metrics in the training, testing, and validation datasets. It is clearly observable that FedAvg’s aggregation method, being ill-suited to handle data imbalance issues, results in suboptimal performance across all datasets. Utilizing a dataset size-based weighting approach, FedAvg-Data demonstrates notable enhancements in comparison to its averaging method for all measured data. Yet, FedAvg-Data is limited to the volume of data, overlooking other essential attributes of the databases, leading to its inability to reach peak performance standards. Despite FedAvg-ContribData’s marginally reduced precision compared to FedAvg-Data in the test group, its effectiveness surpasses all other metrics for all datasets. This demonstration highlights its steadfast superiority in managing varied data, permitting a broader and more efficient use of data information, resulting in superb overall efficacy. This emphasizes the heightened flexibility and dependability of the algorithm in this paper in complex data settings.
FedAvg-ContribData demonstrates superior performance over all data sets, thereby affirming its effectiveness in handling diverse data sets.
Displayed in Figure 8 are the confusion matrices for two specific algorithms: FedAvg-Data and FedAvg-ContribData. Issues of class imbalance in the dataset, causing underperformance in the FedAvg-Data algorithm, especially in underrepresented groups like classes 25 and 26, stem from their reduced sample sizes. The algorithm in this paper outperforms FedAvg-Data in all categories. As an example, within the 17th and 18th classes, the algorithm in this paper attains accuracies of 73.9% and 80.6%, correspondingly, in stark contrast to FedAvg-Data’s accuracy levels of 47.8% and 22.6%, respectively. FedAvg-Data exhibited significant classification bias when dealing with category 14, with 30.3% of the samples incorrectly judged as category 11. When processing category 18, its accuracy rate was low, at only 22.6%, and it was prone to misjudging samples of this category as either category 19 or 20. For category 23, the accuracy rate was 36.7%. Due to the similarity between the features of categories 23 and 24, the algorithm struggled to effectively distinguish between these two categories, resulting in limited classification accuracy. When the algorithm proposed in this paper processed category 14, only 12.1% of the samples were misjudged as category 11, significantly lower than FedAvg-Data. When handling category 18, the accuracy rate reached 80.6%, which is 58% higher than FedAvg-Data, clearly demonstrating the effectiveness of the algorithm in category 18 classification tasks. For category 23, the accuracy rate improved to 66.7%. Compared to the previous scenario, the number of samples misjudged as category 24 was significantly reduced, effectively enhancing the classification accuracy for category 23. The algorithm in this paper shows better performance when dealing with difficult categories.
The algorithm in this paper outperforms FedAvg-Data in precision and additional metrics, exhibiting a significant edge in managing diverse data. The algorithm in this paper, through improved adjustment for data irregularities in the design phase, sustains strong classification efficiency in the face of less commonly occurring classes.
Figure 9 shows the variation curves of accuracy, precision, recall, and F1 score. These graphs provide a detailed view of how the performance of each algorithm changes with iterations.
The FedAvg algorithm does not fully consider the difference between the data of each client, and its performance is poor when faced with the situation of large data dispersion. When the data distribution between clients shows significant differences, the FedAvg algorithm cannot effectively aggregate data, resulting in a decline in model performance.
The FedAvg-Data algorithm aggregates according to data weight, and can achieve better results in the case of heterogeneous data. By giving different weights to the data of different clients, the contribution of each client to the global model can be better balanced, so as to improve the performance of the model. However, determining the weight only through the size or importance of the data may ignore other important characteristics of the data, which leads to limited performance improvement of the model, and may not reach the ideal level in accuracy, recall and other indicators.
The algorithm in this paper combines the weight of the dataset and the contribution of the client to the overall model. Good results have been achieved in the training set and test set, and significant advantages have been shown in the verification set. Because of its careful consideration of dataset weight and client contribution, the model is more robust in the face of unknown data distribution. The algorithm in this paper not only has good fitting ability, but also shows stronger versatility and adaptability. The algorithm in this paper can transfer the knowledge learned from training data and apply it to new and independent data sets, so as to maintain high prediction performance on data that have not been seen before.
The FedAvg algorithm is relatively simple in terms of aggregation. It uses the average aggregation method, and does not pay attention to differences in data size. The FedAvg-ContribData algorithm deeply analyzes data through statistical analysis and calculation, adjusting the value weight of data, accordingly. Although the FedAvg-Data algorithm pays some attention to data size, it is not accurate or delicate in measuring value and cannot mine the value of data as deeply as FedAvg-ContribData. This results in the model being unable to fully leverage the advantages of high-contribution data during the learning process.
The FedAvg-Data algorithm aggregates data mainly based on the size of the data without in-depth mining of the internal structure of the data and the different contributions of different parts to model learning. For example, in an image classification task, when the number of images of different categories in a dataset is seriously unbalanced—for instance, some rare category images are extremely rare, but play a key role in the integrity of the overall classification system—FedAvg-Data may not reasonably evaluate the contribution of these categories of data. Consequently, it assigns inappropriate weights, which ultimately leads to low recognition accuracy for rare category images. The FedAvg-ContribData algorithm calculates the contribution degree and makes reasonable weight allocation accordingly. In cases of very high data heterogeneity, it can ensure that the model fully learns the characteristics of each category, especially those of key few categories. This effectively reduces the classification deviation caused by data imbalance, thus outperforming the FedAvg-Data algorithm in overall classification accuracy.
During training, the FedAvg algorithm cannot distinguish between the size and contribution of data, so it wastes a lot of computing resources when dealing with redundant data of low quality, full of noise, or with low relevance to the model’s learning objectives. With the help of a reasonable contribution evaluation and weight allocation mechanism, FedAvg-ContribData can quickly screen out data that significantly impact model improvement in each iteration process. This reduces the interference of invalid data, thereby promoting the model to converge to the global optimal solution more quickly. Although FedAvg-Data also filters data, its weight distribution is not accurate enough and may still be adversely affected by some low-contribution data during the optimization process, resulting in inefficient convergence. FedAvg-ContribData can quickly focus on high-value data and concentrate on learning in large-scale distributed data-processing scenarios. This greatly reduces training time and significantly improves the final performance of the model, enabling it to better adapt to rapidly changing practical application needs and complex data environments.
To sum up, the algorithm in this paper has obvious advantages in dealing with data heterogeneity; not only can it effectively use the data of each client in the training process, but it also can show good prediction ability on new data.

4.3. Statistical Analysis

In this paper, t-tests are used to statistically analyze the three algorithms. The significance level p is 0.05. Formula (9) is used to calculate the average value of algorithm samples; Equation (10) is used to calculate the variance of the algorithm sample. The Levene test is used to judge the variance of the three algorithms, and the variance is statistically insignificant. Therefore, Formula (12) is used to calculate the degree of freedom.
x ¯ = 1 n i = 1 n x i
S 2 = 1 n 1 i = 1 4 ( x i x ¯ ) 2
t = x ¯ 1 x ¯ 2 S 1 2 n 1 + S 2 2 n 2
d f = n 1 + n 2 2
Table 3 presents the t-tests analysis results, comparing the proposed algorithm with FedAvg and FedAvg-Data algorithms. In the comparison between FedAvg and the proposed algorithm, the T-statistic is −11.40, with a p-value of 2.74 × 10−5 (significantly lower than the 0.05 significance level), and the absolute value of the T-statistic exceeds the critical value of 2.45, indicating that the proposed algorithm significantly outperforms FedAvg.
For the comparison between FedAvg-Data and the proposed algorithm, the T-statistic is −3.16, with a p-value of 0.02 (less than the 0.05 significance level), and the absolute value of the T-statistic also exceeds the critical value of 2.45, demonstrating a significant performance difference, favoring the proposed algorithm.
In summary, the proposed algorithm exhibits a significant advantage in performance over both comparative algorithms.

5. Conclusions and Future Work

The equipment fault-detection model based on federated learning proposed in this paper performs well in dealing with data heterogeneity. Through the combination of contribution mechanism and data-set weight re weighting, the aggregation coefficient of each data set is considered dynamically, which can achieve better results when facing the problem of unbalanced data distribution. The experimental results show that the model not only has good fitting ability, but also can show strong generalization ability on new data.
The algorithm in this paper can also cross-integrate with cutting-edge algorithms in the field of information security, such as blockchain technology, and carry out practical research in realizing cross-agency data sharing and cooperation and ensuring the integrity and authenticity of data.

Author Contributions

Conceptualization, J.H. and W.Z.; methodology, Z.X.; software, X.Z.; data curation, Z.T.; writing—original draft preparation, J.H.; writing—review and editing, Z.X. and W.Z. All authors have read and agreed to the published version of the manuscript.

Funding

This work was partially supported by the National Natural Science Foundation of China (61772160, Funder: Z.X.); subject of National College Computer Education Research Association (CERACU2024R13, Funder: W.Z.); the teaching research topic of Jilin Normal University: (Jilin Normal University Office [2023] 107 (No. 2418 in total), Funder: W.Z.); and Jilin Normal University Graduate Research Innovation Program Project (201951, Funder: Z.T.).

Data Availability Statement

Data are contained within the article.

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Choudhary, A.; Mian, T.; Fatima, S. Convolutional neural network based bearing fault diagnosis of rotating machine using thermal images. Measurement 2021, 176, 109196. [Google Scholar] [CrossRef]
  2. Cui, B.W.; Ren, Z. Inverter fault detection and diagnosis based on Fourier transform and neural network. Trans. China Electrotech. Soc. 2006, 7, 37–43. [Google Scholar] [CrossRef]
  3. Yang, H.X.; Peng, Z.S.; Xu, Q.J.; Huang, T.X.; Zhu, X.O. Inverter fault diagnosis based on Fourier transform and evolutionary neural network. Front. Energy Res. 2023, 10, 1090209. [Google Scholar] [CrossRef]
  4. Wei, W.J.; Zhang, X.M.; Yang, L.B. Fault diagnosis of small sample bearings based on fuzzy clustering and improved Densenet network. J. Harbin Inst. Technol. 2022, 56, 154–163. [Google Scholar] [CrossRef]
  5. Zhang, Y.D.; Zhan, X.J.; Zhang, R.N.; Zhang, H.F. Fault diagnosis method based on multi-layer hypergraph convolutional neural network. Complex Syst. Complex. Sci. 2024, 1–8. Available online: http://kns.cnki.net/kcms/detail/37.1402.N.20240111.0912.004.html (accessed on 20 December 2024).
  6. Assadi, K.; Slimane, J.B.; Salhi, C.S. Shunt faults detection and classification in electrical power transmission line systems based on artificial neural networks. COMPEL-Int. J. Comput. Math. Electr. Electron. Eng. 2023, 42, 1518–1530. [Google Scholar] [CrossRef]
  7. Ning, X.; Sheng, D.; Zhou, J.; Liu, Y.; Wang, Y.; Zhang, H.; Lei, X. A Novel Series Arc Fault Detection Method Based on Lightweight Neural Network. Electronics 2023, 12, 4617. [Google Scholar] [CrossRef]
  8. Alhanaf, A.S.; Balik, H.H.; Farsadi, M. Intelligent Fault Detection and Classification Schemes for Smart Grids Based on Deep Neural Networks. Energies 2023, 16, 7680. [Google Scholar] [CrossRef]
  9. Chakraborty, S.; Shamrat, F.J.M.; Ahammad, R.; Billah, M.; Kabir, M.; Hosen, M.R. Bearing Fault Detection based on Internet of Things using Convolutional Neural Network. Int. J. Adv. Comput. Sci. Appl. 2022, 13. [Google Scholar] [CrossRef]
  10. Konen, J.; Mcmahan, H.B.; Yu, F.X.; Richtárik, P.; Bacon, D. Federated Learning: Strategies for Improving Communication Efficiency. arXiv 2016, arXiv:1610.05492. [Google Scholar] [CrossRef]
  11. Mehmood, A.; Natgunanathan, I.; Xiang, Y.; Hua, G.; Guo, S. Protection of Big Data Privacy. IEEE Access 2016, 4, 1821–1834. [Google Scholar] [CrossRef]
  12. 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]
  13. Wu, T.H.; Li, H.; Chi, L.H.; Kou, W.B.; Wu, Y.C.; Wang, S. A hierarchical federated learning framework for collaborative quality defect inspection in construction. Eng. Appl. Artif. Intell. 2024, 133, 108218. [Google Scholar] [CrossRef]
  14. Wu, H.; Hao, J.J.; Lu, Y.L. Research on distributed network intrusion detection system based on honeypot in Internet of Things scenario. J. Commun. 2024, 45, 106–118. [Google Scholar] [CrossRef]
  15. Mcmahan, H.B.; Moore, E.; Ramage, D.; Hampson, S.; Arcas, B.A.y. Communication-Efficient Learning of Deep Networks from Decentralized Data. In Proceedings of the International Conference on Artificial Intelligence and Statistics, Cadiz, Spain, 9–11 May 2016. [Google Scholar] [CrossRef]
  16. He, Y.; Song, K.; Meng, Q.; Yan, Y. An end-to-end steel surface defect detection approach via fusing multiple hierarchical features. IEEE Trans. Instrum. Meas. 2019, 69, 1493–1504. [Google Scholar] [CrossRef]
  17. Wieler, M.; Hahn, T.; Hamprecht, F.A. Weakly Supervised Learning for Industrial Optical Inspection. 2007. [Dataset]. Available online: https://hci.iwr.uni-heidelberg.de/content/weakly-supervised-learning-industrial-optical-inspection (accessed on 20 December 2024).
  18. Lv, X.; Duan, F.; Jiang, J.J.; Fu, X.; Gan, L. GC10-DET Metallic Surface Defect Datasets. 2020. Available online: https://github.com/lvxiaoming2019/GC10-DET-Metallic-Surface-Defect-Datasets (accessed on 20 December 2024).
Figure 1. Algorithm flowchart.
Figure 1. Algorithm flowchart.
Electronics 14 00092 g001
Figure 2. Data preprocessing technology roadmap.
Figure 2. Data preprocessing technology roadmap.
Electronics 14 00092 g002
Figure 3. Technology roadmap for feature extraction.
Figure 3. Technology roadmap for feature extraction.
Electronics 14 00092 g003
Figure 4. Model training flowchart.
Figure 4. Model training flowchart.
Electronics 14 00092 g004
Figure 5. Network structure diagram.
Figure 5. Network structure diagram.
Electronics 14 00092 g005
Figure 6. (A) Original drawing. (B) FedAvg. (C) FedAvg-Data. (D) FedAvg-ContribData.
Figure 6. (A) Original drawing. (B) FedAvg. (C) FedAvg-Data. (D) FedAvg-ContribData.
Electronics 14 00092 g006
Figure 7. (A) Bar chart of training set. (B) Bar chart of testing set. (C) Bar chart of validation.
Figure 7. (A) Bar chart of training set. (B) Bar chart of testing set. (C) Bar chart of validation.
Electronics 14 00092 g007aElectronics 14 00092 g007b
Figure 8. (A) Confusion matrix of FedAvg-Data. (B) Confusion matrix of FedAvg-ContribData.
Figure 8. (A) Confusion matrix of FedAvg-Data. (B) Confusion matrix of FedAvg-ContribData.
Electronics 14 00092 g008
Figure 9. (A) Accuracy. (B) Precision. (C) Recall. (D) F1 Score.
Figure 9. (A) Accuracy. (B) Precision. (C) Recall. (D) F1 Score.
Electronics 14 00092 g009
Table 1. Parameter setting.
Table 1. Parameter setting.
AlgorithmNumber of ClientsIteration CountLearning RateDeviceDataset Size WeightContribution Weight
FedAvg73002 × 10−9cuda————
FedAvg-Data73002 × 10−9cuda10
FedAvg-ContribData73002 × 10−9cuda0.40.6
Table 2. Weighted Results on the Validation Set.
Table 2. Weighted Results on the Validation Set.
AlgorithmAccuracyRelative Accuracy Improvement RatePrecisionRelative Precision Improvement RateRecallRelative Recall
Improvement Rate
F1 ScoreRelative
F1 Score Improvement Rate
FedAvg49.7%39.7%50.7%40.4%42.5%41.0%37.4%46.6%
FedAvg-
Data
81.5%7.9%82.0%9.1%75.7%7.8%74.7%9.3%
FedAvg-ContribData89.4%——91.1%——83.5%——84.0%——
Table 3. t-tests.
Table 3. t-tests.
Comparison Algorithmt-Statisticsp-ValueCritical Value
FedAvg−11.42.74 × 10−52.45
FedAvg-Data−3.160.022.45
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.

Share and Cite

MDPI and ACS Style

Han, J.; Zhang, X.; Xie, Z.; Zhou, W.; Tan, Z. Federated Learning-Based Equipment Fault-Detection Algorithm. Electronics 2025, 14, 92. https://doi.org/10.3390/electronics14010092

AMA Style

Han J, Zhang X, Xie Z, Zhou W, Tan Z. Federated Learning-Based Equipment Fault-Detection Algorithm. Electronics. 2025; 14(1):92. https://doi.org/10.3390/electronics14010092

Chicago/Turabian Style

Han, Jiale, Xuesong Zhang, Zhiqiang Xie, Wei Zhou, and Zhenjiang Tan. 2025. "Federated Learning-Based Equipment Fault-Detection Algorithm" Electronics 14, no. 1: 92. https://doi.org/10.3390/electronics14010092

APA Style

Han, J., Zhang, X., Xie, Z., Zhou, W., & Tan, Z. (2025). Federated Learning-Based Equipment Fault-Detection Algorithm. Electronics, 14(1), 92. https://doi.org/10.3390/electronics14010092

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop