Federal learning method, system and device based on block chain, medium and product
By conducting federated learning on the blockchain, the parameters and computing resource requirements of the image recognition model are reduced, and the training time and computing performance requirements are solved due to excessive model parameters in the prior art are solved, thereby achieving efficient and flexible image recognition tasks.
Patent Information
- Application Number
- CN202411606095.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-11
- Publication Date
- 2025-03-04
AI Technical Summary
There are too many parameters of the backbone feature extraction network model in the existing image recognition model, which makes training time-consuming and requires high equipment computing performance, making it difficult to implement flexibly.
A federated learning method based on blockchain is proposed. By performing feature extraction of local training samples and calculation of model update parameters on any training participating node on the blockchain, and sending model update parameters to the leading node on the blockchain for aggregation and update, the model parameters and computing resource requirements are reduced.
It realizes efficient image recognition tasks with limited computing resources, reduces the time and computing resource requirements for model training, and improves the flexibility of the model and the usability of multimodal and multi-scenarios.
Smart Images

Figure CN119558383A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to a blockchain-based federated learning method, system, device, medium and product. Background Art
[0002] Image semantic segmentation has a wide range of applications in image recognition. For example, by performing in-image recognition on high-resolution remote sensing images, the spatial distribution and quantitative characteristics of land (such as farmland, water bodies, buildings, etc.) in different regions can be quickly and accurately obtained. In addition to remote sensing images, this technology can also be extended to other image fields, such as medical image recognition, traffic monitoring, environmental detection, etc. With the development of deep learning, fully convolutional neural networks (FCN) have become an important technology in the field of semantic segmentation. FCN uses convolutional layers instead of fully connected layers, so the input of the image does not need to be fixed. With the further development of technology, Deeplabv3 proposed the hollow convolution and spatial pyramid pooling modules, and then Deeplabv3+ merged shallow features with high-level features on the basis of Deeplabv3, thereby improving the accuracy of boundary recognition. At present, the backbone feature extraction network used by Deeplabv3+ is Xception, but in actual applications, due to the excessive number of model parameters of Xception, training is very time-consuming and the application of the model requires high computing performance of the device, making it difficult to implement flexibly.
[0003] The above contents are only used to assist in understanding the technical solution of the present application and do not constitute an admission that the above contents are prior art. Summary of the invention
[0004] The main purpose of this application is to provide a blockchain-based federated learning method, system, device, medium and product, aiming to solve the technical problem that the backbone feature extraction network model in the current existing image recognition model has too many parameters and requires high computing performance of the application equipment.
[0005] To achieve the above objectives, the present application proposes a blockchain-based federated learning method, which is applied to any training participating node on the blockchain. The blockchain-based federated learning method includes the following steps:
[0006] Training a global image recognition model to be trained based on local training samples to obtain model update parameters of the global image recognition model, wherein a preset feature extraction network part in the global image recognition model consists of a first inverted residual block that does not carry a dilation coefficient and a second inverted residual block that carries a dilation coefficient;
[0007] Send the model update parameters to the leader node on the blockchain, wherein, after receiving the model update parameters, the leader node will aggregate and update the global image recognition model in combination with the model update parameters sent by other training participating nodes to obtain a new global image recognition model, and broadcast the new global image recognition model to each training participating node on the blockchain;
[0008] Receive the new global image recognition model sent by the leader node.
[0009] Optionally, the local training samples are local image samples, and the step of training the global image recognition model to be trained based on the local training samples to obtain the model update parameters of the global image recognition model includes:
[0010] By using each first inverted residual block and each second inverted residual block in the preset feature extraction network part, feature extraction is performed on the local image sample to obtain image features;
[0011] Classifying the image features through a preset feature recognition network part in the global image recognition model to obtain an image recognition result of the local image sample;
[0012] Based on the difference between the image recognition result and the label corresponding to the local image sample, a model update parameter of the global image recognition model with respect to the local image sample is calculated.
[0013] Optionally, the blockchain-based federated learning method further includes:
[0014] The sample quantity of the local training samples is determined, and the sample quantity is sent to the leader node, wherein the sample quantity is used to determine the weight coefficient of the model update parameter in the aggregate update.
[0015] In addition, to achieve the above purpose, the present application also proposes a blockchain-based federated learning method, which is applied to the leader node on the blockchain. The blockchain-based federated learning method also includes:
[0016] Receive each model update parameter sent by each training participating node, wherein, for any one of the model update parameters, the model update parameter is obtained by the training participating node that sends the model update parameter, training the global image recognition model to be trained based on the local training sample of the training participating node, wherein the preset feature extraction network part in the global image recognition model is composed of a plurality of inverted residual blocks that do not carry expansion coefficients and a plurality of residual blocks that carry expansion coefficients:
[0017] Based on the update parameters of each model, the global image recognition model is aggregated and updated to obtain a new global image recognition model;
[0018] The new global image recognition model is broadcasted to each training participating node.
[0019] Optionally, the step of performing aggregate update on the global image recognition model based on the model update parameters to obtain a new global image recognition model includes:
[0020] Receive the number of local training samples sent by each training participating node;
[0021] Based on the number of samples of each training participating node, a weighted aggregation update operation is performed on the model update parameters to obtain the new global image recognition model, wherein the more the number of samples the training participating nodes corresponding to the model update parameters have, the higher the weighting coefficient of the model update parameter in the weighted aggregation update operation.
[0022] Optionally, the blockchain-based federated learning method further includes:
[0023] Receive node training condition information sent by each candidate node on the blockchain, wherein the node training condition information includes at least one of node computing power, node local data set, and node model training loss;
[0024] The node score of each candidate node is calculated based on the training condition information of each node. The stronger the node computing power, the larger the node local data set, and the more the node model training loss, the higher the node score;
[0025] The training participating nodes are selected from the candidate nodes according to the scores of the nodes, wherein the higher the node score of the candidate node is, the higher the probability that the candidate node is selected as the training participating node is.
[0026] In addition, to achieve the above-mentioned purpose, the present application also proposes an electronic device, which includes: a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the computer program is configured to implement the steps of the blockchain-based federated learning method as described above.
[0027] In addition, to achieve the above-mentioned purpose, the present application also proposes a storage medium, which is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by the processor, the steps of the blockchain-based federated learning method as described above are implemented.
[0028] In addition, to achieve the above-mentioned purpose, the present application also provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps of the blockchain-based federated learning method as described above.
[0029] One or more technical solutions proposed in this application have at least the following technical effects:
[0030] In an embodiment of the present application, a global image recognition model to be trained is trained based on local training samples to obtain model update parameters of the global image recognition model, wherein the preset feature extraction network part in the global image recognition model is composed of a first inverted residual block that does not carry an expansion coefficient and a second residual block that carries an expansion coefficient; the model update parameters are sent to the leader node on the blockchain, wherein, after receiving the model update parameters, the leader node aggregates and updates the global image recognition model in combination with the model update parameters sent by other training participating nodes to obtain a new global image recognition model, and the new global image recognition model is broadcast to each training participating node on the blockchain; the new global image recognition model sent by the leader node is received. That is, in this embodiment, a framework for federated learning is constructed based on the training participating nodes and the leader node on the blockchain, thereby ensuring the security of the local data of each training participating node. At the same time, in the present embodiment, the preset feature extraction network part in the global image recognition model is composed of a first inverted residual block that does not carry the expansion coefficient and a second residual block that carries the expansion coefficient. Compared with the backbone feature extraction network Xception of Deeplabv3+, it does not use the complex structure of input-intermediate-output stream, nor does it have a fully connected layer. Instead, it only uses the stacking of inverted residual blocks, which reduces model parameters, improves training efficiency, and enables the global image recognition model to achieve efficient image recognition tasks under limited computing resources. It can be flexibly deployed on different terminals to achieve multi-modal and multi-scenario usability. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0032] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0033] Figure 1 This is a flowchart of the first embodiment of the blockchain-based federated learning method of this application;
[0034] Figure 2 This is a flowchart of image preprocessing in the blockchain-based federated learning method of this application;
[0035] Figure 3 This is a schematic diagram of the structure of the preset feature extraction network in the blockchain-based federated learning method of this application;
[0036] Figure 4 This is a schematic diagram of the structure of the first inverted residual block in the blockchain-based federated learning method of this application;
[0037] Figure 5 This is a schematic diagram of the structure of the second inverted residual block in the blockchain-based federated learning method of this application;
[0038] Figure 6 This is a schematic diagram of the structure of the pyramid pooling layer in the blockchain-based federated learning method of this application;
[0039] Figure 7 This is a flowchart of the second embodiment of the blockchain-based federated learning method of this application;
[0040] Figure 8 A schematic diagram of a framework for aggregation of adaptive federated learning training models in a blockchain-based federated learning method of this application;
[0041] Fig. 9 A schematic diagram of screening training participating nodes in the blockchain-based federated learning method of this application;
[0042] Fig.10 This is a schematic diagram of the framework of the blockchain-based federated learning system for this application;
[0043] Fig.11 This is a schematic diagram of the device structure of the hardware operating environment involved in the blockchain-based federated learning method in the embodiment of the present application.
[0044] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0045] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of the present application and are not used to limit the present application.
[0046] In order to better understand the technical solution of the present application, a detailed description will be given below in conjunction with the accompanying drawings and specific implementation methods.
[0047] Image semantic segmentation has a wide range of applications in image recognition. For example, by performing in-image recognition on high-resolution remote sensing images, the spatial distribution and quantitative characteristics of land (such as farmland, water bodies, buildings, etc.) in different regions can be quickly and accurately obtained. In addition to remote sensing images, this technology can also be extended to other image fields, such as medical image recognition, traffic monitoring, environmental detection, etc. With the development of deep learning, fully convolutional neural networks (FCNs) have become an important technology in the field of semantic segmentation. FCN uses convolutional layers instead of fully connected layers, so the input of the image does not need to be fixed. With the further development of technology, Deeplabv3 proposed the dilated convolution and spatial pyramid pooling modules, and then Deeplabv3+ merged shallow features with high-level features on the basis of Deeplabv3, thereby improving the accuracy of boundary recognition. At present, the backbone feature extraction network used by Deeplabv3+ is Xception, but in practical applications, due to the excessive number of model parameters of Xception, training will be very time-consuming, so it is difficult to implement it in practice under limited computing conditions.
[0048] The main solution of the embodiment of the present application is: training the global image recognition model to be trained based on local training samples to obtain the model update parameters of the global image recognition model, wherein the preset feature extraction network part in the global image recognition model is composed of a first inverse residual block that does not carry a dilation coefficient and a second residual block that carries a dilation coefficient; sending the model update parameters to the leader node on the blockchain, wherein after receiving the model update parameters, the leader node will aggregate and update the global image recognition model in combination with the model update parameters sent by other training participating nodes to obtain a new global image recognition model, and broadcast the new global image recognition model to each training participating node on the blockchain; receiving the new global image recognition model sent by the leader node.
[0049] In this embodiment, a framework of federated learning is constructed based on the training participating nodes and the leading nodes on the blockchain, thereby ensuring the security of the local data of each training participating node. At the same time, in this embodiment, the preset feature extraction network part in the global image recognition model is composed of a first inverted residual block that does not carry an expansion coefficient and a second residual block that carries an expansion coefficient. Compared with the main feature extraction network Xception of Deeplabv3+, it does not use a complex structure such as an input-intermediate-output stream, nor a fully connected layer, but only uses the stacking of inverted residual blocks, which reduces model parameters, improves training efficiency, and enables the global image recognition model to achieve efficient image recognition image tasks under limited computing resources, and can be flexibly deployed on different terminals to achieve multi-modal and multi-scenario usability.
[0050] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a cloud platform, a computer, a mobile phone, etc., or an electronic device that can realize the above functions.
[0051] Based on this, the present application embodiment provides a blockchain-based federated learning method, referring to Figure 1 , which is a flow chart of the first embodiment of the blockchain-based federated learning method of this application.
[0052] In this embodiment, the blockchain-based federated learning method is applied to any training participating node on the blockchain and includes steps S10 to S30:
[0053] Step S10, training the global image recognition model to be trained based on the local training samples to obtain the model update parameters of the global image recognition model, wherein the preset feature extraction network part in the global image recognition model is composed of a first inverted residual block that does not carry the expansion coefficient and a second residual block that carries the expansion coefficient;
[0054] It should be noted that in this embodiment, the framework of federated learning is mainly based on blockchain, and the nodes on the blockchain can be the participants in the federated learning. And because of the use of blockchain and federated learning, the privacy security of data can be greatly guaranteed, such as the privacy security of training samples and the privacy security of model parameters. In addition, the above-mentioned blockchain-based federated learning method can be applied to each training participating node on the blockchain. In practical applications, the training participating node can be a terminal device or server on the chain. Correspondingly, different training participating nodes may use different computing resources for model training, and the advantages and disadvantages of computing resources are specifically reflected by some parameters, such as the number of CPU cores, clock frequency, memory bandwidth and capacity, etc., and no specific restrictions are made here. In addition, since the process of applying the above scheme to each training participating node is basically the same, in this embodiment, one of the training participating nodes will be used as an example for explanation, and the implementation process of other training participating nodes can refer to the example of the training participating node.
[0055] Exemplarily, for any training participating node on the blockchain, the training participating node can train the locally stored global image recognition model to be trained based on its local training samples (such as local image training samples). Among them, the global image recognition model can be derived from the leader node, and the leader node is used to integrate the model update parameters uploaded by each training participating node to update the model. And the above-mentioned global image recognition model can be an improved Deeplabv3+ model. Exemplarily, the preset feature extraction network part in the global image recognition model is composed of a first inverted residual block that does not carry an expansion coefficient and a second residual block that carries an expansion coefficient. That is, in this embodiment, the preset feature extraction network composed of the above-mentioned first inverted residual block and the second inverted residual block can be used to replace the Xception part in the original Deeplabv3+ model, thereby constructing an improved Deeplabv3+ model. In a preferred embodiment, the preset feature extraction network part becomes: convolution layer - first inverted residual block (without expansion coefficient) × 7 - second inverted residual block (with expansion coefficient) × 10, and the image output by the last layer of the second inverted residual block will be processed using the hollow space pyramid pooling process to complete the extraction of image features. That is, in the preset feature extraction network part, the input image training sample is first convolved and batch normalized in the convolution layer and activated using the ReLU function, and then 7 inverted residual blocks are used to extract general features, and finally 10 inverted residual blocks with expansion are used to extract features after increasing the receptive field. Compared with the main feature extraction network Xception of Deeplabv3+, the above-mentioned preset feature extraction network in the embodiment of the present application does not use the complex structure of input-intermediate-output flow, nor does it have a fully connected layer, but only uses the stacking of inverted residual blocks. Through the above approach, not only can efficient image recognition image tasks be achieved under limited computing resources, but it can also be flexibly deployed on terminals with different computing capabilities to achieve multi-modal and multi-scenario usability. In addition, the rest of the global image recognition model except the preset feature extraction network part can be identified based on the extracted features to obtain the model recognition result, and then the model recognition result is compared with the label of the above image training sample, and the model loss of the global image recognition model at this time is calculated based on the difference between the two, and then the model gradient is calculated based on the model loss, that is, the above model update parameter. Among them, the algorithm for calculating the model update parameter can be selected by a technician and will not be repeated here.
[0056] Step S20, sending the model update parameters to the leader node on the blockchain, wherein, after receiving the model update parameters, the leader node will aggregate and update the global image recognition model in combination with the model update parameters sent by other training participating nodes to obtain a new global image recognition model, and broadcast the new global image recognition model to each training participating node on the blockchain;
[0057] Exemplarily, after the training participating node calculates the model update parameters of the global image recognition model based on the local training samples, the local global image recognition model may not be updated using the model update parameters, and the model update parameters may be directly sent to the leader node on the blockchain. It should be noted that the leader node on the blockchain may be a node pre-selected in the blockchain. For example, a node may be randomly selected from each training participating node as the leader node. Preferably, the node with the best computing performance on the blockchain may be used as the leader node. After receiving the training participating node, the leader node will aggregate and update the global image recognition model in combination with the model update parameters sent by other training participating nodes. For example, the model update parameters sent by each training participating node may be summed, and then the global update parameters obtained by the sum may be used to update the above global model to obtain a new global image recognition model. The leader node then broadcasts the new global image recognition model to each training participating node on the blockchain.
[0058] Step S30, receiving the new global image recognition model sent by the leading node.
[0059] Exemplarily, after receiving the new global image recognition model sent by the leading node, the training participating nodes can replace the previous global image recognition model and then perform the next round of iterative training until the trained global image recognition model converges.
[0060] In this embodiment, the global image recognition model to be trained is trained based on local training samples to obtain the model update parameters of the global image recognition model, wherein the preset feature extraction network part in the global image recognition model is composed of a first inverted residual block that does not carry an expansion coefficient and a second residual block that carries an expansion coefficient; the model update parameters are sent to the leader node on the blockchain, wherein after receiving the model update parameters, the leader node will aggregate and update the global image recognition model in combination with the model update parameters sent by other training participating nodes to obtain a new global image recognition model, and the new global image recognition model will be broadcast to each training participating node on the blockchain; the new global image recognition model sent by the leader node is received. That is, in this embodiment, a framework of federated learning is constructed based on the training participating nodes and the leader node on the blockchain, thereby ensuring the security of the local data of each training participating node. At the same time, in the present embodiment, the preset feature extraction network part in the global image recognition model is composed of a first inverted residual block that does not carry the expansion coefficient and a second residual block that carries the expansion coefficient. Compared with the backbone feature extraction network Xception of Deeplabv3+, it does not use the complex structure of input-intermediate-output stream, nor does it have a fully connected layer. Instead, it only uses the stacking of inverted residual blocks, which reduces model parameters, improves training efficiency, and enables the global image recognition model to achieve efficient image recognition tasks under limited computing resources. It can be flexibly deployed on different terminals to achieve multi-modal and multi-scenario usability.
[0061] In addition, it is worth noting that the training participating nodes will also perform feature enhancement preprocessing on the local image samples before inputting them into the global image recognition model for training. Figure 2, as shown, taking the local image sample as a remote sensing image as an example, the preprocessing process includes, in sequence, inputting remote sensing images, adaptive scaling, bicubic interpolation, Gaussian blur, color gamut transformation, and obtaining preprocessed images. It is worth noting that the above preprocessing method takes into account previous knowledge and takes adaptive scaling as the first step. The scaling ratio is dynamically determined by the size and resolution of the input image. For high-resolution images, a higher scaling ratio can be used to reduce the amount of calculation; for images with complex content, the scaling ratio can be appropriately reduced to retain more details. Then, the image quality can be improved by using the bicubic interpolation method to enlarge the image again, thereby enhancing the clarity and details of the image. Based on these advantages, random scaling is used as the first step of the serial remote sensing image data enhancement method. In the subsequent steps, the color gamut transformation is placed after the Gaussian blur, which can reduce the noise and high-frequency components in the image and ensure the accuracy of the color gamut transformation. If the color gamut transformation is performed first, the noise and high-frequency components in the image may interfere with the process, affect the image quality, and have an adverse effect on the feature extraction of the object. Such a design helps to optimize the data enhancement process and make it more in line with the needs of image recognition tasks. The specific steps are as follows:
[0062] 1. The input remote sensing image is first adaptively scaled to obtain the scaled image. The calculation formula is as follows:
[0063]
[0064] Where P(x,y) is the interpolated pixel value, I(x,y) is the pixel value in the original image, w(i) and w(j) are the weights of the cubic polynomial, which are usually generated by cubic spline interpolation. This formula shows that in the case of θ times scaling, by interpolating the pixels of the original image, the pixel values of non-integer coordinates in the new image are estimated.
[0065] 2. Use bicubic interpolation to enlarge the scaled remote sensing image again to obtain the processed image. The calculation formula is as follows:
[0066]
[0067] In the formula, P1(x,y) is the interpolated pixel value, I(x,y) is the pixel value in the original image, w(i) and w(j) are the weights of the cubic polynomial, which are usually generated by cubic spline interpolation. This interpolation method is often used in image processing to enlarge images and in scenes such as image transformation. Compared with linear interpolation, bicubic interpolation can better preserve image details and smoothness.
[0068] 3. Use Gaussian blur to obtain the blurred image on the enlarged remote sensing image. The calculation formula is as follows:
[0069]
[0070] Where H(i,j) is the weight of the two-dimensional Gaussian filter at position (i,j) and σ is the standard deviation of the Gaussian distribution. This filter can be applied to each pixel of the image to smooth the image and reduce noise.
[0071] 4. Use color gamut transformation to process the filtered remote sensing image. By performing such linear transformation on the RGB color channels, the color information can be decomposed into two components: brightness and chromaticity, making the image easier to process in different color spaces. The calculation formula is as follows:
[0072]
[0073] Among them, Y, Cb, Cr are the brightness and chrominance components of the color channel, and R, G, B are the values of the original RGB color channel. After the above processing, the preprocessed image is obtained.
[0074] The preprocessed images will be input into the global image recognition model for model training.
[0075] In a feasible implementation manner, the local training samples are local image samples, and the step of training the global image recognition model to be trained based on the local training samples to obtain the model update parameters of the global image recognition model includes steps S11 to S13:
[0076] Step S11, extracting features from the local image sample by using each first inverted residual block and each second inverted residual block in the preset feature extraction network part to obtain image features;
[0077] Step S12, classifying the image features through a preset feature recognition network part in the global image recognition model to obtain an image recognition result of the local image sample;
[0078] Step S13, calculating the model update parameters of the global image recognition model with respect to the local image sample based on the difference between the image recognition result and the label corresponding to the local image sample.
[0079] Exemplarily, in this embodiment, each first inverted residual block and each second inverted residual block in the preset feature extraction network part can be used to extract features of local image samples to obtain image features. In a preferred embodiment, the preset feature extraction network part becomes: convolution layer - first inverted residual block (without expansion coefficient) × 7 - second inverted residual block (with expansion coefficient) × 10, and the image output by the last layer of the second inverted residual block will be processed using the void space pyramid pooling to complete the extraction of image features. In order to clearly understand the image feature extraction process, the following will be combined with Figure 3 The above feature extraction process may include the following steps:
[0080] In convolution layer 1 (convolution kernel 3×3×3×32, step size 2, input 512×512×3), the input local image sample is first convolved with a convolution kernel of size 1×1 to map the low-dimensional features to a high-dimensional space. This is because the deep convolution itself does not have the ability to change the channel and will not associate each channel. Some features cannot be obtained. Therefore, in order to obtain more features, the present invention adds pwise (point-by-point convolution, convolution kernel is 1×1) in front to increase the dimension. Then, a 3×3 depth-separable convolution is used to extract features, and then a 1×1 convolution is used to map the high-dimensional features to a low-dimensional space. This structure is also called a bottleneck layer. In the final 1×1 convolution part, the mapping part no longer uses the ReLu activation function but a linear activation function.
[0081] In the A inverted residual block unit, except for the inverted residual block 2, a constant dimensionality increase ratio is used in the entire LW-HPN network (Lightweight HollowPixel Network, lightweight hole pixel network model, preset feature extraction network). This is because the performance is almost the same when the expansion factor is between 5 and 10 times. Larger networks show better performance when the expansion factor is larger, while slightly smaller expansion factors perform better under smaller networks. The number of ×n representations after the inverted residual block in the figure is n, which will be passed through Figure 3 In the figure, the local image samples processed by the inverted residual block unit A are input into the inverted residual block unit B, as shown in Figure 4 (a schematic diagram of the structure of a first inverted residual block in an inverted residual block unit A) and Figure 5 As shown in (a structural diagram of a second inverted residual block in a B inverted residual block unit), the difference between the first inverted residual block and the second inverted residual block unit is that the dilated convolution with a dilation coefficient (i.e., dilation in the figure) of d is used in the separable convolution in the second inverted residual block (i.e., Dwise is a separable convolution, and Conv is a convolution), which can help the backbone network obtain more receptive fields without increasing other network parameters. The features in remote sensing images often show clustered features and have larger granularity, so a larger receptive field is also necessary. Figure 3 As shown, the number of channels used by the LW-HPN network proposed in this application is relatively small. This is because in some image recognition tasks with simple features and few types, such as image recognition, features with too many dimensions are not required. If convolution kernels with too many dimensions are used, overfitting will occur, resulting in reduced accuracy.
[0082] Reference Figure 6, Atrous Spatial Pyramid Pooling (ASPP) structure diagram, here the expansion coefficient of 2 is used in 1×1 convolution, and the adaptive expansion coefficient is used in 3×3 convolution. This is mainly because different tasks require different sizes of receptive fields. The calculation formula is as follows:
[0083] d_l=d_b+(l-1)*d_r_i
[0084] Among them, d_l is the expansion coefficient of the lth layer (l starts counting from 1), d_b represents the basic expansion coefficient of the shallowest layer of the network (or the first convolutional layer), and d_r_i represents the expansion coefficient growth rate (determines how the expansion coefficient grows as the network depth increases). Using the receptive field of the adaptive scene in the enhanced feature extraction stage is conducive to the network extracting larger scale and more contextual features. Then continue to output the final image classification result through the remaining network part except Xception in deeplabv3+ (that is, the preset feature recognition network part in the above global image recognition model), that is, the image recognition result of the above local image sample. Then substitute the image recognition result and the corresponding label of the local image sample into the pre-set loss function (in the loss function, the difference between the image recognition result and the corresponding label of the local image sample is represented) to calculate the model loss, and then calculate the gradient according to the model loss, for example, the back propagation update algorithm. Thus, the model update parameters of the global image recognition model with respect to the above local image are obtained.
[0085] In a feasible implementation, the blockchain-based federated learning method further includes step S21:
[0086] Step S21, determining the sample quantity of local training samples, and sending the sample quantity to the leader node, wherein the sample quantity is used to determine the weight coefficient of the model update parameter in the aggregate update.
[0087] Exemplarily, in this embodiment, in addition to sending the obtained model update parameters to the leading node, the training participating nodes can also count the number of local training samples used by the local node and send the number of samples to the leading node, so that the leading node can determine the weighting coefficient of the model update parameters of the training participating nodes in the aggregation update process according to the number of samples and perform weighted aggregation update.
[0088] Reference Figure 7, is a flowchart of a second embodiment proposed based on the first embodiment of the blockchain-based federated learning method of the present application. For the same or similar contents as the above embodiments in this embodiment, please refer to the above introduction and will not be repeated later. Applied to the leader node on the blockchain, the blockchain-based federated learning method also includes steps S100 to S300:
[0089] Step S100, receiving each model update parameter sent by each training participating node, wherein, for any one of the model update parameters, the model update parameter is obtained by the training participating node that sends the model update parameter, training the global image recognition model to be trained based on the local training sample of the training participating node, wherein the preset feature extraction network part in the global image recognition model is composed of a plurality of inverted residual blocks that do not carry expansion coefficients and a plurality of residual blocks that carry expansion coefficients;
[0090] Step S200, based on the update parameters of each model, the global image recognition model is aggregated and updated to obtain a new global image recognition model;
[0091] Step S300: broadcast the new global image recognition model to each training participating node.
[0092] It should be noted that, in this embodiment, the above-mentioned blockchain-based federated learning method is applied to the leading node, wherein the leading node can be a central node on the blockchain specifically used for federated learning aggregation, or it can be one of the training participating nodes.
[0093] Exemplarily, the leading node can receive each model update parameter sent by each training participating node, and the model update parameters are obtained by the training participating node that sends the model update parameters, based on the local training samples of the training participating node, to train the global image recognition model to be trained, wherein the preset feature extraction network part in the global image recognition model is composed of a plurality of inverted residual blocks that do not carry expansion coefficients and a plurality of residual blocks that carry expansion coefficients, and the details can be referred to the first embodiment above. In addition, it is worth noting that since the number of each training participating node will be large in actual applications, in order to assist the leading node in receiving the pressure of each model update parameter, several training participating nodes can be selected as worker nodes, and each training participating node first sends the model update parameters to the worker node, and then the worker node forwards the received update parameters to the leading node, thereby alleviating the receiving pressure of the leading node.
[0094] After receiving the update parameters of each model, the leader node aggregates and updates the global image recognition model. For example, the leader node can obtain the global model update parameters based on the sum of the update parameters of each model, and multiply the global model update parameters with the preset learning rate to obtain the learning parameters, and then accumulate the above learning parameters on the basis of the existing model parameters of the global image recognition model, thereby completing the model update and obtaining a new global image recognition model. Finally, the leader node broadcasts each new global image recognition model to each training participating node, thereby completing an iterative update.
[0095] It is understandable that in this embodiment, a framework of federated learning is constructed based on the training participating nodes and the leading nodes on the blockchain, thereby ensuring the security of the local data of each training participating node. At the same time, in this embodiment, the preset feature extraction network part in the global image recognition model is composed of a first inverted residual block that does not carry an expansion coefficient and a second residual block that carries an expansion coefficient. Compared with the main feature extraction network Xception of Deeplabv3+, it does not use a complex structure such as an input-intermediate-output stream, nor a fully connected layer, but only uses the stacking of inverted residual blocks, which reduces model parameters, improves training efficiency, and enables the global image recognition model to achieve efficient image recognition image tasks under limited computing resources, and can be flexibly deployed on different terminals to achieve multi-modal and multi-scenario usability.
[0096] In a feasible implementation manner, the step of performing aggregate update on the global image recognition model based on the model update parameters to obtain a new global image recognition model includes steps S210 to S220:
[0097] Step S210, receiving the sample quantity of local training samples sent by each training participating node;
[0098] Step S220, based on the number of samples of each training participating node, a weighted aggregation update operation is performed on the model update parameters to obtain the new global image recognition model, wherein the more the number of samples the training participating nodes corresponding to the model update parameters have, the higher the weighting coefficient of the model update parameter in the weighted aggregation update operation.
[0099] Exemplarily, in addition to receiving each model update parameter sent by each training participating node, the leading node will also receive the sample number of local training samples sent by each training participating node. The leading node then performs a weighted aggregation update operation on each model update parameter according to the sample number of each training participating node to obtain the new global image recognition model. Among them, when summing each model update parameter in the weighted aggregation update operation, each model update parameter will be multiplied by the corresponding weight coefficient, that is, the global model update parameter is obtained by weighted summation, and then updated based on the global model update parameter, and the specific parameters can be as mentioned above. It is worth noting that the more the number of local samples owned by the training participating node corresponding to the model update parameter, the higher the weight coefficient of the model update parameter in the weighted aggregation update operation, that is, under normal circumstances, the more the sample number of the training sample, the more correct the model update parameter calculated by the corresponding training participating node, so a higher weight coefficient is set for it to ensure the accuracy of the new global image recognition model obtained by the aggregation update.
[0100] like Figure 8 As shown, in order to improve the model training performance, this proposal proposes an improved adaptive federated learning training model aggregation method Improved Adaptive Federated Aggregation, referred to as IAFA, which takes into account the image data conditions processed by each training participating node and the training model status. IAFA is adaptive based on the model training loss and local data set size (i.e. the number of samples mentioned above) uploaded by each participating node. After receiving the model update from each training participating node, the leader node calculates the loss calculated after the model update and the size of the local image data set in the participating node to score. After the score is calculated, the leader node uses the weighted average of the scores of each trainer participating node to update the global model to obtain a new global image recognition model. The calculation formula is as follows:
[0101]
[0102] In the formula, θ (t+1) represents the t+1th round update after global model aggregation, θ (t) represents the global model of the tth round, η represents the learning rate, Update the training loss of the local model and the data size of the local image dataset for the kth participating node. Update the model of the kth participating node in the tth round. The specific steps are as follows:
[0103] First, input the global model θ of the tth round (t) For each participating node, the model ρ is first trained locally using the local image dataset k (t) ;
[0104] For each participant node, a model update needs to be sent to the worker node.
[0105] The leader node calculates the score for each participating node k based on the training loss of the model update uploaded by the worker node and the local dataset size of the participating node. (also known as node score).
[0106] The leader node updates the global model according to the above calculation formula and obtains the updated aggregated model θ (t+1) ;
[0107] In addition, in order to further improve the accuracy of the model, you can continue to use the publicly available image dataset for fine-tuning (since the publicly available image dataset does not need to be kept confidential, you do not need to use federated learning for training).
[0108] IAFA can make the server fit the conditions of each participating node, and can assign appropriate weights to each participating node, reducing the weight of models with lower training effects. By considering the loss of model updates uploaded by participating nodes and the size of the participants' local image datasets, the performance and accuracy of the model in the federated learning process can be improved.
[0109] In a feasible implementation, the blockchain-based federated learning method further includes steps S110 to S130:
[0110] Step S110, receiving node training condition information sent by each candidate node on the blockchain, wherein the node training condition information includes at least one of node computing power, node local data set, and node model training loss;
[0111] Step S120, calculating the node score of each candidate node according to the training condition information of each node, wherein the stronger the node computing capability, the larger the node local data set, and the more the node model training loss, the higher the node score;
[0112] Step S130 , selecting the training participating nodes from the candidate nodes according to the node scores, wherein the higher the node score of the candidate node is, the higher the probability that the candidate node is selected as the training participating node is.
[0113] It should be noted that with the development of blockchain technology, its decentralization, transparency and immutability provide new solutions for distributed learning. In the model training of distributed federated learning, since there are many nodes on the blockchain that can participate in the training, and there may be differences in performance and data volume between the nodes, in order to ensure that the nodes participating in the training have good training conditions so that the model training can be better completed, the nodes participating in the training are screened in this embodiment.
[0114] Exemplarily, each candidate node that wants to participate in training on the blockchain can send its own training condition information to the leading node. After the leading node receives the node training condition information sent by each candidate node on the blockchain, it calculates the node score of the corresponding training node according to the node training condition information. Exemplarily, the node training condition information includes node computing power, node local data set or node model training loss, etc., and in a preferred method. The leading node can calculate the index scores of each indicator such as node computing power, node local data set and node model training loss respectively, and then perform weighted summation of each index score to obtain the final node score. Finally, the leading node selects each training participating node from each candidate node according to the node score, and the higher the node score of the candidate node, the higher the probability of being selected as a training participating node. It should be noted that the specific score calculation rules and the method of selecting training participating nodes can be set by technical personnel according to the above rules, which will not be repeated here.
[0115] In addition, it is worth noting that in the present application, the above-mentioned step of screening each training participating node can be performed once in each round of iteration, so that each node participating in federated learning is a valid node, thereby solving the single point failure problem that may occur in existing federated learning schemes (i.e., some order nodes fail and cannot participate in training).
[0116] Reference Fig. 9 , is a flow chart of selecting training participating nodes in this application, such as Fig. 9 The process shown includes:
[0117] Node application: Each node submits an application to participate in this training iteration to the blockchain network based on its own computing resources, data volume, network conditions, etc., i.e. the above-mentioned node training condition information. The application information includes the node's computing power, local data set size, model training loss, etc.
[0118] Score calculation, after the leader node in the blockchain network collects the application information of all participating nodes, it calculates the score of each node according to the IAFA algorithm, that is, the above-mentioned node score. The score is weighted based on two factors: the node's model training loss and the size of the local data set, ensuring that nodes with sufficient computing resources and high data quality can obtain higher scores.
[0119] Consensus election: The leader node broadcasts the calculated node score to other nodes in the blockchain network. Based on the received score information, each node selects a certain number of high-scoring nodes through IAFA as participating nodes for this training iteration. The election results will be recorded on the blockchain to ensure fairness and immutability.
[0120] Model training and aggregation: The elected participating nodes (i.e. the training participating nodes mentioned above) perform model training based on the local data set and upload the training results (such as model weight updates) to the blockchain. The leader node performs weighted aggregation on the uploaded training results according to the IAFA algorithm to generate a global model update. The global model update will be broadcast to other nodes in the blockchain network so that all nodes can synchronously update the local model, which is the synchronous update process. At this point, a round of model iteration is completed.
[0121] This method can ensure that the election process of participating nodes is fair and transparent, and prevent malicious nodes from obtaining improper benefits through cheating. At the same time, the IAFA algorithm can make adaptive adjustments based on the actual performance and data quality of the nodes to ensure the efficiency and accuracy of model training.
[0122] The present application also provides a blockchain-based federated learning system, which includes:
[0123] The training participating node 10 is used to train the global image recognition model to be trained based on the local training samples to obtain the model update parameters of the global image recognition model, wherein the preset feature extraction network part in the global image recognition model is composed of a first inverted residual block that does not carry the expansion coefficient and a second residual block that carries the expansion coefficient; send the model update parameters to the leader node on the blockchain; receive the new global image recognition model sent by the leader node;
[0124] The leader node 20 is used to receive the model update parameters sent by each training participating node; based on the model update parameters, the global image recognition model is aggregated and updated to obtain a new global image recognition model; and the new global image recognition model is broadcast to each training participating node.
[0125] Optionally, the local training sample is a local image sample, and the training participating node 10 is further used for:
[0126] By using each first inverted residual block and each second inverted residual block in the preset feature extraction network part, feature extraction is performed on the local image sample to obtain image features;
[0127] Classifying the image features through a preset feature recognition network part in the global image recognition model to obtain an image recognition result of the local image sample;
[0128] Based on the difference between the image recognition result and the label corresponding to the local image sample, a model update parameter of the global image recognition model with respect to the local image sample is calculated.
[0129] Optionally, the training participating node 10 is further used for:
[0130] The sample quantity of the local training samples is determined, and the sample quantity is sent to the leader node, wherein the sample quantity is used to determine the weight coefficient of the model update parameter in the aggregate update.
[0131] Optionally, the leader node 20 is further configured to:
[0132] Receive the number of local training samples sent by each training participating node;
[0133] Based on the number of samples of each training participating node, a weighted aggregation update operation is performed on the model update parameters to obtain the new global image recognition model, wherein the more the number of samples the training participating nodes corresponding to the model update parameters have, the higher the weighting coefficient of the model update parameter in the weighted aggregation update operation.
[0134] Optionally, the leader node 20 is further configured to:
[0135] Receive node training condition information sent by each candidate node on the blockchain, wherein the node training condition information includes at least one of node computing power, node local data set, and node model training loss;
[0136] The node score of each candidate node is calculated based on the training condition information of each node. The stronger the node computing power, the larger the node local data set, and the more the node model training loss, the higher the node score;
[0137] The training participating nodes are selected from the candidate nodes according to the node scores, wherein the higher the node score of the candidate node is, the higher the probability that the candidate node is selected as the training participating node is.
[0138] The blockchain-based federated learning system provided by the present application adopts the scheduling method of the optical fiber communication system in the above embodiment, which can solve the technical problem that the backbone feature extraction network model in the current existing image recognition model has too many parameters and requires high computing performance of the application equipment. Compared with the prior art, the beneficial effects of the blockchain-based federated learning system provided by the present application are the same as the beneficial effects of the scheduling method of the optical fiber communication system provided by the above embodiment, and the other technical features of the blockchain-based federated learning system are the same as the features disclosed in the above embodiment method, which will not be repeated here.
[0139] The present application provides an electronic device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the blockchain-based federated learning method in the above-mentioned embodiment 1.
[0140] Reference below Fig.11 , which shows a schematic diagram of the structure of an electronic device suitable for implementing the embodiment of the present application. The electronic device in the embodiment of the present application may include but is not limited to mobile terminals such as computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Descriptions), PMPs (Portable Media Players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), and fixed terminals such as computers. Fig.11 The electronic device shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0141] like Fig.11 As shown, the electronic device may include a processing device 1001 (e.g., a central processing unit, a graphics processor, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM: Read Only Memory) 1002 or a program loaded from a storage device 1003 to a random access memory (RAM: Random Access Memory) 1004. In RAM1004, various programs and data required for the operation of the electronic device are also stored. The processing device 1001, ROM1002, and RAM1004 are connected to each other through a bus 1005. An input / output (I / O) interface 1006 is also connected to the bus. Generally, the following systems can be connected to the I / O interface 1006: an input device 1007 including, for example, a touch screen, a touch pad, a keyboard, a mouse, an image sensor, a microphone, an accelerometer, a gyroscope, etc.; an output device 1008 including, for example, a liquid crystal display (LCD: Liquid Crystal Display), a speaker, a vibrator, etc.; a storage device 1003 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 can allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. Although the figure shows an electronic device with various systems, it should be understood that it is not required to implement or have all the systems shown. More or fewer systems can be implemented or have alternatively.
[0142] In particular, according to the embodiments disclosed in the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present application include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device 1003, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment disclosed in the present application are executed.
[0143] The electronic device provided by this application adopts the blockchain-based federated learning method in the above embodiment, which can solve the technical problem that the backbone feature extraction network model in the current existing image recognition model has too many parameters and requires high computing performance of the application device. Compared with the prior art, the beneficial effects of the electronic device provided by this application are the same as the beneficial effects of the blockchain-based federated learning method provided in the above embodiment, and the other technical features in the electronic device are the same as the features disclosed in the previous embodiment method, which will not be repeated here.
[0144] It should be understood that the various parts disclosed in this application can be implemented by hardware, software, firmware or a combination thereof. In the description of the above embodiments, specific features, structures, materials or characteristics can be combined in any one or more embodiments or examples in a suitable manner.
[0145] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0146] The present application provides a computer-readable storage medium having computer-readable program instructions (i.e., computer programs) stored thereon, and the computer-readable program instructions are used to execute the blockchain-based federated learning method in the above-mentioned embodiment.
[0147] The computer-readable storage medium provided in the present application may be, for example, a USB flash drive, but is not limited to electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems, systems or devices, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, system or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination of the above.
[0148] The computer-readable storage medium may be included in the electronic device, or may exist independently without being installed in the electronic device.
[0149] The computer-readable storage medium carries one or more programs. When the one or more programs are executed by an electronic device, the electronic device:
[0150] The global image recognition model to be trained is trained based on local training samples to obtain model update parameters of the global image recognition model, wherein the preset feature extraction network part in the global image recognition model is composed of a first inverse residual block that does not carry a dilation coefficient and a second residual block that carries a dilation coefficient; the model update parameters are sent to a leader node on the blockchain, wherein after receiving the model update parameters, the leader node will aggregate and update the global image recognition model in combination with the model update parameters sent by other training participating nodes to obtain a new global image recognition model, and the new global image recognition model will be broadcast to each training participating node on the blockchain; the new global image recognition model sent by the leader node is received.
[0151] Computer program code for performing the operations of the present application may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0152] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0153] The modules involved in the embodiments described in this application may be implemented by software or hardware, wherein the name of the module does not constitute a limitation on the unit itself in some cases.
[0154] The readable storage medium provided in this application is a computer-readable storage medium, which stores computer-readable program instructions (i.e., computer programs) for executing the above-mentioned blockchain-based federated learning method, which can solve the technical problem that the backbone feature extraction network model in the existing image recognition model has too many parameters and requires high computing performance of the application equipment. Compared with the prior art, the beneficial effects of the computer-readable storage medium provided in this application are the same as the beneficial effects of the blockchain-based federated learning method provided in the above-mentioned embodiment, which will not be repeated here.
[0155] The present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the above-mentioned blockchain-based federated learning method.
[0156] The computer program product provided in this application can solve the technical problems of blockchain-based federated learning. Compared with the prior art, the beneficial effects of the computer program product provided in this application are the same as the beneficial effects of the blockchain-based federated learning method provided in the above embodiment, which will not be repeated here.
[0157] The above descriptions are only some embodiments of the present application, and are not intended to limit the patent scope of the present application. All equivalent structural changes made using the contents of the present application specification and drawings under the technical concept of the present application, or direct / indirect application in other related technical fields are included in the patent protection scope of the present application.
Claims
1. A blockchain-based federated learning method, characterized in that: Applied to any training participating node on the blockchain, the blockchain-based federated learning method includes the following steps: Training a global image recognition model to be trained based on local training samples to obtain model update parameters of the global image recognition model, wherein a preset feature extraction network part in the global image recognition model consists of a first inverted residual block that does not carry a dilation coefficient and a second inverted residual block that carries a dilation coefficient; Send the model update parameters to the leader node on the blockchain, wherein, after receiving the model update parameters, the leader node will aggregate and update the global image recognition model in combination with the model update parameters sent by other training participating nodes to obtain a new global image recognition model, and broadcast the new global image recognition model to each training participating node on the blockchain; Receive the new global image recognition model sent by the leader node.
2. The blockchain-based federated learning method according to claim 1, characterized in that: The local training samples are local image samples, and the step of training the global image recognition model to be trained based on the local training samples to obtain the model update parameters of the global image recognition model includes: By using each first inverted residual block and each second inverted residual block in the preset feature extraction network part, feature extraction is performed on the local image sample to obtain image features; Classifying the image features through a preset feature recognition network part in the global image recognition model to obtain an image recognition result of the local image sample; Based on the difference between the image recognition result and the label corresponding to the local image sample, a model update parameter of the global image recognition model with respect to the local image sample is calculated.
3. The blockchain-based federated learning method according to claim 1, characterized in that: The blockchain-based federated learning method further includes: The sample quantity of the local training samples is determined, and the sample quantity is sent to the leader node, wherein the sample quantity is used to determine the weight coefficient of the model update parameter in the aggregate update.
4. A blockchain-based federated learning method, characterized in that: Applied to the leader node on the blockchain, the blockchain-based federated learning method further includes: Receive each model update parameter sent by each training participating node, wherein, for any one of the model update parameters, the model update parameter is obtained by the training participating node that sends the model update parameter, training the global image recognition model to be trained based on the local training sample of the training participating node, wherein the preset feature extraction network part in the global image recognition model is composed of a plurality of inverted residual blocks that do not carry expansion coefficients and a plurality of residual blocks that carry expansion coefficients: Based on the update parameters of each model, the global image recognition model is aggregated and updated to obtain a new global image recognition model; The new global image recognition model is broadcasted to each training participating node.
5. The blockchain-based federated learning method according to claim 4, characterized in that: The step of performing aggregate update on the global image recognition model based on the model update parameters to obtain a new global image recognition model comprises: Receive the number of local training samples sent by each training participating node; Based on the number of samples of each training participating node, a weighted aggregation update operation is performed on the model update parameters to obtain the new global image recognition model, wherein the more the number of samples the training participating nodes corresponding to the model update parameters have, the higher the weighting coefficient of the model update parameter in the weighted aggregation update operation.
6. The blockchain-based federated learning method according to claim 4, characterized in that: The blockchain-based federated learning method further includes: Receive node training condition information sent by each candidate node on the blockchain, wherein the node training condition information includes at least one of node computing power, node local data set, and node model training loss; The node score of each candidate node is calculated based on the training condition information of each node. The stronger the node computing power, the larger the node local data set, and the more the node model training loss, the higher the node score; The training participating nodes are selected from the candidate nodes according to the scores of the nodes, wherein the higher the node score of the candidate node is, the higher the probability that the candidate node is selected as the training participating node is.
7. A blockchain-based federated learning system, characterized in that: The blockchain-based federated learning system includes: A training participating node is used to train a global image recognition model to be trained based on local training samples to obtain model update parameters of the global image recognition model, wherein a preset feature extraction network part in the global image recognition model is composed of a first inverted residual block that does not carry an expansion coefficient and a second residual block that carries an expansion coefficient; send the model update parameters to a leader node on the blockchain; and receive the new global image recognition model sent by the leader node; The leading node is used to receive the model update parameters sent by each training participating node; based on the model update parameters, the global image recognition model is aggregated and updated to obtain a new global image recognition model; and the new global image recognition model is broadcast to each training participating node.
8. An electronic device, characterized in that: The device comprises: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program is configured to implement the steps of blockchain-based federated learning as described in any one of claims 1 to 6.
9. A storage medium, characterized in that: The storage medium is a computer-readable storage medium, and a computer program is stored on the storage medium. When the computer program is executed by a processor, the steps of blockchain-based federated learning are implemented as described in any one of claims 1 to 6.
10. A computer program product, characterized in that The computer program product comprises a computer program, which, when executed by a processor, implements the steps of blockchain-based federated learning as described in any one of claims 1 to 6.