Service-driven consensus method and visual model intelligent training method
Through blockchain technology and federated learning, combined with service-driven consensus method and visual model intelligent training, the problem of low recognition rate of smart bracelets and webcams in the existing technology is solved, and more efficient care management and emergency monitoring are achieved. , ensuring data privacy and security.
Patent Information
- Application Number
- CN202410927034.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2024-03-28
- Filing Date
- 2024-07-11
- Publication Date
- 2024-11-12
AI Technical Summary
The prior art is difficult to effectively monitor and identify the emergency situations of elderly people living alone or hospitalized patients in special circumstances. The monitoring function of smart bracelets is limited, the recognition rate of webcam is poor and the generalization ability is insufficient, so it is impossible to understand the status of the observer in a timely manner.
Through the integration of blockchain technology, computer vision and federated learning, a service-driven consensus method and visual model intelligent training method are adopted to improve the sharing of services and needs among nodes, enhance the level of care management, use federated learning to conduct intelligent training, and improve the model recognition rate and generalization ability.
It realizes more efficient care management, improves the sharing of services and needs among nodes, ensures the privacy and security of private data, enhances the recognition rate and generalization capabilities of visual models, and can promptly understand and respond to emergency situations.
Smart Images

Figure CN118940027A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of blockchain, and specifically relates to a service-driven consensus method and a visual model intelligent training method. Background Art
[0002] Elderly people living alone or hospitalized patients have no caregivers to look after them, which makes their lives inconvenient. When they encounter special situations such as falls or fires, they are very likely to fall into crisis due to lack of timely help, or even die due to untimely rescue, causing property losses and personal safety injuries. In order to solve this problem, domestic and foreign researchers and enterprises have developed a variety of products, which can be mainly summarized into the following two types: ① Developing equipment such as smart bracelets to monitor the user's heartbeat and other indicators, judge the user's status, and trigger emergency measures when the user's indicators are abnormal; ② Developing network cameras, users can watch real-time videos remotely, and can also communicate through the audio chip built into the device to understand the status of the person being observed; ③ Developing intelligent recognition cameras that can help users automatically identify the status of the person being observed and the abnormality of the environment in real time. However, for the first type of product, the monitoring function of the smart bracelet is limited, and it is difficult to infer the user's specific abnormal behavior, environment and need for help based on parameters such as heart rate and blood oxygen; for the second type of product, the user can only watch the camera video remotely when he is free, and cannot understand the status of the observed person in time; for the third type of product, although the camera can replace manual monitoring of the observed person's status, the recognition rate is relatively poor and the generalization ability needs to be improved.
[0003] The recognition rate of the recognition model carried by the camera can be improved by optimizing the algorithm or increasing the quantity, diversity and professionalism of the training data. Therefore, various nursing devices including network cameras and other entities that purchase or provide services can be regarded as nodes. Through the technical integration of blockchain, computer vision and federated learning, the sharing of services and needs between different nodes can be realized, thus improving the level of nursing management. Summary of the invention
[0004] In order to better realize the sharing of services and needs between different nodes and improve the level of care management, the present invention provides a service-driven consensus method and a visual intelligence training method. In the consensus method of the present invention, users can publish or provide services to the system through their nodes to fine-tune the probability of each node becoming a consensus node; and on the basis of the service-driven consensus method, federated learning is used for intelligent training to improve the level of care management and the performance of the local model of the node.
[0005] The present invention is implemented by the following technical solutions: A service-driven consensus method, each node supporting service activities constitutes a blockchain system, and the consensus process includes:
[0006] Assign a node number to each node and initialize data;
[0007] Each node votes for each other. In addition to the nodes that receive votes and the number of votes, the voting information must also carry a trust factor.
[0008] Calculate the number of votes of all nodes from the voting information, and select the nodes with the highest number of votes as trusted nodes; at the same time, for each trusted node, the trusted factors carried in all the voting information that voted for the trusted node form a trusted factor sequence;
[0009] Remove nodes that have not voted and nodes that violate regulations from all nodes to form a valid node sequence; according to the weight of the nodes in the valid node sequence, expand the number of times each node appears in the valid node sequence to construct a candidate node sequence; select a trusted factor from the trusted factor sequence of each trusted node and perform calculations, and the obtained value is used as the random seed of the random number generator. The candidate node sequence is the range of the random number generator selection value, and a random number is generated using the random number generator. The random number is the node number of the consensus node; the process of cyclically calculating the random seed and using the random number generator to generate a random number is used to select multiple consensus nodes to poll for blocks until the time for this consensus node selection ends;
[0010] Trusted nodes verify the selected consensus nodes, and the verified consensus nodes produce blocks and upload them to the chain.
[0011] Further preferably, the data initialization is: for the node that runs the blockchain system for the first time, after the node number is assigned, its weight is set to 10, and the weight deduction number and service weight are set to 0; for the node that does not run the blockchain system for the first time, the node information in the blockchain system is loaded.
[0012] Further preferably, the process of constructing the candidate node sequence is:
[0013] Use P1, P2, ..., P n Respectively represent the 1st, 2nd, ..., nth valid nodes, d1, d2, ..., d n They represent the node numbers corresponding to the 1st, 2nd, …, nth valid nodes respectively. The valid node sequence is represented by C. For the i-th valid node P i , where the weight is w i , the service weight is tw i , the transfer expansion factor preset by the blockchain system is α, and the service impact factor preset is β. Then, the i-th valid node P in the valid node sequence i The number of repetitions is:
[0014]
[0015] Repeating sequence X = [x1, x2, ..., x n],x1,x2,…,x n are the repetition times of the 1st, 2nd, …, nth valid nodes in the valid node sequence respectively. Therefore, the sequence obtained after expanding each node in the valid node sequence according to the repetition number sequence X is the candidate node sequence.
[0016] Further preferably, a trusted factor is selected from the trusted factor sequence of each trusted node and operated, and the obtained value is used as a random seed of the random number generator. The specific process is:
[0017] First, k credible factors are extracted from the credible factor sequence of each credible node by linear transformation and then taking the modulus of the credible factor sequence length:
[0018] c and d are two preset hyperparameters for linear transformation. The length of the i-th trusted node sequence is l i , when making the jth consensus node selection, select a trust factor y from the i-th trusted node sequence i :
[0019] Then, the k trusted factors taken out form a trusted factor sequence Y = [y1, y2, ..., y k ],y1,y2,…,y k are the 1st, 2nd, …, kth credible factors respectively;
[0020] Next, we get the jth random seed s j The calculation method is:
[0021] s j =y1⊕y2⊕…⊕y k .
[0022] Further optimization is to use an equal probability random number generator when selecting a consensus node, with a random seed s j Select a node number from the candidate node sequence as the consensus node.
[0023] Further preferably, the method of assigning a node number to each node and initializing data is as follows: for a node without a node number, a node number needs to be assigned to it and the data of the node is initialized; for a node with a node number, it is initialized by loading the data of an existing node.
[0024] Further optimization, the service provider can publish the service demand information, completion time, service provider selection criteria and deduct the corresponding amount of weight according to its own needs. At this time, the weight of the service should be deducted from the weight in the service provider node, and the weight of the service provider obtained after deduction should be guaranteed to be not less than 0; the nodes of the entire network receive the demand published by the node and compete, and after receiving a number of candidate service providers within a period of time, the best service provider is selected to complete the service according to the service provider selection criteria. If the best service provider fails to complete the service within a period of time, the second best service provider is selected to complete the service until a service provider completes it or no service provider completes it. For services that are not completed by a service provider or the service provider is not satisfied with the service provided by the service provider, the data involved in the service is directly discarded; for services that the service provider is satisfied with the service provided by the service provider, the deducted weight is included in the service weight of the service provider. If the service provider is dissatisfied with the satisfaction score of the service provider, it can be submitted to arbitration for the trusted node to judge. If more than two-thirds of the trusted nodes agree with the view, it can pass the review.
[0025] Further preferably, the service is a data labeling service, the service demander provides his own picture or video data, and the service provider labels the data according to the data labeling method.
[0026] Further preferably, the trust factor is an arbitrary positive integer, which is completely determined by the voting nodes themselves; the weight and service weight are only used to generate the number of repetitions of each node in the valid node sequence to change the probability of each node being selected as a consensus node, and have no other effect; in addition, the consensus node is responsible for packaging and publishing data, and has the opportunity to download the latest visual model training results for several consecutive times; the trusted node is used to determine the consensus node, the violation node, the service arbitration, and as a server node for intelligent training, and has the opportunity to download the latest visual model training results within the trusted term.
[0027] The present invention also provides a visual model intelligent training method based on a service-driven consensus mechanism, characterized in that the steps are:
[0028] Step S1: Set system hyperparameters in the node configuration file, including the service weight M and timer T of the data annotation that triggers intelligent training. C and the number of fine-tuning times of each node P;
[0029] Step S2: When the node identification is running, the timer T has expired. C If the timing time is reached, the timer task is triggered and step S3 is executed; otherwise, the waiting time continues;
[0030] Step S3, timer T C Reset time to 0, timer TC Re-timing; timer T C The task starts by calculating the total service weight N generated by data annotation from the last intelligent training to the current time;
[0031] Step S4: If N is greater than or equal to M, proceed to step S5; otherwise, return to step S2;
[0032] Step S5: turn off the timer T C , so as to avoid the situation that the total service weight generated by data annotation meets the requirements before the intelligent training of the visual model is completed and the training phase needs to be entered again, resulting in resource competition and an endless loop; the trusted nodes selected by the consensus node according to the service-driven consensus method randomly select a trusted node as the server, and the other consensus nodes as clients;
[0033] Step S6: For the nodes with data annotation in the remote care system and the server selected in step S5, a global model is trained using federated learning;
[0034] Step S7: The client that obtains downloading qualifications downloads the global model, and performs P times of fine-tuning based on the global model and local data to obtain a local model.
[0035] Step S8: Replace the global model in the client that is eligible for downloading with the latest fine-tuned local model or the global model trained by federated learning; start the timer T C Continue timing; this training session is over.
[0036] The consensus method of the present invention allows users to publish or provide services to the system through their nodes, thereby fine-tuning the probability of each node becoming a consensus node; and based on the service-driven consensus method, federated learning is used for intelligent training to improve the level of care management and the local model performance of the node. It has the following advantages: First, more data can be obtained for training, and the model can be fine-tuned according to the actual situation of the user, thereby improving the recognition rate and generalization ability of the model. Second, the application of blockchain and federated learning technology can ensure the privacy and security of private data. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 A service-driven consensus approach for the present invention.
[0038] Figure 2 This is a flow chart of the service-driven remote nursing system training method of the present invention. DETAILED DESCRIPTION
[0039] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0040] Example 1
[0041] Reference Figure 1 ,A service-driven consensus method, each node supporting service activities constitutes a blockchain system, and the consensus process includes node startup phase, node voting phase, trusted node selection phase, consensus node selection phase, and consensus phase.
[0042] Node startup phase: assign a node number to each node and initialize data; for nodes without node numbers, assign a node number to them and initialize the data of the node; for nodes with node numbers, initialize them by loading data from existing nodes.
[0043] For nodes without node numbers, the process of assigning them a node number is as follows: the node first publishes an application for assigning a Node ID to the blockchain system, and the application is packaged in the blockchain system as a transaction; after the application is processed, the blockchain system assigns a node number that is 1 greater than the largest node number already in the blockchain system; it should be noted that each block contains the largest Node ID value in the blockchain system as of the current packaging. When the block is a genesis block, the default largest Node ID value of the previous block is 0; since the arrangement of packaged transactions in the block is orderly, when a node that has not been assigned a Node ID accesses a packaged block, it finds the ranking of the node's Node ID application in all Node ID applications in the block, and can find the Node ID value of the node based on the largest Node ID value recorded in the block plus the ranking of the Node ID application assigned by the blockchain system in the block.
[0044] Data initialization: For nodes that are running the blockchain system for the first time, after the node number is assigned, the weight is set to 10, and the weight deduction service weight is 0; for nodes that are not running the blockchain system for the first time, the node information in the blockchain system is loaded.
[0045] Node voting stage: Each node votes for each other. In addition to carrying each voting node and the number of votes, the voting information must also carry a trust factor. Nodes can vote directly or through proxy voting. Nodes can vote for multiple other nodes or just one node. The number of votes is the node mirror weight. The so-called mirror weight means that the maximum number of votes a node can cast is not greater than its own weight. The mirror weight operation will not reduce the weight of the node. The trust factor can be any positive integer, which is completely determined by the voting node itself. The node can arbitrarily assign any positive integer within the word length range to the trust factor, and the value is only determined by the voting node itself and is not affected by any other factors. A node can vote for r nodes, where r is a positive integer, but the number of votes cast for r nodes and the number of votes not higher than the mirror weight must be satisfied.
[0046] Trusted node selection stage: On the blockchain system, the number of votes of all nodes is calculated from the voting information, and several nodes with the highest number of votes are selected as trusted nodes. At the same time, for each trusted node, the trusted factors carried in all the voting information for the trusted node form a trusted factor sequence;
[0047] Specifically, once the calculation period of the voting time is reached, the number of votes obtained by all nodes is immediately counted on the chain, and the nodes with the most votes are sorted from most to least. The first k nodes with the most votes are selected as trusted nodes. The node numbers of the 1st, 2nd, ..., k-1, k trusted nodes are: id1, id2, ..., id k-1 ,id k ; Trusted nodes are used to verify the correctness of consensus node selection, vote on whether certain nodes are illegal nodes, and provide arbitration services; when counting the number of votes for each node, the trusted factor sequence obtained by counting and obtaining the trusted factors carried by the voting information is unordered. The trusted factor sequences corresponding to the 1st, 2nd, ..., k-1, kth node numbers are: list_x1, list_x2, ..., list_x k-1 ,list_x k .
[0048] Consensus node selection phase: remove nodes that have not voted and nodes that violate regulations (illegal nodes include nodes that are not the latest version of the consensus mechanism software loaded and nodes that are voted as violations by trusted nodes) from all nodes to form a valid node sequence; according to the weight and service weight of the nodes in the valid node sequence, expand the number of times each node appears in the valid node sequence to construct a candidate node sequence; select a trusted factor from the trusted factor sequence of each trusted node and perform an XOR operation, and the obtained value is used as the random seed of the random number generator. The candidate node sequence is the range of the random number generator selection value, and a random number is generated by the random number generator. The random number is the node number of the consensus node; the process of cyclically calculating the random seed and using the random number generator to generate a random number is used to select multiple consensus nodes to poll for blocks until the time of this consensus node selection ends;
[0049] The process of constructing a candidate node sequence is:
[0050] Use P1, P2, ..., P n Respectively represent the 1st, 2nd, ..., nth valid nodes, d1, d2, ..., d n They represent the node numbers corresponding to the 1st, 2nd, …, nth valid nodes respectively. The valid node sequence is represented by C. For the i-th valid node P i , where the weight is w i , the service weight is tw i , the transfer expansion factor preset by the blockchain system is α, and the service impact factor preset is β. Then, the i-th valid node P in the valid node sequence i The number of repetitions is:
[0051]
[0052] Repeating sequence X = [x1, x2, ..., x n ],x1,x2,…,x n are the repetition times of the 1st, 2nd, …, nth valid nodes in the valid node sequence respectively. Therefore, the sequence obtained after expanding each node in the valid node sequence according to the repetition number sequence X is the candidate node sequence.
[0053] In the consensus node selection phase, a trusted factor is selected from the trusted factor sequence of each trusted node and an XOR operation is performed. The obtained value is used as the random seed of the random number generator. The specific process is as follows:
[0054] First, k credible factors are extracted from the credible factor sequence of each credible node by linear transformation and then taking the modulus of the credible factor sequence length:
[0055] c and d are two preset hyperparameters for linear transformation. The length of the i-th trusted node sequence is li , when making the jth consensus node selection, select a trust factor y from the i-th trusted node sequence i :
[0056]
[0057] Then, the k trusted factors taken out form a trusted factor sequence Y = [y1, y2, ..., y k ],y1,y2,…,y k are the 1st, 2nd,…,kth credible factors respectively.
[0058] Next, we get the jth random seed s j The calculation method is:
[0059] s j =y1⊕y2⊕…⊕y k ;
[0060] Calculate the 1st, 2nd, …, kth random seeds respectively;
[0061] Finally, an equal probability random number generator is used with a random seed s j Select a node number from the candidate node sequence as the consensus node.
[0062] Consensus stage: Trusted nodes verify the selected consensus nodes (consensus node 1, consensus node 2, ..., consensus node u-1, consensus node u), and the verified consensus nodes generate blocks and upload them to the chain. The verification method set in this embodiment is: each selected result can generate blocks and upload them to the chain if it is confirmed by more than 50% of the trusted nodes.
[0063] After the calculation cycle ends, the weight of each valid node is restored to the initial value, that is, the weight is 10, and the weight deduction number and service weight are 0.
[0064] The service described is to perform data annotation on the collected / recorded images / videos.
[0065] It should be noted that, in a general consensus mechanism, the first s nodes with the highest number of votes in voting are the block-producing nodes. A service-driven consensus mechanism in the patent of this invention defines the first s nodes with the highest number of votes as trusted nodes, and removes the block-producing function from them, which can reduce the benefits of the node's malicious behavior and reduce the collusion of malicious nodes.
[0066] It should be noted that in the node voting process stage, the node vote is unknown, and the trust factor attached to the vote is also unknown; in the trusted node selection stage, the trusted node for the final vote is not certain, and the trusted factor sequence of the selected trusted node is unknown; in the consensus node selection stage, the operation of selecting a number from the trusted factor sequence of each trusted node is predictable, but the number in the trusted factor sequence is unknown, so the random number seed is also unknown, and therefore, the consensus node selected by the random number generator is also unknown. For attackers, the unknown nature of the consensus node makes the system more secure.
[0067] It should be noted that within a cycle, the random number generator uses an equal probability generator, and the expansion from the valid node sequence to the candidate node sequence increases the probability of the node providing the service being selected as the consensus node, encouraging more nodes to participate in the service. On the other hand, using an equal probability random number generator, the blockchain system preset service impact factor β can be taken as about 0.01. Therefore, it can be regarded as that each node has almost equal probability of producing blocks, and removing the account nodes that did not vote in the selection of trusted nodes can actively mobilize all nodes to participate in system maintenance and avoid the phenomenon of node voting being inactive. In addition, after a cycle, the weights, weight deductions, and service weights of all nodes are restored to the initial values to avoid the tendency of system centralization.
[0068] The service provider shall publish the service demand information, completion time, service provider selection criteria and corresponding weights according to its own needs. At this time, the weight of the service shall be deducted from the weight in the service provider node, and the weight of the service provider obtained after deduction shall not be less than 0; all network nodes receive the demand published by the node and compete, and after collecting a number of candidate service providers within a period of time, the best service provider shall be selected to complete the service according to the service provider selection criteria; if the best service provider fails to complete the service within a period of time, the second best service provider shall be selected to complete the service until a service provider completes the service or no service provider completes the service; for services that are not completed by a service provider or the service provider is not satisfied with the service provided by the service provider, the data involved in the service shall be directly discarded; for services that are satisfied with the service provided by the service provider, the deducted weight shall be included in the service weight of the service provider; if the service provider is dissatisfied with the satisfaction score of the service provider, it shall be submitted to arbitration for judgment by the trusted nodes, and it shall pass the review if more than two-thirds of the trusted nodes agree with the view.
[0069] The consensus method of the present invention does not use the calculation of brute force hash function by nodes in proof of work. Nodes do not need to compete for computing power to compete for block generation opportunities, saving computing power and energy. This is just right for application on small edge devices. In addition, the restricted eligibility to download the latest model opportunity can encourage more people to provide data and services, thereby improving the recognition effect of the visual model.
[0070] Example 2
[0071] This embodiment provides a service-driven video model intelligent training method. On the one hand, the federated learning method is used to timely train the labeled data of all nodes in the remote care system to obtain a better local model. The local model includes a neural network-based image / video detection algorithm model or a data calculation or processing model running on other nodes; on the other hand, the local model can be fine-tuned according to the settings of each node user and local data to achieve a local model that is more suitable for the user environment and application direction, thereby improving the recognition rate of the local model. Figure 2 As shown, the specific steps are:
[0072] Step S1: Set system hyperparameters in the node configuration file, including the service weight M and timer T that trigger intelligent training. C And the number of fine-tuning times of each node P. Among them, the data annotation service weight M is used to adjust the time and necessity of intelligent training, based on the following considerations: First, training cannot be started all the time, which will waste computing power and affect the image / video detection tasks of the blockchain system and devices. If the time is too long, it will not be updated in time to a model with a higher recognition rate; second, by setting the service weight M that triggers intelligent training in the configuration file, the time interval of intelligent training can be dynamically adjusted according to the operation of the blockchain system and nodes.
[0073] Step S2: When the node identification is running, the timer T has expired. C If the timing is reached, the timer task is triggered and step S3 is executed; otherwise, the process continues to wait.
[0074] Step S3, timer T C Reset time to 0, timer T C Re-timing; timer T C The task starts calculating the total service weight N generated by data annotation from the last intelligent training to the current time.
[0075] Step S4: If N is greater than or equal to M, proceed to step S5; otherwise, return to step S2.
[0076] Step S5: turn off the timer T C, so as to avoid the situation that the total service weight generated by data annotation meets the requirements and needs to enter the training phase before the intelligent training of the visual model is completed, resulting in resource competition and an endless loop; the trusted nodes selected by the consensus node according to the service-driven consensus method randomly select a trusted node as the server, and the other consensus nodes are clients.
[0077] Step S6: Federated learning is used to train a global model for the nodes with data annotations in the remote care system and the servers selected in S5.
[0078] Step S7: The client that obtains downloading qualifications downloads the global model, and performs P times of fine-tuning based on the global model and local data to obtain a local model.
[0079] Step S8: Replace the global model in the client that is eligible for downloading with the latest fine-tuned local model (there is data locally, and the user has also set the fine-tuning parameter P locally and P>0) or the global model trained by federated learning; start the timer T C Continue timing; this training session is over.
[0080] Obviously, the above embodiments are merely examples for the purpose of clear explanation, and are not intended to limit the implementation methods. For those skilled in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation methods here. The obvious changes or modifications derived therefrom are still within the scope of protection of the invention.
Claims
1. A service-driven consensus method, characterized in that: The nodes that support service activities constitute the blockchain system, and the consensus process includes: Assign a node number to each node and initialize data; Each node votes for each other. In addition to the nodes that receive votes and the number of votes, the voting information must also carry a trust factor. Calculate the number of votes of all nodes from the voting information, and select the nodes with the highest number of votes as trusted nodes; at the same time, for each trusted node, the trusted factors carried in all the voting information that voted for the trusted node form a trusted factor sequence; Remove nodes that have not voted and nodes that violate regulations from all nodes to form a valid node sequence; according to the weight of the nodes in the valid node sequence, expand the number of times each node appears in the valid node sequence to construct a candidate node sequence; select a trusted factor from the trusted factor sequence of each trusted node and perform calculations, and the obtained value is used as the random seed of the random number generator. The candidate node sequence is the range of the random number generator selection value, and a random number is generated using the random number generator. The random number is the node number of the consensus node; the process of cyclically calculating the random seed and using the random number generator to generate a random number is used to select multiple consensus nodes to poll for blocks until the time for this consensus node selection ends; Trusted nodes verify the selected consensus nodes, and the verified consensus nodes produce blocks and upload them to the chain.
2. A service-driven consensus method according to claim 1, characterized in that: The data initialization is: for the node that runs the blockchain system for the first time, after the node number is assigned, its weight, weight deduction number and service weight are set; for the node that does not run the blockchain system for the first time, the node information in the blockchain system is loaded.
3. A service-driven consensus method according to claim 1, characterized in that: The process of constructing a candidate node sequence is: Use P1, P2, ..., P n Respectively represent the 1st, 2nd, ..., nth valid nodes, d1, d2, ..., d n They represent the node numbers corresponding to the 1st, 2nd, …, nth valid nodes respectively. The valid node sequence is represented by C. For the i-th valid node P i , where the weight is w i , the service weight is tw i , the transfer expansion factor preset by the blockchain system is α, and the service impact factor preset is β. Then, the i-th valid node P in the valid node sequence i The number of repetitions is: Repeating sequence X = [x1, x2, ..., x n ],x1,x2,…,x n are the repetition times of the 1st, 2nd, …, nth valid nodes in the valid node sequence respectively. Therefore, the sequence obtained after expanding each node in the valid node sequence according to the repetition number sequence X is the candidate node sequence.
4. A service-driven consensus method according to claim 3, characterized in that: A trusted factor is selected from the trusted factor sequence of each trusted node and operated. The obtained value is used as the random seed of the random number generator. The specific process is as follows: First, k credible factors are extracted from the credible factor sequence of each credible node by linear transformation and then taking the modulus of the credible factor sequence length: c and d are two preset hyperparameters for linear transformation. The length of the i-th trusted node sequence is l i , when making the jth consensus node selection, select a trust factor y from the i-th trusted node sequence i : y i =([c d]×[ j 1])%×l i ; Then, the k trusted factors taken out form a trusted factor sequence Y = [y1, y2, ..., y k ],y1,y2,…,y k are the 1st, 2nd, …, kth credible factors respectively; Next, we get the jth random seed s j The calculation method is: s j =y1⊕y2⊕…⊕y k 。 5. A service-driven consensus method according to claim 4, characterized in that: When selecting a consensus node, an equal probability random number generator is used with a random seed s j Select a node number from the candidate node sequence as the consensus node.
6. A service-driven consensus method according to claim 1, characterized in that: The method of assigning a node number to each node and initializing data is as follows: for a node without a node number, a node number needs to be assigned to it and the data of the node is initialized; for a node with a node number, it is initialized by loading the data of an existing node.
7. A service-driven consensus method according to claim 1, characterized in that: The service provider shall publish the service demand information, completion time, service provider selection criteria and corresponding weights according to its own needs. At this time, the weight of the service shall be deducted from the weight in the service provider node, and the weight of the service provider obtained after deduction shall not be less than 0; all network nodes receive the demand published by the node and compete, and after collecting a number of candidate service providers within a period of time, the best service provider shall be selected to complete the service according to the service provider selection criteria; if the best service provider fails to complete the service within a period of time, the second best service provider shall be selected to complete the service until a service provider completes the service or no service provider completes the service; for services that are not completed by a service provider or the service provider is not satisfied with the service provided by the service provider, the data involved in the service shall be directly discarded; for services that are satisfied with the service provided by the service provider, the deducted weight shall be included in the service weight of the service provider; if the service provider is dissatisfied with the satisfaction score of the service provider, it shall be submitted to arbitration for judgment by the trusted nodes, and it shall pass the review if more than two-thirds of the trusted nodes agree with the view.
8. A service-driven consensus method according to claim 7, characterized in that: The service in this category is a data labeling service. The service provider needs to provide its own image or video data, and the service provider labels the data according to the data labeling method.
9. A visual model intelligent training method based on a service-driven consensus mechanism, characterized in that: The steps are: Step S1: Set system hyperparameters in the node configuration file, including the service weight M and timer T of the data annotation that triggers intelligent training. C and the number of fine-tuning times of each node P; Step S2: When the node identification is running, the timer T has expired. C If the timing time is reached, the timer task is triggered and step S3 is executed; otherwise, the waiting time continues; Step S3, timer T C Reset time to 0, timer T C Re-timing; timer T C The task starts by calculating the total service weight N generated by data annotation from the last intelligent training to the current time; Step S4: If N is greater than or equal to M, proceed to step S5; Otherwise, return to step S2; Step S5: turn off the timer T C , so as to avoid the situation that the total service weight generated by data annotation meets the requirements before the intelligent training of the visual model is completed and the training phase needs to be entered again, resulting in resource competition and an endless loop; the trusted nodes selected by the consensus node according to the service-driven consensus method randomly select a trusted node as the server, and the other consensus nodes as clients; Step S6: For the nodes with data annotation in the remote care system and the server selected in step S5, a global model is trained using federated learning; Step S7: The client that obtains downloading qualifications downloads the global model, and performs P times of fine-tuning based on the global model and local data to obtain a local model. Step S8: Replace the global model in the client that is eligible for downloading with the latest fine-tuned local model or the global model trained by federated learning; start the timer T C Continue timing; this training session is over.
10. A service-driven consensus method according to claim 1, characterized in that: The trust factor is an arbitrary positive integer, which is completely determined by the voting node itself; the weight and service weight are only used to generate the number of repetitions of each node in the valid node sequence to change the probability of each node being selected as a consensus node, and have no other function; in addition, the consensus node is responsible for packaging and publishing data, and has the opportunity to download the latest visual model training results for several consecutive times; Trusted nodes are used to determine consensus nodes, violation nodes, service arbitration, and server nodes for intelligent training, and have the opportunity to download the latest visual model training results within the trusted term; after a calculation cycle, the weights, weight deductions, and service weights of all valid nodes are restored to their initial values, that is, the weight is 10, the weight deductions, and service weights are 0.
Citation Information
Patent Citations
Federal learning method of lightweight grouping consensus based on block chain
CN115796261A
Block chain consensus mechanism processing system based on weight distribution calculation scene
CN117082075A
Block chain consensus method capable of randomly selecting main node
CN117411636A
