Railway internal data circulation sharing method based on semi-supervised federated learning
By adopting a semi-supervised federated learning method in the railway data scenario, using label data to train the initial global model and assigning pseudo-labels to the labelless data, combined with cluster distribution to allocate weight parameters, the challenges of railway data sharing and model training are solved, and efficient data circulation sharing and model generalization are achieved.
Patent Information
- Application Number
- CN202510088643.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-21
- Publication Date
- 2025-02-28
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Due to data splitting between systems and dominance of unlabeled data, it is difficult to achieve effective data sharing and model training, and traditional federated learning faces the challenges of data heterogeneity and label dependence.
Using a semi-supervised federated learning method, the data set and initial local model are obtained from multiple clients, the initial global model is trained through label data, and the Mahayana distance is used to allocate pseudo-labels to label-free data to expand the training data. At the same time, the local model is assigned weight parameters based on the clustering distribution, and the data sharing model is calculated.
The generalization ability of the model is improved, the scale of training data is expanded, and the global commonality and individual differences are taken into account, so as to realize the effectiveness of data circulation sharing and model training.
Smart Images

Figure CN119537956A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of semi-supervised technology, and in particular to a method for railway internal data circulation and sharing based on semi-supervised federated learning. Background Art
[0002] Since the development of railway informatization, China Railway Corporation has built more than 200 systems, covering multiple fields such as vehicles, machinery, engineering, and electricity, and has rich data resources. However, due to the data fragmentation between systems, circulation barriers hinder the sharing and value of data; in addition, railway data is mainly unlabeled data, and traditional machine learning frameworks are difficult to directly apply to this scenario.
[0003] To solve the problems of data privacy and circulation, federated learning has become an important technical choice. It has advantages in privacy protection and efficiency improvement, but it also faces the following challenges: 1. Data heterogeneity makes it difficult for local models to generalize to the global level; 2. Label dependency increases the labeling cost, and many participants only have unlabeled data, which affects model performance. Summary of the invention
[0004] The purpose of the present invention is to provide a method for railway internal data circulation and sharing based on semi-supervised federated learning to improve the above problems. In order to achieve the above purpose, the technical solution adopted by the present invention is as follows: In a first aspect, the present application provides a method for railway internal data circulation and sharing based on semi-supervised federated learning, including: Acquire a data set and a plurality of initial local models from a plurality of clients, wherein the data set comprises a labeled data set and an unlabeled data set; Training a preset model based on the label data set to obtain an initial global model; Assigning a pseudo label to each unlabeled data in the unlabeled data set based on the initial global model and the Mahalanobis distance; The initial local model is trained based on the data on each client and the initial global model. When the preset model index meets the set conditions, the training is stopped to obtain multiple local models. The data on the client includes labeled data and unlabeled data with pseudo labels. Assign corresponding weight parameters to each local model based on the cluster distribution of data on each client; A data sharing model is calculated based on multiple local models and corresponding weight parameters.
[0005] In a second aspect, the present application also provides a railway internal data circulation and sharing device based on semi-supervised federated learning, comprising: A first acquisition unit is used to acquire a data set and a plurality of initial local models from a plurality of clients, wherein the data set includes a labeled data set and an unlabeled data set; A first training unit is used to train a preset model based on the label data set to obtain an initial global model; A first assigning unit, configured to assign a pseudo label to each unlabeled data in the unlabeled data set based on the initial global model and the Mahalanobis distance; A second training unit is used to train the initial local model based on the data on each client and the initial global model, and when the preset model index meets the set conditions, the training is stopped to obtain multiple local models, and the data on the client includes labeled data and unlabeled data carrying pseudo labels; A second allocation unit, configured to allocate corresponding weight parameters to each local model based on the cluster distribution of data on each client; The obtaining unit is used to calculate and obtain a data sharing model based on multiple local models and corresponding weight parameters.
[0006] In a third aspect, the present application also provides a railway internal data circulation and sharing device based on semi-supervised federated learning, including: Memory for storing computer programs; A processor is used to implement the steps of the railway internal data circulation and sharing method based on semi-supervised federated learning when executing the computer program.
[0007] In a fourth aspect, the present application also provides a readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned railway internal data circulation and sharing method based on semi-supervised federated learning are implemented.
[0008] The beneficial effects of the present invention are: The present invention assigns pseudo labels to unlabeled data based on a model trained on a labeled data set, so that the unlabeled data can participate in subsequent model training, further expanding the scale of training data and improving the generalization ability of the model; and assigns corresponding weight parameters to each local model based on the clustering distribution of data on each client, thereby reflecting the importance of each local model in the data sharing model, so that the final data sharing model can take into account both the global commonality and the individuality of different clients.
[0009] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or be understood by implementing the embodiments of the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures particularly pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0011] Figure 1 A schematic diagram of a flow chart of a method for railway internal data circulation and sharing based on semi-supervised federated learning described in an embodiment of the present invention; Figure 2 It is a schematic diagram of the structure of a railway internal data circulation and sharing device based on semi-supervised federated learning described in an embodiment of the present invention; Figure 3 This is a schematic diagram of the structure of a railway internal data circulation and sharing device based on semi-supervised federated learning described in an embodiment of the present invention.
[0012] Markings in the figure: 10. First acquisition unit; 20. First training unit; 30. First allocation unit; 40. Second training unit; 50. Second allocation unit; 60. Obtaining unit; 800. Railway internal data circulation and sharing device based on semi-supervised federated learning; 801. Processor; 802. Memory; 803. Multimedia component; 804. I / O interface; 805. Communication component. DETAILED DESCRIPTION
[0013] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. The components of the embodiments of the present invention generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the present invention. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0014] It should be noted that similar reference numerals and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further defined and explained in the subsequent drawings. At the same time, in the description of the present invention, the terms "first", "second", etc. are only used to distinguish the description and cannot be understood as indicating or implying relative importance. Embodiment 1:
[0015] This embodiment provides a method for railway internal data circulation and sharing based on semi-supervised federated learning.
[0016] See also Figure 1 , the figure shows that the method includes step S10, step S20, step S30, step S40, step S50 and step S60.
[0017] Step S10. Obtaining data sets and multiple initial local models from multiple clients, where the data sets include labeled data sets and unlabeled data sets; Step S20. Train the preset model based on the label data set to obtain an initial global model; Specifically, there is a large amount of distributed unstructured data stored in the railway information system. These data can be divided into labeled data and unlabeled data. All labeled data are collected to obtain a labeled data set, and all unlabeled data are collected as an unlabeled data set. Training is performed based on the labeled data set to obtain an initial global model. Each client is trained based on the existing labeled data to obtain multiple initial local models.
[0018] Step S30. assigning a pseudo label to each unlabeled data in the unlabeled data set based on the initial global model and the Mahalanobis distance; Specifically, considering the limited amount of labeled data, the trained global model may have insufficient generalization ability. Therefore, the present application assigns pseudo labels to unlabeled data based on the Mahalanobis distance, so that the unlabeled data can participate in subsequent model training, further expanding the scale of training data and improving the generalization ability of the global model.
[0019] Specifically, step S30 specifically includes step S31, step S32, step S33, step S34, step S35, step S36 and step S37: Step S31. Extract features of the unlabeled data on the client based on the initial global model to obtain multiple unlabeled features; Step S32. Clustering multiple unlabeled features based on a clustering algorithm to obtain multiple cluster centers; Step S33. Predict the label probability distribution of each cluster center based on the initial global model to obtain multiple probability distribution values; Specifically, we use the k-means clustering algorithm to get Cluster centers are used to The characteristics of cluster centers are predicted and the The probability distribution of cluster centers.
[0020] Step S34. Calculate the Mahalanobis distance between each unlabeled feature and each cluster center to obtain multiple distance values; Step S35. Based on the Gaussian kernel function and the distance value, the confidence of each unlabeled feature and each cluster center is calculated to obtain multiple initial confidences; Step S36. Normalize each initial confidence to obtain a target confidence; Step S37. Based on the target confidence and probability distribution value, determine the label probability distribution value of each unlabeled feature, and use the label value corresponding to the maximum label probability distribution value as the pseudo label of the corresponding unlabeled data; Specifically, for the unlabeled data on each client, the Mahalanobis distance between the features of each unlabeled data and all cluster centers is calculated: ;
[0021] in, For the The unlabeled data features and The Mahalanobis distance of the cluster centers; For the The unlabeled data is Characteristics of dimensions; For the The cluster center is in Characteristics of dimensions; For the The unlabeled data is Characteristics of dimensions; For the The cluster center is in Characteristics of dimensions; The cluster center is Dimensions and The inverse of the covariance matrix between dimensions; is the number of feature dimensions.
[0022] Calculate the confidence using the Gaussian kernel function: ;
[0023] in, For the The unlabeled data features and The Mahalanobis distance of the cluster centers; For the The unlabeled data features and The confidence level of each cluster center; is the width parameter of the kernel function; is an exponential function.
[0024] The confidence is normalized and the target confidence is obtained. The calculation formula is: ;
[0025] in, For the The unlabeled data features and The confidence level of each cluster center; For the The unlabeled data features and The target confidence of each cluster center; is the number of cluster centers.
[0026] Calculate the final probability distribution of each unlabeled data and select the label with the highest probability as the corresponding pseudo label: ;
[0027] in, For the Pseudo labels for unlabeled data; For the The unlabeled data features and The target confidence of each cluster center; For the The probability distribution of cluster centers; is the number of cluster centers.
[0028] The Mahalanobis distance in this application comprehensively considers the characteristic distribution of data in multiple dimensions, and can more accurately assign relatively accurate pseudo-labels to unlabeled data, so that all available data can be fully utilized for model training, avoiding the problem of limited model training due to insufficient labeled data.
[0029] Step S40. Train the initial local model based on the data on each client and the initial global model. When the preset model indicators meet the set conditions, stop the training to obtain multiple local models. The data on the client includes labeled data and unlabeled data with pseudo labels. Specifically, labeled data and data with pseudo labels are used for training on each client, the initial local model is updated, the loss function value is reduced during the training process to optimize the performance of the model on the local dataset, and the updated local model parameters are uploaded to the central server.
[0030] Specifically, step S40 specifically includes step S41, step S42, step S43, step S44, step S45, step S46, step S47, step S48, step S49, step S410 and step S411: Step S41. Input the data on the client into the initial global model and the initial local model to calculate the loss function, and obtain the cross entropy loss function value and the KL divergence function value; Step S42. Obtaining the preset initial weight, final weight and total number of iterations; Step S43. Obtain the number of model parameter adjustments; Step S44. First calculation operation: calculate the product of the total number of iterations and the initial weight to obtain a first value; Step S45. Second calculation operation: Calculate the product of the final weight and the number of model parameter adjustments to obtain a second value; Step S46. The third calculation operation: calculating the difference between the initial weight and the first value to obtain a third value; Step S47. Fourth calculation operation: calculate the difference between the third value and the second value to obtain a linear parameter; Step S48. Fifth calculation operation: Calculate the product of the linear parameter and the KL divergence function value and the sum of the cross entropy loss function value to obtain the total loss function value; Step S49. Adjustment operation: adjusting the model parameters of the initial local model based on the total loss function to obtain an adjusted initial local model, and updating the number of model parameter adjustment times; Step S410. Input operation: input the data on the client into the initial global model and the adjusted initial local model to calculate the loss function, and obtain the updated cross entropy loss function value and KL divergence function value; Step S411. Repeat the first calculation operation, the second calculation operation, the third calculation operation, the fourth calculation operation, the fifth calculation operation, the adjustment operation and the input operation until the number of model parameter adjustments is the same as the total number of iterations, and use the current model as the local model; Specifically, in order to ensure that the local model learns the global model parameters while taking into account the heterogeneity of local data, the KL divergence is introduced to measure the difference between the two probability distributions, and the loss function is set to: ;
[0031] in, To indicate the The loss function of the round; is the cross entropy loss function; is a linear parameter; are the parameters of the initial global model; For input data; is the probability distribution of the initial global model; are the parameters of the initial local model; is the probability distribution of the initial local model; is the difference between the predictions of the initial global model and the local model.
[0032] Linear parameters It decays linearly, and the decay calculation formula is: ;
[0033] in, is a linear parameter; is the initial weight; is the final weight; is the total number of iterations; is the number of model parameter adjustments; The attenuation of linear parameters makes the initial local model parameters more inclined to the initial global model at the beginning of the update, and more inclined to the data set on the client in the later stage, so that all participants in the railway data scenario can obtain a local model that performs well on the data set on the client.
[0034] At the same time, considering the extreme case, when the difference between the initial local model and the initial global model exceeds the threshold and the accuracy of the data set on the client is higher than a certain value, the update of the initial global model to the initial local model is completely ignored, and the corresponding linear parameter .
[0035] Step S50. assigning corresponding weight parameters to each local model based on the cluster distribution of data on each client; Specifically, in order to obtain better results when the central server aggregates the local model parameters uploaded by each client, different weights can be assigned to the model parameters of each client. In this application, the weight of the local model on each client is calculated based on information entropy.
[0036] Specifically, step S50 specifically includes step S51, step S52, step S53, step S54, step S55, step S56, step S57 and step S58: Step S51. Extract features of the data on the corresponding client based on the local model to obtain multiple data features; Step S52. Clustering multiple data features based on a clustering algorithm to obtain multiple data categories; Step S53. Calculate the ratio of the amount of data in each data category to the amount of data on the client to obtain the proportion of multiple categories; Specifically, for the clustering results of each client, we first calculate the probability distribution of each cluster, that is, the proportion of data in the cluster: ;
[0037] in, For the On the client The proportion of class data; For the On the client The number of class data; For the The amount of data on the client.
[0038] Step S54. Calculate the global distribution of each category based on the proportions of multiple categories to obtain the global proportion of each category; Specifically, step S54 specifically includes step S541, step S542, step S543 and step S544: Step S541. Calculate the sum of the data quantities on all clients to obtain the total quantity; Step S542. Calculate the product of the category ratio of the target data category and the data quantity of the corresponding client to obtain a plurality of fourth values; Step S543. Sum multiple fourth values to obtain a fifth value; Step S544. Calculate the product of the fifth value and the total number to obtain the global proportion of the target data category; Specifically, the proportion of each category of data from a global perspective is calculated using the following formula: ;
[0039] in, For the The global proportion of class data; For the The number of class data; For the On the client The proportion of class data; For the The amount of data on each client; is the number of clients.
[0040] Step S55. Calculate the weight value corresponding to each category based on the global proportion to obtain multiple category weights; Specifically, the category weight calculation formula is: ;
[0041] in, For the The global proportion of class data; For the Class weights of class data; is a constant to avoid the denominator being 0.
[0042] Step S56. Calculate the initial weight of each client based on the category weight and category proportion; Specifically, the initial weight calculation formula is: ;
[0043] in, is the initial weight of the i-th client; For the Class weights of class data; For the On the client The proportion of class data; is the number of data categories.
[0044] Step S57. Calculate the clustering information entropy of each client based on the category proportion to obtain multiple information entropies; Specifically, information entropy reflects the complexity and uncertainty of data on the client. The higher the entropy, the more evenly distributed the data is and the more difficult it is to classify. Conversely, the lower the entropy, the more predictable the data is and the better the clustering effect is. At the same time, considering the extremely serious imbalance between railway data categories, it is necessary to appropriately increase the weight of rare data to improve the performance of the global model.
[0045] The clustering information entropy calculation formula for each client is: ;
[0046] in, For the Clustering information entropy of clients; For the On the client The proportion of class data; is the number of data categories.
[0047] Step S58. Update the weights based on the clustering information entropy and the initial weights and perform normalization processing to obtain the weight parameters corresponding to each local model; Specifically, step S58 specifically includes step S581, step S582, step S583 and step S584: Step S581. Calculate the sum of the clustering information entropy of each client and a preset constant to obtain a plurality of sixth values; Step S582. Calculate the ratio of the initial weight of each client to the corresponding sixth value to obtain the target weight of each client; Step S583. Sum the target weights of all clients to obtain a seventh value; Step S584. Calculate the ratio of the target weight of each client to the seventh value to obtain the weight parameter corresponding to the local model of each client; Specifically, rare data will have a greater impact on the entropy value, thereby increasing the local model weight corresponding to the client with rare data when aggregating the model. The higher the information entropy, the more complex the data distribution of the client, and the more difficult the model may be to accurately predict, so we can give clients with higher entropy values a greater weight.
[0048] The target weight calculation formula is: ;
[0049] in, For the The target weight of each client; For the Clustering information entropy of clients; For the The initial weight of each client; is a constant to avoid the denominator being 0.
[0050] To ensure that the sum of all client weight parameters is 1, the target weight is normalized: ;
[0051] in, For the The weight parameter of each client; For the The target weight of each client; No. The target weight of each client; is the number of clients.
[0052] Step S60. Calculate a data sharing model based on multiple local models and corresponding weight parameters; Specifically, the local model parameters of each client are weighted and aggregated based on the calculated weight parameters to obtain a global model with updated parameters. Embodiment 2:
[0053] like Figure 2 As shown, this embodiment provides a railway internal data circulation and sharing device based on semi-supervised federated learning, and the device includes: A first acquisition unit 10 is used to acquire a data set and a plurality of initial local models from a plurality of clients, wherein the data set includes a labeled data set and an unlabeled data set; A first training unit 20 is used to train a preset model based on a label data set to obtain an initial global model; A first assigning unit 30 is used to assign a pseudo label to each unlabeled data in the unlabeled data set based on the initial global model and the Mahalanobis distance; A second training unit 40 is used to train the initial local model based on the data on each client and the initial global model. When the preset model index meets the set conditions, the training is stopped to obtain multiple local models. The data on the client includes labeled data and unlabeled data with pseudo labels. A second allocation unit 50, configured to allocate corresponding weight parameters to each local model based on the cluster distribution of data on each client; The obtaining unit 60 is used to calculate and obtain a data sharing model based on multiple local models and corresponding weight parameters.
[0054] In a specific implementation disclosed in the present application, the first allocation unit 30 includes: A first extraction unit, configured to extract features from unlabeled data on the client based on an initial global model to obtain a plurality of unlabeled features; A first clustering unit is used to perform clustering processing on multiple unlabeled features based on a clustering algorithm to obtain multiple cluster centers; A prediction unit, used to predict the label probability distribution of each cluster center based on the initial global model to obtain multiple probability distribution values; A first calculation unit is used to calculate the Mahalanobis distance between each unlabeled feature and each cluster center to obtain multiple distance values; A second calculation unit is used to calculate the confidence of each unlabeled feature and each cluster center based on the Gaussian kernel function and the distance value to obtain multiple initial confidences; A normalization unit, used to normalize each initial confidence to obtain a target confidence; The determination unit is used to determine the label probability distribution value of each unlabeled feature based on the target confidence and the probability distribution value, and use the label value corresponding to the maximum label probability distribution value as the pseudo label of the corresponding unlabeled data.
[0055] In a specific implementation disclosed in the present application, the second training unit 40 includes: The first input unit is used to input the data on the client into the initial global model and the initial local model to calculate the loss function, and obtain the cross entropy loss function value and the KL divergence function value; A second acquisition unit is used to acquire a preset initial weight, a final weight and a total number of iterations; A third acquisition unit is used to acquire the number of model parameter adjustment times; A third calculation unit is used for a first calculation operation: calculating the product of the total number of iterations and the initial weight to obtain a first value; A fourth calculation unit is used for a second calculation operation: calculating the product of the final weight and the number of model parameter adjustments to obtain a second value; A fifth calculation unit, configured for a third calculation operation: calculating a difference between the initial weight and the first value to obtain a third value; a sixth calculation unit, configured for a fourth calculation operation: calculating a difference between the third value and the second value to obtain a linear parameter; A seventh calculation unit, used for the fifth calculation operation: calculating the sum of the product of the linear parameter and the KL divergence function value and the cross entropy loss function value to obtain a total loss function value; An adjustment unit, used for an adjustment operation: adjusting the model parameters of the initial local model based on the total loss function to obtain an adjusted initial local model, and updating the number of model parameter adjustment times; The second input unit is used for input operation: inputting the data on the client into the initial global model and the adjusted initial local model to calculate the loss function, and obtaining the updated cross entropy loss function value and KL divergence function value; The repeating unit is used to repeat the first calculation operation, the second calculation operation, the third calculation operation, the fourth calculation operation, the fifth calculation operation, the adjustment operation and the input operation until the number of model parameter adjustments is the same as the total number of iterations, and the current model is used as the local model.
[0056] In a specific implementation disclosed in the present application, the second allocation unit 50 includes: A second extraction unit is used to extract features from the data on the corresponding client based on the local model to obtain multiple data features; A second clustering unit is used to perform clustering processing on multiple data features based on a clustering algorithm to obtain multiple data categories; An eighth calculation unit, used to calculate the ratio of the amount of data in each data category to the amount of data on the client, to obtain a proportion of multiple categories; A ninth calculation unit, configured to calculate the global distribution of each category based on the proportions of the multiple categories, and obtain the global proportion of each category; A tenth calculation unit is used to calculate the weight value corresponding to each category based on the global proportion, and obtain multiple category weights; An eleventh calculation unit, configured to calculate an initial weight of each client based on the category weight and the category proportion; A twelfth calculation unit, used to calculate the clustering information entropy of each client based on the category proportion, to obtain multiple information entropies; The updating unit is used to update the weights based on the clustering information entropy and the initial weights and perform normalization processing to obtain the weight parameters corresponding to each local model.
[0057] In a specific implementation manner disclosed in the present application, the ninth computing unit includes: A thirteenth calculation unit is used to calculate the sum of the data quantities on all clients to obtain a total quantity; A fourteenth calculation unit, used to calculate the product of the category ratio of the target data category and the data quantity of the corresponding client to obtain a plurality of fourth values; A first summing unit, used for summing a plurality of fourth values to obtain a fifth value; The fifteenth calculation unit is used to calculate the product of the fifth value and the total number to obtain the global proportion of the target data category.
[0058] In a specific implementation disclosed in the present application, the updating unit includes: A sixteenth calculation unit, used to calculate the sum of the clustering information entropy of each client and a preset constant to obtain a plurality of sixth values; a seventeenth calculation unit, configured to calculate a ratio of an initial weight of each client to a corresponding sixth value, to obtain a target weight of each client; A second summing unit is used to sum the target weights of all clients to obtain a seventh value; The eighteenth calculation unit is used to calculate the ratio of the target weight of each client and the seventh value, and obtain the weight parameter corresponding to the local model of each client.
[0059] It should be noted that, regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment of the method, and will not be elaborated here. Embodiment 3:
[0060] Corresponding to the above method embodiment, this embodiment also provides a railway internal data circulation and sharing device based on semi-supervised federated learning. The railway internal data circulation and sharing device based on semi-supervised federated learning described below and the railway internal data circulation and sharing method based on semi-supervised federated learning described above can be referenced to each other.
[0061] Figure 3 FIG. 8 is a block diagram of a railway internal data circulation and sharing device 800 based on semi-supervised federated learning according to an exemplary embodiment. Figure 3 As shown, the railway internal data circulation sharing device 800 based on semi-supervised federated learning may include: a processor 801, a memory 802. The railway internal data circulation sharing device 800 based on semi-supervised federated learning may also include one or more of a multimedia component 803, an I / O interface 804, and a communication component 805.
[0062] The processor 801 is used to control the overall operation of the railway internal data circulation and sharing device 800 based on semi-supervised federated learning to complete all or part of the steps in the above-mentioned railway internal data circulation and sharing method based on semi-supervised federated learning. The memory 802 is used to store various types of data to support the operation of the railway internal data circulation and sharing device 800 based on semi-supervised federated learning. These data may include, for example, instructions for any application or method operating on the railway internal data circulation and sharing device 800 based on semi-supervised federated learning, as well as application-related data, such as contact data, sent and received messages, pictures, audio, video, etc. The memory 802 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, disk or optical disk. The multimedia component 803 may include a screen and an audio component. The screen may be, for example, a touch screen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone, which is used to receive external audio signals. The received audio signal may be further stored in the memory 802 or sent via the communication component 805. The audio component also includes at least one speaker for outputting audio signals. The I / O interface 804 provides an interface between the processor 801 and other interface modules, and the above-mentioned other interface modules can be keyboards, mice, buttons, etc. These buttons can be virtual buttons or physical buttons. The communication component 805 is used for wired or wireless communication between the railway internal data circulation sharing device 800 based on semi-supervised federated learning and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G or 4G, or a combination of one or more of them, so the corresponding communication component 805 can include: Wi-Fi module, Bluetooth module, NFC module.
[0063] In an exemplary embodiment, the railway internal data circulation and sharing device 800 based on semi-supervised federated learning can be implemented by one or more application specific integrated circuits (Application Specific Integrated Circuit, referred to as ASIC), digital signal processors (Digital Signal Processor, referred to as DSP), digital signal processing devices (Digital Signal Processing Device, referred to as DSPD), programmable logic devices (Programmable Logic Device, referred to as PLD), field programmable gate arrays (Field Programmable Gate Array, referred to as FPGA), controllers, microcontrollers, microprocessors or other electronic components, and is used to execute the above-mentioned railway internal data circulation and sharing method based on semi-supervised federated learning.
[0064] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, and when the program instructions are executed by a processor, the steps of the above-mentioned railway internal data circulation and sharing method based on semi-supervised federated learning are implemented. For example, the computer-readable storage medium can be the above-mentioned memory 802 including program instructions, and the above-mentioned program instructions can be executed by the processor 801 of the railway internal data circulation and sharing device 800 based on semi-supervised federated learning to complete the above-mentioned railway internal data circulation and sharing method based on semi-supervised federated learning. Embodiment 4:
[0065] Corresponding to the above method embodiment, a readable storage medium is also provided in this embodiment. The readable storage medium described below and the railway internal data circulation and sharing method based on semi-supervised federated learning described above can refer to each other.
[0066] A readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the railway internal data circulation and sharing method based on semi-supervised federated learning of the above method embodiment.
[0067] The readable storage medium may specifically be a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or other readable storage medium that can store program codes.
[0068] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
[0069] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A method for railway internal data circulation and sharing based on semi-supervised federated learning, characterized in that: include: Acquire a data set and a plurality of initial local models from a plurality of clients, wherein the data set comprises a labeled data set and an unlabeled data set; Training a preset model based on the label data set to obtain an initial global model; Assigning a pseudo label to each unlabeled data in the unlabeled data set based on the initial global model and the Mahalanobis distance; The initial local model is trained based on the data on each client and the initial global model. When the preset model index meets the set conditions, the training is stopped to obtain multiple local models. The data on the client includes labeled data and unlabeled data with pseudo labels. Assign corresponding weight parameters to each local model based on the cluster distribution of data on each client; A data sharing model is calculated based on multiple local models and corresponding weight parameters.
2. According to claim 1, the method for railway internal data circulation and sharing based on semi-supervised federated learning is characterized in that , assigning a pseudo label to each unlabeled data in the unlabeled data set based on the initial global model and the Mahalanobis distance, comprising: Based on the initial global model, feature extraction is performed on the unlabeled data on the client to obtain a plurality of unlabeled features; Based on the clustering algorithm, multiple unlabeled features are clustered to obtain multiple cluster centers; Predicting the label probability distribution of each cluster center based on the initial global model to obtain multiple probability distribution values; Calculate the Mahalanobis distance between each unlabeled feature and each cluster center to obtain multiple distance values; Based on the Gaussian kernel function and the distance value, the confidence of each unlabeled feature and each cluster center is calculated to obtain multiple initial confidences; Normalize each initial confidence to obtain the target confidence; Based on the target confidence and the probability distribution value, the label probability distribution value of each unlabeled feature is determined, and the label value corresponding to the maximum label probability distribution value is used as the pseudo label of the corresponding unlabeled data.
3. The method for railway internal data circulation and sharing based on semi-supervised federated learning according to claim 1 is characterized in that , based on the data on each client and the initial global model, the initial local model is trained. When the preset model indicators meet the set conditions, the training is stopped to obtain multiple local models, including: Inputting the data on the client into the initial global model and the initial local model to calculate the loss function, and obtaining the cross entropy loss function value and the KL divergence function value; Get the preset initial weight, final weight and total number of iterations; Get the number of model parameter adjustments; A first calculation operation: calculating the product of the total number of iterations and the initial weight to obtain a first value; Second calculation operation: calculating the product of the final weight and the number of times the model parameter is adjusted to obtain a second value; A third calculation operation: calculating a difference between the initial weight and the first value to obtain a third value; Fourth calculation operation: calculating the difference between the third value and the second value to obtain a linear parameter; Fifth calculation operation: calculating the sum of the product of the linear parameter and the KL divergence function value and the cross entropy loss function value to obtain a total loss function value; Adjustment operation: adjusting the model parameters of the initial local model based on the total loss function to obtain an adjusted initial local model, and updating the number of model parameter adjustment times; Input operation: inputting the data on the client into the initial global model and the adjusted initial local model to calculate the loss function, and obtaining the updated cross entropy loss function value and KL divergence function value; Repeat the first calculation operation, the second calculation operation, the third calculation operation, the fourth calculation operation, the fifth calculation operation, the adjustment operation and the input operation until the number of model parameter adjustments is the same as the total number of iterations, and use the current model as the local model.
4. The method for railway internal data circulation and sharing based on semi-supervised federated learning according to claim 1 is characterized in that ,The allocation of corresponding weight parameters to each local model based on each client ,includes: Extracting features from the data on the corresponding client based on the local model to obtain multiple data features; Clustering multiple data features based on clustering algorithms to obtain multiple data categories; Calculate the ratio of the amount of data in each data category to the amount of data on the client to obtain the proportion of multiple categories; Calculate the global distribution of each category based on the proportions of multiple categories to obtain the global proportion of each category; The weight value corresponding to each category is calculated based on the global proportion to obtain multiple category weights; Calculating an initial weight of each client based on the category weight and the category proportion; Calculate the clustering information entropy of each client based on the category proportion to obtain multiple information entropies; The weights are updated based on the clustering information entropy and the initial weights and normalized to obtain weight parameters corresponding to each local model.
5. A railway internal data circulation and sharing device based on semi-supervised federated learning, characterized in that: include: A first acquisition unit is used to acquire a data set and a plurality of initial local models from a plurality of clients, wherein the data set includes a labeled data set and an unlabeled data set; A first training unit is used to train a preset model based on the label data set to obtain an initial global model; A first assigning unit, configured to assign a pseudo label to each unlabeled data in the unlabeled data set based on the initial global model and the Mahalanobis distance; A second training unit is used to train the initial local model based on the data on each client and the initial global model, and when the preset model index meets the set conditions, the training is stopped to obtain multiple local models, and the data on the client includes labeled data and unlabeled data carrying pseudo labels; A second allocation unit, configured to allocate corresponding weight parameters to each local model based on the cluster distribution of data on each client; The obtaining unit is used to calculate and obtain a data sharing model based on multiple local models and corresponding weight parameters.
6. The railway internal data circulation and sharing device based on semi-supervised federated learning according to claim 5 is characterized in that: The first allocation unit comprises: A first extraction unit, configured to extract features from the unlabeled data on the client based on the initial global model to obtain a plurality of unlabeled features; A first clustering unit is used to perform clustering processing on multiple unlabeled features based on a clustering algorithm to obtain multiple cluster centers; A prediction unit, used to predict the label probability distribution of each cluster center based on the initial global model to obtain multiple probability distribution values; A first calculation unit is used to calculate the Mahalanobis distance between each unlabeled feature and each cluster center to obtain multiple distance values; A second calculation unit is used to calculate the confidence of each unlabeled feature and each cluster center based on the Gaussian kernel function and the distance value to obtain multiple initial confidences; A normalization unit, used to normalize each initial confidence to obtain a target confidence; A determination unit is used to determine the label probability distribution value of each unlabeled feature based on the target confidence and the probability distribution value, and use the label value corresponding to the maximum label probability distribution value as the pseudo label of the corresponding unlabeled data.
7. The railway internal data circulation and sharing device based on semi-supervised federated learning according to claim 5 is characterized in that: The second training unit comprises: A first input unit is used to input the data on the client into the initial global model and the initial local model to calculate the loss function, and obtain a cross entropy loss function value and a KL divergence function value; A second acquisition unit is used to acquire a preset initial weight, a final weight and a total number of iterations; A third acquisition unit is used to acquire the number of model parameter adjustment times; A third calculation unit is used for a first calculation operation: calculating the product of the total number of iterations and the initial weight to obtain a first value; A fourth calculation unit, configured for a second calculation operation: calculating a product of the final weight and the number of times the model parameter is adjusted to obtain a second value; A fifth calculation unit, configured for a third calculation operation: calculating a difference between the initial weight and the first value to obtain a third value; a sixth calculation unit, configured to perform a fourth calculation operation: calculating a difference between the third value and the second value to obtain a linear parameter; A seventh calculation unit, configured for a fifth calculation operation: calculating a sum of a product of the linear parameter and the KL divergence function value and the cross entropy loss function value to obtain a total loss function value; An adjustment unit, configured to perform an adjustment operation: adjusting the model parameters of the initial local model based on the total loss function to obtain an adjusted initial local model, and updating the number of model parameter adjustment times; A second input unit is used for input operation: inputting the data on the client into the initial global model and the adjusted initial local model to calculate the loss function, and obtaining an updated cross entropy loss function value and a KL divergence function value; A repeating unit is used to repeat the first calculation operation, the second calculation operation, the third calculation operation, the fourth calculation operation, the fifth calculation operation, the adjustment operation and the input operation until the number of model parameter adjustments is the same as the total number of iterations, and the current model is used as the local model.
8. The railway internal data circulation and sharing device based on semi-supervised federated learning according to claim 5 is characterized in that: The second allocation unit comprises: A second extraction unit, configured to extract features from the data on the corresponding client based on the local model to obtain a plurality of data features; A second clustering unit is used to perform clustering processing on multiple data features based on a clustering algorithm to obtain multiple data categories; An eighth calculation unit, used to calculate the ratio of the amount of data in each data category to the amount of data on the client, to obtain a proportion of multiple categories; A ninth calculation unit, configured to calculate the global distribution of each category based on the proportions of the multiple categories, and obtain the global proportion of each category; A tenth calculation unit, configured to obtain a weight value corresponding to each category based on the global proportion calculation, and obtain multiple category weights; an eleventh calculating unit, configured to calculate an initial weight of each client based on the category weight and the category proportion; A twelfth calculation unit, configured to calculate the clustering information entropy of each client based on the category proportion to obtain multiple information entropies; An updating unit is used to update the weights based on the clustering information entropy and the initial weights and perform normalization processing to obtain weight parameters corresponding to each local model.
9. A railway internal data circulation and sharing device based on semi-supervised federated learning, characterized in that: include: Memory for storing computer programs; A processor, used to implement the steps of the railway internal data circulation and sharing method based on semi-supervised federated learning as described in any one of claims 1 to 4 when executing the computer program.
10. A readable storage medium, characterized in that: The readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the railway internal data circulation and sharing method based on semi-supervised federated learning as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Transverse federated learning optimization method and device based on semi-supervision and storage medium
CN111310938A
Training method of personalized model of distillation-based semi-supervised federated learning
CN113205863A
Training method and device of grammar error correction model, equipment and storage medium
CN115062611A
Federal unsupervised image classification model training method, classification method and equipment based on semantic clustering
CN116310530A
High-reliability semi-supervised federal learning method and system
CN116402156A
Cited By
Federal semi-supervised target detection method and device for water area ecological monitoring
CN122244598A
A federated semi-supervised object detection method and device for water area ecological monitoring
CN122244598B