Blockchain consensus method, apparatus, device, storage medium and product
By selecting the node with the highest classification accuracy as the consensus node based on the feature convolution value of the new labeled image on the blockchain node, the problem of low blockchain consensus efficiency is solved, and efficient utilization of computing resources and improvement of image recognition accuracy are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA MOBILE FINANCIAL TECHNOLOGY CO LTD
- Filing Date
- 2024-03-07
- Publication Date
- 2026-05-05
AI Technical Summary
Blockchain suffers from low consensus efficiency and difficulty in making efficient use of computing resources.
When a new labeled image is acquired by a blockchain node, the blockchain node with the highest classification accuracy is determined based on the feature convolution value of the new labeled image, and this node is used as the consensus node to initiate on-chain consensus. By combining image recognition technology with blockchain consensus, the node with the largest average image feature convolution value is selected as the consensus initiating node.
It improves the efficiency of blockchain consensus, saves computing resources, increases the utilization efficiency of computing resources, and improves the accuracy of image recognition by eliminating abnormal images.
Smart Images

Figure CN118802098B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of blockchain technology, and in particular to a blockchain consensus method, apparatus, device, storage medium, and computer program product. Background Technology
[0002] Blockchain is a distributed, decentralized database with the characteristics of immutability and traceability, and has broad application prospects. However, during consensus-building, all nodes need to continuously perform meaningless hash calculations and compete for consensus-initiating permissions, which seriously wastes computing resources, resulting in low consensus efficiency and difficulty in efficiently utilizing computing resources.
[0003] The above content is only used to help understand the technical solution of the present invention and does not represent an admission that the above content is prior art. Summary of the Invention
[0004] The main objective of this invention is to provide a blockchain consensus method, apparatus, device, storage medium, and computer program product, aiming to solve the technical problems of low consensus efficiency and difficulty in efficiently utilizing computing resources in existing blockchain technologies.
[0005] To achieve the above objectives, the present invention provides a blockchain consensus method, the method comprising the following steps:
[0006] When a blockchain node obtains a new label image, the blockchain node with the highest classification accuracy is determined based on the feature convolution value of the new label image.
[0007] The blockchain node with the highest classification accuracy is selected as the consensus node, and on-chain consensus is initiated based on the consensus node.
[0008] Optionally, before determining the blockchain node with the highest classification accuracy based on the feature convolution value of the new label image when the blockchain node obtains the new label image, the method further includes:
[0009] Based on the labeled images to be trained stored on the blockchain nodes, a corresponding image classification model is constructed on each blockchain node;
[0010] After selecting the blockchain node with the highest classification accuracy as the consensus node and initiating on-chain consensus based on the consensus node, the process further includes:
[0011] Based on the new labeled image, the image classification model on the blockchain node is updated, and the parameters of the updated image classification model are stored on the blockchain.
[0012] Optionally, when the blockchain node obtains a new label image, determining the blockchain node with the highest classification accuracy based on the feature convolution values of the new label image includes:
[0013] When the blockchain node obtains a new label image, it performs convolution processing on the abstract matrix of the new label image and the convolution kernel of the image classification model on the corresponding blockchain node to obtain the convolution matrix corresponding to each new label image.
[0014] The largest element in the convolution matrix is used as the feature convolution value of the corresponding new label image;
[0015] Based on the feature convolution values of the new label image, determine the average feature convolution value of each blockchain node;
[0016] The maximum feature convolution mean is determined among the feature convolution mean values, and the blockchain node corresponding to the maximum feature convolution mean value has the highest classification accuracy.
[0017] Optionally, the blockchain consensus method further includes:
[0018] Based on the mean of the feature convolutions of the blockchain nodes, the feature convolution threshold of the blockchain nodes is determined;
[0019] Based on the feature convolution threshold, an abnormal image is determined in the new label image of the blockchain node, wherein the feature convolution value of the abnormal image is less than or equal to the feature convolution threshold;
[0020] The abnormal image is removed from the new label image of the blockchain node.
[0021] Optionally, determining the feature convolution threshold of the blockchain node based on the mean of the feature convolutions of the blockchain node includes:
[0022] Based on the mean of the feature convolution of the blockchain nodes and the feature convolution value of the new label image of the blockchain nodes, the feature convolution variance of each blockchain node is determined.
[0023] Based on the feature convolution mean and feature convolution variance of the blockchain nodes, a normal distribution function is constructed for each blockchain node;
[0024] Based on the normal distribution function and anomaly index of the blockchain nodes, the threshold of the feature convolution value that meets the condition of the proportion of feature convolution values for each blockchain node is determined.
[0025] Optionally, storing the updated image classification model parameters on the blockchain includes:
[0026] The parameters of the updated image classification model are stored in the leaf nodes of the Merkle tree, and the parent node of the leaf node is determined based on the hash value of the leaf node.
[0027] Based on the leaf node and the parent node, construct the corresponding block body;
[0028] Based on the hash value of a preset field, the block header identifier is determined. The preset field includes at least the block size, parent block identifier, block body identifier, block creation time, and consensus node identifier.
[0029] Based on the block header identifier, the block size, the parent block identifier, the block body identifier, the block creation time, and the consensus node identifier, construct the corresponding block header;
[0030] The block header and block body corresponding to the parameters are stored on the image recognition node.
[0031] Optionally, before constructing the corresponding image classification model on each blockchain node based on the labeled images to be trained stored on the blockchain node, the method further includes:
[0032] Obtain the label image to be trained, perform modulo operation on the consistent hash value of the label image to be trained, and determine the partition value of the label image to be trained;
[0033] Based on the partition values of the image to be trained, determine the storage number of the image to be trained;
[0034] Based on the storage number of the image to be trained, the image to be trained is stored on the blockchain node corresponding to the storage number.
[0035] Furthermore, to achieve the above objectives, the present invention also proposes a blockchain consensus device, which includes:
[0036] The on-chain consensus module is used to determine the blockchain node with the highest classification accuracy based on the feature convolution value of the new label image when the blockchain node obtains a new label image.
[0037] The on-chain consensus module is also used to select the blockchain node with the highest classification accuracy as the consensus node, and initiate on-chain consensus based on the consensus node.
[0038] Furthermore, to achieve the above objectives, the present invention also proposes a blockchain consensus device, which includes: a memory, a processor, and a blockchain consensus program stored in the memory and executable on the processor, wherein the blockchain consensus program is configured to implement the steps of the blockchain consensus method described above.
[0039] Furthermore, to achieve the above objectives, the present invention also proposes a storage medium storing a blockchain consensus program, which, when executed by a processor, implements the steps of the blockchain consensus method described above.
[0040] In addition, to achieve the above objectives, the present invention also proposes a computer program product, including a computer program that, when executed by a processor, implements the steps of the blockchain consensus method as described above.
[0041] In this invention, when a blockchain node acquires a new labeled image, it determines the blockchain node with the highest classification accuracy based on the feature convolution values of the new labeled image. This node is then designated as the consensus node, and on-chain consensus is initiated based on it. Because during blockchain consensus, all nodes continuously perform meaningless hash calculations to compete for consensus initiation rights, severely wasting computing resources and resulting in low consensus efficiency, this invention integrates blockchain with image recognition. During blockchain consensus, the node with the largest mean convolution value of image features is selected as the consensus initiation node. This transforms the previously meaningless competition for consensus initiation through hash calculations into a meaningful calculation that improves image recognition classification accuracy, thereby increasing blockchain consensus efficiency, saving computing resources, and improving the utilization efficiency of computing resources. Attached Figure Description
[0042] Figure 1 This is a schematic diagram of the structure of a blockchain consensus device in the hardware operating environment involved in the embodiments of the present invention;
[0043] Figure 2 This is a flowchart illustrating the first embodiment of the blockchain consensus method of the present invention;
[0044] Figure 3 This is a schematic diagram of the overall architecture of an embodiment of the blockchain consensus method of the present invention;
[0045] Figure 4 This is a flowchart illustrating the second embodiment of the blockchain consensus method of the present invention;
[0046] Figure 5 This is a schematic diagram of the overall process of an embodiment of the blockchain consensus method of the present invention;
[0047] Figure 6 This is a flowchart illustrating the third embodiment of the blockchain consensus method of the present invention;
[0048] Figure 7 This is a flowchart illustrating the fourth embodiment of the blockchain consensus method of the present invention;
[0049] Figure 8This is a schematic diagram of the block storage structure of an embodiment of the blockchain consensus method of the present invention;
[0050] Figure 9 This is a structural block diagram of the first embodiment of the blockchain consensus device of the present invention.
[0051] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0052] It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of the invention.
[0053] Reference Figure 1 , Figure 1 This is a schematic diagram of the blockchain consensus device structure in the hardware operating environment involved in the embodiments of the present invention.
[0054] like Figure 1 As shown, the blockchain consensus device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display screen or an input unit such as a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wireless-Fidelity (Wi-Fi) interface). The memory 1005 may be a high-speed random access memory (RAM) or a stable non-volatile memory (NVM), such as a disk drive. The memory 1005 may also optionally be a storage device independent of the aforementioned processor 1001.
[0055] Those skilled in the art will understand that Figure 1 The structure shown does not constitute a limitation on blockchain consensus devices and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0056] like Figure 1 As shown, the memory 1005, which serves as a storage medium, may include an operating system, a network communication module, a user interface module, and a blockchain consensus program.
[0057] exist Figure 1In the blockchain consensus device shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the blockchain consensus device of the present invention can be set in the blockchain consensus device, and the blockchain consensus device calls the blockchain consensus program stored in the memory 1005 through the processor 1001 and executes the blockchain consensus method provided in the embodiment of the present invention.
[0058] This invention provides a blockchain consensus method, referring to... Figure 2 , Figure 2 This is a flowchart illustrating the first embodiment of a blockchain consensus method according to the present invention.
[0059] In this embodiment, the blockchain consensus method includes the following steps:
[0060] Step S10: When a blockchain node obtains a new label image, it determines the blockchain node with the highest classification accuracy based on the feature convolution value of the new label image.
[0061] It should be noted that the execution entity in this embodiment can be a blockchain consensus device, which contains a blockchain consensus program. By running the blockchain consensus program, efficient consensus of the blockchain can be achieved.
[0062] It is understood that a blockchain system typically includes multiple blockchain nodes; in this embodiment, these blockchain nodes can be considered as image recognition nodes. For example... Figure 3 As shown, in order to manage the distributed image recognition nodes in a unified manner, this embodiment also sets up a task distribution node, which can be regarded as an image optimization task distribution node.
[0063] It should be understood that each blockchain node stores labeled images to be trained. These labeled images refer to tagged images within the blockchain system, and their number is determined based on the actual situation. These labeled images are stored separately on different blockchain nodes. Using the labeled images stored on the blockchain nodes, a corresponding image classification model can be constructed. This image classification model can classify and recognize images. Generally, each blockchain node has a corresponding image classification model, and the image classification models of different blockchain nodes are usually different. Generally, after training the image classification model, it is also necessary to determine the corresponding convolutional kernel for the image classification model.
[0064] Further, step S10 includes: when the blockchain node obtains a new label image, performing convolution processing on the abstract matrix of the new label image and the convolution kernel of the image classification model on the corresponding blockchain node to obtain a convolution matrix corresponding to each new label image; taking the largest element in the convolution matrix as the feature convolution value of the corresponding new label image; determining the feature convolution mean of each blockchain node based on the feature convolution value of the new label image; determining the largest feature convolution mean among the feature convolution means, wherein the blockchain node corresponding to the largest feature convolution mean has the highest classification accuracy.
[0065] It should be noted that a newly labeled image refers to an additional image with a label. The abstract matrix of the new labeled image can be distributed by the image optimization task distribution node. Generally, it can be assumed that any new labeled image is abstracted as a p*q matrix, as shown below:
[0066]
[0067] Next, the convolution kernel used when performing convolution operations on the new labeled image is obtained. It is usually the convolution kernel of the image classification model on the blockchain node corresponding to the new labeled image. Taking a 3*3 convolution kernel as an example, it is shown below:
[0068]
[0069] Then, the abstract matrix of the new label image is convolved with the corresponding convolution kernel to obtain the convolved matrix, i.e., the convolution matrix. The convolution matrix is a matrix of (p-2)*(q-2) dimensions. The specific calculation method of each element in the convolution matrix F is as follows:
[0070] f 11 =b 11 *d 11 +b 12 *d 12 +b 13 *d 13 +…+b 33 *d 33
[0071] f 12 =b 12 *d 11 +b 13 *d 12 +b 13 *d 13 +…+b 34 *d 33
[0072] ...
[0073] It can be seen that for any element f in the convolution matrix Fij It has the following calculation relationship:
[0074] f ij =b ij *d 11 +b i(j+1) *d 12 +b i(j+2) *d 13 +…+b (i+2)(j+2) *d 33
[0075] Finally, each new labeled image forms the following convolution matrix:
[0076]
[0077] Therefore, the largest element in the convolution matrix of each new label image is selected as the feature convolution value of that new label image, which can be denoted as E. The larger the feature convolution value, the more accurate the classification.
[0078] Understandably, after determining the feature convolution values of all new label images, the mean of the feature convolution values of each blockchain node can be calculated based on the new label images of each blockchain node. That is, the mean of the feature convolution values corresponding to the new label images of each blockchain node is obtained. Generally, the higher the mean of the feature convolution of a blockchain node, the higher its classification accuracy is considered to be. Therefore, in this embodiment, the blockchain node with the highest classification accuracy refers to the blockchain node with the largest mean of feature convolution.
[0079] Step S20: Select the blockchain node with the highest classification accuracy as the consensus node, and initiate on-chain consensus based on the consensus node.
[0080] It should be understood that selecting the blockchain node with the highest classification accuracy, that is, the blockchain node with the largest feature convolution mean, as the consensus node, or consensus initiating node, transforms the original meaningless competition for consensus initiating node through hash calculations into meaningful calculations that improve image recognition accuracy, thereby improving the utilization of computing resources.
[0081] In the specific implementation, all blockchain nodes use the convolution kernel corresponding to the image classification model to perform convolution operation between each new labeled image and the convolution kernel, select the largest convolution value as the feature convolution value, and select the node with the largest average image feature convolution value as the consensus initiating node to initiate consensus.
[0082] In this embodiment, when a blockchain node acquires a new labeled image, it determines the blockchain node with the highest classification accuracy based on the feature convolution values of the new labeled image. This blockchain node with the highest classification accuracy is then selected as the consensus node, and on-chain consensus is initiated based on this consensus node. This embodiment integrates blockchain and image recognition. During blockchain consensus, the node with the largest mean convolution value of image features is selected as the consensus initiating node. This transforms the previously meaningless competition for consensus initiating node through hash calculations into a meaningful calculation that improves the classification accuracy of image recognition, thereby improving blockchain consensus efficiency, saving computing resources, and increasing the efficiency of computing resource utilization.
[0083] Reference Figure 4 , Figure 4 This is a flowchart illustrating a second embodiment of a blockchain consensus method according to the present invention.
[0084] Based on the first embodiment described above, the method further includes the following steps before step S10:
[0085] Step S01: Based on the labeled images to be trained stored on the blockchain nodes, construct a corresponding image classification model on each blockchain node.
[0086] Further, step S01 includes: acquiring the label image to be trained; performing modulo operation on the consistent hash value of the label image to be trained to determine the partition value of the label image to be trained; determining the storage number of the label image to be trained based on the partition value of the label image to be trained; and storing the label image to be trained on the blockchain node corresponding to the storage number based on the storage number of the label image to be trained.
[0087] It should be noted that all labeled images to be trained need to undergo consistent hashing to obtain consistent hash values, and then the modulo operation is performed on the obtained consistent hash values. In this embodiment, the final value is defined as the partition value, and the calculation formula for the partition value is as follows:
[0088] T=hash(picture)%M,T∈(1~M)
[0089] In the formula, T represents the partition value, and M represents the M blockchain nodes in the blockchain system. The calculated partition value can be any integer from 1 to M. The value corresponding to the partition value is used as the number of the blockchain node storing the image to be trained, which is also the storage number of the image to be trained. For example, if the partition value of the image to be trained is 3, then the storage number of the image to be trained is considered to be 3, and the image to be trained needs to be stored on the blockchain node with the number 3. According to the storage number of each image to be trained, each image to be trained is stored on the corresponding blockchain node. When the number of images to be trained reaches a certain level, the images to be trained in the blockchain system can be evenly and randomly stored on various blockchain nodes.
[0090] It is understandable that the training label images that need to be stored on each blockchain node can be divided by the image optimization task distribution node.
[0091] It should be understood that an image classification model can be trained using an image classification algorithm, or it can be trained using other suitable methods, such as using a CNN (Convolutional Neural Networks) deep learning algorithm to train the image classification model, and then using an error back propagation (BP) algorithm to further train the image classification model. This embodiment does not limit this.
[0092] Furthermore, after step S20, the method further includes:
[0093] Step S30: Based on the new labeled image, update the image classification model on the blockchain node, and store the parameters of the updated image classification model on the blockchain.
[0094] It should be noted that the image classification model on the blockchain nodes is updated based on the new labeled images of each blockchain node. According to the consensus initiator selected in step 20, a request to upload the image to the blockchain is broadcast to other nodes. During the upload process, the various parameters of the image classification model are stored on the blockchain in the form of a block body and a block header, ensuring the trustworthiness of the image classification model.
[0095] like Figure 5 The overall process diagram shown first involves partitioning the labeled images to be trained according to the consistent hash value and storing them on the blockchain nodes, training and building the image classification model, selecting consensus nodes based on the feature convolution values, and finally updating the image classification model and putting the model on the blockchain.
[0096] It is understood that in this embodiment, the blockchain node serves both as a storage and consensus node, storing image files and image classification models and participating in consensus, and as a training node for the image classification model, determining the consensus initiating node based on feature convolution values. By integrating and reusing blockchain storage and image classification computation, the efficiency of computing and storage resource utilization is improved. Specifically, the blockchain node can act as the underlying storage provider for the image classification model, uploading the model's parameters to the blockchain to ensure its credibility and traceability. During image classification model training, the blockchain node can participate in computation as a training node. The blockchain node can also apply for tasks from image optimization task distribution nodes, identify abnormal images, and initiate on-chain consensus after the consensus initiating node has been determined.
[0097] It should be understood that the image optimization task distribution node in this embodiment is used to coordinate and manage the distributed image recognition nodes (blockchain nodes) and train the image classification model. When the blockchain nodes reach consensus, the node distributes the model training task to each blockchain node. Based on the consistent hashing result of the image, the image is distributed to each blockchain node for storage, ensuring that the image can be stored randomly and evenly and ensuring traceability.
[0098] In this embodiment, based on the labeled images to be trained stored on the blockchain nodes, a corresponding image classification model is built on each blockchain node. When a blockchain node acquires a new labeled image, the blockchain node with the highest classification accuracy is determined based on the feature convolution values of the new labeled image. This blockchain node with the highest classification accuracy is selected as the consensus node, and on-chain consensus is initiated based on the consensus node. Based on the new labeled image, the image classification model on the blockchain node is updated, and the parameters of the updated image classification model are stored on the blockchain. This embodiment integrates blockchain and image recognition. During blockchain consensus, the node with the largest mean of image feature convolution is selected as the consensus initiating node. This transforms the originally meaningless competition for consensus initiating node through hash calculation into a meaningful calculation to improve the classification accuracy of image recognition, thereby improving blockchain consensus efficiency, saving computing resources, and improving the utilization efficiency of computing resources.
[0099] Reference Figure 6 , Figure 6 This is a flowchart illustrating a third embodiment of a blockchain consensus method according to the present invention.
[0100] Based on the above embodiments, the method further includes the following steps before step S30:
[0101] Step S21: Determine the feature convolution threshold of the blockchain node based on the mean of the feature convolution of the blockchain node.
[0102] Further, step S21 includes: determining the feature convolution variance of each blockchain node based on the feature convolution mean of the blockchain node and the feature convolution value of the new label image of the blockchain node; constructing a normal distribution function for each blockchain node based on the feature convolution mean and feature convolution variance of the blockchain node; and determining the feature convolution value threshold that meets the feature convolution value quantity ratio condition for each blockchain node based on the normal distribution function and anomaly index of the blockchain node.
[0103] It should be noted that, assuming the m-th blockchain node has k new labeled images, the feature convolution values E1, E2...E1 for each new labeled image are calculated sequentially. k Next, calculate the mean of the feature convolution of the image with a new label for a certain category on the m-th blockchain node. As shown below:
[0104]
[0105] In the formula, E represents the mean of the feature convolution. l This represents the feature convolution value of the l-th image among k newly labeled images.
[0106] Then, the variance of the feature convolution values of the new label image for a certain category of the m-th blockchain node is calculated, i.e., the feature convolution variance σ, as shown below:
[0107]
[0108] In the formula, E represents the mean of the feature convolution. l Let σ represent the feature convolution value of the l-th image among the k newly labeled images, and let σ represent the feature convolution variance.
[0109] It is understandable that the feature convolution values of any blockchain node for a specific category follow a normal distribution. Therefore, a corresponding normal distribution function can be constructed based on the feature convolution mean and variance. The condition for the proportion of feature convolution values refers to: when P(E≤E) min When ) < β, P(E ≤ E min ) is E≤E min The proportion of all feature convolution values, β is the anomaly index, which can be adjusted appropriately, to find the largest E that meets the conditions. min This is the threshold value for the feature convolution.
[0110] Step S22: Based on the feature convolution threshold, identify abnormal images in the new label images of the blockchain node. If the feature convolution value of the abnormal image is less than or equal to the feature convolution threshold, remove the abnormal image from the new label images of the blockchain node.
[0111] It should be understood that when the feature convolution value of a new labeled image is less than or equal to the feature convolution threshold, the new labeled image is considered an abnormal image. These abnormal images need to be eliminated when updating the model to improve the accuracy of image classification.
[0112] In this embodiment, a feature convolution threshold is obtained for each blockchain node. Based on this threshold, abnormal images are identified in the newly labeled images of the blockchain node. If the feature convolution value of an abnormal image is less than or equal to the threshold, the abnormal image is removed from the newly labeled images of the blockchain node. This embodiment integrates blockchain and image recognition. During blockchain consensus, the node with the largest mean image feature convolution value is selected as the consensus initiating node. This transforms the previously meaningless competition for consensus initiating node through hash calculations into a meaningful calculation that improves the accuracy of image recognition classification. This improves blockchain consensus efficiency, saves computing resources, and increases the efficiency of computing resource utilization. Furthermore, by eliminating abnormal images during model updates, the accuracy of image classification can be improved.
[0113] Reference Figure 7 , Figure 7 This is a flowchart illustrating the fourth embodiment of a blockchain consensus method according to the present invention.
[0114] Based on the above embodiments, step S30 includes:
[0115] Step S301: Update the image classification model on the blockchain node based on the new labeled image.
[0116] Step S302: Store the updated parameters of the image classification model in the leaf nodes of the Merkle tree, determine the parent node of the leaf node based on the hash value of the leaf node, and construct the corresponding block based on the leaf node and the parent node.
[0117] It should be noted that when the image classification model is uploaded to the blockchain, the model parameters are stored in Merkle tree format, such as... Figure 8 As shown. If the image classification model parameter is G, G is stored in the leaf node of the Merkle tree. The parent node of the leaf node is represented by the hash value of the leaf node. Any node in the tree is composed of the hash values of the leaf nodes. Through this block-based storage structure, when some data is modified, it can be easily detected, which can play a role in trust and tamper-proof.
[0118] Step S303: Determine the block header identifier code based on the hash value of the preset fields. The preset fields include at least the block size, parent block identifier code, block body identifier code, block creation time, and consensus node identifier code. Construct the corresponding block header based on the block header identifier code, the block size, the parent block identifier code, the block body identifier code, the block creation time, and the consensus node identifier code.
[0119] It is understandable that the block header consists of preset fields, which at least include the block header identifier, block size, parent block identifier, block body identifier, block creation time, and consensus node identifier. The block header identifier can be considered as the block header ID, the parent block identifier as the parent block ID, the block body identifier as the block body ID, and the consensus node identifier as the consensus node ID. In other words, the block header consists of fields such as block header ID, block size, parent block ID, block body ID, block creation time, and consensus node ID, as shown in Table 1.
[0120] Table 1
[0121]
[0122] It should be understood that the block header ID is calculated from the hash values of the block size, parent block ID, block body ID, block creation time, and consensus node ID fields, i.e., Block Header ID = hash(block size, parent block ID, block body ID, block creation time, consensus node ID). Because the block header ID includes the hash values of the parent block ID and block body ID, when data is tampered with, all data on the entire blockchain will be changed, making it easy to detect anomalies and providing a reliable and tamper-proof effect.
[0123] Step S304: Store the block header and block body corresponding to the parameters on the image recognition node.
[0124] In this embodiment, the parameters of the updated image classification model are stored in the leaf nodes of a Merkle tree. The parent node of each leaf node is determined based on its hash value. A corresponding block body is constructed based on the leaf node and its parent node. A block header identifier is determined based on the hash value of a preset field. A corresponding block header is constructed based on the block header identifier, block size, parent block identifier, block body identifier, block creation time, and consensus node identifier. The block header and block body corresponding to the parameters are then stored on the image recognition node. This embodiment integrates blockchain and image recognition. During blockchain consensus, the node with the largest mean convolutional value of image features is selected as the consensus initiating node. This transforms the previously meaningless competition for consensus initiating node through hash calculations into a meaningful calculation that improves the accuracy of image recognition classification, thereby improving blockchain consensus efficiency, saving computing resources, and increasing the efficiency of computing resource utilization. Furthermore, storing the various parameters of the image classification model on the blockchain ensures the trustworthiness of the image classification model.
[0125] Furthermore, this embodiment of the invention also proposes a storage medium storing a blockchain consensus program, which, when executed by a processor, implements the steps of the blockchain consensus method described above.
[0126] Furthermore, embodiments of the present invention also propose a computer program product, including a computer program that, when executed by a processor, implements the steps of the blockchain consensus method as described above.
[0127] Reference Figure 9 , Figure 9 This is a structural block diagram of the first embodiment of the blockchain consensus device of the present invention.
[0128] like Figure 9 As shown, the blockchain consensus device proposed in this embodiment of the invention includes:
[0129] The image classification module 10 is used to determine the blockchain node with the highest classification accuracy based on the feature convolution value of the new label image when the blockchain node obtains a new label image.
[0130] The on-chain consensus module 20 is used to select the blockchain node with the highest classification accuracy as the consensus node, and initiate on-chain consensus based on the consensus node.
[0131] In this embodiment, when a blockchain node acquires a new labeled image, it determines the blockchain node with the highest classification accuracy based on the feature convolution values of the new labeled image. This blockchain node with the highest classification accuracy is then selected as the consensus node, and on-chain consensus is initiated based on this consensus node. This embodiment integrates blockchain and image recognition. During blockchain consensus, the node with the largest mean convolution value of image features is selected as the consensus initiating node. This transforms the previously meaningless competition for consensus initiating node through hash calculations into a meaningful calculation that improves the classification accuracy of image recognition, thereby improving blockchain consensus efficiency, saving computing resources, and increasing the efficiency of computing resource utilization.
[0132] In one embodiment, the image classification module 10 is further configured to construct a corresponding image classification model on each blockchain node based on the labeled images to be trained stored on the blockchain node.
[0133] In one embodiment, the on-chain consensus module 20 is further configured to update the image classification model on the blockchain node based on the new labeled image, and store the parameters of the updated image classification model on the blockchain.
[0134] In one embodiment, the on-chain consensus module 20 is further configured to perform convolution processing on the abstract matrix of the new label image and the convolution kernel of the image classification model on the blockchain node corresponding to the new label image when the blockchain node obtains the new label image, so as to obtain the convolution matrix corresponding to each new label image.
[0135] The largest element in the convolution matrix is used as the feature convolution value of the corresponding new label image;
[0136] Based on the feature convolution values of the new label image, determine the average feature convolution value of each blockchain node;
[0137] The maximum feature convolution mean is determined among the feature convolution mean values, and the blockchain node corresponding to the maximum feature convolution mean value has the highest classification accuracy.
[0138] In one embodiment, the on-chain consensus module 20 is further configured to determine the feature convolution threshold of the blockchain node based on the feature convolution mean of the blockchain node;
[0139] Based on the feature convolution threshold, an abnormal image is determined in the new label image of the blockchain node, wherein the feature convolution value of the abnormal image is less than or equal to the feature convolution threshold;
[0140] The abnormal image is removed from the new label image of the blockchain node.
[0141] In one embodiment, the on-chain consensus module 20 is further configured to determine the feature convolution variance of each blockchain node based on the feature convolution mean of the blockchain node and the feature convolution value of the new label image of the blockchain node.
[0142] Based on the feature convolution mean and feature convolution variance of the blockchain nodes, a normal distribution function is constructed for each blockchain node;
[0143] Based on the normal distribution function and anomaly index of the blockchain nodes, the threshold of the feature convolution value that meets the condition of the proportion of feature convolution values for each blockchain node is determined.
[0144] In one embodiment, the on-chain consensus module 20 is further configured to store the parameters of the updated image classification model in the leaf nodes of the Merkle tree, and determine the parent node of the leaf node based on the hash value of the leaf node.
[0145] Based on the leaf node and the parent node, construct the corresponding block body;
[0146] Based on the hash value of a preset field, the block header identifier is determined. The preset field includes at least the block size, parent block identifier, block body identifier, block creation time, and consensus node identifier.
[0147] Based on the block header identifier, the block size, the parent block identifier, the block body identifier, the block creation time, and the consensus node identifier, construct the corresponding block header;
[0148] The block header and block body corresponding to the parameters are stored on the image recognition node.
[0149] In one embodiment, the image classification module 10 is further configured to acquire the label image to be trained, perform modulo operation on the consistent hash value of the label image to be trained, and determine the partition value of the label image to be trained.
[0150] Based on the partition values of the image to be trained, determine the storage number of the image to be trained;
[0151] Based on the storage number of the image to be trained, the image to be trained is stored on the blockchain node corresponding to the storage number.
[0152] It should be understood that the above are merely illustrative examples and do not constitute any limitation on the technical solutions of the present invention. In specific applications, those skilled in the art can make settings as needed, and the present invention does not impose any restrictions on this.
[0153] It should be noted that the workflow described above is merely illustrative and does not limit the scope of protection of this invention. In practical applications, those skilled in the art can select some or all of the workflow to achieve the purpose of this embodiment according to actual needs, and no restrictions are imposed here.
[0154] In addition, for technical details not described in detail in this embodiment, please refer to the blockchain consensus method provided in any embodiment of the present invention, which will not be repeated here.
[0155] Furthermore, it should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.
[0156] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0157] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as read-only memory (ROM) / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0158] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.
Claims
1. A blockchain consensus method, characterized in that, The blockchain consensus method includes: When a blockchain node obtains a new label image, it performs convolution processing on the abstract matrix of the new label image and the convolution kernel of the image classification model on the corresponding blockchain node to obtain the convolution matrix corresponding to each new label image. The largest element in the convolution matrix is used as the feature convolution value of the corresponding new label image; Based on the feature convolution values of the new label image, the average feature convolution value of each blockchain node is determined, and the blockchain node corresponding to the largest average feature convolution value is taken as the blockchain node with the highest classification accuracy. The blockchain node with the highest classification accuracy is selected as the consensus node, and on-chain consensus is initiated based on the consensus node.
2. The method as described in claim 1, characterized in that, Before determining the blockchain node with the highest classification accuracy based on the feature convolution value of the new label image when the blockchain node obtains the new label image, the process further includes: Based on the labeled images to be trained stored on the blockchain nodes, a corresponding image classification model is constructed on each blockchain node; After selecting the blockchain node with the highest classification accuracy as the consensus node and initiating on-chain consensus based on the consensus node, the process further includes: Based on the new labeled image, the image classification model on the blockchain node is updated, and the parameters of the updated image classification model are stored on the blockchain.
3. The method as described in claim 1, characterized in that, The blockchain consensus method also includes: Based on the mean of the feature convolutions of the blockchain nodes, the feature convolution threshold of the blockchain nodes is determined; Based on the feature convolution threshold, an abnormal image is determined in the new label image of the blockchain node, wherein the feature convolution value of the abnormal image is less than or equal to the feature convolution threshold; The abnormal image is removed from the new label image of the blockchain node.
4. The method as described in claim 3, characterized in that, Determining the feature convolution threshold of the blockchain node based on the mean of the feature convolutions of the blockchain node includes: Based on the mean of the feature convolution of the blockchain nodes and the feature convolution value of the new label image of the blockchain nodes, the feature convolution variance of each blockchain node is determined. Based on the feature convolution mean and feature convolution variance of the blockchain nodes, a normal distribution function is constructed for each blockchain node; Based on the normal distribution function and anomaly index of the blockchain nodes, the threshold of the feature convolution value that meets the condition of the proportion of feature convolution values for each blockchain node is determined.
5. The method as described in claim 2, characterized in that, The step of storing the updated image classification model parameters on the blockchain includes: The parameters of the updated image classification model are stored in the leaf nodes of the Merkle tree, and the parent node of the leaf node is determined based on the hash value of the leaf node. Based on the leaf node and the parent node, construct the corresponding block body; Based on the hash value of a preset field, the block header identifier is determined. The preset field includes at least the block size, parent block identifier, block body identifier, block creation time, and consensus node identifier. Based on the block header identifier, the block size, the parent block identifier, the block body identifier, the block creation time, and the consensus node identifier, construct the corresponding block header; The block header and block body corresponding to the parameters are stored on the blockchain node.
6. A blockchain consensus device, characterized in that, The blockchain consensus device includes: The on-chain consensus module is used to determine the blockchain node with the highest classification accuracy based on the feature convolution value of the new label image when the blockchain node obtains a new label image. The on-chain consensus module is also used to select the blockchain node with the highest classification accuracy as the consensus node, and to initiate on-chain consensus based on the consensus node. The on-chain consensus module is also used to perform convolution processing on the abstract matrix of the new label image and the convolution kernel of the image classification model on the blockchain node corresponding to the new label image when the blockchain node obtains the new label image, so as to obtain the convolution matrix corresponding to each new label image. The largest element in the convolution matrix is used as the feature convolution value of the corresponding new label image; Based on the feature convolution values of the new labeled image, the average feature convolution value of each blockchain node is determined, and the blockchain node corresponding to the largest average feature convolution value is selected as the blockchain node with the highest classification accuracy.
7. A blockchain consensus device, characterized in that, The device includes: a memory, a processor, and a blockchain consensus program stored on the memory and executable on the processor, the blockchain consensus program being configured to implement the steps of the blockchain consensus method as described in any one of claims 1 to 5.
8. A storage medium, characterized in that, The storage medium stores a blockchain consensus program, which, when executed by a processor, implements the steps of the blockchain consensus method as described in any one of claims 1 to 5.
9. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the blockchain consensus method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Target tracking method based on distribution field characteristics
CN109255304A
False information identification method and system based on machine learning and storage medium
CN110083827A