Traffic prediction method and system, computer equipment and storage medium

By selecting unverified nodes in the underlying blockchain for verification and training, a traffic prediction model is formed, which solves the single point failure risk and low throughput problems of existing traffic prediction methods and achieves efficient model quality evaluation and decentralized training.

CN120808597APending Publication Date: 2025-10-17HANGZHOU QULIAN TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510941605.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-08
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

Existing traffic prediction methods suffer from single point failure risks, low throughput, and insufficient coupling between the consensus mechanism and the model quality assessment system.

Method used

By selecting unverified nodes within the target transaction shard in the underlying blockchain for verification, a basic model is established and locally trained. After meeting the benchmark model requirements, it is uploaded to the underlying blockchain. The underlying blockchain performs local model aggregation and uploads it to the top blockchain for global aggregation to form a traffic prediction model.

Benefits of technology

It improves throughput, ensures model quality, realizes decentralized model training, avoids single point failure risks, and solves the shortcomings of existing technologies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120808597A_ABST
    Figure CN120808597A_ABST
Patent Text Reader

Abstract

The invention relates to a traffic prediction method and system, computer equipment and a storage medium. The method comprises the following steps: terminal equipment selects a first target node from a bottom block chain for verification, determines a basic model by using a model corresponding to the first target node, locally trains the basic model and then uploads the basic model to a corresponding transaction fragment in the bottom block chain, the transaction fragments in the underlying block chain are mutually independent and concurrently carry out consensus processing on the received transaction nodes, so that the throughput is improved. The bottom block chain uploads the model data corresponding to the unverified node with the highest model accuracy to the top block chain as the local model corresponding to the transaction fragment where the model data is located, so that the model quality of the local model participating in global aggregation is ensured; the top block chain globally aggregates the plurality of local models to obtain the traffic prediction model, model training is realized by different terminal devices, the degree of dependence on core nodes is low, and decentralized model training is realized.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of blockchain, and particularly relates to a traffic prediction method and system, a computer device and a storage medium. BACKGROUND

[0002] In a large-scale intelligent traffic scenario, a traffic global model is currently established by using centralized federated learning technology or blockchain and federated learning combined technology. The centralized federated learning technology is that a terminal device first completes model training locally, and then uploads the parameters obtained by training to a cloud server, and the cloud server performs a global aggregation operation to form a traffic global model. This technology presents a very significant centralized feature. The entire process from data transmission to model aggregation is highly dependent on the central node. Once the cloud server, as the core node of the entire system, fails, the global training will be directly interrupted, which will have a disastrous impact on real-time traffic decision-making, such as automatic driving path planning, that is, there is a single-point failure risk.

[0003] The blockchain and federated learning combined technology mainly uses blockchain technology to record model parameters. However, the transaction processing capacity of a chain block chain is generally less than 1000TPS, and its throughput is limited, which cannot meet the demand of millions of concurrent vehicle requests, such as in the scene of real-time road condition reporting. Moreover, there is a problem of insufficient coupling between the existing consensus mechanism and the model quality evaluation system. SUMMARY

[0004] The present application provides a traffic prediction method, system, computer device and storage medium to solve the problems of single-point failure risk, low throughput, and insufficient coupling between the existing consensus mechanism and the model quality evaluation system of the existing traffic prediction method.

[0005] In a first aspect, the present application provides a traffic prediction method applied to a terminal device, and the traffic prediction method comprises the following steps:

[0006] selecting a first target node from a target transaction shard in a bottom layer blockchain based on a preset consensus algorithm, wherein a traffic prediction area corresponding to the target transaction shard is an area where the terminal device is located, and the first target node comprises at least one unverified transaction node in the target transaction shard;

[0007] verifying the first target node by using local data to obtain a verification result;

[0008] when the verification result is verified, determining a basic model according to model data corresponding to the first target node;

[0009] training the base model by using the local data to obtain a local model;

[0010] when the local model meets the model requirement of the base model, uploading model data corresponding to the local model to the underlying blockchain, wherein the underlying blockchain is configured to determine a local model based on the model data uploaded by the terminal device, and upload model data of the local model to a top-level blockchain to participate in global aggregation processing to obtain a traffic prediction model.

[0011] In a second aspect, the application provides a traffic prediction method applied to an underlying blockchain, the traffic prediction method comprising:

[0012] model data of a base model issued by a top-level blockchain is used as an initial node in each transaction shard, and the base model corresponding to the initial node is issued to each terminal device, so that the terminal device generates a local model after iterative training of the base model, and the terminal device uses the local model to predict road conditions in a traffic prediction area where the terminal device is located to obtain a traffic prediction result;

[0013] when receiving model data of a local model uploaded by a target terminal device in a target traffic prediction area, adding the model data uploaded by the target terminal device as a second target node to a target transaction shard corresponding to the target traffic prediction area, and establishing a verification relationship between the second target node and a verified node corresponding to the target terminal device in the target transaction shard;

[0014] determining a plurality of unverified nodes that have not been verified based on the verification relationship between each transaction node in the target transaction shard, wherein the plurality of unverified nodes include the second target node;

[0015] uploading model data corresponding to the unverified node with the highest model accuracy as model data of a local model corresponding to the target transaction shard to the top-level blockchain, wherein the top-level blockchain is configured to perform global aggregation processing on model data of a plurality of local models uploaded by the underlying blockchain to obtain a traffic prediction model.

[0016] In a third aspect, the application provides a traffic prediction system, comprising:

[0017] a top-level blockchain configured to provide a base model for an underlying blockchain, and perform global aggregation processing on model data of a plurality of local models uploaded by the underlying blockchain to obtain a traffic prediction model, and then issue the traffic prediction model as an updated base model to the underlying blockchain for iterative circulation;

[0018] The bottom-layer blockchain is configured to add model data of a basic model issued by the top-layer blockchain as an initial node in each transaction shard; add model data of a local model uploaded by a terminal device in a different traffic prediction area as a transaction node, and add the model data to a transaction shard corresponding to the traffic prediction area, and determine a verification relationship between different transaction nodes and the initial node in the same transaction shard; and upload model data corresponding to an unverified transaction node with the highest model accuracy in the same transaction shard as model data of a local model to the top-layer blockchain.

[0019] The terminal device is configured to select a first target node from a target shard in the bottom-layer blockchain based on a preset consensus algorithm; perform verification processing on the first target node based on local data to obtain a verification result; when the verification result is a verification pass, determine a basic model based on model data corresponding to the first target node; train the basic model based on the local data to obtain a local model, and when the local model meets a model requirement of the basic model, upload model data corresponding to the local model to the bottom-layer blockchain, wherein a traffic prediction area corresponding to the target shard is an area where the terminal device is located, and the first target node includes at least one unverified transaction node in the target shard.

[0020] In a fourth aspect, the present application provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the traffic prediction method when executing the computer program.

[0021] In a fifth aspect, the present application further provides a computer storage medium storing computer executable instructions, and the computer executable instructions are used to execute the traffic prediction method.

[0022] Compared with the prior art, the above technical solution provided in the embodiments of the present application has the following advantages: the method provided in the embodiments of the present application selects a first target node from a target transaction shard in a bottom-layer blockchain based on a preset consensus algorithm, wherein the traffic prediction area corresponding to the target transaction shard is the area where the terminal device is located, and the first target node includes at least one unverified transaction node in the target transaction shard; the first target node is verified by using local data to obtain a verification result; when the verification result is verified, a base model is determined according to the model data corresponding to the first target node; the base model is trained by using the local data to obtain a local model; when the local model meets the model requirements of the base model, the local model is used to predict the road conditions of the traffic prediction area where the terminal device is located to obtain a traffic prediction result, and the model data corresponding to the local model is uploaded to the bottom-layer blockchain, wherein the bottom-layer blockchain is used to determine a local model based on the model data uploaded by the terminal device, and upload the model data of the local model with the highest model accuracy to a top-layer blockchain to participate in global aggregation processing to obtain a traffic prediction model, and the traffic prediction model is issued by the top-layer blockchain to each transaction shard in the bottom-layer blockchain as an initial node of the next training period, and is used as the base model of the terminal device in the next training period.

[0023] Based on the above method, after the terminal device selects a first target node from the bottom-layer blockchain and verifies it, the first target node is used to determine a base model corresponding to the model, and after the base model is trained locally, it is uploaded to the corresponding transaction shard in the bottom-layer blockchain. Each transaction shard in the bottom-layer blockchain is independent and is connected in parallel to perform consensus processing on the received multiple transaction nodes, that is, to establish a verification relationship between each transaction node in the transaction shard, thereby improving the throughput. The bottom-layer blockchain uploads the model data corresponding to the unverified node with the highest model accuracy as the local model corresponding to the transaction shard to the top-layer blockchain, so as to ensure the model quality of the local model participating in global aggregation, solve the problem of insufficient coupling between the existing consensus mechanism and the model quality evaluation system, and then the top-layer blockchain performs global aggregation processing on multiple local models to obtain a traffic prediction model. Since the model training is realized by multiple terminal devices, the dependence on the core node is low, the decentralized model training is realized, the single-point failure risk is avoided, and the problems of the existing traffic prediction method, such as single-point failure risk, low throughput, and insufficient coupling between the existing consensus mechanism and the model quality evaluation system, are solved. BRIEF DESCRIPTION OF DRAWINGS

[0024] The accompanying drawings, which are incorporated into and form part of the specification, illustrate embodiments consistent with the present application and, together with the specification, serve to explain the principles of the present application.

[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the accompanying drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced as follows. Obviously, the drawings are only a part of the embodiments of the present application, and thus they are not limitative of the present application.

[0026] One or more embodiments are illustrated by way of example with reference to the drawings, which are not limiting of the embodiments and which are merely meant to explain the embodiments. The same reference numbers in different drawings represent the same elements unless otherwise stated. The drawings are not necessarily to scale, the emphasis being placed rather on the principles of the application.

[0027] Figure 1 A structural schematic diagram of a traffic prediction system provided by an embodiment of the present application;

[0028] Figure 2 A structural schematic diagram of a traffic prediction system provided by an embodiment of the present application;

[0029] Figure 3 A flowchart of a traffic prediction method provided by an embodiment of the present application;

[0030] Figure 4 A structural schematic diagram in a transaction shard provided by an embodiment of the present application;

[0031] Figure 5 A flowchart of a traffic prediction method provided by an embodiment of the present application;

[0032] Figure 6 An internal structural schematic diagram of a computer device provided by an embodiment of the present application. DETAILED DESCRIPTION

[0033] In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all the other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.

[0034] The following disclosure provides many different embodiments, or examples, for implementing different structures of the application. For the purpose of simplifying the present disclosure, the components and arrangements of the various examples are described. Of course, these are simply examples and are not intended to limit the present application. Moreover, the present application can be repeated with variations and permutations of the various examples described. Such repetitions are not to be regarded as efforts to limit the application, but as contemplations of additional examples.

[0035] Figure 1 An application environment diagram of a traffic prediction method in an embodiment is shown in FIG. 1. Referring to FIG. 1, the traffic prediction method is applied to a traffic prediction system. The traffic prediction system includes a top-layer blockchain 110 and a bottom-layer blockchain 120. Figure 1

[0036] The top-layer blockchain 110 is configured to provide a base model for the bottom-layer blockchain 120, and to perform global aggregation processing on model data of a plurality of local models uploaded to the bottom-layer blockchain 120 to obtain a traffic prediction model, and then to issue the traffic prediction model as an updated base model to the bottom-layer blockchain 120 for iterative circulation.

[0037] The bottom-layer blockchain 120 is configured to take model data of the base model issued by the top-layer blockchain 110 as an initial node in each transaction shard, take model data of a local model uploaded by a terminal device 130 in a different traffic prediction area as a transaction node, and add the model data to a transaction shard corresponding to the traffic prediction area, and determine a verification relationship between different transaction nodes and the initial node in the same transaction shard, and upload model data corresponding to an unverified transaction node with the highest model accuracy in the same transaction shard as model data of a local model to the top-layer blockchain 110.

[0038] The terminal device 130 is configured to select a first target node from a target shard in the bottom-layer blockchain 120 based on a preset consensus algorithm, perform verification processing on the first target node using local data to obtain a verification result, determine a base model according to model data corresponding to the first target node when the verification result is a verification pass, train the base model using the local data to obtain a local model, and upload model data corresponding to the local model to the bottom-layer blockchain 120 when the local model meets model requirements of the base model, wherein a traffic prediction area corresponding to the target shard is an area where the terminal device 130 is located, and the first target node includes at least one unverified transaction node in the target shard.

[0039] Specifically, the top-layer blockchain 110 uses a weighted average method to perform global aggregation processing on a plurality of received local models to obtain a traffic prediction model, and the traffic prediction model is reissued to the bottom-layer blockchain 120 as a base model for iterative training.​

[0040] With reference to Figure 2 The bottom-layer blockchain 120 includes a plurality of transaction shards, each of which corresponds to a traffic prediction area, which is a sub-area in a global area corresponding to a traffic prediction model, for example, a municipal area, a sub-city area or a county-level area. The transaction shard is used to aggregate local models uploaded by each terminal device 130 in the same traffic prediction area to form a local model corresponding to the traffic prediction area, and then upload the local model to the top-layer blockchain 110 for global aggregation processing.

[0041] The terminal device 130 is any device with traffic prediction and model training functions, such as a vehicle device, a mobile terminal, a drone device, etc. The mobile terminal can be at least one of a smart bracelet, a smart watch, a smart phone, a tablet computer, a notebook computer, etc. The terminal device 130 trains the received base model to obtain a local model using local data, which can be data collected by the terminal device 130 itself or manually input by a user. The local data includes at least one of sensor data, vehicle state data, positioning data and traffic environment data. The sensor data includes at least one of camera image data, laser radar point cloud data, millimeter wave radar data, ultrasonic sensor data, etc. The vehicle state data includes at least one of speed information, steering angle, acceleration data, gear information, etc. The positioning data includes at least one of high-precision map data, global positioning system (GPS) data, inertial measurement unit (IMU) data, etc. The traffic environment data includes at least one of traffic flow information, traffic signal state, traffic weather state, etc.

[0042] With reference to Figure 2 Through the above three-layer structure, the training of the local model is implemented on the terminal device 130, the aggregation of the local model is implemented on the bottom-layer blockchain 120 to form a local model, and the global aggregation of the local model is implemented on the top-layer blockchain 110 to form a traffic prediction model. The training of the traffic prediction model no longer depends on the centralized top-layer blockchain 110, and even if a single point failure occurs in a terminal device 130, it will not have a serious impact on the global traffic prediction model.

[0043] The different terminal devices 130 locally perform local model training and then upload to the corresponding transaction shards in the bottom layer blockchain 120. The transaction shards are independent and concurrently interface the received multiple transaction nodes for consensus processing, that is, the verification relationship between the transaction nodes in the transaction shard is established, and the local model is formed by concurrent aggregation to improve the throughput. Based on the verification relationship, the unverified nodes at the end of the consensus are determined, and the model data of the unverified node corresponding to the highest model accuracy is uploaded to the top layer blockchain 110 as the local model corresponding to the transaction shard to ensure the model quality of the local model participating in global aggregation, and solve the problem of insufficient coupling between the existing consensus mechanism and the model quality evaluation system. Then, the top layer blockchain 110 performs global aggregation on multiple local models to obtain a traffic prediction model. Based on the above traffic prediction system, the problems of single point failure risk, low throughput, and insufficient coupling between the existing consensus mechanism and the model quality evaluation system in the existing traffic prediction method are solved.

[0044] In one embodiment, a traffic prediction method is provided, applied to a terminal device 130, and the traffic prediction method comprises:

[0045] In step S210, a first target node is selected from a target transaction shard in the bottom layer blockchain 120 based on a preset consensus algorithm, wherein the traffic prediction area corresponding to the target transaction shard is the area where the terminal device 130 is located, and the first target node includes at least one unverified transaction node in the target transaction shard.

[0046] Specifically, the terminal device 130 selects a first target node from a target transaction shard in the bottom layer blockchain 120 based on a preset consensus algorithm. The target transaction shard is the transaction shard corresponding to the traffic prediction area where the terminal device 130 is located, that is, the terminal device 130 needs to select different first target nodes from different transaction shards when it moves to different locations and is in different traffic prediction areas. The first target node includes at least one unverified transaction node in the target transaction shard, which is referred to as a tip node. The unverified transaction node refers to a transaction node that has not been selected by the terminal device for verification, but has been verified by the bottom layer blockchain, that is, the first target node includes at least one tip node.

[0047] For example, when the target transaction shard is in an initial state and no local model uploaded by the terminal device 130 is received, at this time, the target transaction shard only has one initial node, and the initial node is an unverified node corresponding to the base model, the first target node selected by the terminal device 130 from the target transaction shard only includes one unverified node. After that, with more and more local models uploaded by the terminal device 130 joining the transaction shard as transaction nodes, the number of transaction nodes in the transaction shard is increasing, and when the number of unverified nodes in the transaction shard exceeds two, the first target node includes two unverified nodes, that is, the terminal device 130 selects two unverified nodes from the target transaction shard according to the preset consensus algorithm, that is, the number of unverified nodes in the first target node N is greater than or equal to 1 and less than or equal to 2, that is, N∈[1, 2].

[0048] In step S220, the first target node is verified using local data to obtain a verification result.

[0049] Specifically, after the terminal device 130 selects the first target node from the underlying blockchain 120, the terminal device 130 verifies the first target node using local data, that is, verifies the model corresponding to the first target node, thereby obtaining the verification result of the model. The verification content specifically includes transaction legality, model gradient rationality, and timestamp validity, so as to ensure the availability of the model corresponding to the first target node, that is, the verification result is used to indicate the availability of the model corresponding to the first target node.

[0050] When the first target node includes one unverified node, the verification result represents the verification result of the unverified node; when the first target node includes two unverified nodes, only when the models corresponding to the two unverified nodes are both verified, the verification result of the first target node is verified, and at least one unverified node has a verification result of verification failure, then the verification result of the first target node is verification failure.

[0051] In step S230, when the verification result is verified, the base model is determined according to the model data corresponding to the first target node.

[0052] Specifically, when the verification result is verified, it means that the model corresponding to the first target node is effective and available, and then the base model for model training of the terminal device 130 is determined based on the model corresponding to the first target node.

[0053] When the verification result is a verification failure, it indicates that the first target node corresponding model is unavailable, and the base model cannot be determined based on the first target node corresponding model. Then, the terminal device 130 reports the verification result of the first target node to the underlying blockchain 120 to update the node selection state of the first target node in the target transaction shard, i.e., changing the node selection state of the first target node in the target transaction shard relative to the current terminal device 130 from optional to non-optional. Then, the current terminal device 130 reselects a new first target node based on the preset consensus algorithm, i.e., reselects other unverified nodes as new first target nodes for verification in the target transaction shard except the first target node with a verification failure, until the first target node passes the verification.

[0054] If the first target node is an initial node and the verification fails, the terminal device 130 uploads the verification result of the initial node corresponding model verification failure to the underlying blockchain 120, and the underlying blockchain 120 counts the verification results of the initial node corresponding base model of different terminal devices 130. If the number of verification successes exceeds half of the total number of verification results, it indicates that the current terminal device 130 fails to verify the initial node due to its own reasons. Then, the device type of the current terminal device 130 with a verification failure of the initial node is updated from an authorized device to an unauthorized device. Alternatively, the underlying blockchain 120 sends a message of the initial node verification success of other terminal devices 130 to the current terminal device 130, so that the current terminal device 130 knows that the base model is valid and available. Even if the base model fails to verify, the current terminal device 130 still uses the base model for local training. If most of the verification results are verification failures, the underlying blockchain 120 reports the verification result of the initial node verification failure to the top-level blockchain 110, which updates the base model and then updates the initial node in the underlying blockchain 120.

[0055] Step S240, training the base model using the local data to obtain a local model.

[0056] Specifically, after the terminal device 130 determines the base model to be trained based on the first target node corresponding model, the terminal device 130 locally trains the base model using local data to obtain a local model. The local model is a local model corresponding to a traffic prediction area.

[0057] Step S250, when the local model meets the model requirements of the base model, uploading the model data corresponding to the local model to the underlying blockchain 120. The underlying blockchain 120 is used to determine a local model based on the model data uploaded by the terminal device 130, and upload the model data of the local model to the top-level blockchain 110 for global aggregation processing to obtain a traffic prediction model.

[0058] Specifically, the terminal device 130 also compares the trained local model with the benchmark model to determine whether the model quality of the local model meets the standard. When the local model meets the model requirements of the benchmark model, the terminal device 130 uploads the model data of the local model to a target transaction shard of the underlying blockchain 120 and serves as a new unverified node in the target transaction shard. The underlying blockchain 120 establishes a verification relationship between the unverified node and a first target node verified by the terminal device 130 in the target transaction shard, so that the first target node changes from an unverified node to a verified node. That is, the underlying blockchain 120 establishes a verification relationship between the transaction node corresponding to the local model uploaded by the terminal device 130 and the first target node according to the verification result of the terminal device 130 on the first target node. Similarly, the transaction nodes in each transaction shard in the underlying blockchain 120 gradually form a DAG blockchain structure.

[0059] Since each transaction node corresponds to a model trained based on the model of a previous transaction node, each transaction shard naturally aggregates different local models. That is, the model corresponding to the unverified node in the transaction shard is the aggregated model. Then, the underlying blockchain 120 selects the model data of the model corresponding to the unverified node with the highest model accuracy and uploads it to the top-level blockchain 110. From the local model uploaded by the terminal device 130 to the local model uploaded by the underlying blockchain 120, the model quality is ensured to improve the model quality of the traffic prediction model.

[0060] Different terminal devices 130 train local models locally and then upload them to corresponding transaction shards in the underlying blockchain 120. The transaction shards are independent and in parallel and perform consensus processing on the received multiple transaction nodes, that is, establish a verification relationship between the transaction nodes in the transaction shard, thereby improving the throughput. Based on the verification relationship, the unverified node at the end of the consensus is determined. The model data corresponding to the unverified node with the highest model accuracy is uploaded to the top-level blockchain 110 as the local model corresponding to the transaction shard. This ensures the model quality of the local model participating in global aggregation and solves the problem of insufficient coupling between the existing consensus mechanism and the model quality evaluation system. The top-level blockchain 110 then globally aggregates multiple local models to obtain a traffic prediction model. Since the model training is implemented by multiple terminal devices 130, the dependence on core nodes is low, which realizes decentralized model training and avoids single-point failure risks, thereby solving the problems of single-point failure risks, low throughput, and insufficient coupling between the existing consensus mechanism and the model quality evaluation system in the existing traffic prediction method.

[0061] In an embodiment, the selecting the first target node from the target transaction shard in the underlying blockchain 120 based on the preset consensus algorithm comprises:

[0062] Obtaining model data corresponding to each existing node in the target transaction shard;

[0063] According to the local data and the model data corresponding to each existing node, calculating the node weight value of the model corresponding to each existing node relative to the terminal device 130;

[0064] Taking the initial node in the target transaction shard as a starting point of walking, walking in the plurality of existing nodes according to the node weight value in a large mode until walking to a target existing node, wherein the target existing node is the first existing node not verified in the target transaction shard according to the descending order of the node weight value, or the target existing node includes the first existing node and the second existing node not verified according to the descending order of the node weight value.

[0065] Taking the target existing node as the first target node.

[0066] Specifically, the terminal device 130 reads the model data corresponding to each existing node from the target transaction shard, and the existing node refers to the transaction node existing in the target transaction shard, and the existing node includes the verified node which has been verified and the unverified node which has not been verified. The terminal device 130 calculates the node weight value of the model corresponding to each existing node relative to the terminal device 130 by using the local data and the model data corresponding to each existing node, and the node weight value is used to represent the model score or model performance of the model corresponding to the existing node in the local model of the terminal device 130, and the higher the node weight value is, the better the model performance is.

[0067] Since all existing nodes have direct or indirect verification relationship with each other, when screening unverified nodes as the first target node, it is necessary to start from the initial node and walk in the direction opposite to the verification direction. The verification direction is the direction from the unverified node to the verified node, so the direction opposite to the verification direction is the direction from the verified node to the unverified node. That is, starting from the initial node, in the case that the initial node has direct verification relationship with multiple transaction nodes, it means that there are multiple walking paths after the initial node, and one of the multiple walking paths needs to be selected for walking. The selection of the walking path is based on the node weight value of each transaction node having direct verification relationship with the initial node relative to the terminal device 130. In the multiple walking paths, the walking path in which the transaction node with the maximum node weight value is selected for walking. In this way, when each transaction node faces multiple walking paths, the walking path in which the transaction node with the maximum node weight value is selected for walking is selected. Walking is performed until the unverified node is reached. The unverified node at the end of the walking path is taken as the first target node. In this way, two different unverified nodes are screened out.

[0068] For example, referring to Figure 4 , the initial node is A, the multiple transaction nodes having direct verification relationship with the initial node include node B and node C, the node weight value of node B relative to the terminal device 130 is 2, and the node weight value of node C relative to the terminal device 130 is 3. Then, the walking path is selected to node C, that is, node A walks to node C. The multiple transaction nodes having direct verification relationship with node C include node D and node E, the node weight value of node D relative to the terminal device 130 is 1, and the node weight value of node E relative to the terminal device 130 is 2. Then, the walking path is node C walking to node E. In the case of facing a fork in the walking process, the transaction node with a larger node weight value is selected for walking. The node weight value needs to be compared and judged at each fork. Until the unverified node is reached, node J and / or node K are selected as the first target node.

[0069] Based on the above walking method, the model best performing for the terminal device 130 can be screened out for local training, so as to ensure the training quality of the local model.

[0070] In one embodiment, according to the local data and the model data corresponding to each of the existing nodes, the node weight value of the model corresponding to each of the existing nodes relative to the terminal device 130 is calculated, comprising:

[0071] According to the local data and the model data corresponding to each of the existing nodes, the model training energy consumption of each of the existing nodes corresponding model, and the model accuracy of each of the existing nodes corresponding model relative to the terminal device 130 are calculated;

[0072] determine the node weight value of each of the existing nodes for the terminal device 130 in the target transaction shard according to the model training energy consumption of each of the existing node corresponding models and the model accuracy of each of the existing node corresponding models relative to the terminal device 130;

[0073] Or, determine the node weight value of each of the existing nodes for the terminal device 130 in the target transaction shard according to the model accuracy of each of the existing node corresponding models on the terminal device 130 and the verification number and random factor of each of the existing nodes.

[0074] Specifically, according to the model data corresponding to each of the existing nodes, the model training energy consumption of each of the existing node corresponding models is counted, and the maximum training energy consumption and the minimum training energy consumption in the model training energy consumption of all the existing node corresponding models are counted, and the model training energy consumption of the target existing node corresponding model is where the target existing node is any one of the existing nodes, C max is the maximum training energy consumption, C min is the minimum training energy consumption, is the model training energy consumption of the target existing node corresponding model trained by the uploading terminal device 130 of the target existing node, n is used to indicate the uploading terminal device 130 of the target existing node, represents the device cluster formed by each of the existing node corresponding terminal devices 130, t is used to indicate the current iteration training number of the traffic prediction model, L n represents the iteration number of the target existing node corresponding model, is the model training energy consumption of a single training of the model by the uploading terminal device 130 of the target existing node, ζ represents the effective capacitance parameter of the computing chip, U represents the CPU cycle number per bit of data, d n is the data amount used by the uploading terminal device 130 of the target existing node n, f n represents the CPU cycle frequency. The above model training energy consumption calculation function reflects the nonlinear influence of computing resources and data size on device energy consumption.

[0075] According to the local data and the model data corresponding to each of the existing nodes, the model accuracy of each of the existing node corresponding models relative to the terminal device 130 is calculated, and the model accuracy of the target existing node corresponding model relative to the terminal device 130 is where, ∈ nThe application accuracy of the target existing node corresponding model on the terminal device 130, that is, the model accuracy of the target existing node corresponding model on the terminal device 130, the same existing node corresponding model may exhibit different model accuracies on different terminal devices 130, ∈ max The maximum accuracy of the application accuracy of each existing node corresponding model on the terminal device 130, ∈ min The maximum accuracy of the application accuracy of each existing node corresponding model on the terminal device 130.

[0076] According to the model training energy consumption of each existing node corresponding model and the model accuracy of each existing node corresponding model relative to the terminal device 130, the node weight value of each existing node corresponding model relative to the terminal device 130 is comprehensively determined. Since the application accuracy of the same transaction node corresponding model on different terminal devices 130 is different, the node weight value of the same transaction node relative to different terminal devices 130 is different, that is, different terminal devices 130 select different walk paths based on different node weight values when selecting the first target node.

[0077] The node weight value of each existing node for the terminal device 130 in the target transaction shard can also be determined according to the model accuracy of each existing node corresponding model on the terminal device 130, and the verification times and random factors of each existing node, specifically including: determining the verification weight value of the target existing node according to the ratio of the verification times of the target existing node to the sum of the verification times of all previous nodes that have a direct or indirect verification relationship with the target existing node before the target existing node, and the verification weight value is node weight (n) is the verification times of the target existing node n, node weight (genesis) is the sum of the verification times of all previous nodes that have a direct or indirect verification relationship with the target existing node before the target existing node; determining the node weight value of the target existing node for the terminal device 130 according to the verification weight value of the target existing node and the first proportional coefficient corresponding to the verification weight value, and the model accuracy of the target existing node and the second proportional coefficient corresponding to the model accuracy, and the node weight value is:

[0078] hybrid weight (n) = e a·norm(n)

[0079]

[0080] Wherein, a is a random factor, λ1 is a first proportional coefficient, and λ2 is a second proportional coefficient.

[0081] The node weight value is calculated by the number of verifications of the node and the model accuracy to avoid selecting a tip node in only one direction, resulting in some transaction nodes being unable to obtain subsequent recognition, and a random walk parameter a is introduced to control randomness. Considering the prevention of malicious nodes interfering with the global model, the value of a should be reasonable: it cannot be too large, leading to excessive random walk, nor too small, leading to degradation of the random walk mechanism.

[0082] In one embodiment, the determination of the node weight value of each existing node in the target transaction shard with respect to the terminal device 130 according to the model training energy consumption of each existing node corresponding model and the model accuracy of each existing node corresponding model with respect to the terminal device 130 includes:

[0083] Obtain the current iteration training number corresponding to the traffic prediction model and the preset total training number;

[0084] Determine an initial weight coefficient according to the comparison relationship between the current iteration training number and the preset total training number;

[0085] Substitute the current iteration training number, the preset total training number and the initial weight coefficient into the decay exponential function to determine a first weight coefficient corresponding to the model training energy consumption;

[0086] Determine a second weight coefficient corresponding to the model accuracy based on the difference between the preset numerical value and the first weight coefficient;

[0087] Based on the first weight coefficient corresponding to the model training energy consumption and the second weight coefficient corresponding to the model accuracy, the model training energy consumption and the model accuracy of each existing node in the target transaction shard are weighted and summed to determine the node weight value corresponding to each existing node in the target transaction shard.

[0088] Specifically, the current iteration training number corresponding to the traffic prediction model is also the global aggregation number of the top-level blockchain 110. The top-level blockchain 110 obtains an iteration trained traffic prediction model every time it aggregates. The preset total training number is the training number configured for the traffic prediction model, which is used to limit the endless iteration training of the traffic prediction model. That is, the current iteration training number is less than or equal to the preset total training number. The current iteration training number and the preset total training number are issued by the top-level blockchain 110 to the bottom-level blockchain 120, and then issued by the bottom-level blockchain 120 to the terminal device 130.

[0089] The initial weight coefficient is determined according to a comparison result between the current iteration training number and the preset total training number, and specifically includes: when a difference between the preset total training number and the current iteration training number is greater than a first preset difference value, it indicates that the current iteration training number is much smaller than the preset total training number, that is, the current training is in an early training stage, and a first preset weight coefficient is selected as the initial weight coefficient, the first preset weight coefficient has a value range of (0, 1], so as to preferentially select a node with lower energy consumption, accelerate network consensus formation, and reduce resource consumption in the cold start stage; when the difference between the preset total training number and the current iteration training number is less than the first preset difference value and greater than or equal to a second preset difference value, the second preset difference value is less than the first preset difference value, and the second preset difference value is close to half of the preset total training number, it indicates that the current iteration training number is close to half of the preset total training number, that is, the current training is in a middle training stage, and a second preset weight coefficient is selected as the initial weight coefficient, the second preset weight coefficient is half of the first preset weight coefficient, so as to balance the energy consumption and accuracy rate indicators, and maintain the synchronous improvement of network stability and model quality; when the difference between the preset total training number and the current iteration training number is less than a third preset difference value, the third preset difference value is less than the second preset difference value, it indicates that the current iteration training number is close to the preset total training number, that is, the current training is in a late training stage, and a third preset weight coefficient is selected as the initial weight coefficient, the third preset weight coefficient is less than the second preset weight coefficient, that is, the third preset weight coefficient is close to 0, so as to focus on selecting a node with high model accuracy rate, and ensure the global model precision in the convergence stage.

[0090] The first weight coefficient corresponding to the model training energy consumption is λ(t) = λ0·e -ηt / T wherein λ0 is the initial weight coefficient, λ0 can be specifically the first preset weight coefficient λ1, the second preset weight coefficient λ2 or the third preset weight coefficient λ3, t is the current iteration training number, η is the decay factor, and T is the preset total training number.

[0091] The preset value is 1, the second weight coefficient corresponding to the model accuracy rate is 1-λ(t), the node weight value corresponding to the target existing node is obtained by weighting and summing the model training energy consumption and the corresponding first weight coefficient of the target existing node, and the model accuracy rate and the corresponding second weight coefficient. The node weight value integrates the model training energy consumption and the model accuracy rate of the model corresponding to the target existing node, and the subsequent walk selection of the tip node based on the node weight value can improve the model performance while ensuring the resource efficiency, and can dynamically adapt to the terminal device 130 algorithmic heterogeneity and data distribution Non-IID characteristics, and the algorithm of the node weight value realizes the collaborative optimization of consensus efficiency and model accuracy.

[0092] In one embodiment, when the verification result is verification passed, determining a base model according to the model data corresponding to the first target node includes:

[0093] When the verification result is passed and the first target node includes two unverified transaction nodes, performing weighted averaging processing on the model data corresponding to the two transaction nodes in the first target node to obtain model data corresponding to the basic model; or

[0094] When the verification result is verification passed and the first target node includes an unverified transaction node, the transaction node corresponding model in the first target node is used as the basic model.

[0095] Specifically, when the first target node includes one unverified node, the model corresponding to the transaction node is directly used as the base model. When the first target node includes two unverified nodes, the model data of the two unverified nodes is weighted averaged to achieve aggregation of the models corresponding to the two unverified nodes, and the aggregated model is used as the base model. The terminal device 130 uses local data to iteratively train the local model based on the previous transaction node model to generate a local model.

[0096] In one embodiment, Figure 3 A flow chart of a traffic prediction method in one embodiment is shown in FIG. Figure 3 , provides a traffic prediction method. This embodiment mainly applies this method to the above Figure 1 Taking the underlying blockchain 120 in

[15] as an example, the traffic prediction method specifically includes the following steps:

[0097] Step S310: Use the model data of the basic model issued by the top-level blockchain 110 as the initial node in each transaction shard.

[0098] Specifically, the top-level blockchain 110 generates a model training task through a smart contract. The model training task includes the model data of the base model, the training configuration of the transaction shard, the model training end conditions, etc., and stores the model training task in the top-level blockchain 110. The smart contract triggers the transaction shard in the bottom-level blockchain 120 according to the model training task to start the training task, that is, sending the model data of the base model to the bottom-level blockchain 120, and the bottom-level blockchain 120 adds the model data of the base model as the initial node to each transaction shard. At this time, each transaction shard only has one transaction node, the initial node. The bottom-level blockchain 120 adopts a blockchain structure based on a directed acyclic graph (DAG), that is, each transaction shard includes multiple transaction nodes with directed arrows pointing to relationships. The model data corresponding to each transaction node includes complete metadata such as model parameters, gradients, device signatures, and timestamps.

[0099] Step S320, when receiving the model data of the local model uploaded by the target terminal device in the target traffic prediction area, adding the model data uploaded by the target terminal device as a second target node to the target transaction shard corresponding to the target traffic prediction area, and establishing a verification relationship between the second target node and the verified node corresponding to the target terminal device in the target transaction shard.

[0100] Specifically, each transaction shard in the underlying blockchain 120 receives the model data of the local model uploaded by the terminal device 130 corresponding to the same traffic prediction area, saves the model data of each local model as a transaction node to the corresponding transaction shard, and establishes a verification relationship between the newly added transaction node and other existing transaction nodes. Specifically, the verified node verified by the target terminal device establishes a verification relationship with the newly added second target node, and the target terminal device verifies the unverified node at the consensus end in the target transaction shard according to the preset consensus algorithm. The unverified node is an unverified transaction node, and the unverified node is referred to as a tip node. Referring to Figure 4 The nodes K and J in are tip nodes. After verification, the unverified node is used as the verified node corresponding to the target terminal device. Different terminal devices 130 may select different unverified nodes at the consensus end in the same transaction shard for verification according to the same preset consensus algorithm.

[0101] Establishing a verification relationship between the second target node and the verified node corresponding to the target terminal device in the target transaction shard is to realize node consensus in the target transaction shard. Referring to Figure 4 , the block at the right end without a directed arrow pointing to it is the unverified node at the consensus end, and the directed arrow points to the verification relationship, for example, the B transaction node points to the A node transaction to the left, indicating that the B transaction node verifies the A transaction node, that is, the terminal device 130 uploading the B transaction node verifies the A transaction node. The consensus is performed based on the verification relationship between the transaction nodes, and the unverified node at the consensus end after the consensus processing includes the newly added second target node.

[0102] Step S330, based on the verification relationship between each transaction node in the target transaction shard, determining a plurality of unverified nodes that have not been verified, wherein the plurality of unverified nodes includes the second target node.

[0103] Specifically, based on the verification relationship between each transaction node in the target transaction shard, the unverified node at the consensus end that has not been verified can be determined. The unverified node is a transaction node without a directed arrow pointing to it.

[0104] In step S340, the model data corresponding to the unverified node with the highest model accuracy is uploaded to the top-level blockchain 110 as the model data of the local model corresponding to the target transaction shard, and the top-level blockchain 110 is used to perform global aggregation processing on the model data of the plurality of local models uploaded by the bottom-level blockchain 120 to obtain a traffic prediction model.

[0105] Specifically, different transaction nodes correspond to different local models, and the model accuracies of different local models are different. There can be a plurality of unverified nodes at the end of consensus in each transaction shard. The local model corresponding to the unverified node with the highest model accuracy is selected as the local model corresponding to the transaction shard. The model data of the local model includes model parameters, model accuracy, clustering labels, and other metadata. Each transaction shard selects a local model according to the rule. The model corresponding to the unverified node at the end of consensus is iteratively trained on the basis of the model corresponding to the previously verified transaction node. Therefore, the model corresponding to the unverified node at the end of consensus is an aggregated model based on all previous local models. Therefore, the transaction shard can implement aggregation processing of the local model. Different transaction shards use an asynchronous parallel consensus processing manner, which greatly improves the throughput and thus improves the consensus efficiency and verification efficiency of the system.

[0106] The smart contract of the top-level blockchain 110 monitors the model transactions uploaded by each transaction shard in real time. The model transaction is the model data of the local model. When a sufficient number of valid transactions are collected or a predetermined timestamp is reached, the aggregation process of the global model is triggered. The entire aggregation process is automatically executed through the smart contract of the top-level chain, and all operation records are recorded on the Hyperchain consortium chain to ensure traceability and non-tamperability. This mechanism not only avoids the single-point risk of traditional centralized aggregation, but also solves the model drift problem of pure distributed aggregation. In actual traffic scenarios, the top-level blockchain 110 dynamically adjusts the model weights of each local model according to the model quality, model data diversity, and reputation value (i.e., historical performance of the model) uploaded by each transaction shard. For example, the local model uploaded by the traffic hub shard is given a higher model weight due to high data diversity, while the local model uploaded by the suburban shard is given a lower model weight due to single data distribution. Then, the model weights of the local models are used for weighted averaging to implement global model aggregation processing, thereby ensuring that the finally generated global model is more suitable for actual road conditions.

[0107] Based on the above method, different terminal devices 130 locally perform local model training and then upload to the corresponding transaction shards in the bottom layer blockchain 120, and the transaction shards are independent and concurrently connected to the received multiple transaction nodes for consensus processing, that is, the verification relationship between each transaction node in the transaction shard is established, thereby improving the throughput. Based on the verification relationship, the unverified nodes located at the end of the consensus are determined, and the model data corresponding to the unverified node with the highest model accuracy is uploaded to the top layer blockchain 110 as the local model corresponding to the transaction shard to ensure the model quality of the local model participating in global aggregation, solving the problem of insufficient coupling between the existing consensus mechanism and the model quality evaluation system. The top layer blockchain 110 performs global aggregation on multiple local models to obtain a traffic prediction model. Since the model training is implemented by multiple terminal devices 130, the dependence on core nodes is low, realizing decentralized model training and avoiding single point failure risk, thereby solving the problems of existing traffic prediction methods, such as single point failure risk, low throughput, and insufficient coupling between the existing consensus mechanism and the model quality evaluation system.

[0108] In one embodiment, before adding the model data uploaded by the target terminal device as a second target node to the target transaction shard corresponding to the target traffic prediction area and establishing a verification relationship between the second target node and the verified node corresponding to the target terminal device in the target transaction shard when receiving the model data of the local model uploaded by the target terminal device in the target traffic prediction area, the method further comprises:

[0109] Obtaining device running data uploaded by each terminal device 130;

[0110] The terminal device 130 whose device running data meets the model training requirement is regarded as an authorized device;

[0111] In the case where the target terminal device is an authorized device, the target terminal device is allowed to download a reference model, and the step of adding the model data uploaded by the target terminal device as a second target node to the target transaction shard corresponding to the target traffic prediction area and establishing a verification relationship between the second target node and the verified node corresponding to the target terminal device in the target transaction shard when receiving the model data of the local model uploaded by the target terminal device in the target traffic prediction area, wherein the reference model is used as a training reference for the target terminal device as a local model.

[0112] Specifically, before the target terminal device uploads the local model to the underlying blockchain 120, the authorized device suitable for local model training needs to be screened according to the device running data uploaded by each terminal device 130, and the device running data specifically includes at least one of the local data features, the remaining power situation, and the network connection quality. In the case where the device running data includes one running parameter, whether the corresponding terminal device 130 meets the model training requirement is determined according to whether the corresponding value of the running parameter is greater than or equal to the corresponding parameter threshold. In the case where the device running data includes multiple running parameters, whether the corresponding terminal device 130 meets the model training requirement can be determined according to the weighted result of the multiple running parameters.

[0113] The terminal device 130 whose device running data meets the model training requirement is regarded as an authorized device allowed to perform local model training. In the case where the target terminal device is an authorized device, the target terminal device is allowed to download the baseline model from the underlying blockchain 120 and perform local training by referring to the baseline model using local data to generate a local model. That is, the authorized device completes the baseline model download and local model upload through the underlying chain secure channel, and the entire selection process is independently run among each transaction shard. Each transaction shard avoids cross-shard resource competition through a state isolation mechanism, thereby improving the parallel processing capability of the underlying blockchain 120. Subsequently, the underlying blockchain 120 executes the step of adding the model data uploaded by the target terminal device as a second target node to the target transaction shard corresponding to the target traffic prediction area, and establishing a verification relationship between the second target node and the verified node corresponding to the target terminal device in the target transaction shard when receiving the model data uploaded by the target terminal device in the target traffic prediction area.

[0114] That is, the underlying blockchain 120 only receives the local model uploaded by the authorized device, and the authorized device is a terminal device 130 that meets the local model training condition. In this way, the reliability and stability of the local model training can be ensured, and the model quality of the local model can be improved.

[0115] Figure 3 And Figure 5 is a flowchart of the traffic prediction method in one embodiment. It should be understood that although the steps in the flowchart of Figure 3 And Figure 5 are displayed in sequence according to the arrows, these steps are not necessarily executed in sequence according to the arrows. Unless otherwise specified herein, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other sequences. Moreover, Figure 3 And Figure 5At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.

[0116] like Figure 6 As shown, an embodiment of the present application provides a computer device, which can be equipped with a top-level blockchain 110 or a bottom-level blockchain 120 in a traffic prediction system, or a terminal device 130. The computer device includes a processor 711, a communication interface 712, a memory 713, and a communication bus 714. The processor 711, the communication interface 712, and the memory 713 communicate with each other through the communication bus 714.

[0117] Memory 713, for storing computer programs;

[0118] The processor 711 is configured to implement the traffic prediction method provided by any one of the aforementioned method embodiments when executing the program stored in the memory 713 .

[0119] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0120] In one embodiment, the traffic prediction system provided by the present application can be implemented in the form of a computer program. Figure 6 The computer device is shown. The memory of the computer device can store various program modules that constitute the traffic prediction system. The computer program composed of each program module enables the processor to execute the traffic prediction method of each embodiment of the present application described in this specification.

[0121] An embodiment of the present application further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the traffic prediction method provided by any of the aforementioned method embodiments is implemented.

[0122] The system embodiments described above are only illustrative, wherein the units described as separate components can or can not be physically separate, and the components displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed on multiple network units. Part or all of the modules can be selected according to actual needs to achieve the purpose of the embodiment.

[0123] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be realized by means of software plus a general hardware platform, and of course can also be realized by hardware. Based on such understanding, the above technical solutions can be embodied in the form of a software product, and the computer software product can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, etc., and includes a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in each embodiment or some parts of the embodiments.

[0124] It should be understood that the terms used herein are for the purpose of describing specific example embodiments only and are not intended to be limiting. As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. The terms "comprises", "comprising", "includes", "including" and "has", "having" are inclusive and therefore specify the presence of stated features, steps, operations, elements, and / or components, but do not preclude the presence or addition of one or more other features, steps, operations, elements, components, and / or groups thereof. The method steps, processes, and operations described herein are not to be construed as necessarily requiring their performance in the particular order in which they are described, unless explicitly stated otherwise. It is also to be understood that additional or alternative steps can be employed.

[0125] The above description is merely illustrative of the application and is not intended to limit the scope of the application. Various modifications can be made to the embodiments described herein without departing from the spirit or scope of the application. Therefore, the application is not limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A traffic prediction method, characterized in that: Applied to a terminal device, the traffic prediction method includes: Selecting a first target node from a target transaction shard in the underlying blockchain based on a preset consensus algorithm, wherein the traffic prediction area corresponding to the target transaction shard is the area where the terminal device is located, and the first target node includes at least one unverified transaction node in the target transaction shard; Using local data to verify the first target node to obtain a verification result; When the verification result is verification passed, determining a basic model according to the model data corresponding to the first target node; Using the local data to train the basic model to obtain a local model; When the local model meets the model requirements of the benchmark model, the local model is used to predict the traffic conditions in the traffic prediction area where the terminal device is located to obtain a traffic prediction result, and the model data corresponding to the local model is uploaded to the underlying blockchain, wherein the underlying blockchain is used to determine the local model based on the model data uploaded by the terminal device, and upload the model data of the local model to the top-level blockchain to participate in global aggregation processing to obtain a traffic prediction model. The traffic prediction model is sent from the top-level blockchain to each transaction shard in the underlying blockchain as the initial node of the next training cycle, and is used as the basic model of the terminal device in the next training cycle.

2. The method according to claim 1, characterized in that The selecting a first target node from a target transaction shard in the underlying blockchain based on a preset consensus algorithm includes: Obtain model data corresponding to each existing node in the target transaction shard; Calculating a node weight value of the model corresponding to each of the existing nodes relative to the terminal device based on the local data and the model data corresponding to each of the existing nodes; Using the initial node in the target transaction shard as the starting point of the roaming, roaming among multiple existing nodes in a manner of selecting the largest node weight value until roaming to the target existing node, wherein the target existing node is the first unverified existing node in the target transaction shard in descending order of node weight value, or the target existing node includes the first existing node and the second unverified existing node in descending order of node weight value; The target existing node is used as the first target node.

3. The method according to claim 2, characterized in that Calculating, based on the local data and the model data corresponding to each of the existing nodes, a node weight value of the model corresponding to each of the existing nodes relative to the terminal device, including: Calculating, based on the local data and the model data corresponding to each of the existing nodes, the model training energy consumption of the model corresponding to each of the existing nodes, and the model accuracy of the model corresponding to each of the existing nodes relative to the terminal device; Determining a node weight value of each of the existing nodes in the target transaction shard with respect to the terminal device based on the model training energy consumption of the model corresponding to each of the existing nodes and the model accuracy of each of the existing node corresponding models relative to the terminal device; or The node weight value of each of the existing nodes in the target transaction shard for the terminal device is determined based on the model accuracy of the corresponding model of each of the existing nodes on the terminal device, as well as the number of verifications and random factors of each of the existing nodes.

4. The method according to claim 3, characterized in that Determining the node weight value of each of the existing nodes in the target transaction shard with respect to the terminal device based on the model training energy consumption of the model corresponding to each of the existing nodes and the model accuracy of each of the existing node corresponding models relative to the terminal device includes: Obtaining a current number of iterative training times and a preset total number of training times corresponding to the traffic prediction model; determining an initial weight coefficient based on a comparison relationship between the current number of iterative training times and the preset total number of training times; Substituting the current number of iterative training times, the preset total number of training times, and the initial weight coefficient into a decay exponential function to determine a first weight coefficient corresponding to the model training energy consumption; Determining a second weight coefficient corresponding to the model accuracy based on a difference between a preset value and the first weight coefficient; Based on the first weight coefficient corresponding to the model training energy consumption and the second weight coefficient corresponding to the model accuracy, the model training energy consumption and model accuracy of each existing node in the target transaction shard are weighted and summed to determine the node weight value corresponding to each existing node in the target transaction shard.

5. The method according to claim 1, wherein When the verification result is verification passed, determining a basic model according to the model data corresponding to the first target node includes: When the verification result is passed and the first target node includes two unverified transaction nodes, performing weighted averaging processing on the model data corresponding to the two transaction nodes in the first target node to obtain model data corresponding to the basic model; or When the verification result is verification passed and the first target node includes an unverified transaction node, the transaction node corresponding model in the first target node is used as the basic model.

6. A traffic prediction method, characterized in that: Applied to the underlying blockchain, the traffic prediction method includes: The model data of the basic model issued by the top-level blockchain is used as the initial node in each transaction shard, and the basic model corresponding to the initial node is issued to each terminal device, so that the terminal device iteratively trains the basic model to generate a local model, so that the terminal device uses the local model to predict the traffic conditions in the traffic prediction area where the terminal device is located to obtain a traffic prediction result; Upon receiving model data of a local model uploaded by a target terminal device in a target traffic prediction area, the model data uploaded by the target terminal device is added as a second target node to a target transaction shard corresponding to the target traffic prediction area, and a verification relationship is established between the second target node and a verified node corresponding to the target terminal device in the target transaction shard; Determining a plurality of unverified nodes that have not been verified based on the verification relationship between each transaction node in the target transaction shard, wherein the plurality of unverified nodes includes the second target node; The model data corresponding to the unverified node with the highest model accuracy is uploaded to the top-level blockchain as the model data of the local model corresponding to the target transaction shard, wherein the top-level blockchain is used to perform global aggregation processing on the model data of multiple local models uploaded from the bottom-level blockchain to obtain a traffic prediction model; The traffic prediction model is obtained from the top-level blockchain, and the traffic prediction model is used as the basic model for the next training cycle. The model data of the basic model issued by the top-level blockchain is cyclically executed as the initial node in each transaction shard, and the basic model corresponding to the initial node is issued to each terminal device, so that the terminal device iteratively trains the basic model and then generates a local model, so that the terminal device uses the local model to predict the road conditions in the traffic prediction area where the terminal device is located, and obtains the traffic prediction result.

7. The method according to claim 6, characterized in that Upon receiving model data of a local model uploaded by a target terminal device within a target traffic prediction area, before adding the model data uploaded by the target terminal device as a second target node to a target transaction shard corresponding to the target traffic prediction area, and establishing a verification relationship between the second target node and a verified node corresponding to the target terminal device in the target transaction shard, the method further includes: Obtain device operation data uploaded by each terminal device; Terminal devices whose operation data meets the model training requirements are designated as authorized devices; In the case that the target terminal device is an authorized device, the target terminal device is allowed to download the benchmark model, and upon receiving the model data of the local model uploaded by the target terminal device in the target traffic prediction area, the model data uploaded by the target terminal device is added as a second target node to the target transaction shard corresponding to the target traffic prediction area, and a verification relationship is established between the second target node and the verified node corresponding to the target terminal device in the target transaction shard, wherein the benchmark model is used as a training reference for the local model in the target terminal device.

8. A traffic prediction system, characterized in that: The traffic prediction system includes: The top-level blockchain is used to provide a basic model for the bottom-level blockchain, and to globally aggregate the model data of multiple local models uploaded by the bottom-level blockchain to obtain a traffic prediction model. The traffic prediction model is then sent to the bottom-level blockchain as the updated basic model for iterative cycles. The bottom blockchain is used to use the model data of the basic model issued by the top blockchain as the initial node in each transaction shard; the model data of the local model uploaded by the terminal devices in different traffic prediction areas are added as transaction nodes to the transaction shard corresponding to the traffic prediction area, and the verification relationship between different transaction nodes in the same transaction shard and the initial node is determined; the model data corresponding to the unverified transaction node with the highest model accuracy in the same transaction shard is uploaded to the top blockchain as the model data of the local model; A terminal device is used to select a first target node from a target shard in the underlying blockchain based on a preset consensus algorithm; use local data to verify the first target node to obtain a verification result; when the verification result is verification passed, determine a basic model based on the model data corresponding to the first target node; use the local data to train the basic model to obtain a local model, and when the local model meets the model requirements of the benchmark model, use the local model to predict the traffic conditions in the traffic prediction area where the terminal device is located to obtain a traffic prediction result, and upload the model data corresponding to the local model to the underlying blockchain, wherein the traffic prediction area corresponding to the target shard is the area where the terminal device is located, and the first target node includes at least one unverified transaction node in the target shard.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.