Federated learning communication method and system based on MQTT for industrial Internet of Things
By performing data compression and model training on the industrial IoT user terminal, and using the MQTT protocol to transmit compressed data packets, it solves the problems of limited bandwidth and delay sensitivity of federated learning in industrial IoT scenarios, and achieves efficient communication and data privacy protection.
Patent Information
- Application Number
- CN202311743532.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-18
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2043-12-18
AI Technical Summary
Existing federated learning communication technology cannot be directly applied to industrial IoT scenarios, especially in environments with limited bandwidth and delay sensitivity, making it difficult to achieve effective transmission and training of models.
Adopting the federated learning communication method based on MQTT, through data compression and model training on the industrial Internet of Things user terminal, the MQTT protocol is used to transmit the compressed data packets, combined with data cleaning and outlier identification, to ensure personalized training and efficient communication of the model .
It reduces the communication overhead of model training, reduces the amount of communication transmission between the device and the server, improves system communication efficiency, protects user data privacy, and reduces network costs.
Smart Images

Figure CN117857647B
Abstract
Description
Technical Field
[0001] The present invention proposes a federated learning communication method and system based on MQTT for industrial Internet of Things, belonging to the technical field of federated learning communication. Background Art
[0002] Existing federated learning communication technology cannot be directly applied to industrial Internet of Things scenarios. IIoT devices usually operate in bandwidth-limited and delay-sensitive environments, and require minimized communication volume to transmit models. Summary of the invention
[0003] The present invention provides a federated learning communication method and system based on MQTT for industrial Internet of Things, which is used to solve the problem that the federated learning communication technology in the prior art cannot be directly applied to the industrial Internet of Things scenario:
[0004] A federated learning communication method based on MQTT for industrial Internet of Things, the federated learning communication method based on MQTT for industrial Internet of Things comprising:
[0005] Use federated learning demand information and communication demand information to train the federated learning model of user terminals in industrial IoT scenarios;
[0006] When the user terminal of the industrial Internet of Things generates data information that needs to be transmitted, the federated learning model of the user terminal is used to compress the data and obtain a compressed data packet;
[0007] The compressed data packet is sent to the Internet of Things platform corresponding to the industrial Internet of Things using the MQTT protocol.
[0008] Furthermore, the federated learning demand information and the communication demand information are used to train the federated learning model of the user terminal in the industrial Internet of Things scenario, including:
[0009] Extracting information on federated learning requirements in industrial IoT scenarios;
[0010] Extract communication requirement information for communication using MQTT protocol;
[0011] Local data is collected on the user terminals of the industrial Internet of Things, and the local data is used to train the learning model corresponding to federated learning.
[0012] Furthermore, local data is collected on the user terminal of the industrial Internet of Things, and the learning model corresponding to the federated learning is trained using the local data, including:
[0013] Controlling the user terminal of the industrial Internet of Things to collect local data corresponding to the user terminal;
[0014] Performing data cleaning on the local data to obtain the cleaned local data, and using the cleaned local data as sample data to form a sample data set;
[0015] Among them, the process of outlier identification and elimination in the data cleaning process is as follows:
[0016] Step 1: Assume that there are n data in the data set that need to remove outliers, and the value of the i-th data is V i , i is the data number, which is greater than or equal to 1 and less than or equal to n, then the mean of these n data is:
[0017]
[0018] Where Avg is the mean of these n data;
[0019] Step 2: Based on the calculation results of step 1, calculate the standard deviation of the n data. The calculation formula is:
[0020]
[0021] Where Std is the standard deviation of these n data;
[0022] Step 3: Based on the calculation results of step 1 and step 2, calculate the value of the i-th data as V i The K value is calculated as follows:
[0023]
[0024] Where K i The value of the i-th data is V i K value. When K i When K is greater than 3, it indicates that the data is abnormal and should be eliminated. i When it is less than or equal to 3, it indicates that the data is normal and should be retained.
[0025] According to the federated learning requirement information and the communication requirement information corresponding to the user terminal of the industrial Internet of Things, a federated learning model corresponding to the federated learning requirement information and the communication requirement information of the user terminal is retrieved from a database of the industrial Internet of Things as a target learning model;
[0026] Sending the target learning model to a corresponding user terminal;
[0027] The user terminal trains the received target learning model using the sample data set to obtain a trained target learning model.
[0028] Furthermore, when the user terminal of the industrial Internet of Things generates data information that needs to be transmitted, the federated learning model of the user terminal is used to compress the data to obtain a compressed data packet, including:
[0029] When the user terminal of the industrial Internet of Things generates data information that needs to be transmitted, the data information to be compressed is extracted;
[0030] The data information to be compressed is input into the federated learning model, the data is compressed according to the compression rules by the federated learning model, and the compressed data packet is output.
[0031] Furthermore, the compression rules are as follows:
[0032] Extracting the gradient information corresponding to the data information to be compressed for compression processing;
[0033] Compressing the data information to be compressed, and performing sparse processing on the gradient information corresponding to the compression process using a single threshold of absolute value on the gradient of a fixed proportion;
[0034] Use 8-bit unsigned linear quantization to map the gradient to the smallest integer value;
[0035] The minimum integer value corresponding to the gradient mapping is obtained according to the data information to be compressed to compress the data information to be compressed.
[0036] The MQTT-based federated learning communication system for industrial Internet of Things includes:
[0037] A learning model training module is used to train the federated learning model of the user terminal in the industrial Internet of Things scenario using the federated learning demand information and the communication demand information;
[0038] The data compression module is used to compress the data through the federated learning model of the user terminal when the user terminal of the industrial Internet of Things generates data information that needs to be transmitted, and obtain a compressed data packet;
[0039] The data sending module is used to send the compressed data packet to the Internet of Things platform corresponding to the industrial Internet of Things using the MQTT protocol.
[0040] Furthermore, the learning model training module includes:
[0041] Learning requirement information extraction module, used to extract federated learning requirement information in industrial IoT scenarios;
[0042] A communication requirement information extraction module, used to extract communication requirement information for communication using the MQTT protocol;
[0043] The training execution module is used to collect local data on the user terminal of the industrial Internet of Things and use the local data to train the learning model corresponding to the federated learning.
[0044] Furthermore, the training execution module includes:
[0045] A local data acquisition module, used to control the user terminal of the industrial Internet of Things to collect local data corresponding to the user terminal;
[0046] A sample data set acquisition module is used to clean the local data to obtain the cleaned local data, and use the cleaned local data as sample data to form a sample data set;
[0047] Among them, the process of outlier identification and elimination in the data cleaning process is as follows:
[0048] Step 1: Assume that there are n data in the data set that need to remove outliers, and the value of the i-th data is V i , i is the data number, which is greater than or equal to 1 and less than or equal to n, then the mean of these n data is:
[0049]
[0050] Where Avg is the mean of these n data;
[0051] Step 2: Based on the calculation results of step 1, calculate the standard deviation of the n data. The calculation formula is:
[0052]
[0053] Where Std is the standard deviation of these n data;
[0054] Step 3: Based on the calculation results of step 1 and step 2, calculate the value of the i-th data as V i The K value is calculated as follows:
[0055]
[0056] Where K i The value of the i-th data is V i K value; when K i When K is greater than 3, it indicates that the data is abnormal and should be eliminated. i When it is less than or equal to 3, it indicates that the data is normal and should be retained.
[0057] a target learning model acquisition module, configured to retrieve, from a database of the industrial Internet of Things, a federated learning model corresponding to the federated learning requirement information and the communication requirement information of the user terminal of the industrial Internet of Things, as a target learning model;
[0058] A target learning model sending module, used to send the target learning model to a corresponding user terminal;
[0059] The model training execution module is used for the user terminal to train the received target learning model using the sample data set to obtain the trained target learning model.
[0060] Furthermore, the data compression module includes:
[0061] The module for extracting data information to be compressed is used to extract data information to be compressed when the user terminal of the industrial Internet of Things generates data information that needs to be transmitted;
[0062] The data packet output module is used to input the data information to be compressed into the federated learning model, perform data compression according to the compression rules through the federated learning model, and output the compressed data packet.
[0063] Furthermore, the compression rules are as follows:
[0064] Extracting the gradient information corresponding to the data information to be compressed for compression processing;
[0065] Compressing the data information to be compressed, and performing sparse processing on the gradient information corresponding to the compression process using a single threshold of absolute value on the gradient of a fixed proportion;
[0066] Use 8-bit unsigned linear quantization to map the gradient to the smallest integer value;
[0067] The minimum integer value corresponding to the gradient mapping is obtained according to the data information to be compressed to compress the data information to be compressed.
[0068] Beneficial effects of the present invention:
[0069] The MQTT-based federated learning communication method and system for industrial Internet of Things proposed in the present invention adopts multiple methods for compression processing, including gradient sparsification technology (sparse fixed-ratio gradients based on a single threshold of absolute value), gradient quantization (linear quantization method using 8-bit unsigned integer), and gradient encoding and decoding method (bit mapping method). The MQTT-based federated learning communication method and system for industrial Internet of Things proposed in the present invention reduce the communication overhead of model training, reduce the communication transmission volume between devices and servers, and improve the communication efficiency of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] Figure 1 is a flow chart of the method of the present invention;
[0071] Figure 2 The system block diagram of the system of the present invention. DETAILED DESCRIPTION
[0072] The preferred embodiments of the present invention are described below in conjunction with the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.
[0073] The embodiment of the present invention proposes a federated learning communication method based on MQTT for industrial Internet of Things, such as Figure 1 As shown, the MQTT-based federated learning communication method for industrial Internet of Things includes:
[0074] S1. Use federated learning demand information and communication demand information to train the federated learning model of the user terminal in the industrial Internet of Things scenario;
[0075] S2. When the user terminal of the industrial Internet of Things generates data information that needs to be transmitted, the federated learning model of the user terminal is used to compress the data to obtain a compressed data packet;
[0076] S3. Send the compressed data packet to the Internet of Things platform corresponding to the industrial Internet of Things using the MQTT protocol.
[0077] The working principle of the above technical solution is as follows: Training the federated learning model (S1): First, the federated learning demand information and communication demand information are used to train the federated learning model of the user terminal in the industrial Internet of Things scenario. This means that the user terminals can learn collaboratively without transmitting original data.
[0078] Data compression (S2): When the user terminal of the Industrial Internet of Things generates data information that needs to be transmitted, the data is not transmitted directly. Instead, the data is compressed by the federated learning model of the user terminal to obtain a compressed data packet. This step helps to reduce the size of data transmission and reduce the demand for network bandwidth.
[0079] Data transmission (S3): The compressed data packets are sent to the IoT platform corresponding to the Industrial IoT using the MQTT (Message Queuing Telemetry Transport) protocol. MQTT is a lightweight and efficient publish / subscribe protocol suitable for communication between IoT devices.
[0080] The effects of the above technical solution are: Reduce the amount of data transmission: By using the federated learning model to compress data on the user terminal, the amount of data that needs to be transmitted over the network is reduced. This helps to reduce the demand for network bandwidth and reduce the cost and delay of data transmission.
[0081] Privacy protection: Federated learning allows user terminals to train models without sharing original data. This helps protect the privacy of user data because sensitive data does not leave the user terminal.
[0082] Efficient communication: Using the MQTT protocol for data transmission can ensure efficient messaging and communication management, especially suitable for industrial IoT environments where real-time or periodic data transmission is required.
[0083] Reduced network costs: Reducing the amount of data transmitted and improving communication efficiency can reduce the network costs associated with data transmission, which is particularly important in large-scale industrial IoT applications.
[0084] In one embodiment of the present invention, a federated learning model of a user terminal in an industrial Internet of Things scenario is trained using federated learning requirement information and communication requirement information, including:
[0085] S101, extracting federated learning demand information in industrial IoT scenarios;
[0086] S102, extracting communication requirement information for communication using the MQTT protocol;
[0087] S103. Collect local data at the user terminal of the industrial Internet of Things, and use the local data to train the learning model corresponding to the federated learning.
[0088] The working principle of the above technical solution is as follows: Extracting federated learning requirement information (S101): In the industrial Internet of Things scenario, firstly, it is necessary to determine the requirement information of federated learning. This includes determining the tasks that require federated learning, the terminal devices involved, and the type of model to be trained. Such requirement information will play a key guiding role in the subsequent model training.
[0089] Extracting communication requirement information (S102): At the same time, communication requirement information also needs to be extracted, including determining the requirement of using the MQTT protocol for communication. This step determines the communication protocol to ensure that the communication method between user terminals is unified.
[0090] Local data collection and model training (S103): The user terminal collects data locally, which will be used to train the federated learning model. The federated learning model can be a machine learning model, such as a neural network, for specific tasks such as prediction, classification, or anomaly detection. The user terminal uses the extracted demand information to train the model to meet the specific needs of the industrial Internet of Things scenario.
[0091] The effects of the above technical solution are: Personalized model training: By performing local model training on each user terminal, a personalized model can be created based on the local data and demand information of the user terminal. This enables each terminal to be trained according to its own characteristics without sharing original data.
[0092] Privacy protection: Since data does not leave the user terminal, privacy is better protected. The user's sensitive data will not be transmitted on the network, and only model parameters or model updates will be transmitted in the communication.
[0093] Customized communication requirements: The extraction of communication requirement information ensures the use of MQTT protocol for communication, which helps ensure consistency in communication methods and can also be customized for specific communication requirements.
[0094] The technical solution of this embodiment is to perform local model training on the terminal through federated learning, thereby realizing model personalization, while ensuring the efficiency and consistency of communication through the MQTT protocol.
[0095] In one embodiment of the present invention, local data is collected at a user terminal of the industrial Internet of Things, and a learning model corresponding to federated learning is trained using the local data, including:
[0096] S1031, controlling the user terminal of the industrial Internet of Things to collect local data corresponding to the user terminal;
[0097] S1032, performing data cleaning on the local data to obtain the cleaned local data, and using the cleaned local data as sample data to form a sample data set;
[0098] S1033. According to the federated learning requirement information and communication requirement information corresponding to the user terminal of the industrial Internet of Things, retrieve a federated learning model corresponding to the federated learning requirement information and communication requirement information of the user terminal from the database of the industrial Internet of Things as a target learning model;
[0099] S1034, sending the target learning model to a corresponding user terminal;
[0100] S1035. The user terminal uses the sample data set to train the received target learning model to obtain a trained target learning model.
[0101] Since the local data collected from user terminals is uneven and contains many outliers, such as a usage time of more than 1 year, the start time is 1970, etc., if such outliers cannot be correctly identified and removed, it will cause great interference to the subsequent model training and have a great impact on the accuracy of the model. In order to accurately identify and remove the above outliers, the following algorithm is used:
[0102] Step 1: Assume that there are n data in the data set that need to remove outliers, and the value of the i-th data is V i , i is the data number, which is greater than or equal to 1 and less than or equal to n, then the mean of these n data is:
[0103]
[0104] Where Avg is the mean of these n data.
[0105] Step 2: Based on the calculation results of step 1, calculate the standard deviation of the n data. The calculation formula is:
[0106]
[0107] Std is the standard deviation of the n data.
[0108] Step 3: Based on the calculation results of step 1 and step 2, calculate the value of the i-th data as V i The K value is calculated as follows:
[0109]
[0110] Where K i The value of the i-th data is V i K value. When K i When K is greater than 3, it indicates that the data is abnormal and should be eliminated. i When it is less than or equal to 3, it indicates that the data is normal and should be retained.
[0111] The algorithm accurately identifies abnormal data through the relationship between the detected data and the mean and variance of the overall data, ensuring the accuracy of the model training data set, providing a good basic condition for model training, and also providing a guarantee for the accuracy of the model.
[0112] The working principle of the above technical solution is: Control local data collection (S1031): Control the user terminal of the industrial Internet of Things to collect local data. These local data may include sensor data, device status, operation records, etc., depending on the specific industrial Internet of Things application scenario.
[0113] Data cleaning (S1032): The collected local data is cleaned to remove noise, outliers or unnecessary information to obtain clean data. The cleaned data will be used as sample data for training the federated learning model.
[0114] Retrieving the target learning model (S1033): According to the federated learning requirement information and communication requirement information of the user terminal of the industrial Internet of Things, a federated learning model matching the user terminal requirements is obtained from the database of the industrial Internet of Things. This target learning model will be used to train local data.
[0115] Sending the target learning model (S1034): The acquired target learning model is sent to the corresponding user terminal. The target model will provide an initialized model structure, and the user terminal will use it for training.
[0116] Local model training (S1035): The user terminal uses the collected sample data set and the received target learning model to perform model training. The local model training process can use technologies such as federated learning to ensure that the user terminal's data does not leave the local area and maintains privacy. After training, the user terminal will obtain a personalized model that is suitable for its specific data and needs.
[0117] The effects of the above technical solution are: Personalized model training: The user terminal can train a personalized model based on its local data, which can improve the performance and adaptability of the model to meet different needs and data characteristics.
[0118] Privacy protection: Data does not leave the user terminal, so privacy is better protected. The user's local data will not be transmitted on the network, only model parameters or model updates will be transmitted in the communication.
[0119] Communication efficiency: User terminals only need to transmit model parameters and updates instead of raw data, which can reduce communication overhead and improve communication efficiency.
[0120] The technical solution of this embodiment is to enable the user terminal to train a personalized model locally through federated learning while ensuring data privacy and communication efficiency.
[0121] In one embodiment of the present invention, when a user terminal of the industrial Internet of Things generates data information that needs to be transmitted, data compression is performed through a federated learning model of the user terminal to obtain a compressed data packet, including:
[0122] S201. When a user terminal of the industrial Internet of Things generates data information that needs to be transmitted, extract the data information to be compressed;
[0123] S202: input the data information to be compressed into a federated learning model, perform data compression according to a compression rule through the federated learning model, and output a compressed data packet.
[0124] The compression rules are as follows:
[0125] Extracting the gradient information corresponding to the data information to be compressed for compression processing;
[0126] Compressing the data information to be compressed, and performing sparse processing on the gradient information corresponding to the compression process using a single threshold of absolute value on the gradient of a fixed proportion;
[0127] Use 8-bit unsigned linear quantization to map the gradient to the smallest integer value;
[0128] The minimum integer value corresponding to the gradient mapping is obtained according to the data information to be compressed to compress the data information to be compressed.
[0129] The working principle of the above technical solution is: extracting data information to be compressed (S201): when the user terminal generates data information to be transmitted, the data is extracted as data information to be compressed.
[0130] The federated learning model performs data compression (S202): The data information to be compressed is compressed through the federated learning model. The compression rules are as follows:
[0131] Gradient information extraction: The gradient information corresponding to the data information to be compressed is extracted. This gradient information is usually used to update the federated learning model.
[0132] Gradient sparsification: A fixed fraction of gradients are sparsified using a single threshold on their absolute value. This means that only those gradients whose absolute value exceeds a certain threshold are retained, while the rest are set to zero.
[0133] Linear quantization: Use 8-bit unsigned integer linear quantization method to map the gradient to the smallest integer value. This helps to reduce the precision of the data, thereby reducing the size of the data.
[0134] Compressed data generation: Obtain the minimum integer value corresponding to the gradient mapping based on the information of the data to be compressed, and then map it into a compressed data packet.
[0135] The effects of the above technical solution are: Data compression: Data compression is performed through the federated learning model to compress the original data information into smaller data packets. This can reduce the amount of data that needs to be transmitted, thereby reducing communication overhead.
[0136] Gradient sparsification: Gradient sparsification can preserve important gradient information while reducing less important gradients to further reduce data size.
[0137] Linear quantization: Use linear quantization to map gradients to integer values, reducing the precision of the data but still retaining enough information to support the training of the federated learning model.
[0138] The technical solution of this embodiment helps to reduce the cost of data transmission and communication delay through data compression, while maintaining sufficient information to support the update of the federated learning model.
[0139] The embodiment of the present invention proposes a federated learning communication system based on MQTT for industrial Internet of Things, such as Figure 2 As shown, the MQTT-based federated learning communication system for industrial Internet of Things includes:
[0140] A learning model training module is used to train the federated learning model of the user terminal in the industrial Internet of Things scenario using the federated learning demand information and the communication demand information;
[0141] The data compression module is used to compress the data through the federated learning model of the user terminal when the user terminal of the industrial Internet of Things generates data information that needs to be transmitted, and obtain a compressed data packet;
[0142] The data sending module is used to send the compressed data packet to the Internet of Things platform corresponding to the industrial Internet of Things using the MQTT protocol.
[0143] The working principle of the above technical solution is as follows: First, the federated learning model of the user terminal in the industrial Internet of Things scenario is trained using the federated learning requirement information and the communication requirement information. This means that the user terminals can learn collaboratively without transmitting the original data.
[0144] When the user terminal of the Industrial Internet of Things generates data information that needs to be transmitted, the data is not transmitted directly. Instead, the data is compressed by the federated learning model of the user terminal to obtain a compressed data packet. This step helps to reduce the size of data transmission and reduce the demand for network bandwidth.
[0145] The compressed data packets are sent to the IoT platform corresponding to the Industrial IoT using the MQTT (Message Queuing Telemetry Transport) protocol. MQTT is a lightweight and efficient publish / subscribe protocol suitable for communication between IoT devices.
[0146] The effects of the above technical solution are: Reduce the amount of data transmission: By using the federated learning model to compress data on the user terminal, the amount of data that needs to be transmitted over the network is reduced. This helps to reduce the demand for network bandwidth and reduce the cost and delay of data transmission.
[0147] Privacy protection: Federated learning allows user terminals to train models without sharing original data. This helps protect the privacy of user data because sensitive data does not leave the user terminal.
[0148] Efficient communication: Using the MQTT protocol for data transmission can ensure efficient messaging and communication management, especially suitable for industrial IoT environments where real-time or periodic data transmission is required.
[0149] Reduced network costs: Reducing the amount of data transmitted and improving communication efficiency can reduce the network costs associated with data transmission, which is particularly important in large-scale industrial IoT applications.
[0150] In one embodiment of the present invention, the learning model training module includes:
[0151] Learning requirement information extraction module, used to extract federated learning requirement information in industrial IoT scenarios;
[0152] A communication requirement information extraction module, used to extract communication requirement information for communication using the MQTT protocol;
[0153] The training execution module is used to collect local data on the user terminal of the industrial Internet of Things and use the local data to train the learning model corresponding to the federated learning.
[0154] The working principle of the above technical solution is as follows: In the industrial Internet of Things scenario, the demand information of federated learning needs to be determined first. This includes determining the tasks that require federated learning, the terminal devices involved, and the type of model to be trained. This demand information will play a key guiding role in subsequent model training.
[0155] At the same time, it is also necessary to extract communication requirements information, including determining the requirements for using the MQTT protocol for communication. This step determines the communication protocol to ensure a unified communication method between user terminals.
[0156] The user terminal collects data locally, which will be used to train the federated learning model. The federated learning model can be a machine learning model, such as a neural network, for specific tasks such as prediction, classification, or anomaly detection. The user terminal uses the extracted demand information to train the model to meet the specific needs of the industrial IoT scenario.
[0157] The effects of the above technical solution are: Personalized model training: By performing local model training on each user terminal, a personalized model can be created based on the local data and demand information of the user terminal. This enables each terminal to be trained according to its own characteristics without sharing original data.
[0158] Privacy protection: Since data does not leave the user terminal, privacy is better protected. The user's sensitive data will not be transmitted on the network, and only model parameters or model updates will be transmitted in the communication.
[0159] Customized communication requirements: The extraction of communication requirement information ensures the use of MQTT protocol for communication, which helps ensure consistency in communication methods and can also be customized for specific communication requirements.
[0160] The technical solution of this embodiment is to perform local model training on the terminal through federated learning, thereby realizing model personalization, while ensuring the efficiency and consistency of communication through the MQTT protocol.
[0161] In one embodiment of the present invention, the training execution module includes:
[0162] A local data acquisition module, used to control the user terminal of the industrial Internet of Things to collect local data corresponding to the user terminal;
[0163] A sample data set acquisition module is used to clean the local data to obtain the cleaned local data, and use the cleaned local data as sample data to form a sample data set;
[0164] a target learning model acquisition module, configured to retrieve, from a database of the industrial Internet of Things, a federated learning model corresponding to the federated learning requirement information and the communication requirement information of the user terminal of the industrial Internet of Things, as a target learning model;
[0165] A target learning model sending module, used to send the target learning model to a corresponding user terminal;
[0166] The model training execution module is used for the user terminal to train the received target learning model using the sample data set to obtain the trained target learning model.
[0167] Since the local data collected from user terminals is uneven and contains many outliers, such as a usage time of more than 1 year, the start time is 1970, etc., if such outliers cannot be correctly identified and removed, it will cause great interference to the subsequent model training and have a great impact on the accuracy of the model. In order to accurately identify and remove the above outliers, the following algorithm is used:
[0168] Step 1: Assume that there are n data in the data set that need to remove outliers, and the value of the i-th data is V i , i is the data number, which is greater than or equal to 1 and less than or equal to n, then the mean of these n data is:
[0169]
[0170] Where Avg is the mean of the n data.
[0171] Step 2: Based on the calculation results of step 1, calculate the standard deviation of the n data. The calculation formula is:
[0172]
[0173] Std is the standard deviation of the n data.
[0174] Step 3: Based on the calculation results of step 1 and step 2, calculate the value of the i-th data as V i The K value is calculated as follows:
[0175]
[0176] Where K i The value of the i-th data is V i K value. When K i When K is greater than 3, it indicates that the data is abnormal and should be eliminated. i When it is less than or equal to 3, it indicates that the data is normal and should be retained.
[0177] The algorithm accurately identifies abnormal data through the relationship between the detected data and the mean and variance of the overall data, ensuring the accuracy of the model training data set, providing a good basic condition for model training, and also providing a guarantee for the accuracy of the model.
[0178] The working principle of the above technical solution is to control the user terminal of the industrial Internet of Things to collect local data. These local data may include sensor data, device status, operation records, etc., depending on the specific industrial Internet of Things application scenario.
[0179] The collected local data is cleaned to remove noise, outliers or unnecessary information to obtain clean data. These cleaned data will be used as sample data for training the federated learning model.
[0180] According to the federated learning demand information and communication demand information of the user terminal of the industrial Internet of Things, a federated learning model matching the user terminal demand is obtained from the database of the industrial Internet of Things. This target learning model will be used to train local data.
[0181] The acquired target learning model is sent to the corresponding user terminal. This target model will provide an initialized model structure, which the user terminal will use for training.
[0182] The user terminal uses the collected sample data set and the received target learning model to perform model training. The training process of the local model can use technologies such as federated learning to ensure that the user terminal's data does not leave the local area and remains private. After training, the user terminal will obtain a personalized model that is suitable for its specific data and needs.
[0183] The effects of the above technical solution are: Personalized model training: The user terminal can train a personalized model based on its local data, which can improve the performance and adaptability of the model to meet different needs and data characteristics.
[0184] Privacy protection: Data does not leave the user terminal, so privacy is better protected. The user's local data will not be transmitted on the network, only model parameters or model updates will be transmitted in the communication.
[0185] Communication efficiency: User terminals only need to transmit model parameters and updates instead of raw data, which can reduce communication overhead and improve communication efficiency.
[0186] The technical solution of this embodiment is to enable the user terminal to train a personalized model locally through federated learning while ensuring data privacy and communication efficiency.
[0187] In one embodiment of the present invention, the data compression module includes:
[0188] The module for extracting data information to be compressed is used to extract data information to be compressed when the user terminal of the industrial Internet of Things generates data information that needs to be transmitted;
[0189] The data packet output module is used to input the data information to be compressed into the federated learning model, perform data compression according to the compression rules through the federated learning model, and output the compressed data packet.
[0190] The compression rules are as follows:
[0191] Extracting the gradient information corresponding to the data information to be compressed for compression processing;
[0192] Compressing the data information to be compressed, and performing sparse processing on the gradient information corresponding to the compression process using a single threshold of absolute value on the gradient of a fixed proportion;
[0193] Use 8-bit unsigned linear quantization to map the gradient to the smallest integer value;
[0194] The minimum integer value corresponding to the gradient mapping is obtained according to the data information to be compressed to compress the data information to be compressed.
[0195] The working principle of the above technical solution is: when the user terminal generates data information that needs to be transmitted, the data is extracted as data information to be compressed.
[0196] The data to be compressed is compressed through the federated learning model. The compression rules are as follows:
[0197] Gradient information extraction: The gradient information corresponding to the data information to be compressed is extracted. This gradient information is usually used to update the federated learning model.
[0198] Gradient sparsification: A fixed fraction of gradients are sparsified using a single threshold on their absolute value. This means that only those gradients whose absolute value exceeds a certain threshold are retained, while the rest are set to zero.
[0199] Linear quantization: Use 8-bit unsigned integer linear quantization method to map the gradient to the smallest integer value. This helps to reduce the precision of the data, thereby reducing the size of the data.
[0200] Compressed data generation: Obtain the minimum integer value corresponding to the gradient mapping based on the information of the data to be compressed, and then map it into a compressed data packet.
[0201] The effects of the above technical solution are: Data compression: Data compression is performed through the federated learning model to compress the original data information into smaller data packets. This can reduce the amount of data that needs to be transmitted, thereby reducing communication overhead.
[0202] Gradient sparsification: Gradient sparsification can preserve important gradient information while reducing less important gradients to further reduce data size.
[0203] Linear quantization: Use linear quantization to map gradients to integer values, reducing the precision of the data but still retaining enough information to support the training of the federated learning model.
[0204] The technical solution of this embodiment helps to reduce the cost of data transmission and communication delay through data compression, while maintaining sufficient information to support the update of the federated learning model.
[0205] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A federated learning communication method based on MQTT for industrial Internet of Things, characterized in that: The MQTT-based federated learning communication method for industrial Internet of Things includes: Use federated learning demand information and communication demand information to train the federated learning model of user terminals in industrial IoT scenarios; When the user terminal of the industrial Internet of Things generates data information that needs to be transmitted, the federated learning model of the user terminal is used to compress the data and obtain a compressed data packet; The compressed data packet is sent to the IoT platform corresponding to the industrial IoT using the MQTT protocol; The federated learning demand information and communication demand information are used to train the federated learning model of the user terminal in the industrial Internet of Things scenario, including: Extracting information on federated learning requirements in industrial IoT scenarios; Extract communication requirement information for communication using MQTT protocol; Collect local data on the user terminals of the industrial Internet of Things and use the local data to train the learning model corresponding to federated learning; Among them, local data is collected on the user terminal of the industrial Internet of Things, and the learning model corresponding to the federated learning is trained using the local data, including: Controlling the user terminal of the industrial Internet of Things to collect local data corresponding to the user terminal; Performing data cleaning on the local data to obtain the cleaned local data, and using the cleaned local data as sample data to form a sample data set; According to the federated learning requirement information and the communication requirement information corresponding to the user terminal of the industrial Internet of Things, a federated learning model corresponding to the federated learning requirement information and the communication requirement information of the user terminal is retrieved from a database of the industrial Internet of Things as a target learning model; Sending the target learning model to a corresponding user terminal; The user terminal trains the received target learning model using the sample data set to obtain a trained target learning model; Among them, the process of outlier identification and elimination in the data cleaning process is as follows: Step 1: Assume that there are n data in the data set that need to remove outliers, and the value of the i-th data is V i , i is the data number, which is greater than or equal to 1 and less than or equal to n, then the mean of these n data is: Where Avg is the mean of these n data; Step 2: Based on the calculation results of step 1, calculate the standard deviation of the n data. The calculation formula is: Where Std is the standard deviation of these n data; Step 3: Based on the calculation results of step 1 and step 2, calculate the value of the i-th data as V i The K value is calculated as follows: Where K i The value of the i-th data is V i K value; when K i When K is greater than 3, it indicates that the data is abnormal and should be eliminated. i When it is less than or equal to 3, it indicates that the data is normal and should be retained.
2. According to claim 1, the MQTT-based federated learning communication method for industrial Internet of Things is characterized in that: When the user terminal of the industrial Internet of Things generates data information that needs to be transmitted, the federated learning model of the user terminal is used to compress the data to obtain a compressed data packet, including: When the user terminal of the industrial Internet of Things generates data information that needs to be transmitted, the data information to be compressed is extracted; The data information to be compressed is input into the federated learning model, the data is compressed according to the compression rules by the federated learning model, and the compressed data packet is output.
3. According to claim 2, the MQTT-based federated learning communication method for industrial Internet of Things is characterized in that: The compression rules are as follows: Extracting the gradient information corresponding to the data information to be compressed for compression processing; Compressing the data information to be compressed, and performing sparse processing on the gradient information corresponding to the compression process using a single threshold of absolute value on the gradient of a fixed proportion; Use 8-bit unsigned linear quantization to map the gradient to the smallest integer value; The minimum integer value corresponding to the gradient mapping is obtained according to the data information to be compressed to compress the data information to be compressed.
4. A federated learning communication system based on MQTT for industrial Internet of Things, characterized by: The MQTT-based federated learning communication system for industrial Internet of Things includes: A learning model training module is used to train the federated learning model of the user terminal in the industrial Internet of Things scenario using the federated learning demand information and the communication demand information; The data compression module is used to compress the data through the federated learning model of the user terminal when the user terminal of the industrial Internet of Things generates data information that needs to be transmitted, and obtain a compressed data packet; A data sending module is used to send the compressed data packet to the Internet of Things platform corresponding to the industrial Internet of Things using the MQTT protocol; Wherein, the learning model training module includes: Learning requirement information extraction module, used to extract federated learning requirement information in industrial IoT scenarios; A communication requirement information extraction module, used to extract communication requirement information for communication using the MQTT protocol; The training execution module is used to collect local data on the user terminal of the industrial Internet of Things and use the local data to train the learning model corresponding to the federated learning; Wherein, the training execution module includes: A local data acquisition module, used to control the user terminal of the industrial Internet of Things to collect local data corresponding to the user terminal; A sample data set acquisition module is used to clean the local data to obtain the cleaned local data, and use the cleaned local data as sample data to form a sample data set; a target learning model acquisition module, configured to retrieve, from a database of the industrial Internet of Things, a federated learning model corresponding to the federated learning requirement information and the communication requirement information of the user terminal of the industrial Internet of Things, as a target learning model; A target learning model sending module, used to send the target learning model to a corresponding user terminal; A model training execution module, used for the user terminal to train the received target learning model using the sample data set to obtain a trained target learning model; Among them, the process of outlier identification and elimination in the data cleaning process is as follows: Step 1: Assume that there are n data in the data set that need to remove outliers, and the value of the i-th data is V i , i is the data number, which is greater than or equal to 1 and less than or equal to n, then the mean of these n data is: Where Avg is the mean of these n data; Step 2: Based on the calculation results of step 1, calculate the standard deviation of the n data. The calculation formula is: Where Std is the standard deviation of these n data; Step 3: Based on the calculation results of step 1 and step 2, calculate the value of the i-th data as V i The K value is calculated as follows: Where K i The value of the i-th data is V i K value, when K i When K is greater than 3, it indicates that the data is abnormal and should be eliminated. i When it is less than or equal to 3, it indicates that the data is normal and should be retained.
5. The MQTT-based federated learning communication system for industrial Internet of Things according to claim 4 is characterized in that: The data compression module comprises: The module for extracting data information to be compressed is used to extract data information to be compressed when the user terminal of the industrial Internet of Things generates data information that needs to be transmitted; The data packet output module is used to input the data information to be compressed into the federated learning model, perform data compression according to the compression rules through the federated learning model, and output the compressed data packet.
6. The MQTT-based federated learning communication system for industrial Internet of Things according to claim 5 is characterized in that: The compression rules are as follows: Extracting the gradient information corresponding to the data information to be compressed for compression processing; Compressing the data information to be compressed, and performing sparse processing on the gradient information corresponding to the compression process using a single threshold of absolute value on the gradient of a fixed proportion; Use 8-bit unsigned linear quantization to map the gradient to the smallest integer value; The minimum integer value corresponding to the gradient mapping is obtained according to the data information to be compressed to compress the data information to be compressed.
