WO2023088131A1 - Traffic state prediction method and apparatus, and device, medium and program - Google Patents
Traffic state prediction method and apparatus, and device, medium and program Download PDFInfo
- Publication number
- WO2023088131A1 WO2023088131A1 PCT/CN2022/130549 CN2022130549W WO2023088131A1 WO 2023088131 A1 WO2023088131 A1 WO 2023088131A1 CN 2022130549 W CN2022130549 W CN 2022130549W WO 2023088131 A1 WO2023088131 A1 WO 2023088131A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- chromosome
- convolutional network
- units
- network model
- spatio
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F30/00—Computer-aided design [CAD]
- G06F30/20—Design optimisation, verification or simulation
- G06F30/27—Design optimisation, verification or simulation using machine learning, e.g. artificial intelligence, neural networks, support vector machines [SVM] or training a model
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/049—Temporal neural networks, e.g. delay elements, oscillating neurons or pulsed inputs
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/12—Computing arrangements based on biological models using genetic models
- G06N3/126—Evolutionary algorithms, e.g. genetic algorithms or genetic programming
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2119/00—Details relating to the type or aim of the analysis or the optimisation
- G06F2119/12—Timing analysis or timing optimisation
Definitions
- the present disclosure relates to the technical field of intelligent transportation, and in particular to a traffic state prediction method, device, equipment, medium and program.
- Traffic status prediction is an important part of intelligent transportation.
- the predicted traffic status information can help people make travel route decisions, thereby alleviating traffic congestion and improving the happiness of urban living.
- the traffic state is usually predicted by statistical methods, and the traffic state at the next moment is predicted by counting the number of vehicles and the speed of vehicles within a period of time.
- the statistical method relies on experience to predict the traffic state, and the accuracy of predicting the traffic state is relatively low. Difference.
- Embodiments of the present disclosure provide a traffic state prediction method, device, equipment, medium, and program to solve the problem in the prior art that traffic state is predicted by statistical methods and the accuracy of traffic state prediction is poor.
- An embodiment of the present disclosure provides a traffic state prediction method, the method comprising:
- Traffic status is predicted based on the pre-trained spatio-temporal convolutional network model.
- the chromosome unit includes at least one of the following: layer number bits, observation domain bits, and expansion factor bits; wherein, the layer number bits are used to characterize the spatio-temporal convolutional network model The number of layers of the hidden layer, the observation domain bit is used to represent the observation domain of each hidden layer, and the expansion factor bit is used to represent the convolution expansion factor of each hidden layer.
- updating the plurality of chromosome units according to the loss values of the time-space convolutional network models corresponding to the plurality of chromosome units includes: according to the loss values of the time-space convolutional network models corresponding to the plurality of chromosome units Sorting the plurality of chromosome units from high to low in loss value; generating M2 first chromosome units based on the first M1 chromosome units, both M1 and M2 are positive integers, and M1 is greater than or equal to M2; The last M2 chromosome units in the unit are replaced by the M2 first chromosome units.
- the generating M2 first chromosome units based on the first M1 chromosome units includes: performing hybridization processing on the first M1 chromosome units to obtain at least one hybrid chromosome unit; performing hybridization processing on the first M1 chromosome units The mutation process is to obtain at least one mutant chromosome unit; wherein, the M2 first chromosome units include the at least one hybrid chromosome unit and the at least one mutant chromosome unit.
- the target chromosomal unit is the chromosomal unit that is sorted at the top after the number of updates reaches the first preset number; or, the target chromosomal unit is the chromosome unit that is sorted at the top for M3 consecutive times during the update process, M3 greater than or equal to the second preset number of times.
- the prediction of the traffic state based on the pre-trained spatio-temporal convolutional network model includes: inputting the real traffic state of the target road section N prediction moments before the current moment into the pre-trained spatio-temporal convolution Network model; wherein, the spatio-temporal convolutional network model includes an input layer, an output layer and a plurality of hidden layers connected between the input layer and the output layer, and the input layer is used to input the data before the current moment
- the real traffic state at N prediction moments, the output of each hidden layer in the plurality of hidden layers is obtained by performing convolution calculation on the input of each hidden layer based on the spatiotemporal attention mechanism, and N is a positive integer; based on The output of the output layer determines the predicted traffic state of the target road segment at the predicted time after the current time.
- the input layer is also used to input additional state information
- the additional state information is used to characterize the environmental characteristics of the traffic state
- the plurality of hidden layers include a first hidden layer, the second hidden layer A hidden layer is connected to the input layer, and the first hidden layer is used to fuse the real traffic state of the N predicted moments before the current moment with the additional state information.
- An embodiment of the present disclosure provides a traffic state prediction device, the device comprising:
- a generating part configured to generate a plurality of chromosome units, each of which is used to represent a class of spatio-temporal convolutional network models
- the calculation part is configured to separately calculate the loss value of the spatio-temporal convolutional network model corresponding to each of the chromosome units in the plurality of chromosome units based on the sample set;
- the update part is configured to update the plurality of chromosome units according to the loss value of the spatio-temporal convolutional network model corresponding to the plurality of chromosome units, and return to perform the calculation of each of the plurality of chromosome units based on the sample set.
- the determining part is configured to determine a pre-trained spatiotemporal convolutional network model based on the spatiotemporal convolutional network model corresponding to the target chromosome unit;
- the prediction part is configured to predict the traffic state based on the pre-trained spatio-temporal convolutional network model.
- the chromosome unit includes at least one of the following: layer number bits, observation domain bits, and expansion factor bits; wherein, the layer number bits are used to characterize the spatio-temporal convolutional network model The number of layers of the hidden layer, the observation domain bit is used to represent the observation domain of each hidden layer, and the expansion factor bit is used to represent the convolution expansion factor of each hidden layer.
- the updating part includes: a sorting subsection configured to sort the multiple chromosome units from high to low according to the loss values of the spatio-temporal convolutional network models corresponding to the multiple chromosome units; generating sub-parts, configured to generate M2 first chromosome units based on the first M1 chromosome units, where both M1 and M2 are positive integers, and M1 is greater than or equal to M2; replacing sub-parts, configured to convert the plurality of chromosome units The last M2 chromosome units are replaced by the M2 first chromosome units.
- the generation sub-part is further configured to perform hybridization processing on the first M1 chromosome units to obtain at least one hybrid chromosome unit; perform mutation processing on the first M1 chromosome units to obtain at least one mutant chromosome unit; wherein, the M2 first chromosome units include the at least one hybrid chromosome unit and the at least one variant chromosome unit.
- the target chromosomal unit is the chromosomal unit that is sorted at the top after the number of updates reaches the first preset number; or, the target chromosomal unit is the chromosome unit that is sorted at the top for M3 consecutive times during the update process, M3 greater than or equal to the second preset number of times.
- the prediction part is further configured to input the real traffic state of the target road section N prediction moments before the current moment into the pre-trained spatiotemporal convolutional network model; wherein, the spatiotemporal convolutional network The model includes an input layer, an output layer and a plurality of hidden layers connected between the input layer and the output layer, the input layer is used to input the real traffic status of N prediction moments before the current moment, the The output of each hidden layer in the plurality of hidden layers is obtained by performing convolution calculation on the input of each hidden layer based on the spatiotemporal attention mechanism, and N is a positive integer; the target road section is determined based on the output of the output layer The predicted traffic state at a predicted time after the current time.
- the spatiotemporal convolutional network The model includes an input layer, an output layer and a plurality of hidden layers connected between the input layer and the output layer, the input layer is used to input the real traffic status of N prediction moments before the current moment, the The output of each hidden layer in the plurality of hidden layers is obtained by performing con
- the input layer is also used to input additional state information
- the additional state information is used to characterize the environmental characteristics of the traffic state
- the plurality of hidden layers include a first hidden layer, the second hidden layer A hidden layer is connected to the input layer, and the first hidden layer is used to fuse the real traffic state of the N predicted moments before the current moment with the additional state information.
- An embodiment of the present disclosure provides an electronic device, including: a processor, a memory, and a program stored in the memory and operable on the processor.
- the program is executed by the processor, any of the above-mentioned The traffic state prediction method described above.
- An embodiment of the present disclosure provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, any one of the traffic state prediction methods described above is implemented.
- An embodiment of the present disclosure provides a computer program, the computer program includes computer-readable codes, and when the computer-readable codes run in an electronic device, the processor of the electronic device executes to implement any of the above-mentioned The traffic state prediction method described above.
- a plurality of chromosome units are generated, and each chromosome unit is used to characterize a class of spatio-temporal convolutional network model; based on the sample set, the time-space corresponding to each of the chromosome units in the plurality of chromosome units is calculated respectively.
- the loss value of the convolutional network model update the plurality of chromosome units according to the loss value of the spatio-temporal convolutional network model corresponding to the plurality of chromosome units, and return to perform the calculation of the plurality of chromosome units based on the sample set
- the step of the loss value of the spatio-temporal convolutional network model corresponding to each of the chromosomal units until the target chromosomal unit satisfying the preset condition is determined; the pre-trained spatio-temporal convolution is determined based on the spatio-temporal convolutional network model corresponding to the target chromosomal unit A network model; predicting a traffic state based on the pre-trained spatio-temporal convolutional network model.
- predicting the traffic state through the pre-trained spatio-temporal convolutional network model can improve the accuracy of predicting the traffic state; and using the evolutionary algorithm to optimize the model structure of the spatio-temporal convolutional network model can reduce the parameters of debugging the spatio-temporal convolutional network model the cost of.
- FIG. 1 is a flow chart of a traffic state prediction method provided by an embodiment of the present disclosure
- FIG. 2 is one of the schematic structural diagrams of a space-time convolutional network model provided by an embodiment of the present disclosure
- Fig. 3 is one of the schematic diagrams of information transmission in a space-time convolutional network model provided by an embodiment of the present disclosure
- Fig. 4 is the second schematic diagram of information transmission in a space-time convolutional network model provided by an embodiment of the present disclosure
- Fig. 5 is the third schematic diagram of information transmission in a space-time convolutional network model provided by an embodiment of the present disclosure
- FIG. 6 is the second structural schematic diagram of a space-time convolutional network model provided by an embodiment of the present disclosure.
- FIG. 7 is a schematic structural diagram of a traffic state prediction device provided by an embodiment of the present disclosure.
- Fig. 8 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure.
- Embodiments of the present disclosure provide a traffic state prediction method, device, equipment, medium, and program to solve the problem in the prior art that traffic state is predicted by statistical methods and the accuracy of traffic state prediction is poor.
- FIG. 1 is a flow chart of a traffic state prediction method provided by an embodiment of the present disclosure. As shown in FIG. 1, the method includes the following steps:
- Step 101 generating a plurality of chromosome units, each of which is used to represent a class of spatio-temporal convolutional network models;
- Step 102 respectively calculating the loss value of the spatio-temporal convolutional network model corresponding to each of the chromosome units in the plurality of chromosome units based on the sample set;
- Step 103 Update the plurality of chromosome units according to the loss values of the spatio-temporal convolutional network models corresponding to the plurality of chromosome units, and return to perform the calculation based on the sample set for each of the chromosomes in the plurality of chromosome units The step of the loss value of the spatio-temporal convolutional network model corresponding to the unit, until the target chromosome unit satisfying the preset condition is determined;
- Step 104 determining a pre-trained spatiotemporal convolutional network model based on the spatiotemporal convolutional network model corresponding to the target chromosome unit;
- Step 105 Predict traffic status based on the pre-trained spatio-temporal convolutional network model.
- multiple chromosome units can be randomly combined to generate, and the generated chromosome units can also be deduplicated to avoid repeated chromosome units.
- the total number of chromosome units can be initialized as 100, and 100 non-repetitive chromosome units can be randomly combined.
- the sample set can be a training sample set and/or a testing sample set.
- the chromosome unit may include at least one of the following: layer number bits, observation domain bits, expansion factor bits, etc., wherein the layer number bits are used to represent the hidden layer of the spatio-temporal convolutional network model
- the number of layers, the observation domain bits are used to characterize the observation domain k of each hidden layer, that is, the number of kernals, and the expansion factor bits are used to characterize the convolution expansion factor d of each hidden layer, namely Dilation factor.
- the loss value of the spatio-temporal convolutional network model corresponding to each of the chromosome units in the plurality of chromosome units based on the sample set taking a single chromosome unit as an example, it can be randomly selected from the training sample set or the test sample set Select preset time-continuous samples to calculate the loss value of the temporal-spatial convolutional network model corresponding to the chromosome unit; or, randomly select some time-continuous samples from the training sample set to the temporal-spatial convolutional network corresponding to the chromosome unit
- the model is trained, and when the number of training rounds reaches the preset number of rounds, samples with a preset duration and continuous time are randomly selected from the test sample set to calculate the loss value of the spatio-temporal convolutional network model corresponding to the chromosome unit.
- the samples used to calculate the loss value for the spatio-temporal convolutional network models corresponding to multiple chromosome units can be the same or different.
- the preset duration can be 2 hours, 1 hour or 0.5 hours and so on. For example, samples from 4:00 to 5:00 may be used to calculate the loss value.
- the loss value of the spatio-temporal convolutional network model can be the average of the loss values of the preset time-continuous samples and the real value.
- the loss value of the preset duration and time-continuous samples and the real value can be calculated, and then averaged to obtain the loss value of the spatio-temporal convolutional network model.
- the loss value of the spatio-temporal convolutional network model can be used as an evaluation value, which can be used as an indicator of the quality of the chromosome. The smaller the evaluation value, the better the chromosome.
- update iterations may be performed on the multiple chromosome units until a target chromosome unit that satisfies the preset condition is determined.
- the process of updating and iterating multiple chromosomal units may be as follows: respectively calculate the loss value of the spatio-temporal convolutional network model corresponding to each of the chromosomal units in the multiple chromosomal units based on the sample set; The loss value of the space-time convolutional network model of the plurality of chromosome units is updated, and the calculation of the loss value of the space-time convolutional network model corresponding to each of the chromosome units in the plurality of chromosome units is returned based on the sample set. Steps until the target chromosome unit satisfying the preset condition is determined.
- the process of updating and iterating multiple chromosome units may be as follows:
- each of the chromosomal units can be used to characterize a class of structural spatio-temporal convolutional network models.
- the structure of a class of spatio-temporal convolutional network models corresponding to different chromosome units is different.
- the spatiotemporal convolutional network model corresponding to each chromosomal unit may be a type of spatiotemporal convolutional network model represented by each chromosomal unit.
- the spatiotemporal convolutional network model corresponding to the plurality of chromosome units may be a multi-type spatiotemporal convolutional network model represented by the plurality of chromosome units.
- the spatio-temporal convolutional network model corresponding to the chromosome unit may be a result of initialization of a type of spatio-temporal convolutional network model represented by the chromosome unit. After the chromosome unit is generated, a class of spatio-temporal convolutional network model represented by the chromosome unit can be initialized to obtain the spatio-temporal convolutional network model corresponding to the chromosome unit.
- a type of space-time convolutional network model for initializing the chromosomal unit representation may be a model parameter of the space-time convolutional network model corresponding to the chromosomal unit with preset parameters.
- the determining the pre-trained spatiotemporal convolutional network model based on the spatiotemporal convolutional network model corresponding to the target chromosome unit may be, performing Model training to obtain the pre-trained spatio-temporal convolutional network model.
- the chromosome unit includes layer number bits, observation domain bits and expansion factor bits. After the target chromosome is determined, based on the layer number bits, observation domain bits and expansion factor bits of the target chromosome, it can be constructed A spatio-temporal convolutional network model, training the constructed spatio-temporal convolutional network model to obtain the pre-trained spatio-temporal convolutional network model.
- a plurality of chromosome units are generated, and each chromosome unit is used to characterize a class of spatio-temporal convolutional network model; based on the sample set, the time-space corresponding to each of the chromosome units in the plurality of chromosome units is calculated respectively.
- the loss value of the convolutional network model update the plurality of chromosome units according to the loss value of the spatio-temporal convolutional network model corresponding to the plurality of chromosome units, and return to perform the calculation of the plurality of chromosome units based on the sample set
- the step of the loss value of the spatio-temporal convolutional network model corresponding to each of the chromosomal units until the target chromosomal unit satisfying the preset condition is determined; the pre-trained spatio-temporal convolution is determined based on the spatio-temporal convolutional network model corresponding to the target chromosomal unit A network model; predicting a traffic state based on the pre-trained spatio-temporal convolutional network model.
- predicting the traffic state through the pre-trained spatio-temporal convolutional network model can improve the accuracy of predicting the traffic state; and using the evolutionary algorithm to optimize the model structure of the spatio-temporal convolutional network model can reduce the parameters of debugging the spatio-temporal convolutional network model the cost of.
- the chromosomal unit comprises at least one of the following:
- the number of layers bit is used to characterize the number of layers of the hidden layer of the spatio-temporal convolutional network model
- the observation domain bit is used to characterize the observation domain of each hidden layer
- the expansion factor bit The convolutional dilation factor used to characterize each of said hidden layers.
- the layer number bits may be header coding bits of the chromosome unit, and the number of layer number bits may be 3 bits, 5 bits, or 8 bits, etc., which is not limited in this embodiment.
- the chromosome unit includes at most 7 hidden layers.
- the observation field of each hidden layer may be represented by 3 bits, or 5 bits, or 8 bits, etc., which is not limited in this embodiment.
- the convolution expansion factor of each hidden layer may be represented by 3 bits, or 5 bits, or 8 bits, etc., which is not limited in this embodiment.
- the values of the observation domain and the convolution expansion factor may be set to be smaller than the maximum number of inputs of the input layer.
- the number of bits in the number of layers is v1
- the observation field of each hidden layer is represented by v2 bits
- the convolution expansion factor of each hidden layer is represented by v3 bits
- for each hidden layer including the observation field of v2 bits and the convolution expansion factor of v3 bits
- the total number of bits of the chromosome unit is: v1+(v2+v3)*n.
- the number of bits in the number of layers is 3, the observation field of each hidden layer is represented by 3 bits, and the convolution expansion factor of each hidden layer is represented by 3 bits, for each Hidden layer, including the observation field of 3 bits and the convolution expansion factor of 3 bits, if the number of layers of the chromosomal unit indicates that the number of layers of the hidden layer of the space-time convolutional network model is n, then the number of layers of the chromosomal unit The total number of bits is: 3+(3+3)*n.
- the 1st to 3rd bits of the chromosome unit represent the number of layers of the hidden layer
- the 4th to 6th bits represent the observation domain of the first hidden layer
- the 7th to 9th bits represent the convolution of the first hidden layer
- the expansion factor, the 10th to 12th bits represent the observation domain of the second hidden layer, the 13th to 15th bits represent the convolution expansion factor of the second hidden layer, and so on, and so on.
- the chromosome unit is: 010010010001001
- the first to third digits "010” indicate that the number of hidden layers is 2
- the fourth to sixth digits "010” indicate that the observation domain of the first hidden layer is 2
- the 7th to 9th "010” indicates that the convolution expansion factor of the first hidden layer is 2
- the 10th to 12th "001” indicates that the observation field of the second hidden layer is 1
- the 13th to The 15th bit "001" indicates that the convolution expansion factor of the second hidden layer is 1.
- the chromosome unit may include one or more of layer number bits, observation domain bits, and expansion factor bits. Taking the chromosome unit only including the number of layers as an example, the observation field of each hidden layer and the convolution expansion factor of each hidden layer can be preset; taking the chromosome unit only including the observation field bits as an example, the The number of layers of the hidden layer of the space-time convolutional network model and the convolution expansion factor of each hidden layer can be preset; taking the chromosome unit including the number of layers bit and the observation domain bit as an example, each hidden layer The convolution expansion factor of can be preset.
- the number of layers bit is used to represent the number of hidden layers of the spatio-temporal convolutional network model
- the observation field bit is used to represent the observation field of each hidden layer
- the extended The factor bits are used to characterize the convolution expansion factor of each hidden layer; like this, the characteristics of less network parameters of the space-time convolutional network model can be utilized to generate a prediction model that is more suitable for the actual situation for each scene, and then can Reduce the cost of personnel debugging the parameters of the model in different intersection scenarios.
- updating the plurality of chromosome units according to the loss values of the spatio-temporal convolutional network models corresponding to the plurality of chromosome units includes:
- M1 and M2 are positive integers, and M1 is greater than or equal to M2;
- M1 may be a preset value, for example, M1 may be 10, 30 or 50, etc., which is not limited in this embodiment.
- the generating M2 first chromosome units based on the first M1 chromosome units may include performing hybridization processing on the first M1 chromosome units to obtain at least one hybrid chromosome unit, and the M2 first chromosome units may include the at least A hybrid chromosome unit; for example, M2 first chromosome units may be the at least one hybrid chromosome unit; and/or, generating M2 first chromosome units based on the first M1 chromosome units may include, for the first M1 chromosomal units undergo mutation processing to obtain at least one mutated chromosomal unit, wherein the M2 first chromosomal units include the at least one mutated chromosomal unit, for example, the M2 first chromosomal units may be the at least one hybrid chromosome unit.
- the generated M2 first chromosome units may be checked against existing chromosome units. Repeated chromosomal units are removed.
- the plurality of chromosome units are sorted according to the loss value of the spatio-temporal convolutional network model corresponding to the plurality of chromosome units from high to low; M2 first chromosome units are generated based on the first M1 chromosome units, Both M1 and M2 are positive integers, and M1 is greater than or equal to M2; the last M2 chromosome units in the plurality of chromosome units are replaced with the M2 first chromosome units.
- M2 first chromosome units are generated based on the first M1 chromosome units, Both M1 and M2 are positive integers, and M1 is greater than or equal to M2; the last M2 chromosome units in the plurality of chromosome units are replaced with the M2 first chromosome units.
- the generating M2 first chromosome units based on the first M1 chromosome units includes:
- the M2 first chromosome units include the at least one hybrid chromosome unit and the at least one variant chromosome unit.
- the hybridization process of the first M1 chromosome units to obtain at least one hybrid chromosome unit may be, in the first M1 chromosome units, part of the bits at the same position of any two chromosome units are exchanged to obtain at least one hybrid chromosome units; or, two chromosome units can be selected from the first M1 chromosome units according to preset rules, and part of the bits at the same position of the selected chromosome units can be exchanged to obtain at least one hybrid chromosome unit.
- Two chromosome units can be randomly selected from the first M1 chromosome units at a time, and some bits at the same positions of the two selected chromosome units are exchanged for multiple times to obtain multiple hybrid chromosome units.
- the bits representing the observation field of a certain hidden layer can be swapped, or the bits representing the convolution expansion factor of a certain hidden layer can be swapped.
- positions 4 to 6 of any two chromosome units can be exchanged; or, among the first M1 chromosome units, positions 7 to 6 of any two chromosome units can be exchanged.
- the ninth bit is exchanged; etc., which is not limited in this embodiment.
- the shortest chromosomal unit among the previous M1 chromosomal units can be used as the maximum mutation point, and the shortest chromosomal unit can be hybridized with other chromosomal units.
- the chromosomal unit 001001001 with a layer number of 1 and the chromosome unit with a layer number of 2 The chromosomal unit 010010010001001 is hybridized, and the 4th to 6th positions of the two chromosomal units are exchanged to obtain two new chromosomal units.
- the performing mutation processing on the first M1 chromosome units to obtain at least one mutated chromosome unit may be inverting some bits of at least one chromosome unit in the first M1 chromosome units; or, it may be Randomly replace some bits of at least one chromosome unit in the first M1 chromosome units, and so on. Random replacement can be to randomly select a value from 1 or 0 to replace the bit value in the chromosome unit.
- a chromosome unit may be randomly selected from the first M1 chromosome units, one or more bits may be randomly selected from the selected chromosome unit, and the selected bit may be reversed or randomly replaced.
- hybridization processing is performed on the first M1 chromosome units to obtain at least one hybrid chromosome unit; mutation processing is performed on the first M1 chromosome units to obtain at least one mutant chromosome unit.
- the target chromosomal unit is the chromosomal unit that ranks first after the number of updates reaches the first preset number
- the target chromosomal unit is the first chromosomal unit sorted for M3 consecutive times during the updating process, and M3 is greater than or equal to the second preset number of times.
- M3 is a positive integer.
- the first preset number of times may be 300, 400, or 500, etc., which is not limited in this embodiment.
- the second preset number of times may be 20, 40 or 50, etc., which is not limited in this embodiment.
- the first preset number of times is 400, and the second preset number of times is 20.
- the chromosome unit sorted at the top can be determined as the target chromosome unit;
- the top chromosome unit is determined as the target chromosome unit.
- the target chromosomal unit is the chromosomal unit that is sorted at the top after the number of updates reaches the first preset number; or, the target chromosomal unit is the chromosome unit that is sorted at the top for N consecutive times during the update process, and N is greater than or equal to the second preset number of times. Therefore, a spatio-temporal convolutional network model with better performance can be determined through multiple update iterations.
- the prediction of the traffic state based on the pre-trained spatio-temporal convolutional network model includes:
- the predicted traffic state of the target road segment at the predicted time after the current time is determined.
- the real traffic state can be characterized by the ratio of the average vehicle speed of the road section to the free flow speed.
- the average speed of the road section may be the average speed of the vehicles passing by the target road section within a preset time period as the average speed of the road section.
- the duration between every two predicted moments may be 5 minutes, 10 minutes, or 30 minutes, etc., which is not limited in this embodiment.
- the spatio-temporal convolutional network model includes four hidden layers, the observation field of the spatio-temporal convolutional network model is 2, and the convolution expansion factors d are 1, 2, and 4 as an example.
- the input layer inputs the real traffic state (X1, X2, X3, X4, X5) of the first 5 prediction moments, and the output layer can output the predicted traffic state Y5 of the future prediction moment.
- the output of each hidden layer in the plurality of hidden layers can be obtained by performing causal convolution calculation on the input of each hidden layer based on the spatio-temporal attention mechanism.
- the output of the output layer may include the ratio of the average vehicle speed of the road section at the predicted time after the current moment to the free flow speed, and the future traffic state corresponding to the ratio may be determined according to "GBT 33171-2016 Urban Traffic Operation Condition Evaluation Specification" and the like. .
- the ratio is greater than 0.7, it can be considered that the traffic is smooth; if the ratio is greater than 0.5 and less than or equal to 0.7, it can be considered that the traffic is basically smooth; if the ratio is greater than 0.4 and less than or equal to 0.5, it can be considered that the traffic is slightly congested; If the ratio is 0.3 and less than or equal to 0.4, it can be considered as moderate traffic congestion; if the ratio is less than or equal to 0.3, it can be considered as severe traffic congestion.
- N 3
- the interval between every two predicted moments is 5 minutes
- the N predicted moments before the current moment are 10:05, 10:10 and 10:15
- the predicted moments after the current moment are 10:20
- the traffic state at 10:20 can be predicted by the real traffic state at 10:05, 10:10 and 10:15.
- the average vehicle speed of the road section when training the spatio-temporal convolutional network model, can be calculated for the target road section, and the ratio of the average vehicle speed of the road section to the free flow speed at the current moment can be calculated.
- the average vehicle speed of the multi-day road section calculated can be combined and normalized, and the normalized data can be divided into a training set and a test set.
- the normalized data can be used as a test set with a ratio of 20%, 80 % is divided as the training set.
- the divided training set and test set can be used to train the spatio-temporal convolutional network model.
- the ratio of the average vehicle speed of the road section to the free flow speed at the current moment may be set to 1.
- the free flow speed can be the speed at which the traffic flow is not affected by upstream and downstream conditions. In actual use, the free-flow speed can be set as the maximum speed limit value of the target road section.
- the samples in the training set can be used for model training of the spatio-temporal convolutional network model, and the early stop (early stop method) method is used to automatically stop the training of the model to prevent the model from overfitting.
- the early stop (early stop method) method is used to automatically stop the training of the model to prevent the model from overfitting. After pausing, the trained prediction model is obtained, and then the samples in the test set are used to judge whether the prediction model is reliable.
- the real traffic state of the target road section at N predicted moments before the current moment is input into the pre-trained spatio-temporal convolutional network model, wherein the spatio-temporal convolutional network model includes an input layer, an output layer, and a connection between the A plurality of hidden layers between the input layer and the output layer, the input layer is used to input the real traffic state of N predicted moments before the current moment, the output of each hidden layer in the plurality of hidden layers Both are obtained by performing convolution calculation on the input of each hidden layer based on the spatio-temporal attention mechanism, and N is a positive integer; based on the output of the output layer, the predicted traffic state of the target road section at the predicted moment after the current moment is determined .
- the predicted traffic state of the target road segment at the predicted time after the current time is determined through the pre-trained spatio-temporal convolutional network model, which can improve the accuracy of the predicted traffic state.
- the input layer is also used to input additional state information, the additional state information is used to characterize the environmental characteristics to which the traffic state belongs;
- the multiple hidden layers include a first hidden layer, the first hidden layer is connected to the input layer, and the first hidden layer is used to compare the real traffic state and The additional state information is fused.
- the additional status information may be weather information, and/or holiday information and the like.
- the first hidden layer can fuse the time period sequence as the real traffic state with additional state information such as weather information and/or holiday information, so that a single input has unique information.
- the process of fusion can be to superimpose the real traffic state of the N predicted moments before the current moment with the additional state information; or, it can also be to combine the real traffic state of the N predicted moments before the current moment with the additional state information Dot product calculation; or, it may also be to process the real traffic state and additional state information at N predicted moments before the current moment according to a preset algorithm, etc., which is not limited in this embodiment of the present disclosure.
- N is 2, and the real traffic status of the two predicted moments before the current moment is: (0.2, 0.5), the weather at the two predicted moments is sunny and rainy respectively, and 0.02 is used to represent sunny, 0.04 represents rain, and the corresponding weather information is: (0.02, 0.04).
- the plurality of hidden layers may further include a second hidden layer, the second hidden layer is connected to the output layer, and the output layer is used to decode the output of the second hidden layer to obtain The ratio of the average vehicle speed of the road segment to the free flow speed at the prediction time.
- the process of fusing the real traffic state of the N predicted moments before the current moment with the additional state information can be an encode (encoding) process; the output of the second hidden layer is decoded to obtain the traffic state after the current moment
- the ratio of the average vehicle speed of the road section at the prediction time to the free flow speed can be a decode (decoding) process. After decoding, a continuous sequence can be obtained.
- the spatiotemporal convolutional network model can learn the correlation between time spans, and adding additional state information during encoding can help the spatiotemporal convolutional network model distinguish data in different states difference.
- the first hidden layer is used to fuse the real traffic state of the N predicted moments before the current moment with the additional state information, so that the spatio-temporal convolutional network model can learn the traffic state to which Environmental characteristics can improve the prediction accuracy of spatio-temporal convolutional network model.
- the output of the target hidden layer is obtained according to the convolution result and the enhanced residual result
- the convolution result is that the target hidden layer performs convolution processing on the input of the target hidden layer based on a spatio-temporal attention mechanism
- the enhanced residual result is obtained by performing enhanced residual processing on the input of the target hidden layer by the target hidden layer, and the target hidden layer is any hidden layer in the plurality of hidden layers.
- the input of the target hidden layer can be convoluted based on the spatio-temporal attention mechanism to obtain the convolution result, and the input of the target hidden layer can be enhanced to obtain the enhanced residual result.
- the enhanced The residual result and the input of the target hidden layer obtain the output of the target hidden layer.
- an activation function may be used to perform operations on the convolution result, the enhanced residual result, and the input of the target hidden layer to obtain the output of the target hidden layer.
- the output of the target hidden layer is obtained according to the convolution result and the enhanced residual result
- the convolution result is that the target hidden layer convolves the input of the target hidden layer based on the spatio-temporal attention mechanism
- the enhanced residual result is obtained by performing enhanced residual processing on the input of the target hidden layer by the target hidden layer, and the target hidden layer is any hidden layer in the plurality of hidden layers. In this way, the ability of the target hidden layer to extract important information can be enhanced by enhancing the residual results, and the learning efficiency of the spatio-temporal convolutional network model can be improved.
- the target hidden layer includes K valid nodes, K is a positive integer, and the output of the valid node is the output of the valid node to at least two nodes of the previous hidden layer of the target hidden layer
- the output is obtained by convolution calculation; the output of the Mth effective node among the K effective nodes is obtained according to the convolution result corresponding to the Mth effective node and the enhanced residual result corresponding to the Mth effective node, and M is A positive integer greater than 1, and M is less than or equal to K.
- the convolution result corresponding to the Mth effective node, the enhanced residual result corresponding to the Mth effective node, and the node corresponding to the Mth effective node in the previous hidden layer of the target hidden layer can be used by the activation function
- the output of the operation is performed to obtain the output of the target hidden layer.
- the output of each node of the hidden layer includes enhanced residual information.
- the target hidden layer may be a hidden layer other than the first hidden layer.
- the space-time convolutional network model includes four hidden layers, the observation field of the space-time convolutional network model is 2, and the convolution expansion factors d are 1, 2, and 4, respectively.
- S i j represents the i-th node in the j+1th hidden layer, i is a positive integer, and j is an integer greater than 0.
- S 5 3 represents the fifth node in the fourth hidden layer node.
- valid nodes are marked with a circle symbol above the node. Taking the second hidden layer as an example, S 2 1 is the first effective node in the second hidden layer.
- the convolution result corresponding to the Mth effective node is obtained by performing causal convolution calculation on at least two of the P intermediate variables corresponding to the P nodes in the previous hidden layer,
- the prediction time corresponding to each node among the P nodes is not after the prediction time corresponding to the Mth valid node, and P is a positive integer;
- the P intermediate variables corresponding to the P nodes are respectively determined according to the value vectors corresponding to the P nodes and the first weight matrix;
- the first weight matrix is obtained by performing dot product calculation on key vectors and query vectors corresponding to the P nodes;
- the key vector, value vector and query vector corresponding to the P nodes are determined based on a spatio-temporal attention mechanism.
- the convolution result corresponding to the Mth effective node may be obtained by performing one-dimensional causal convolution calculation on at least two of the P intermediate variables corresponding to the P nodes in the previous hidden layer.
- the first weight matrix can be:
- l is used to represent the previous hidden layer of the target hidden layer
- d k is the dimension
- the data in the lower left corner of the matrix can represent future information
- the data in the upper right corner of the matrix can be used to represent past information
- the position of i ⁇ j in the first weight matrix can be The data of is set to 0, so that only past information can be used.
- the first weight matrix and the value vectors corresponding to the M effective nodes can be processed through the softplus activation function to obtain the second weight matrix, and the corresponding values of the P nodes in the previous hidden layer can be calculated through the second weight matrix.
- the functions f, g, and h can be conversion functions of conventional spatiotemporal attention mechanisms.
- the functions f(s P l ), g(s P l ), h(s P l ) can be both s P l and Different weight matrices are multiplied.
- the output Sl of the previous hidden layer of the target hidden layer can be processed by f(x), g(x) and h(x) respectively to obtain the corresponding key vector K, value vector Q and query vector V, so that the output data of the previous hidden layer of the target hidden layer can be mapped to three dimensions, the first weight matrix W l is obtained through the key vector K and the value vector Q, and the second weight matrix W l is obtained through the first weight matrix W l and the query vector V weight matrix Wa l , and get the intermediate variable through the second weight matrix and S l
- the intermediate variables Sa 1 2 to Sa 1 5 can be determined through the space - time attention mechanism, and S For the convolution result Sc l 5 corresponding to 5 2 , the enhanced residual processing of S 5 1 is performed through the enhanced residual module, and the enhanced residual result Sr l 5 corresponding to S 5 2 is obtained. 5 and Sr l 5 to obtain S 5 2 .
- the convolution result corresponding to the Mth effective node can be obtained.
- the output of the Mth effective node among the K effective nodes is the output of the node corresponding to the Mth effective node in the previous hidden layer using an activation function, and the Mth effective node
- the convolution result corresponding to the effective node and the enhanced residual result corresponding to the Mth effective node are calculated and obtained;
- the enhanced residual result corresponding to the Mth effective node is obtained by performing enhanced residual processing on the basis of the first weight matrix and the output of the node corresponding to the Mth effective node in the previous hidden layer.
- the output of the Mth effective node can be the output of the node corresponding to the Mth effective node in the previous hidden layer using the softplus activation function of the Mth effective node, and the Mth effective node
- the convolution result corresponding to the node and the enhanced residual result corresponding to the Mth effective node are obtained through calculation.
- the first weight matrix and the value vectors corresponding to the M valid nodes may be processed by a softplus activation function to obtain a second weight matrix.
- the data of each row in the second weight matrix W a l is added to obtain the weight W s l of each time step, and the weight W s l of each time step is combined with the weight W s l in the previous hidden layer
- the Hadamard product is performed on the output S l of the node corresponding to the Mth effective node to obtain the enhanced residual result S r l corresponding to the Mth effective node. Because the larger the observation domain of the spatio-temporal convolutional network model is, the easier it is for the network to degrade its learning ability. By calculating the weight of each time step, key information can be preserved.
- the spatio-temporal convolutional network models represented by multiple chromosomal units can be modeled in the same network, as shown in Figure 6 , for the output of the spatio-temporal convolutional network model with a layer number of 1, it can be considered as the prediction result obtained by decoding the output of the first hidden layer of the network.
- the output of the space-time convolutional network model with different layers it can be considered as decoding the data of each layer, generating the prediction result of the current layer and saving it as Yn.
- evolutionary algorithms are used to generate multiple chromosome units, the weight matrix of each node will be put into a matrix to store the corresponding individual weight matrix. Delete the weight value of eliminated individuals to reduce space occupation and search time.
- the spatio-temporal convolutional network model is obtained through training based on root mean square error analysis algorithm.
- the error analysis of the space-time convolutional network model can be performed through RMSE (root mean square error analysis), and the calculation method of RMSE can be:
- Y t represents the real traffic state
- m is the total number of predicted values. Error analysis is performed by comparing the predicted value with the real traffic state. When the error is less than the preset value, the model training can be considered complete.
- the traffic state prediction method may include a model training process, a model acquisition process, and a model prediction process.
- the model training process may be as follows: extract the average vehicle speed of the vehicle passing through the target road section from the roadside equipment of the target road section The average speed of the target road section can be calculated every 5 minutes between 0:00 and 24:00 every day, and the ratio of the average speed of the road section to the free flow speed can be calculated. If there is no passing vehicle within the statistical time during a certain statistics, the ratio of the average vehicle speed to the free flow speed of the road section in this statistics is set to 1. The ratio of the calculated average vehicle speed to the free flow speed of the road section is normalized, and the normalized data is divided into a training set and a test set.
- the structure of the product network model After determining the structure of the spatiotemporal convolutional network model, the spatiotemporal convolutional network model is trained by the training set, and the spatiotemporal convolutional network model is evaluated by the test set. It is judged whether the prediction result of the trained model is within the error range, if so, it is judged that the model training has been completed; if not, the model is retrained and optimized.
- the model acquisition process can be as follows: an encode-decode mechanism can be introduced in the spatiotemporal convolutional network model, and the output of each hidden layer in the spatiotemporal convolutional network model is based on the spatiotemporal attention mechanism to convolve the input of each hidden layer Calculated to obtain a spatio-temporal convolutional network model based on the spatio-temporal attention mechanism.
- the model prediction process is as follows: input the real traffic status of the N predicted moments before the current moment into the trained spatio-temporal convolutional network model, and the output of the spatio-temporal convolutional network model includes the average vehicle speed and free traffic at the predicted moment after the current moment. The ratio of flow velocity.
- the ratio is greater than 0.7, it can be considered smooth traffic; if the ratio is greater than 0.5 and less than or equal to 0.7, it can be considered that the traffic is basically smooth; if the ratio is greater than 0.4 and less than or equal to 0.5, it can be considered mild traffic congestion; If it is equal to 0.4, it can be considered as moderate traffic congestion; if the ratio is less than or equal to 0.3, it can be considered as severe traffic congestion.
- encode-decode can use any encoding method, which can be used to add additional status information such as location and/or weather.
- the attention mechanism itself cannot express the location information between each time node when calculating the weight, and the convolutional network itself has a vague memory of the long-distance location information.
- a chromosome unit is equivalent to a model structure, and different combinations generate countless possible solutions of the network structure.
- a chromosomal unit is equivalent to an instance of this scheme. By screening and iterating individuals, the superiority of the scheme can be verified, and through subtle changes, such as mutation and generation of new individuals, the possibility of combining advantages can be expanded. The final iterative solution is the model design that is most suitable for the current scene.
- the spatio-temporal convolutional network model is used in combination with the attention mechanism to allow the network to learn key points through dynamic attention weights, which can only be used in the past for short-term predictions, and can expand the length of the input time period, thereby improving the prediction time The accuracy of time data; and use the spatio-temporal convolutional network model with the attention mechanism to make the learning more efficient by learning the weight different from the previous standardized method, which can indirectly reduce the training time and calculation amount; and, using encode- Decode cooperates with the attention mechanism so that the network can learn the correlation between time spans, and add additional state information such as holidays or rest days or weather when encoding to help the model distinguish data differences in different states; in this way, an evolutionary algorithm is used.
- the optimization at the network structure level is universal, that is, this solution can be used for any intersection, which can reduce the cost of personnel adjustment and design.
- FIG. 7 is a schematic structural diagram of a traffic state prediction device provided by an embodiment of the present disclosure.
- the traffic state prediction device 200 includes:
- the generating part 201 is configured to generate a plurality of chromosome units, each of which is used to represent a class of spatio-temporal convolutional network models;
- the calculation part 202 is configured to separately calculate the loss value of the spatio-temporal convolutional network model corresponding to each of the chromosome units in the plurality of chromosome units based on the sample set;
- the update part 203 is configured to update the plurality of chromosome units according to the loss values of the spatio-temporal convolutional network models corresponding to the plurality of chromosome units, and return to perform the calculation based on the sample set for each of the plurality of chromosome units.
- the determining part 204 is configured to determine a pre-trained spatiotemporal convolutional network model based on the spatiotemporal convolutional network model corresponding to the target chromosome unit;
- the prediction part 205 is configured to predict the traffic state based on the pre-trained spatio-temporal convolutional network model.
- the chromosomal unit comprises at least one of the following:
- the number of layers bit is configured to represent the number of hidden layers of the spatio-temporal convolutional network model
- the observation field bit is configured to represent the observation field of each hidden layer
- the expansion factor Bits are configured to characterize the convolutional dilation factor of each of said hidden layers.
- the update section 203 includes:
- the sorting subpart is configured to sort the multiple chromosome units from high to low according to the loss values of the spatio-temporal convolutional network models corresponding to the multiple chromosome units;
- the generating subpart is configured to generate M2 first chromosome units based on the first M1 chromosome units, where both M1 and M2 are positive integers, and M1 is greater than or equal to M2;
- the replacement subpart is configured to replace the last M2 chromosome units among the plurality of chromosome units with the M2 first chromosome units.
- the generation subsection is further configured to:
- the M2 first chromosome units include the at least one hybrid chromosome unit and the at least one variant chromosome unit.
- the target chromosomal unit is the chromosomal unit that ranks first after the number of updates reaches the first preset number
- the target chromosomal unit is the first chromosomal unit sorted for M3 consecutive times during the updating process, and M3 is greater than or equal to the second preset number of times.
- the prediction part 205 is further configured to:
- the predicted traffic state of the target road segment at a predicted time after the current time is determined based on the output of the output layer.
- the input layer is also used to input additional state information, the additional state information is used to characterize the environmental characteristics to which the traffic state belongs;
- the multiple hidden layers include a first hidden layer, the first hidden layer is connected to the input layer, and the first hidden layer is used to compare the real traffic state and The additional state information is fused.
- the traffic state predicting device can realize each process realized in the method embodiment of Fig. 1, and can achieve the same technical effect, no longer describe here.
- an embodiment of the present disclosure also provides an electronic device 300, including: a processor 301, a memory 302, and a program stored in the memory 302 and executable on the processor 301, the When the program is executed by the processor 301, each process of the above-mentioned embodiment of the traffic state prediction method can be realized, and the same technical effect can be achieved, so no further description is given here.
- Embodiments of the present disclosure also provide a computer-readable storage medium, on which a computer program is stored.
- a computer program is stored.
- the computer program is executed by a processor, each process of the above-mentioned embodiment of the traffic state prediction method can be achieved, and the same The technical effect will not be described here.
- the computer-readable storage medium is, for example, a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a magnetic disk or an optical disk, and the like.
- An embodiment of the present disclosure provides a computer program, the computer program includes computer-readable codes, and when the computer-readable codes run in an electronic device, the processor of the electronic device executes to implement the above-mentioned
- the embodiment of the traffic state prediction method can achieve the same technical effect, and will not be described here again.
- the terms "comprises,” “comprises,” or any other variation thereof are intended to encompass a non-exclusive inclusion such that a process, method, article, or apparatus that includes a set of elements includes not only those elements, but also includes the elements not expressly included. other elements listed, or also include elements inherent in such a process, method, article, or device. Without further limitations, an element defined by the phrase “comprising a " does not preclude the presence of additional identical elements in the process, method, article, or apparatus comprising that element.
- the methods of the above embodiments can be implemented by means of software plus a necessary general-purpose hardware platform, and of course also by hardware, but in many cases the former is better implementation.
- the technical solution of the present disclosure can be embodied in the form of a software product in essence or the part that contributes to the prior art, and the computer software product is stored in a storage medium (such as ROM/RAM, disk, CD) contains several instructions to enable a terminal (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in various embodiments of the present disclosure.
- a terminal which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.
- the present disclosure provides a traffic state prediction method, device, equipment, medium and program, which relate to the field of intelligent transportation technology.
- the method includes: generating a plurality of chromosome units, each chromosome unit is used to represent a class of spatio-temporal convolutional network model; Calculate the loss value of the time-space convolutional network model corresponding to each chromosome unit in multiple chromosome units based on the sample set; update multiple chromosome units according to the loss value of the time-space convolutional network model corresponding to multiple chromosome units, and return to execute based on The step of calculating the loss value of the time-space convolutional network model corresponding to each chromosome unit in the sample set, until the target chromosome unit that meets the preset conditions is determined; based on the time-space convolutional network model corresponding to the target chromosome unit Trained spatio-temporal convolutional network model; predict traffic status based on pre-trained spatio-temporal convolutional network model
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Evolutionary Computation (AREA)
- Biophysics (AREA)
- Life Sciences & Earth Sciences (AREA)
- Health & Medical Sciences (AREA)
- Artificial Intelligence (AREA)
- Software Systems (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Mathematical Physics (AREA)
- Computing Systems (AREA)
- Molecular Biology (AREA)
- Biomedical Technology (AREA)
- General Health & Medical Sciences (AREA)
- Computational Linguistics (AREA)
- Data Mining & Analysis (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Bioinformatics & Computational Biology (AREA)
- Evolutionary Biology (AREA)
- Medical Informatics (AREA)
- Computer Hardware Design (AREA)
- Geometry (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Physiology (AREA)
- Genetics & Genomics (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
A traffic state prediction method and apparatus, and a device, a medium and a program, which relate to the technical field of intelligent traffic. The method comprises: generating a plurality of chromosome units (101), wherein each chromosome unit is used for representing a type of spatial-temporal convolutional network model; respectively calculating, on the basis of a sample set, a loss value of the spatial-temporal convolutional network model corresponding to each of the plurality of chromosome units (102); according to the loss values of spatial-temporal convolutional network models corresponding to the plurality of chromosome units, updating the plurality of chromosome units, and returning to execute the step of respectively calculating, on the basis of a sample set, a loss value of the spatial-temporal convolutional network model corresponding to each of the plurality of chromosome units until a target chromosome unit that meets a preset condition is determined (103); on the basis of a spatial-temporal convolutional network model corresponding to the target chromosome unit, determining a pre-trained spatial-temporal convolutional network model (104); and on the basis of the pre-trained spatial-temporal convolutional network model, predicting a traffic state (105). By means of the method, the accuracy of predicting a traffic state can be improved.
Description
相关申请的交叉引用Cross References to Related Applications
本专利申请要求2021年11月22日提交的中国专利申请号为202111382079.5、申请人为中移(上海)信息通信科技有限公司,中移智行网络科技有限公司,中国移动通信集团有限公司,申请名称为“一种交通状态预测方法、装置及电子设备”的优先权,该申请的全文以引用的方式并入本申请中。This patent application requires that the Chinese patent application number submitted on November 22, 2021 is 202111382079.5, and the applicants are China Mobile (Shanghai) Information and Communication Technology Co., Ltd., China Mobile Zhixing Network Technology Co., Ltd., and China Mobile Communications Group Co., Ltd., and the application name is The priority of "a traffic state prediction method, device and electronic equipment", the entirety of the application is incorporated in this application by reference.
本公开涉及智能交通技术领域,尤其涉及一种交通状态预测方法、装置、设备、介质及程序。The present disclosure relates to the technical field of intelligent transportation, and in particular to a traffic state prediction method, device, equipment, medium and program.
随着城市化进程的不断推进,智能交通的重要程度越来越高。交通状态预测是智能交通的重要组成部分,预测的交通状态信息有助于人们的出行路线决策,从而可以缓解交通堵塞,提升城市居住的幸福感。现有技术中,通常通过统计方法预测交通状态,通过统计一段时间内的车辆的数量及车速预测下一时刻的交通状态,然而,统计方法是依赖经验预测交通状态,预测交通状态的准确性较差。With the continuous advancement of the urbanization process, the importance of intelligent transportation is getting higher and higher. Traffic status prediction is an important part of intelligent transportation. The predicted traffic status information can help people make travel route decisions, thereby alleviating traffic congestion and improving the happiness of urban living. In the prior art, the traffic state is usually predicted by statistical methods, and the traffic state at the next moment is predicted by counting the number of vehicles and the speed of vehicles within a period of time. However, the statistical method relies on experience to predict the traffic state, and the accuracy of predicting the traffic state is relatively low. Difference.
发明内容Contents of the invention
本公开实施例提供一种交通状态预测方法、装置、设备、介质及程序,以解决现有技术中通过统计方法预测交通状态,预测交通状态的准确性较差的问题。Embodiments of the present disclosure provide a traffic state prediction method, device, equipment, medium, and program to solve the problem in the prior art that traffic state is predicted by statistical methods and the accuracy of traffic state prediction is poor.
为解决上述技术问题,本公开是这样实现的:In order to solve the above-mentioned technical problems, the present disclosure is achieved as follows:
本公开实施例提供了一种交通状态预测方法,所述方法包括:An embodiment of the present disclosure provides a traffic state prediction method, the method comprising:
生成多个染色体单元,每个所述染色体单元用于表征一类时空卷积网络模型;Generate a plurality of chromosome units, each of which is used to represent a class of spatio-temporal convolutional network models;
基于样本集分别计算所述多个染色体单元中每个所述染色体单元对应的时空卷积网络模型的损失值;Calculate the loss value of the spatio-temporal convolutional network model corresponding to each of the chromosome units in the plurality of chromosome units based on the sample set;
依据所述多个染色体单元对应的时空卷积网络模型的损失值更新所述多个染色体单元,并返回执行所述基于样本集分别计算所述多个染色体单元中每个所述染色体单元对应的时空卷积网络模型的损失值的步骤,直至确定满足预设条件的目标染色体单元;Updating the plurality of chromosome units according to the loss values of the spatio-temporal convolutional network models corresponding to the plurality of chromosome units, and returning to performing the calculation based on the sample set respectively corresponding to each of the chromosome units in the plurality of chromosome units The step of the loss value of the spatio-temporal convolutional network model until the target chromosome unit satisfying the preset condition is determined;
基于所述目标染色体单元对应的时空卷积网络模型确定预先训练的时空卷积网络模型;Determining a pre-trained spatiotemporal convolutional network model based on the spatiotemporal convolutional network model corresponding to the target chromosome unit;
基于所述预先训练的时空卷积网络模型预测交通状态。Traffic status is predicted based on the pre-trained spatio-temporal convolutional network model.
在一些实施例中,所述染色体单元包括如下至少一项:层数比特位,观测域比特位,扩展因子比特位;其中,所述层数比特位用于表征所述时空卷积网络模型的隐藏层的层数,所述观测域比特位用于表征每个所述隐藏层的观测域,所述扩展因子比特位用于表征每个所述隐藏层的卷积扩展因子。In some embodiments, the chromosome unit includes at least one of the following: layer number bits, observation domain bits, and expansion factor bits; wherein, the layer number bits are used to characterize the spatio-temporal convolutional network model The number of layers of the hidden layer, the observation domain bit is used to represent the observation domain of each hidden layer, and the expansion factor bit is used to represent the convolution expansion factor of each hidden layer.
在一些实施例中,所述依据所述多个染色体单元对应的时空卷积网络模型的损失值更新所述多个染色体单元,包括:按照所述多个染色体单元对应的时空卷积网络模型的损失值从高至低对所述多个染色体单元进行排序;基于前M1个染色体单元生成M2个第一染色体单元,M1和M2均为正整数,M1大于或等于M2;将所述多个染色体单元中后M2个染色体单元替换为所述M2个第一染色体单元。In some embodiments, updating the plurality of chromosome units according to the loss values of the time-space convolutional network models corresponding to the plurality of chromosome units includes: according to the loss values of the time-space convolutional network models corresponding to the plurality of chromosome units Sorting the plurality of chromosome units from high to low in loss value; generating M2 first chromosome units based on the first M1 chromosome units, both M1 and M2 are positive integers, and M1 is greater than or equal to M2; The last M2 chromosome units in the unit are replaced by the M2 first chromosome units.
在一些实施例中,所述基于前M1个染色体单元生成M2个第一染色体单元,包括:对前M1个染色体单元进行杂交处理,得到至少一个杂交染色体单元;对所述前M1个 染色体单元进行变异处理,得到至少一个变异染色体单元;其中,所述M2个第一染色体单元包括所述至少一个杂交染色体单元和所述至少一个变异染色体单元。In some embodiments, the generating M2 first chromosome units based on the first M1 chromosome units includes: performing hybridization processing on the first M1 chromosome units to obtain at least one hybrid chromosome unit; performing hybridization processing on the first M1 chromosome units The mutation process is to obtain at least one mutant chromosome unit; wherein, the M2 first chromosome units include the at least one hybrid chromosome unit and the at least one mutant chromosome unit.
在一些实施例中,所述目标染色体单元为更新次数达到第一预设次数后排序在最前的染色体单元;或者,所述目标染色体单元为更新过程中连续M3次排序位于最前的染色体单元,M3大于或等于第二预设次数。In some embodiments, the target chromosomal unit is the chromosomal unit that is sorted at the top after the number of updates reaches the first preset number; or, the target chromosomal unit is the chromosome unit that is sorted at the top for M3 consecutive times during the update process, M3 greater than or equal to the second preset number of times.
在一些实施例中,所述基于所述预先训练的时空卷积网络模型预测交通状态,包括:将目标路段在当前时刻之前的N个预测时刻的真实交通状态输入所述预先训练的时空卷积网络模型;其中,所述时空卷积网络模型包括输入层,输出层及连接在所述输入层与所述输出层之间的多个隐藏层,所述输入层用于输入在当前时刻之前的N个预测时刻的真实交通状态,所述多个隐藏层中每个隐藏层的输出均基于时空注意力机制分别对每个所述隐藏层的输入进行卷积计算获得,N为正整数;基于所述输出层的输出确定所述目标路段在当前时刻之后的预测时刻的预测交通状态。In some embodiments, the prediction of the traffic state based on the pre-trained spatio-temporal convolutional network model includes: inputting the real traffic state of the target road section N prediction moments before the current moment into the pre-trained spatio-temporal convolution Network model; wherein, the spatio-temporal convolutional network model includes an input layer, an output layer and a plurality of hidden layers connected between the input layer and the output layer, and the input layer is used to input the data before the current moment The real traffic state at N prediction moments, the output of each hidden layer in the plurality of hidden layers is obtained by performing convolution calculation on the input of each hidden layer based on the spatiotemporal attention mechanism, and N is a positive integer; based on The output of the output layer determines the predicted traffic state of the target road segment at the predicted time after the current time.
在一些实施例中,所述输入层还用于输入附加状态信息,所述附加状态信息用于表征所述交通状态所属的环境特征;所述多个隐藏层包括第一隐藏层,所述第一隐藏层与所述输入层连接,所述第一隐藏层用于对所述在当前时刻之前的N个预测时刻的真实交通状态与所述附加状态信息进行融合。In some embodiments, the input layer is also used to input additional state information, the additional state information is used to characterize the environmental characteristics of the traffic state; the plurality of hidden layers include a first hidden layer, the second hidden layer A hidden layer is connected to the input layer, and the first hidden layer is used to fuse the real traffic state of the N predicted moments before the current moment with the additional state information.
本公开实施例提供了一种交通状态预测装置,所述装置包括:An embodiment of the present disclosure provides a traffic state prediction device, the device comprising:
生成部分,被配置为生成多个染色体单元,每个所述染色体单元用于表征一类时空卷积网络模型;A generating part configured to generate a plurality of chromosome units, each of which is used to represent a class of spatio-temporal convolutional network models;
计算部分,被配置为基于样本集分别计算所述多个染色体单元中每个所述染色体单元对应的时空卷积网络模型的损失值;The calculation part is configured to separately calculate the loss value of the spatio-temporal convolutional network model corresponding to each of the chromosome units in the plurality of chromosome units based on the sample set;
更新部分,被配置为依据所述多个染色体单元对应的时空卷积网络模型的损失值更新所述多个染色体单元,并返回执行所述基于样本集分别计算所述多个染色体单元中每个所述染色体单元对应的时空卷积网络模型的损失值的步骤,直至确定满足预设条件的目标染色体单元;The update part is configured to update the plurality of chromosome units according to the loss value of the spatio-temporal convolutional network model corresponding to the plurality of chromosome units, and return to perform the calculation of each of the plurality of chromosome units based on the sample set. The step of the loss value of the spatio-temporal convolutional network model corresponding to the chromosomal unit, until the target chromosomal unit satisfying the preset condition is determined;
确定部分,被配置为基于所述目标染色体单元对应的时空卷积网络模型确定预先训练的时空卷积网络模型;The determining part is configured to determine a pre-trained spatiotemporal convolutional network model based on the spatiotemporal convolutional network model corresponding to the target chromosome unit;
预测部分,被配置为基于所述预先训练的时空卷积网络模型预测交通状态。The prediction part is configured to predict the traffic state based on the pre-trained spatio-temporal convolutional network model.
在一些实施例中,所述染色体单元包括如下至少一项:层数比特位,观测域比特位,扩展因子比特位;其中,所述层数比特位用于表征所述时空卷积网络模型的隐藏层的层数,所述观测域比特位用于表征每个所述隐藏层的观测域,所述扩展因子比特位用于表征每个所述隐藏层的卷积扩展因子。In some embodiments, the chromosome unit includes at least one of the following: layer number bits, observation domain bits, and expansion factor bits; wherein, the layer number bits are used to characterize the spatio-temporal convolutional network model The number of layers of the hidden layer, the observation domain bit is used to represent the observation domain of each hidden layer, and the expansion factor bit is used to represent the convolution expansion factor of each hidden layer.
在一些实施例中,所述更新部分包括:排序子部分,被配置为按照所述多个染色体单元对应的时空卷积网络模型的损失值从高至低对所述多个染色体单元进行排序;生成子部分,被配置为基于前M1个染色体单元生成M2个第一染色体单元,M1和M2均为正整数,M1大于或等于M2;替换子部分,被配置为将所述多个染色体单元中后M2个染色体单元替换为所述M2个第一染色体单元。In some embodiments, the updating part includes: a sorting subsection configured to sort the multiple chromosome units from high to low according to the loss values of the spatio-temporal convolutional network models corresponding to the multiple chromosome units; generating sub-parts, configured to generate M2 first chromosome units based on the first M1 chromosome units, where both M1 and M2 are positive integers, and M1 is greater than or equal to M2; replacing sub-parts, configured to convert the plurality of chromosome units The last M2 chromosome units are replaced by the M2 first chromosome units.
在一些实施例中,所述生成子部分,还被配置为对前M1个染色体单元进行杂交处理,得到至少一个杂交染色体单元;对所述前M1个染色体单元进行变异处理,得到至少一个变异染色体单元;其中,所述M2个第一染色体单元包括所述至少一个杂交染色体单元和所述至少一个变异染色体单元。In some embodiments, the generation sub-part is further configured to perform hybridization processing on the first M1 chromosome units to obtain at least one hybrid chromosome unit; perform mutation processing on the first M1 chromosome units to obtain at least one mutant chromosome unit; wherein, the M2 first chromosome units include the at least one hybrid chromosome unit and the at least one variant chromosome unit.
在一些实施例中,所述目标染色体单元为更新次数达到第一预设次数后排序在最前的染色体单元;或者,所述目标染色体单元为更新过程中连续M3次排序位于最前的染色体单元,M3大于或等于第二预设次数。In some embodiments, the target chromosomal unit is the chromosomal unit that is sorted at the top after the number of updates reaches the first preset number; or, the target chromosomal unit is the chromosome unit that is sorted at the top for M3 consecutive times during the update process, M3 greater than or equal to the second preset number of times.
在一些实施例中,所述预测部分,还配置为将目标路段在当前时刻之前的N个预测 时刻的真实交通状态输入所述预先训练的时空卷积网络模型;其中,所述时空卷积网络模型包括输入层,输出层及连接在所述输入层与所述输出层之间的多个隐藏层,所述输入层用于输入在当前时刻之前的N个预测时刻的真实交通状态,所述多个隐藏层中每个隐藏层的输出均基于时空注意力机制分别对每个所述隐藏层的输入进行卷积计算获得,N为正整数;基于所述输出层的输出确定所述目标路段在当前时刻之后的预测时刻的预测交通状态。In some embodiments, the prediction part is further configured to input the real traffic state of the target road section N prediction moments before the current moment into the pre-trained spatiotemporal convolutional network model; wherein, the spatiotemporal convolutional network The model includes an input layer, an output layer and a plurality of hidden layers connected between the input layer and the output layer, the input layer is used to input the real traffic status of N prediction moments before the current moment, the The output of each hidden layer in the plurality of hidden layers is obtained by performing convolution calculation on the input of each hidden layer based on the spatiotemporal attention mechanism, and N is a positive integer; the target road section is determined based on the output of the output layer The predicted traffic state at a predicted time after the current time.
在一些实施例中,所述输入层还用于输入附加状态信息,所述附加状态信息用于表征所述交通状态所属的环境特征;所述多个隐藏层包括第一隐藏层,所述第一隐藏层与所述输入层连接,所述第一隐藏层用于对所述在当前时刻之前的N个预测时刻的真实交通状态与所述附加状态信息进行融合。In some embodiments, the input layer is also used to input additional state information, the additional state information is used to characterize the environmental characteristics of the traffic state; the plurality of hidden layers include a first hidden layer, the second hidden layer A hidden layer is connected to the input layer, and the first hidden layer is used to fuse the real traffic state of the N predicted moments before the current moment with the additional state information.
本公开实施例提供一种电子设备,包括:处理器、存储器及存储在所述存储器上并可在所述处理器上运行的程序,所述程序被所述处理器执行时实现上述任一所述的交通状态预测方法。An embodiment of the present disclosure provides an electronic device, including: a processor, a memory, and a program stored in the memory and operable on the processor. When the program is executed by the processor, any of the above-mentioned The traffic state prediction method described above.
本公开实施例提供一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现上述任一所述的交通状态预测方法。An embodiment of the present disclosure provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, any one of the traffic state prediction methods described above is implemented.
本公开实施例提供一种计算机程序,所述计算机程序包括计算机可读代码,在所述计算机可读代码在电子设备中运行的情况下,所述电子设备的处理器执行用于实现上述任一所述的交通状态预测方法。An embodiment of the present disclosure provides a computer program, the computer program includes computer-readable codes, and when the computer-readable codes run in an electronic device, the processor of the electronic device executes to implement any of the above-mentioned The traffic state prediction method described above.
本公开实施例中,生成多个染色体单元,每个所述染色体单元用于表征一类时空卷积网络模型;基于样本集分别计算所述多个染色体单元中每个所述染色体单元对应的时空卷积网络模型的损失值;依据所述多个染色体单元对应的时空卷积网络模型的损失值更新所述多个染色体单元,并返回执行所述基于样本集分别计算所述多个染色体单元中每个所述染色体单元对应的时空卷积网络模型的损失值的步骤,直至确定满足预设条件的目标染色体单元;基于所述目标染色体单元对应的时空卷积网络模型确定预先训练的时空卷积网络模型;基于所述预先训练的时空卷积网络模型预测交通状态。这样,通过预先训练的时空卷积网络模型预测交通状态,能够提高预测交通状态的准确性;且采用进化算法对时空卷积网络模型进行模型结构的优化,能够降低调试时空卷积网络模型的参数的成本。In the embodiment of the present disclosure, a plurality of chromosome units are generated, and each chromosome unit is used to characterize a class of spatio-temporal convolutional network model; based on the sample set, the time-space corresponding to each of the chromosome units in the plurality of chromosome units is calculated respectively. The loss value of the convolutional network model; update the plurality of chromosome units according to the loss value of the spatio-temporal convolutional network model corresponding to the plurality of chromosome units, and return to perform the calculation of the plurality of chromosome units based on the sample set The step of the loss value of the spatio-temporal convolutional network model corresponding to each of the chromosomal units until the target chromosomal unit satisfying the preset condition is determined; the pre-trained spatio-temporal convolution is determined based on the spatio-temporal convolutional network model corresponding to the target chromosomal unit A network model; predicting a traffic state based on the pre-trained spatio-temporal convolutional network model. In this way, predicting the traffic state through the pre-trained spatio-temporal convolutional network model can improve the accuracy of predicting the traffic state; and using the evolutionary algorithm to optimize the model structure of the spatio-temporal convolutional network model can reduce the parameters of debugging the spatio-temporal convolutional network model the cost of.
为使本公开的上述目的、特征和优点能更明显易懂,下文特举较佳实施例,并配合所附附图,作详细说明如下。In order to make the above-mentioned objects, features and advantages of the present disclosure more comprehensible, preferred embodiments will be described in detail below together with the accompanying drawings.
为了更清楚地说明本公开实施例的技术方案,下面将对本公开实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本公开的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the following will briefly introduce the accompanying drawings that need to be used in the description of the embodiments of the present disclosure. Obviously, the accompanying drawings in the following description are only some embodiments of the present disclosure. For those skilled in the art, other drawings can also be obtained based on these drawings without any creative effort.
图1是本公开实施例提供的一种交通状态预测方法的流程图;FIG. 1 is a flow chart of a traffic state prediction method provided by an embodiment of the present disclosure;
图2是本公开实施例提供的一种时空卷积网络模型的结构示意图之一;FIG. 2 is one of the schematic structural diagrams of a space-time convolutional network model provided by an embodiment of the present disclosure;
图3是本公开实施例提供的一种时空卷积网络模型中信息传递的示意图之一;Fig. 3 is one of the schematic diagrams of information transmission in a space-time convolutional network model provided by an embodiment of the present disclosure;
图4是本公开实施例提供的一种时空卷积网络模型中信息传递的示意图之二;Fig. 4 is the second schematic diagram of information transmission in a space-time convolutional network model provided by an embodiment of the present disclosure;
图5是本公开实施例提供的一种时空卷积网络模型中信息传递的示意图之三;Fig. 5 is the third schematic diagram of information transmission in a space-time convolutional network model provided by an embodiment of the present disclosure;
图6是本公开实施例提供的一种时空卷积网络模型的结构示意图之二;FIG. 6 is the second structural schematic diagram of a space-time convolutional network model provided by an embodiment of the present disclosure;
图7是本公开实施例提供的一种交通状态预测装置的结构示意图;FIG. 7 is a schematic structural diagram of a traffic state prediction device provided by an embodiment of the present disclosure;
图8是本公开实施例提供的一种电子设备的结构示意图。Fig. 8 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure.
下面将结合本公开实施例中的附图,对本公开实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本公开一部分实施例,而不是全部的实施例。基于本公开中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本公开保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present disclosure with reference to the accompanying drawings in the embodiments of the present disclosure. Apparently, the described embodiments are part of the embodiments of the present disclosure, not all of them. Based on the embodiments in the present disclosure, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present disclosure.
本公开实施例提供一种交通状态预测方法、装置、设备、介质及程序,以解决现有技术中通过统计方法预测交通状态,预测交通状态的准确性较差的问题。Embodiments of the present disclosure provide a traffic state prediction method, device, equipment, medium, and program to solve the problem in the prior art that traffic state is predicted by statistical methods and the accuracy of traffic state prediction is poor.
参见图1,图1是本公开实施例提供的一种交通状态预测方法的流程图,如图1所示,所述方法包括以下步骤:Referring to FIG. 1, FIG. 1 is a flow chart of a traffic state prediction method provided by an embodiment of the present disclosure. As shown in FIG. 1, the method includes the following steps:
步骤101、生成多个染色体单元,每个所述染色体单元用于表征一类时空卷积网络模型; Step 101, generating a plurality of chromosome units, each of which is used to represent a class of spatio-temporal convolutional network models;
步骤102、基于样本集分别计算所述多个染色体单元中每个所述染色体单元对应的时空卷积网络模型的损失值; Step 102, respectively calculating the loss value of the spatio-temporal convolutional network model corresponding to each of the chromosome units in the plurality of chromosome units based on the sample set;
步骤103、依据所述多个染色体单元对应的时空卷积网络模型的损失值更新所述多个染色体单元,并返回执行所述基于样本集分别计算所述多个染色体单元中每个所述染色体单元对应的时空卷积网络模型的损失值的步骤,直至确定满足预设条件的目标染色体单元;Step 103: Update the plurality of chromosome units according to the loss values of the spatio-temporal convolutional network models corresponding to the plurality of chromosome units, and return to perform the calculation based on the sample set for each of the chromosomes in the plurality of chromosome units The step of the loss value of the spatio-temporal convolutional network model corresponding to the unit, until the target chromosome unit satisfying the preset condition is determined;
步骤104、基于所述目标染色体单元对应的时空卷积网络模型确定预先训练的时空卷积网络模型; Step 104, determining a pre-trained spatiotemporal convolutional network model based on the spatiotemporal convolutional network model corresponding to the target chromosome unit;
步骤105、基于所述预先训练的时空卷积网络模型预测交通状态。 Step 105. Predict traffic status based on the pre-trained spatio-temporal convolutional network model.
其中,可以随机组合生成多个染色体单元,还可以对生成的染色体单元进行去重处理,以避免出现重复的染色体单元。示例地,可以初始化染色体单元的总群数量为100,随机组合出不重复的染色体单元100个。样本集可以为训练样本集和/或测试样本集。所述染色体单元可以包括以下至少之一:层数比特位,观测域比特位,扩展因子比特位等等,其中,所述层数比特位用于表征所述时空卷积网络模型的隐藏层的层数,所述观测域比特位用于表征每个所述隐藏层的观测域k,即kernal数,所述扩展因子比特位用于表征每个所述隐藏层的卷积扩展因子d,即扩张系数(dilation factor)。Wherein, multiple chromosome units can be randomly combined to generate, and the generated chromosome units can also be deduplicated to avoid repeated chromosome units. For example, the total number of chromosome units can be initialized as 100, and 100 non-repetitive chromosome units can be randomly combined. The sample set can be a training sample set and/or a testing sample set. The chromosome unit may include at least one of the following: layer number bits, observation domain bits, expansion factor bits, etc., wherein the layer number bits are used to represent the hidden layer of the spatio-temporal convolutional network model The number of layers, the observation domain bits are used to characterize the observation domain k of each hidden layer, that is, the number of kernals, and the expansion factor bits are used to characterize the convolution expansion factor d of each hidden layer, namely Dilation factor.
另外,在基于样本集分别计算所述多个染色体单元中每个所述染色体单元对应的时空卷积网络模型的损失值时,以单个染色体单元为例,可以从训练样本集或测试样本集中随机挑选出预设时长且时间连续的样本计算染色体单元对应的时空卷积网络模型的损失值;或者,还可以是从训练样本集中随机挑选出部分时间连续的样本对染色体单元对应的时空卷积网络模型进行训练,在训练轮数达到预设轮数时,从测试样本集中随机挑选出预设时长且时间连续的样本计算染色体单元对应的时空卷积网络模型的损失值。对多个染色体单元对应的时空卷积网络模型计算损失值时采用的样本可以相同,也可以不同。预设时长可以为2小时,1小时或者0.5小时等等。示例地,可以采用4:00至5:00的样本计算损失值。时空卷积网络模型的损失值,可以是预设时长且时间连续的样本与真实值的损失值的平均值。可以计算预设时长且时间连续的样本与真实值的损失值,再取平均,得到时空卷积网络模型的损失值。时空卷积网络模型的损失值可以作为评价值,该评价值可以作为染色体优劣的指标,评价值越小,则染色体越优秀。In addition, when calculating the loss value of the spatio-temporal convolutional network model corresponding to each of the chromosome units in the plurality of chromosome units based on the sample set, taking a single chromosome unit as an example, it can be randomly selected from the training sample set or the test sample set Select preset time-continuous samples to calculate the loss value of the temporal-spatial convolutional network model corresponding to the chromosome unit; or, randomly select some time-continuous samples from the training sample set to the temporal-spatial convolutional network corresponding to the chromosome unit The model is trained, and when the number of training rounds reaches the preset number of rounds, samples with a preset duration and continuous time are randomly selected from the test sample set to calculate the loss value of the spatio-temporal convolutional network model corresponding to the chromosome unit. The samples used to calculate the loss value for the spatio-temporal convolutional network models corresponding to multiple chromosome units can be the same or different. The preset duration can be 2 hours, 1 hour or 0.5 hours and so on. For example, samples from 4:00 to 5:00 may be used to calculate the loss value. The loss value of the spatio-temporal convolutional network model can be the average of the loss values of the preset time-continuous samples and the real value. The loss value of the preset duration and time-continuous samples and the real value can be calculated, and then averaged to obtain the loss value of the spatio-temporal convolutional network model. The loss value of the spatio-temporal convolutional network model can be used as an evaluation value, which can be used as an indicator of the quality of the chromosome. The smaller the evaluation value, the better the chromosome.
在一些实施例中,生成多个染色体单元后,可以对多个染色体单元进行更新迭代,直至确定满足预设条件的目标染色体单元。对多个染色体单元进行更新迭代的过程可以如下:基于样本集分别计算所述多个染色体单元中每个所述染色体单元对应的时空卷积网络模型的损失值;依据所述多个染色体单元对应的时空卷积网络模型的损失值更新所述多个染色体单元,并返回执行所述基于样本集分别计算所述多个染色体单元中每个所述染色体单元对应的时空卷积网络模型的损失值的步骤,直至确定满足预设条件的目标染色体单元。在一些实施例中,对多个染色体单元进行更新迭代的过程可以如下:In some embodiments, after the multiple chromosome units are generated, update iterations may be performed on the multiple chromosome units until a target chromosome unit that satisfies the preset condition is determined. The process of updating and iterating multiple chromosomal units may be as follows: respectively calculate the loss value of the spatio-temporal convolutional network model corresponding to each of the chromosomal units in the multiple chromosomal units based on the sample set; The loss value of the space-time convolutional network model of the plurality of chromosome units is updated, and the calculation of the loss value of the space-time convolutional network model corresponding to each of the chromosome units in the plurality of chromosome units is returned based on the sample set. Steps until the target chromosome unit satisfying the preset condition is determined. In some embodiments, the process of updating and iterating multiple chromosome units may be as follows:
(1)基于样本集分别计算所述多个染色体单元中每个所述染色体单元对应的时空卷积网络模型的损失值,执行(2);(1) Calculate the loss value of the spatio-temporal convolutional network model corresponding to each of the chromosome units in the plurality of chromosome units based on the sample set, and perform (2);
(2)依据所述多个染色体单元对应的时空卷积网络模型的损失值更新所述多个染色体单元,更新后的多个染色体单元中是否存在满足预设条件的目标染色体单元,若是,则结束更新迭代;若否,则返回执行(1)。(2) Update the plurality of chromosome units according to the loss value of the spatio-temporal convolutional network model corresponding to the plurality of chromosome units, whether there is a target chromosome unit satisfying the preset condition in the updated plurality of chromosome units, and if so, then End the update iteration; if not, return to execute (1).
另外,每个所述染色体单元可以用于表征一类结构的时空卷积网络模型。不同染色体单元对应的一类时空卷积网络模型的结构不同。每个所述染色体单元对应的时空卷积网络模型,可以是,每个所述染色体单元所表征的一类时空卷积网络模型。所述多个染色体单元对应的时空卷积网络模型,可以是,所述多个染色体单元所表征的多类时空卷积网络模型。染色体单元对应的时空卷积网络模型可以是染色体单元表征的一类时空卷积网络模型初始化后的结果。生成染色体单元后,可以初始化染色体单元表征的一类时空卷积网络模型,得到染色体单元对应的时空卷积网络模型。初始化染色体单元表征的一类时空卷积网络模型,可以是将预设参数作为染色体单元对应的时空卷积网络模型的模型参数。In addition, each of the chromosomal units can be used to characterize a class of structural spatio-temporal convolutional network models. The structure of a class of spatio-temporal convolutional network models corresponding to different chromosome units is different. The spatiotemporal convolutional network model corresponding to each chromosomal unit may be a type of spatiotemporal convolutional network model represented by each chromosomal unit. The spatiotemporal convolutional network model corresponding to the plurality of chromosome units may be a multi-type spatiotemporal convolutional network model represented by the plurality of chromosome units. The spatio-temporal convolutional network model corresponding to the chromosome unit may be a result of initialization of a type of spatio-temporal convolutional network model represented by the chromosome unit. After the chromosome unit is generated, a class of spatio-temporal convolutional network model represented by the chromosome unit can be initialized to obtain the spatio-temporal convolutional network model corresponding to the chromosome unit. A type of space-time convolutional network model for initializing the chromosomal unit representation may be a model parameter of the space-time convolutional network model corresponding to the chromosomal unit with preset parameters.
在一些实施例中,所述基于所述目标染色体单元对应的时空卷积网络模型确定所述预先训练的时空卷积网络模型,可以是,对所述目标染色体单元对应的时空卷积网络模型进行模型训练,得到所述预先训练的时空卷积网络模型。示例地,所述染色体单元包括层数比特位,观测域比特位及扩展因子比特位,在确定目标染色体后,基于目标染色体的层数比特位,观测域比特位及扩展因子比特位,可以构建一个时空卷积网络模型,对构建的时空卷积网络模型进行训练,可以得到所述预先训练的时空卷积网络模型。In some embodiments, the determining the pre-trained spatiotemporal convolutional network model based on the spatiotemporal convolutional network model corresponding to the target chromosome unit may be, performing Model training to obtain the pre-trained spatio-temporal convolutional network model. Exemplarily, the chromosome unit includes layer number bits, observation domain bits and expansion factor bits. After the target chromosome is determined, based on the layer number bits, observation domain bits and expansion factor bits of the target chromosome, it can be constructed A spatio-temporal convolutional network model, training the constructed spatio-temporal convolutional network model to obtain the pre-trained spatio-temporal convolutional network model.
本公开实施例中,生成多个染色体单元,每个所述染色体单元用于表征一类时空卷积网络模型;基于样本集分别计算所述多个染色体单元中每个所述染色体单元对应的时空卷积网络模型的损失值;依据所述多个染色体单元对应的时空卷积网络模型的损失值更新所述多个染色体单元,并返回执行所述基于样本集分别计算所述多个染色体单元中每个所述染色体单元对应的时空卷积网络模型的损失值的步骤,直至确定满足预设条件的目标染色体单元;基于所述目标染色体单元对应的时空卷积网络模型确定预先训练的时空卷积网络模型;基于所述预先训练的时空卷积网络模型预测交通状态。这样,通过预先训练的时空卷积网络模型预测交通状态,能够提高预测交通状态的准确性;且采用进化算法对时空卷积网络模型进行模型结构的优化,能够降低调试时空卷积网络模型的参数的成本。In the embodiment of the present disclosure, a plurality of chromosome units are generated, and each chromosome unit is used to characterize a class of spatio-temporal convolutional network model; based on the sample set, the time-space corresponding to each of the chromosome units in the plurality of chromosome units is calculated respectively. The loss value of the convolutional network model; update the plurality of chromosome units according to the loss value of the spatio-temporal convolutional network model corresponding to the plurality of chromosome units, and return to perform the calculation of the plurality of chromosome units based on the sample set The step of the loss value of the spatio-temporal convolutional network model corresponding to each of the chromosomal units until the target chromosomal unit satisfying the preset condition is determined; the pre-trained spatio-temporal convolution is determined based on the spatio-temporal convolutional network model corresponding to the target chromosomal unit A network model; predicting a traffic state based on the pre-trained spatio-temporal convolutional network model. In this way, predicting the traffic state through the pre-trained spatio-temporal convolutional network model can improve the accuracy of predicting the traffic state; and using the evolutionary algorithm to optimize the model structure of the spatio-temporal convolutional network model can reduce the parameters of debugging the spatio-temporal convolutional network model the cost of.
在一些实施例中,所述染色体单元包括如下至少一项:In some embodiments, the chromosomal unit comprises at least one of the following:
层数比特位,观测域比特位,扩展因子比特位;Layer number bits, observation domain bits, expansion factor bits;
其中,所述层数比特位用于表征所述时空卷积网络模型的隐藏层的层数,所述观测域比特位用于表征每个所述隐藏层的观测域,所述扩展因子比特位用于表征每个所述隐藏层的卷积扩展因子。Wherein, the number of layers bit is used to characterize the number of layers of the hidden layer of the spatio-temporal convolutional network model, the observation domain bit is used to characterize the observation domain of each hidden layer, and the expansion factor bit The convolutional dilation factor used to characterize each of said hidden layers.
另外,层数比特位可以为染色体单元的头部编码比特,层数比特位的比特位数可以为3位,5位或者8位等等,本实施例对此不进行限定。以染色体单元的层数比特位的比特位数为3位为例,该染色体单元最多包括7层隐藏层。每个所述隐藏层的观测域可以用3位比特表征,或者5位比特表征或者8位比特表征,等等,本实施例对此不进行限定。每个所述隐藏层的卷积扩展因子可以用3位比特表征,或者5位比特表征或者8位比特表征,等等,本实施例对此不进行限定。在一些实施例中,在设置观测域和卷积扩展因子时,可以设置观测域和卷积扩展因子的值均小于输入层输入的最大个数。In addition, the layer number bits may be header coding bits of the chromosome unit, and the number of layer number bits may be 3 bits, 5 bits, or 8 bits, etc., which is not limited in this embodiment. Taking the layer number bits of the chromosome unit as 3 bits as an example, the chromosome unit includes at most 7 hidden layers. The observation field of each hidden layer may be represented by 3 bits, or 5 bits, or 8 bits, etc., which is not limited in this embodiment. The convolution expansion factor of each hidden layer may be represented by 3 bits, or 5 bits, or 8 bits, etc., which is not limited in this embodiment. In some embodiments, when setting the observation domain and the convolution expansion factor, the values of the observation domain and the convolution expansion factor may be set to be smaller than the maximum number of inputs of the input layer.
在一种实施方式中,层数比特位的比特位数为v1,每个所述隐藏层的观测域用v2位比特表征,且每个所述隐藏层的卷积扩展因子用v3位比特表征,对于每个隐藏层,包括v2位比特的观测域及v3位比特的卷积扩展因子,若染色体单元的层数比特位表征所 述时空卷积网络模型的隐藏层的层数为n,则该染色体单元的总比特位数为:v1+(v2+v3)*n。示例地,层数比特位的比特位数为3,每个所述隐藏层的观测域用3位比特表征,且每个所述隐藏层的卷积扩展因子用3位比特表征,对于每个隐藏层,包括3位比特的观测域及3位比特的卷积扩展因子,若染色体单元的层数比特位表征所述时空卷积网络模型的隐藏层的层数为n,则该染色体单元的总比特位数为:3+(3+3)*n。染色体单元的第1位至第3位表征隐藏层的层数,第4位至第6位表征第一个隐藏层的观测域,第7位至第9位表征第一个隐藏层的卷积扩展因子,第10位至第12位表征第二个隐藏层的观测域,第13位至第15位表征第二个隐藏层的卷积扩展因子,等等,依次类推。In one embodiment, the number of bits in the number of layers is v1, the observation field of each hidden layer is represented by v2 bits, and the convolution expansion factor of each hidden layer is represented by v3 bits , for each hidden layer, including the observation field of v2 bits and the convolution expansion factor of v3 bits, if the number of layers of chromosome units represents the number of hidden layers of the space-time convolutional network model is n, then The total number of bits of the chromosome unit is: v1+(v2+v3)*n. For example, the number of bits in the number of layers is 3, the observation field of each hidden layer is represented by 3 bits, and the convolution expansion factor of each hidden layer is represented by 3 bits, for each Hidden layer, including the observation field of 3 bits and the convolution expansion factor of 3 bits, if the number of layers of the chromosomal unit indicates that the number of layers of the hidden layer of the space-time convolutional network model is n, then the number of layers of the chromosomal unit The total number of bits is: 3+(3+3)*n. The 1st to 3rd bits of the chromosome unit represent the number of layers of the hidden layer, the 4th to 6th bits represent the observation domain of the first hidden layer, and the 7th to 9th bits represent the convolution of the first hidden layer The expansion factor, the 10th to 12th bits represent the observation domain of the second hidden layer, the 13th to 15th bits represent the convolution expansion factor of the second hidden layer, and so on, and so on.
示例地,染色体单元为:010010010001001,第1位至第3位“010”表征隐藏层的层数为2,第4位至第6位“010”表征第一个隐藏层的观测域为2,第7位至第9位“010”表征第一个隐藏层的卷积扩展因子为2,第10位至第12位“001”表征第二个隐藏层的观测域为1,第13位至第15位“001”表征第二个隐藏层的卷积扩展因子为1。For example, the chromosome unit is: 010010010001001, the first to third digits "010" indicate that the number of hidden layers is 2, and the fourth to sixth digits "010" indicate that the observation domain of the first hidden layer is 2, The 7th to 9th "010" indicates that the convolution expansion factor of the first hidden layer is 2, the 10th to 12th "001" indicates that the observation field of the second hidden layer is 1, and the 13th to The 15th bit "001" indicates that the convolution expansion factor of the second hidden layer is 1.
在一些实施例中,所述染色体单元可以包括层数比特位,观测域比特位,扩展因子比特位中的一项或多项。以染色体单元仅包括层数比特位为例,每个所述隐藏层的观测域及每个所述隐藏层的卷积扩展因子可以预先设置;以染色体单元仅包括观测域比特位为例,所述时空卷积网络模型的隐藏层的层数及每个所述隐藏层的卷积扩展因子可以预先设置;以染色体单元包括层数比特位及观测域比特位为例,每个所述隐藏层的卷积扩展因子可以预先设置。In some embodiments, the chromosome unit may include one or more of layer number bits, observation domain bits, and expansion factor bits. Taking the chromosome unit only including the number of layers as an example, the observation field of each hidden layer and the convolution expansion factor of each hidden layer can be preset; taking the chromosome unit only including the observation field bits as an example, the The number of layers of the hidden layer of the space-time convolutional network model and the convolution expansion factor of each hidden layer can be preset; taking the chromosome unit including the number of layers bit and the observation domain bit as an example, each hidden layer The convolution expansion factor of can be preset.
该实施方式中,所述层数比特位用于表征所述时空卷积网络模型的隐藏层的层数,所述观测域比特位用于表征每个所述隐藏层的观测域,所述扩展因子比特位用于表征每个所述隐藏层的卷积扩展因子;这样,能够利用时空卷积网络模型的网络参数较少的特点,对于每个场景生成更适应实际情况的预测模型,进而能够降低人员对不同路口场景下对模型进行参数调试的成本。In this embodiment, the number of layers bit is used to represent the number of hidden layers of the spatio-temporal convolutional network model, the observation field bit is used to represent the observation field of each hidden layer, and the extended The factor bits are used to characterize the convolution expansion factor of each hidden layer; like this, the characteristics of less network parameters of the space-time convolutional network model can be utilized to generate a prediction model that is more suitable for the actual situation for each scene, and then can Reduce the cost of personnel debugging the parameters of the model in different intersection scenarios.
在一些实施例中,所述依据所述多个染色体单元对应的时空卷积网络模型的损失值更新所述多个染色体单元,包括:In some embodiments, updating the plurality of chromosome units according to the loss values of the spatio-temporal convolutional network models corresponding to the plurality of chromosome units includes:
按照所述多个染色体单元对应的时空卷积网络模型的损失值从高至低对所述多个染色体单元进行排序;sorting the plurality of chromosome units from high to low according to the loss values of the spatio-temporal convolutional network models corresponding to the multiple chromosome units;
基于前M1个染色体单元生成M2个第一染色体单元,M1和M2均为正整数,M1大于或等于M2;Generate M2 first chromosome units based on the first M1 chromosome units, both M1 and M2 are positive integers, and M1 is greater than or equal to M2;
将所述多个染色体单元中后M2个染色体单元替换为所述M2个第一染色体单元。replacing the last M2 chromosome units among the plurality of chromosome units with the M2 first chromosome units.
其中,M1可以为预设值,示例地,M1可以为10,30或者50等等,本实施例对此不进行限定。Wherein, M1 may be a preset value, for example, M1 may be 10, 30 or 50, etc., which is not limited in this embodiment.
另外,所述基于前M1个染色体单元生成M2个第一染色体单元可以包括,对前M1个染色体单元进行杂交处理,得到至少一个杂交染色体单元,所述M2个第一染色体单元可以包括所述至少一个杂交染色体单元;示例地,M2个第一染色体单元可以为所述至少一个杂交染色体单元;和/或,所述基于前M1个染色体单元生成M2个第一染色体单元可以包括,对所述前M1个染色体单元进行变异处理,得到至少一个变异染色体单元,其中,所述M2个第一染色体单元包括所述至少一个变异染色体单元,示例地,M2个第一染色体单元可以为所述至少一个杂交染色体单元。In addition, the generating M2 first chromosome units based on the first M1 chromosome units may include performing hybridization processing on the first M1 chromosome units to obtain at least one hybrid chromosome unit, and the M2 first chromosome units may include the at least A hybrid chromosome unit; for example, M2 first chromosome units may be the at least one hybrid chromosome unit; and/or, generating M2 first chromosome units based on the first M1 chromosome units may include, for the first M1 chromosomal units undergo mutation processing to obtain at least one mutated chromosomal unit, wherein the M2 first chromosomal units include the at least one mutated chromosomal unit, for example, the M2 first chromosomal units may be the at least one hybrid chromosome unit.
在一些实施例中,在将所述多个染色体单元中后M2个染色体单元替换为所述M2个第一染色体单元之前,可以对生成的M2个第一染色体单元与已有的染色体单元进行查重,将重复的染色体单元去除。In some embodiments, before replacing the last M2 chromosome units among the plurality of chromosome units with the M2 first chromosome units, the generated M2 first chromosome units may be checked against existing chromosome units. Repeated chromosomal units are removed.
该实施方式中,按照所述多个染色体单元对应的时空卷积网络模型的损失值从高至低对所述多个染色体单元进行排序;基于前M1个染色体单元生成M2个第一染色体单元,M1和M2均为正整数,M1大于或等于M2;将所述多个染色体单元中后M2个染色 体单元替换为所述M2个第一染色体单元。这样,通过损失值筛选迭代染色体单元,能够挑选出较优的目标染色体单元,从而能够确定出性能较佳的时空卷积网络模型。In this embodiment, the plurality of chromosome units are sorted according to the loss value of the spatio-temporal convolutional network model corresponding to the plurality of chromosome units from high to low; M2 first chromosome units are generated based on the first M1 chromosome units, Both M1 and M2 are positive integers, and M1 is greater than or equal to M2; the last M2 chromosome units in the plurality of chromosome units are replaced with the M2 first chromosome units. In this way, better target chromosome units can be selected by filtering iterative chromosome units through the loss value, so that a spatio-temporal convolutional network model with better performance can be determined.
在一些实施例中,所述基于前M1个染色体单元生成M2个第一染色体单元,包括:In some embodiments, the generating M2 first chromosome units based on the first M1 chromosome units includes:
对前M1个染色体单元进行杂交处理,得到至少一个杂交染色体单元;Perform hybridization processing on the first M1 chromosome units to obtain at least one hybrid chromosome unit;
对所述前M1个染色体单元进行变异处理,得到至少一个变异染色体单元;performing mutation processing on the first M1 chromosomal units to obtain at least one mutated chromosomal unit;
其中,所述M2个第一染色体单元包括所述至少一个杂交染色体单元和所述至少一个变异染色体单元。Wherein, the M2 first chromosome units include the at least one hybrid chromosome unit and the at least one variant chromosome unit.
其中,所述对前M1个染色体单元进行杂交处理,得到至少一个杂交染色体单元,可以是,将前M1个染色体单元中,任意两个染色体单元的相同位置处的部分比特互换,得到至少一个杂交染色体单元;或者,可以按照预设规则从前M1个染色体单元中选择两个染色体单元,将选择的染色体单元相同位置处的部分比特互换,得到至少一个杂交染色体单元。可以每次从前M1个染色体单元中随机选择两个染色体单元,将选择的两个染色体单元的相同位置处的部分比特互换,重复多次,得到多个杂交染色体单元。可以将表征某个隐藏层的观测域的比特进行互换,或者,可以将表征某个隐藏层的卷积扩展因子的比特进行互换。示例地,可以将前M1个染色体单元中,任意两个染色体单元的第4位至第6位进行互换;或者,可以将前M1个染色体单元中,任意两个染色体单元的第7位至第9位进行互换;等等,本实施例对此不进行限定。Wherein, the hybridization process of the first M1 chromosome units to obtain at least one hybrid chromosome unit may be, in the first M1 chromosome units, part of the bits at the same position of any two chromosome units are exchanged to obtain at least one hybrid chromosome units; or, two chromosome units can be selected from the first M1 chromosome units according to preset rules, and part of the bits at the same position of the selected chromosome units can be exchanged to obtain at least one hybrid chromosome unit. Two chromosome units can be randomly selected from the first M1 chromosome units at a time, and some bits at the same positions of the two selected chromosome units are exchanged for multiple times to obtain multiple hybrid chromosome units. The bits representing the observation field of a certain hidden layer can be swapped, or the bits representing the convolution expansion factor of a certain hidden layer can be swapped. Exemplarily, among the first M1 chromosome units, positions 4 to 6 of any two chromosome units can be exchanged; or, among the first M1 chromosome units, positions 7 to 6 of any two chromosome units can be exchanged. The ninth bit is exchanged; etc., which is not limited in this embodiment.
示例地,可以以前M1个染色体单元中最短的染色体单元为最大突变点,将最短的染色体单元与其他染色体单元进行杂交处理,示例地,可以将层数为1的染色体单元001001001和层数为2的染色体单元010010010001001进行杂交处理,将该两个染色体单元的第4位至第6位进行互换,得到两条新的染色体单元。Exemplarily, the shortest chromosomal unit among the previous M1 chromosomal units can be used as the maximum mutation point, and the shortest chromosomal unit can be hybridized with other chromosomal units. Exemplarily, the chromosomal unit 001001001 with a layer number of 1 and the chromosome unit with a layer number of 2 The chromosomal unit 010010010001001 is hybridized, and the 4th to 6th positions of the two chromosomal units are exchanged to obtain two new chromosomal units.
另外,所述对所述前M1个染色体单元进行变异处理,得到至少一个变异染色体单元,可以是,对所述前M1个染色体单元中的至少一个染色体单元的部分比特取反;或者,可以是对所述前M1个染色体单元中的至少一个染色体单元的部分比特随机替换,等等。随机替换可以是从1或0中随机选择一个值替换染色体单元中的比特值。可以从所述前M1个染色体单元中随机选择一个染色体单元,从该选择的染色体单元中随机选择一个比特或多个比特,对选择的比特进行取反或随机替换。示例地,对染色体单元的高层可以设置变异率μ,概率为μ=0.001*n1,其中n1为第n1层隐藏层,如果击中命中率则该隐藏层发生观测域,卷积扩展因子的随机变异,从而生成新的染色体单元。In addition, the performing mutation processing on the first M1 chromosome units to obtain at least one mutated chromosome unit may be inverting some bits of at least one chromosome unit in the first M1 chromosome units; or, it may be Randomly replace some bits of at least one chromosome unit in the first M1 chromosome units, and so on. Random replacement can be to randomly select a value from 1 or 0 to replace the bit value in the chromosome unit. A chromosome unit may be randomly selected from the first M1 chromosome units, one or more bits may be randomly selected from the selected chromosome unit, and the selected bit may be reversed or randomly replaced. For example, the mutation rate μ can be set for the upper layer of the chromosome unit, the probability is μ=0.001*n1, where n1 is the n1th hidden layer, if the hit rate is hit, the hidden layer will appear in the observation domain, and the random expansion factor of the convolution Mutations to generate new chromosome units.
该实施方式中,对前M1个染色体单元进行杂交处理,得到至少一个杂交染色体单元;对所述前M1个染色体单元进行变异处理,得到至少一个变异染色体单元。这样,通过杂交及变异处理实现了对表现较优的染色体单元的组合,从而能够获得较为符合当前场景的模型设计。In this embodiment, hybridization processing is performed on the first M1 chromosome units to obtain at least one hybrid chromosome unit; mutation processing is performed on the first M1 chromosome units to obtain at least one mutant chromosome unit. In this way, the combination of chromosome units with better performance is realized through hybridization and mutation processing, so that a model design that is more suitable for the current scene can be obtained.
在一些实施例中,所述目标染色体单元为更新次数达到第一预设次数后排序在最前的染色体单元;In some embodiments, the target chromosomal unit is the chromosomal unit that ranks first after the number of updates reaches the first preset number;
或者,or,
所述目标染色体单元为更新过程中连续M3次排序位于最前的染色体单元,M3大于或等于第二预设次数。The target chromosomal unit is the first chromosomal unit sorted for M3 consecutive times during the updating process, and M3 is greater than or equal to the second preset number of times.
其中,M3为正整数。第一预设次数可以为300,400或者500等等,本实施例对此不进行限定。第二预设次数可以为20,40或者50等等,本实施例对此不进行限定。示例地,第一预设次数为400,第二预设次数为20,可以将迭代400代后,排序在最前的染色体单元确定为目标染色体单元;或者,可以将更新过程中连续20次排序位于最前的染色体单元确定为目标染色体单元。Wherein, M3 is a positive integer. The first preset number of times may be 300, 400, or 500, etc., which is not limited in this embodiment. The second preset number of times may be 20, 40 or 50, etc., which is not limited in this embodiment. For example, the first preset number of times is 400, and the second preset number of times is 20. After 400 iterations, the chromosome unit sorted at the top can be determined as the target chromosome unit; The top chromosome unit is determined as the target chromosome unit.
该实施方式中,所述目标染色体单元为更新次数达到第一预设次数后排序在最前的染色体单元;或者,所述目标染色体单元为更新过程中连续N次排序位于最前的染色体 单元,N大于或等于第二预设次数。从而通过多次更新迭代能够确定出性能较佳的时空卷积网络模型。In this embodiment, the target chromosomal unit is the chromosomal unit that is sorted at the top after the number of updates reaches the first preset number; or, the target chromosomal unit is the chromosome unit that is sorted at the top for N consecutive times during the update process, and N is greater than or equal to the second preset number of times. Therefore, a spatio-temporal convolutional network model with better performance can be determined through multiple update iterations.
在一些实施例中,所述基于所述预先训练的时空卷积网络模型预测交通状态,包括:In some embodiments, the prediction of the traffic state based on the pre-trained spatio-temporal convolutional network model includes:
首先,将目标路段在当前时刻之前的N个预测时刻的真实交通状态输入预先训练的时空卷积网络模型;其中,所述时空卷积网络模型包括输入层,输出层及连接在所述输入层与所述输出层之间的多个隐藏层,所述输入层用于输入在当前时刻之前的N个预测时刻的真实交通状态,所述多个隐藏层中每个隐藏层的输出均基于时空注意力机制分别对每个所述隐藏层的输入进行卷积计算获得,N为正整数;First, input the real traffic state of the target road segment at N predicted moments before the current moment into the pre-trained spatio-temporal convolutional network model; A plurality of hidden layers between the output layer, the input layer is used to input the real traffic state of N prediction moments before the current moment, and the output of each hidden layer in the plurality of hidden layers is based on the space-time The attention mechanism performs convolution calculation on the input of each hidden layer, and N is a positive integer;
然后,基于所述输出层的输出确定所述目标路段在当前时刻之后的预测时刻的预测交通状态。Then, based on the output of the output layer, the predicted traffic state of the target road segment at the predicted time after the current time is determined.
其中,所述真实交通状态可以用路段平均车速与自由流速度的比值表征。路段平均车速可以为预设时长内在目标路段过车的车辆的平均车速的均值作为路段平均车速。另外,每两个预测时刻之间的时长可以为5min,10min或者30min等等,本实施例对此不进行限定。如图2所示,以N的值为5,时空卷积网络模型包括四个隐藏层,时空卷积网络模型的观测域为2,卷积扩展因子d分别为1,2,4为例,输入层输入前5个预测时刻的真实交通状态(X1,X2,X3,X4,X5),输出层可以输出未来的预测时刻的预测交通状态Y5。所述多个隐藏层中每个隐藏层的输出可以均基于时空注意力机制对每个所述隐藏层的输入进行因果卷积计算获得。Wherein, the real traffic state can be characterized by the ratio of the average vehicle speed of the road section to the free flow speed. The average speed of the road section may be the average speed of the vehicles passing by the target road section within a preset time period as the average speed of the road section. In addition, the duration between every two predicted moments may be 5 minutes, 10 minutes, or 30 minutes, etc., which is not limited in this embodiment. As shown in Figure 2, taking the value of N as 5, the spatio-temporal convolutional network model includes four hidden layers, the observation field of the spatio-temporal convolutional network model is 2, and the convolution expansion factors d are 1, 2, and 4 as an example. The input layer inputs the real traffic state (X1, X2, X3, X4, X5) of the first 5 prediction moments, and the output layer can output the predicted traffic state Y5 of the future prediction moment. The output of each hidden layer in the plurality of hidden layers can be obtained by performing causal convolution calculation on the input of each hidden layer based on the spatio-temporal attention mechanism.
其中,所述输出层的输出可以包括在当前时刻之后的预测时刻的路段平均车速与自由流速度的比值,可以依据《GBT 33171-2016城市交通运行状况评价规范》等判定比值对应的未来交通状态。示例地,若比值大于0.7,则可以认为交通通畅;若比值大于0.5且小于等于0.7,则可以认为交通基本通畅;若比值大于0.4且小于等于0.5,则可以认为交通轻度拥堵;若比值大于0.3且小于等于0.4,则可以认为交通中度拥堵;若比值小于等于0.3,则可以认为交通严重拥堵。Wherein, the output of the output layer may include the ratio of the average vehicle speed of the road section at the predicted time after the current moment to the free flow speed, and the future traffic state corresponding to the ratio may be determined according to "GBT 33171-2016 Urban Traffic Operation Condition Evaluation Specification" and the like. . For example, if the ratio is greater than 0.7, it can be considered that the traffic is smooth; if the ratio is greater than 0.5 and less than or equal to 0.7, it can be considered that the traffic is basically smooth; if the ratio is greater than 0.4 and less than or equal to 0.5, it can be considered that the traffic is slightly congested; If the ratio is 0.3 and less than or equal to 0.4, it can be considered as moderate traffic congestion; if the ratio is less than or equal to 0.3, it can be considered as severe traffic congestion.
示例地,N为3,每两个预测时刻之间的间隔为5min,当前时刻之前的N个预测时刻为10:05、10:10及10:15,当前时刻之后的预测时刻为10:20,则可以通过10:05、10:10及10:15的真实交通状态预测10:20的交通状态。For example, N is 3, the interval between every two predicted moments is 5 minutes, the N predicted moments before the current moment are 10:05, 10:10 and 10:15, and the predicted moments after the current moment are 10:20 , the traffic state at 10:20 can be predicted by the real traffic state at 10:05, 10:10 and 10:15.
在一些实施例中,在对时空卷积网络模型进行训练时,可以针对目标路段计算路段平均车速,并计算路段平均车速与当前时刻的自由流速度的比值。路段平均车速的计算方法可以为:将同一辆车在经过当前时刻对应的电警卡口的时间戳Tc和经过上游电警卡口的时间戳Tp进行相减得到过车时间T=Tc-Tp,将两个电警卡口间的路长D除以过车时间T得到Sv,Sv为该车辆在目标路段的平均车速,可以将预设时长内在目标路段过车的车辆的平均车速的均值作为路段平均车速。可以每间隔5分钟计算一次前15分钟在目标路段过车的各个车辆的平均车速,依据车流量计算各个车辆的平均车速的均值得到路段平均车速,一小时可以得到12条数据,一天可以得到24*12=288条数据。可以将计算的多天的路段平均车速进行合并和归一化,将归一化后的数据划分成训练集和测试集,可以将归一化后的数据按照比例为20%作为测试集,80%作为训练集进行划分。可以将划分得到的训练集和测试集对时空卷积网络模型进行训练。In some embodiments, when training the spatio-temporal convolutional network model, the average vehicle speed of the road section can be calculated for the target road section, and the ratio of the average vehicle speed of the road section to the free flow speed at the current moment can be calculated. The calculation method of the average vehicle speed of the road section can be: subtract the time stamp Tc of the same vehicle passing the corresponding electric police checkpoint at the current moment from the time stamp Tp of passing the upstream electric police checkpoint to obtain the passing time T=Tc-Tp , divide the road length D between two electric police checkpoints by the passing time T to get Sv, Sv is the average speed of the vehicle on the target road section, and the average speed of the vehicles passing on the target road section within the preset time can be calculated as the average speed of the road segment. The average speed of each vehicle that passed the target road section in the previous 15 minutes can be calculated every 5 minutes, and the average speed of each vehicle can be calculated according to the traffic flow to obtain the average speed of the road section. 12 pieces of data can be obtained in one hour, and 24 pieces can be obtained in one day. *12=288 pieces of data. The average vehicle speed of the multi-day road section calculated can be combined and normalized, and the normalized data can be divided into a training set and a test set. The normalized data can be used as a test set with a ratio of 20%, 80 % is divided as the training set. The divided training set and test set can be used to train the spatio-temporal convolutional network model.
若所述预设时长内在所述目标路段没有过车,则可以设置路段平均车速与当前时刻的自由流速度的比值为1。自由流速度可以为不受上下游条件影响的交通流运行速度。在实际使用时,自由流速度可以设置为该目标路段的最大限速值。If there is no passing vehicle on the target road section within the preset time period, the ratio of the average vehicle speed of the road section to the free flow speed at the current moment may be set to 1. The free flow speed can be the speed at which the traffic flow is not affected by upstream and downstream conditions. In actual use, the free-flow speed can be set as the maximum speed limit value of the target road section.
另外,在对时空卷积网络模型进行训练时,可以采用训练集中的样本对时空卷积网络模型进行模型训练,通过early stop(早停法)方法来自动停止模型的训练以防止模型学习过拟合,暂停后得到训练后的预测模型,再用测试集中的样本来判断预测模型是否可靠。In addition, when training the spatio-temporal convolutional network model, the samples in the training set can be used for model training of the spatio-temporal convolutional network model, and the early stop (early stop method) method is used to automatically stop the training of the model to prevent the model from overfitting. After pausing, the trained prediction model is obtained, and then the samples in the test set are used to judge whether the prediction model is reliable.
该实施方式中,将目标路段在当前时刻之前的N个预测时刻的真实交通状态输入预先训练的时空卷积网络模型,其中,所述时空卷积网络模型包括输入层,输出层及连接在所述输入层与所述输出层之间的多个隐藏层,所述输入层用于输入在当前时刻之前的N个预测时刻的真实交通状态,所述多个隐藏层中每个隐藏层的输出均基于时空注意力机制分别对每个所述隐藏层的输入进行卷积计算获得,N为正整数;基于所述输出层的输出确定所述目标路段在当前时刻之后的预测时刻的预测交通状态。这样,通过预先训练的时空卷积网络模型确定所述目标路段在当前时刻之后的预测时刻的预测交通状态,能够提高预测交通状态的准确性。In this embodiment, the real traffic state of the target road section at N predicted moments before the current moment is input into the pre-trained spatio-temporal convolutional network model, wherein the spatio-temporal convolutional network model includes an input layer, an output layer, and a connection between the A plurality of hidden layers between the input layer and the output layer, the input layer is used to input the real traffic state of N predicted moments before the current moment, the output of each hidden layer in the plurality of hidden layers Both are obtained by performing convolution calculation on the input of each hidden layer based on the spatio-temporal attention mechanism, and N is a positive integer; based on the output of the output layer, the predicted traffic state of the target road section at the predicted moment after the current moment is determined . In this way, the predicted traffic state of the target road segment at the predicted time after the current time is determined through the pre-trained spatio-temporal convolutional network model, which can improve the accuracy of the predicted traffic state.
在一些实施例中,所述输入层还用于输入附加状态信息,所述附加状态信息用于表征所述交通状态所属的环境特征;In some embodiments, the input layer is also used to input additional state information, the additional state information is used to characterize the environmental characteristics to which the traffic state belongs;
所述多个隐藏层包括第一隐藏层,所述第一隐藏层与所述输入层连接,所述第一隐藏层用于对所述在当前时刻之前的N个预测时刻的真实交通状态与所述附加状态信息进行融合。The multiple hidden layers include a first hidden layer, the first hidden layer is connected to the input layer, and the first hidden layer is used to compare the real traffic state and The additional state information is fused.
其中,附加状态信息可以为天气信息,和/或节假日信息等等。第一隐藏层可以将作为真实交通状态的时间段序列与天气信息和/或节假日信息等附加状态信息进行融合,使得单一的输入具有独特信息。进行融合的过程可以是将在当前时刻之前的N个预测时刻的真实交通状态与附加状态信息进行叠加;或者,还可以是将在当前时刻之前的N个预测时刻的真实交通状态与附加状态信息进行点乘运算;或者,还可以是按照预设算法对在当前时刻之前的N个预测时刻的真实交通状态与附加状态信息进行处理,等等,本公开实施例对此不进行限定。作为一个简单的示例,N为2,在当前时刻之前的2个预测时刻的真实交通状态为:(0.2,0.5),该2个预测时刻的天气分别为晴和下雨,用0.02表征晴,0.04表征下雨,对应的天气信息为:(0.02,0.04),可以将(0.2,0.5)与(0.02,0.04)进行相加,得到第一隐藏层的输出(0.22,0.54)。Wherein, the additional status information may be weather information, and/or holiday information and the like. The first hidden layer can fuse the time period sequence as the real traffic state with additional state information such as weather information and/or holiday information, so that a single input has unique information. The process of fusion can be to superimpose the real traffic state of the N predicted moments before the current moment with the additional state information; or, it can also be to combine the real traffic state of the N predicted moments before the current moment with the additional state information Dot product calculation; or, it may also be to process the real traffic state and additional state information at N predicted moments before the current moment according to a preset algorithm, etc., which is not limited in this embodiment of the present disclosure. As a simple example, N is 2, and the real traffic status of the two predicted moments before the current moment is: (0.2, 0.5), the weather at the two predicted moments is sunny and rainy respectively, and 0.02 is used to represent sunny, 0.04 represents rain, and the corresponding weather information is: (0.02, 0.04). You can add (0.2, 0.5) and (0.02, 0.04) to get the output of the first hidden layer (0.22, 0.54).
另外,所述多个隐藏层还可以包括第二隐藏层,所述第二隐藏层与所述输出层连接,所述输出层用于对第二隐藏层的输出进行解码,得到在当前时刻之后的预测时刻的路段平均车速与自由流速度的比值。对所述在当前时刻之前的N个预测时刻的真实交通状态与所述附加状态信息进行融合的过程可以为encode(编码)过程;对第二隐藏层的输出进行解码,得到在当前时刻之后的预测时刻的路段平均车速与自由流速度的比值可以为decode(解码)过程。经过decode后,可以得到一个个连续序列,由于预测时不需要额外的返回值信息,可以在decode解码时仅返回在当前时刻之后的预测时刻的路段平均车速与自由流速度的比值。如图2所示,通过引入encode-decode机制,可以让时空卷积网络模型学习到时间跨度间的关联关系,并且在编码时加入附加状态信息可以帮助时空卷积网络模型区分不同状态下的数据差异。In addition, the plurality of hidden layers may further include a second hidden layer, the second hidden layer is connected to the output layer, and the output layer is used to decode the output of the second hidden layer to obtain The ratio of the average vehicle speed of the road segment to the free flow speed at the prediction time. The process of fusing the real traffic state of the N predicted moments before the current moment with the additional state information can be an encode (encoding) process; the output of the second hidden layer is decoded to obtain the traffic state after the current moment The ratio of the average vehicle speed of the road section at the prediction time to the free flow speed can be a decode (decoding) process. After decoding, a continuous sequence can be obtained. Since no additional return value information is required during prediction, only the ratio of the average vehicle speed to the free flow speed of the road section at the prediction time after the current time can be returned during decoding. As shown in Figure 2, by introducing the encode-decode mechanism, the spatiotemporal convolutional network model can learn the correlation between time spans, and adding additional state information during encoding can help the spatiotemporal convolutional network model distinguish data in different states difference.
该实施方式中,所述第一隐藏层用于对所述在当前时刻之前的N个预测时刻的真实交通状态与所述附加状态信息进行融合,从而时空卷积网络模型能够学习到交通状态所属的环境特征,能够提高时空卷积网络模型预测的准确性。In this embodiment, the first hidden layer is used to fuse the real traffic state of the N predicted moments before the current moment with the additional state information, so that the spatio-temporal convolutional network model can learn the traffic state to which Environmental characteristics can improve the prediction accuracy of spatio-temporal convolutional network model.
在一些实施例中,目标隐藏层的输出依据卷积结果及增强残差结果获得,所述卷积结果为所述目标隐藏层基于时空注意力机制对所述目标隐藏层的输入进行卷积处理获得,所述增强残差结果为所述目标隐藏层对所述目标隐藏层的输入进行增强残差处理获得,所述目标隐藏层为所述多个隐藏层中的任意一个隐藏层。In some embodiments, the output of the target hidden layer is obtained according to the convolution result and the enhanced residual result, and the convolution result is that the target hidden layer performs convolution processing on the input of the target hidden layer based on a spatio-temporal attention mechanism The enhanced residual result is obtained by performing enhanced residual processing on the input of the target hidden layer by the target hidden layer, and the target hidden layer is any hidden layer in the plurality of hidden layers.
其中,可以基于时空注意力机制对所述目标隐藏层的输入进行卷积处理得到卷积结果,对所述目标隐藏层的输入进行增强残差处理获得增强残差结果,依据卷积结果、增强残差结果及所述目标隐藏层的输入获取所述目标隐藏层的输出。示例地,可以采用激活函数对卷积结果、增强残差结果及所述目标隐藏层的输入进行运算,得到所述目标隐藏层的输出。Wherein, the input of the target hidden layer can be convoluted based on the spatio-temporal attention mechanism to obtain the convolution result, and the input of the target hidden layer can be enhanced to obtain the enhanced residual result. According to the convolution result, the enhanced The residual result and the input of the target hidden layer obtain the output of the target hidden layer. For example, an activation function may be used to perform operations on the convolution result, the enhanced residual result, and the input of the target hidden layer to obtain the output of the target hidden layer.
该实施方式中,所述目标隐藏层的输出依据卷积结果及增强残差结果获得,所述卷积结果为所述目标隐藏层基于时空注意力机制对所述目标隐藏层的输入进行卷积处理获得,所述增强残差结果为所述目标隐藏层对所述目标隐藏层的输入进行增强残差处理获得,所述目标隐藏层为所述多个隐藏层中的任意一个隐藏层。这样,能够通过增强残差结果来增强目标隐藏层提取重要信息的能力,提升时空卷积网络模型的学习效率。In this embodiment, the output of the target hidden layer is obtained according to the convolution result and the enhanced residual result, and the convolution result is that the target hidden layer convolves the input of the target hidden layer based on the spatio-temporal attention mechanism The enhanced residual result is obtained by performing enhanced residual processing on the input of the target hidden layer by the target hidden layer, and the target hidden layer is any hidden layer in the plurality of hidden layers. In this way, the ability of the target hidden layer to extract important information can be enhanced by enhancing the residual results, and the learning efficiency of the spatio-temporal convolutional network model can be improved.
在一些实施例中,所述目标隐藏层包括K个有效节点,K为正整数,所述有效节点的输出为所述有效节点对所述目标隐藏层的前一隐藏层的至少两个节点的输出进行卷积计算获得;所述K个有效节点中第M个有效节点的输出依据第M个有效节点对应的卷积结果及所述第M个有效节点对应的增强残差结果获取,M为大于1的正整数,且M小于等于K。In some embodiments, the target hidden layer includes K valid nodes, K is a positive integer, and the output of the valid node is the output of the valid node to at least two nodes of the previous hidden layer of the target hidden layer The output is obtained by convolution calculation; the output of the Mth effective node among the K effective nodes is obtained according to the convolution result corresponding to the Mth effective node and the enhanced residual result corresponding to the Mth effective node, and M is A positive integer greater than 1, and M is less than or equal to K.
其中,可以采用激活函数对第M个有效节点对应的卷积结果、第M个有效节点对应的增强残差结果及目标隐藏层的前一隐藏层中与所述第M个有效节点对应的节点的输出进行运算,得到所述目标隐藏层的输出。这样,隐藏层的每个节点的输出均包括增强残差信息。所述目标隐藏层可以为除第一隐藏层以外的隐藏层。Wherein, the convolution result corresponding to the Mth effective node, the enhanced residual result corresponding to the Mth effective node, and the node corresponding to the Mth effective node in the previous hidden layer of the target hidden layer can be used by the activation function The output of the operation is performed to obtain the output of the target hidden layer. In this way, the output of each node of the hidden layer includes enhanced residual information. The target hidden layer may be a hidden layer other than the first hidden layer.
继续参考图2所示,时空卷积网络模型包括四个隐藏层,时空卷积网络模型的观测域为2,卷积扩展因子d分别为1,2,4。在图2中,S
i
j表征第j+1个隐藏层中第i个节点,i为正整数,j为大于0的整数,示例地,S
5
3表征第4个隐藏层中第5个节点。在图2中,有效节点在节点上方标记有圆圈符号。以第2个隐藏层为例,S
2
1为第2个隐藏层中的第一个有效节点。
Continuing to refer to Figure 2, the space-time convolutional network model includes four hidden layers, the observation field of the space-time convolutional network model is 2, and the convolution expansion factors d are 1, 2, and 4, respectively. In Figure 2, S i j represents the i-th node in the j+1th hidden layer, i is a positive integer, and j is an integer greater than 0. For example, S 5 3 represents the fifth node in the fourth hidden layer node. In Figure 2, valid nodes are marked with a circle symbol above the node. Taking the second hidden layer as an example, S 2 1 is the first effective node in the second hidden layer.
在一些实施例中,所述第M个有效节点对应的卷积结果为对所述前一隐藏层中P个节点对应的P个中间变量中的至少两个中间变量进行因果卷积计算获得,所述P个节点中每个节点所对应的预测时刻均不在所述第M个有效节点对应的预测时刻之后,P为正整数;In some embodiments, the convolution result corresponding to the Mth effective node is obtained by performing causal convolution calculation on at least two of the P intermediate variables corresponding to the P nodes in the previous hidden layer, The prediction time corresponding to each node among the P nodes is not after the prediction time corresponding to the Mth valid node, and P is a positive integer;
所述P个节点对应的P个中间变量分别依据所述P个节点对应的值向量及第一权重矩阵确定;The P intermediate variables corresponding to the P nodes are respectively determined according to the value vectors corresponding to the P nodes and the first weight matrix;
所述第一权重矩阵为对所述P个节点对应的键向量及查询向量进行点乘计算获得;The first weight matrix is obtained by performing dot product calculation on key vectors and query vectors corresponding to the P nodes;
所述P个节点对应的键向量、值向量及查询向量基于时空注意力机制确定。The key vector, value vector and query vector corresponding to the P nodes are determined based on a spatio-temporal attention mechanism.
其中,所述第M个有效节点对应的卷积结果可以是对所述前一隐藏层中P个节点对应的P个中间变量中的至少两个中间变量进行一维因果卷积计算获得。为了保持每个隐藏层的计算长度相同,可以通过zero-padding(零填充)的方式,每层在左边的非有效节点增加padding(填充),把每层左边的信息慢慢累积到右边。Wherein, the convolution result corresponding to the Mth effective node may be obtained by performing one-dimensional causal convolution calculation on at least two of the P intermediate variables corresponding to the P nodes in the previous hidden layer. In order to keep the calculation length of each hidden layer the same, you can use zero-padding (zero padding) to add padding (filling) to the non-effective nodes on the left side of each layer, and slowly accumulate the information on the left side of each layer to the right side.
另外,第一权重矩阵可以为:In addition, the first weight matrix can be:
其中,l用于表征目标隐藏层的前一隐藏层,i∈{1,2,…,P},j∈{1,2,…,P},d
k为维度,
为所述P个节点对应的键向量中第i个节点对应的键向量,
为所述P个节点对应的查询向量中第j个节点对应的查询向量。
Among them, l is used to represent the previous hidden layer of the target hidden layer, i∈{1,2,…,P}, j∈{1,2,…,P}, d k is the dimension, is the key vector corresponding to the i-th node in the key vectors corresponding to the P nodes, is the query vector corresponding to the jth node among the query vectors corresponding to the P nodes.
在一些实施例中,对于第一权重矩阵,矩阵左下角部分的数据可以表征未来的信息,矩阵右上角部分的数据可以用于表征过去的信息,可以将第一权重矩阵中i<j的位置的数据均设为0,从而可以仅使用过去的信息。In some embodiments, for the first weight matrix, the data in the lower left corner of the matrix can represent future information, the data in the upper right corner of the matrix can be used to represent past information, and the position of i<j in the first weight matrix can be The data of is set to 0, so that only past information can be used.
另外,可以通过softplus激活函数对第一权重矩阵和所述M个有效节点对应的值向量进行处理,得到第二权重矩阵,可以通过第二权重矩阵计算所述前一隐藏层中P个节点对应的P个中间变量
In addition, the first weight matrix and the value vectors corresponding to the M effective nodes can be processed through the softplus activation function to obtain the second weight matrix, and the corresponding values of the P nodes in the previous hidden layer can be calculated through the second weight matrix. P intermediate variables of
其中,t∈{1,2,…,P},
为第二权重矩阵,
为第i个节点的输出。
where, t∈{1,2,…,P}, is the second weight matrix, is the output of the i-th node.
另外,所述P个节点对应的键向量(key)、值向量(values)及查询向量(query)可以分别为:key:k
P
l=f(s
P
l),query:q
P
l=g(s
P
l),values:v
P
l=h(s
P
l)。函数f,g,h可以为常规的时空注意力机制的转换函数,示例地,函数f(s
P
l),g(s
P
l),h(s
P
l)可以均为将s
P
l与不同的权重矩阵相乘。如图3所示,可以将目标隐藏层的前一隐藏层的输出Sl分别经过f(x)、g(x)及h(x)处理,得到对应的键向量K、值向量Q及查询向量V,从而实现将目标隐藏层的前一隐藏层的输出数据映射到三维,通过键向量K和值向量Q得到第一权重矩阵W
l,通过第一权重矩阵W
l和查询向量V得到第二权重矩阵Wa
l,并通过第二权重矩阵和S
l得到中间变量
In addition, the key vector (key), value vector (values) and query vector (query) corresponding to the P nodes can be respectively: key: k P l = f(s P l ), query: q P l = g (s P l ), values: v P l =h(s P l ). The functions f, g, and h can be conversion functions of conventional spatiotemporal attention mechanisms. For example, the functions f(s P l ), g(s P l ), h(s P l ) can be both s P l and Different weight matrices are multiplied. As shown in Figure 3, the output Sl of the previous hidden layer of the target hidden layer can be processed by f(x), g(x) and h(x) respectively to obtain the corresponding key vector K, value vector Q and query vector V, so that the output data of the previous hidden layer of the target hidden layer can be mapped to three dimensions, the first weight matrix W l is obtained through the key vector K and the value vector Q, and the second weight matrix W l is obtained through the first weight matrix W l and the query vector V weight matrix Wa l , and get the intermediate variable through the second weight matrix and S l
示例地,如图4所示,在计算有效节点S
5
2时,可以通过时空注意力机制确定中间变量Sa
l
2至Sa
l
5,由Sa
l
3及Sa
l
5进行因果卷积计算得到S
5
2对应的卷积结果Sc
l
5,通过增强残差模块对S
5
1进行增强残差处理,得到S
5
2对应的增强残差结果Sr
l
5,采用激活函数对S
5
1、Sc
l
5及Sr
l
5进行计算获得S
5
2。
For example, as shown in Figure 4, when calculating the effective node S 5 2, the intermediate variables Sa 1 2 to Sa 1 5 can be determined through the space - time attention mechanism, and S For the convolution result Sc l 5 corresponding to 5 2 , the enhanced residual processing of S 5 1 is performed through the enhanced residual module, and the enhanced residual result Sr l 5 corresponding to S 5 2 is obtained. 5 and Sr l 5 to obtain S 5 2 .
这样,基于时空注意力机制确定的键向量、值向量及查询向量,可以获取所述第M个有效节点对应的卷积结果。In this way, based on the key vector, value vector and query vector determined by the spatio-temporal attention mechanism, the convolution result corresponding to the Mth effective node can be obtained.
在一些实施例中,所述K个有效节点中第M个有效节点的输出为采用激活函数对所述前一隐藏层中与所述第M个有效节点对应的节点的输出、所述第M个有效节点对应的卷积结果及所述第M个有效节点对应的增强残差结果进行计算获得;In some embodiments, the output of the Mth effective node among the K effective nodes is the output of the node corresponding to the Mth effective node in the previous hidden layer using an activation function, and the Mth effective node The convolution result corresponding to the effective node and the enhanced residual result corresponding to the Mth effective node are calculated and obtained;
所述第M个有效节点对应的增强残差结果依据所述第一权重矩阵及所述前一隐藏层中与所述第M个有效节点对应的节点的输出进行增强残差处理获得。The enhanced residual result corresponding to the Mth effective node is obtained by performing enhanced residual processing on the basis of the first weight matrix and the output of the node corresponding to the Mth effective node in the previous hidden layer.
其中,第M个有效节点的输出可以为所述第M个有效节点采用softplus激活函数对所述前一隐藏层中与所述第M个有效节点对应的节点的输出、所述第M个有效节点对应的卷积结果及所述第M个有效节点对应的增强残差结果进行计算获得。可以通过softplus激活函数对第一权重矩阵和所述M个有效节点对应的值向量进行处理,得到第二权重矩阵。如图5所示,将第二权重矩阵W
a
l中每一行的数据相加得到每个时间步的权重W
s
l,将每个时间步的权重W
s
l与所述前一隐藏层中与所述第M个有效节点对应的节点的输出S
l进行阿达玛乘积得到所述第M个有效节点对应的增强残差结果S
r
l。因为时空卷积网络模型的观测域越大,网络学习能力越容易退化,通过计算每个时间步的权重,可以保存关键信息。
Wherein, the output of the Mth effective node can be the output of the node corresponding to the Mth effective node in the previous hidden layer using the softplus activation function of the Mth effective node, and the Mth effective node The convolution result corresponding to the node and the enhanced residual result corresponding to the Mth effective node are obtained through calculation. The first weight matrix and the value vectors corresponding to the M valid nodes may be processed by a softplus activation function to obtain a second weight matrix. As shown in Figure 5, the data of each row in the second weight matrix W a l is added to obtain the weight W s l of each time step, and the weight W s l of each time step is combined with the weight W s l in the previous hidden layer The Hadamard product is performed on the output S l of the node corresponding to the Mth effective node to obtain the enhanced residual result S r l corresponding to the Mth effective node. Because the larger the observation domain of the spatio-temporal convolutional network model is, the easier it is for the network to degrade its learning ability. By calculating the weight of each time step, key information can be preserved.
在一些实施例中,由于多个染色体单元用于表征不同层数的时空卷积网络模型,可以将多个染色体单元表征的时空卷积网络模型在同一个网络中建模,如图6所示,对于层数为1的时空卷积网络模型的输出,可以认为是对该网络的第一个隐藏层的输出进行解码得到的预测结果。对于不同层数的时空卷积网络模型的输出,可以认为是对每层数据进行解码,生成当前层的预测结果并保存成Yn。由于要使用进化算法,生成多个染色体单元,每个节点的权重矩阵会放进一个矩阵中来存储对应的个体权重矩阵中。对淘汰的个体删除其权重值以减少空间占用和查找时间。In some embodiments, since multiple chromosomal units are used to represent spatio-temporal convolutional network models with different layers, the spatio-temporal convolutional network models represented by multiple chromosomal units can be modeled in the same network, as shown in Figure 6 , for the output of the spatio-temporal convolutional network model with a layer number of 1, it can be considered as the prediction result obtained by decoding the output of the first hidden layer of the network. For the output of the space-time convolutional network model with different layers, it can be considered as decoding the data of each layer, generating the prediction result of the current layer and saving it as Yn. Since evolutionary algorithms are used to generate multiple chromosome units, the weight matrix of each node will be put into a matrix to store the corresponding individual weight matrix. Delete the weight value of eliminated individuals to reduce space occupation and search time.
在一些实施例中,所述时空卷积网络模型依据均方根误差分析算法训练获得。In some embodiments, the spatio-temporal convolutional network model is obtained through training based on root mean square error analysis algorithm.
其中,可以通过RMSE(均方根误差分析)进行时空卷积网络模型的误差分析,RMSE的计算方式可以为:Among them, the error analysis of the space-time convolutional network model can be performed through RMSE (root mean square error analysis), and the calculation method of RMSE can be:
Y
t表示的是真实交通状态,
为预测值,m是预测值的总数。通过把预测值和真实交通状态对比来进行误差分析,在误差小于预设值时,可以认为模型训练完成。
Y t represents the real traffic state, is the predicted value, and m is the total number of predicted values. Error analysis is performed by comparing the predicted value with the real traffic state. When the error is less than the preset value, the model training can be considered complete.
作为一种可行的实施方式,交通状态预测方法可以包括模型训练过程,模型获取过程及模型预测过程,模型训练过程可以如下:从目标路段的路端设备提取在目标路段过车的车辆的平均车速的均值,可以每天0点至24点间每隔5分钟统计一次目标路段的路段平均车速,计算路段平均车速与自由流速度的比值。若某次统计时在统计时长内没有过车,则将该次统计的路段平均车速与自由流速度的比值设为1。将计算的路段平均车速与自由流速度的比值进行归一化处理,将归一化后的数据划分成训练集和测试集。生成多个染色体单元,每个所述染色体单元用于表征一类时空卷积网络模型,采用训练集训练染色体单元对应的时空卷积网络模型,对多个染色体单元进行迭代更新,以优化时空卷积网络模型的结构。在确定时空卷积网络模型的结构后,通过训练集训练时空卷积网络模型,并采用测试集评估时空卷积网络模型。判断训练的模型的预测结果是否在误差范围内,若是,则判断已完成模型训练;若否,则重新训练和优化模型。模型获取过程可以如下:可以在时空卷积网络模型中引入encode-decode机制,时空卷积网络模型中每个隐藏层的输出均基于时空注意力机制对每个所述隐藏层的输入进行卷积计算获得,从而得到基于时空注意力机制的时空卷积网络模型。模型预测过程如下:将在当前时刻之前的N个预测时刻的真实交通状态输入训练好的时空卷积网络模型,时空卷积网络模型的输出包括在当前时刻之后的预测时刻的路段平均车速与自由流速度的比值。若比值大于0.7,则可以认为交通通畅;若比值大于0.5且小于等于0.7,则可以认为交通基本通畅;若比值大于0.4且小于等于0.5,则可以认为交通轻度拥堵;若比值大于0.3且小于等于0.4,则可以认为交通中度拥堵;若比值小于等于0.3,则可以认为交通严重拥堵。As a feasible implementation, the traffic state prediction method may include a model training process, a model acquisition process, and a model prediction process. The model training process may be as follows: extract the average vehicle speed of the vehicle passing through the target road section from the roadside equipment of the target road section The average speed of the target road section can be calculated every 5 minutes between 0:00 and 24:00 every day, and the ratio of the average speed of the road section to the free flow speed can be calculated. If there is no passing vehicle within the statistical time during a certain statistics, the ratio of the average vehicle speed to the free flow speed of the road section in this statistics is set to 1. The ratio of the calculated average vehicle speed to the free flow speed of the road section is normalized, and the normalized data is divided into a training set and a test set. Generate a plurality of chromosome units, each of which is used to represent a class of spatiotemporal convolutional network model, use the training set to train the spatiotemporal convolutional network model corresponding to the chromosome unit, and iteratively update the multiple chromosome units to optimize the spatiotemporal volume The structure of the product network model. After determining the structure of the spatiotemporal convolutional network model, the spatiotemporal convolutional network model is trained by the training set, and the spatiotemporal convolutional network model is evaluated by the test set. It is judged whether the prediction result of the trained model is within the error range, if so, it is judged that the model training has been completed; if not, the model is retrained and optimized. The model acquisition process can be as follows: an encode-decode mechanism can be introduced in the spatiotemporal convolutional network model, and the output of each hidden layer in the spatiotemporal convolutional network model is based on the spatiotemporal attention mechanism to convolve the input of each hidden layer Calculated to obtain a spatio-temporal convolutional network model based on the spatio-temporal attention mechanism. The model prediction process is as follows: input the real traffic status of the N predicted moments before the current moment into the trained spatio-temporal convolutional network model, and the output of the spatio-temporal convolutional network model includes the average vehicle speed and free traffic at the predicted moment after the current moment. The ratio of flow velocity. If the ratio is greater than 0.7, it can be considered smooth traffic; if the ratio is greater than 0.5 and less than or equal to 0.7, it can be considered that the traffic is basically smooth; if the ratio is greater than 0.4 and less than or equal to 0.5, it can be considered mild traffic congestion; If it is equal to 0.4, it can be considered as moderate traffic congestion; if the ratio is less than or equal to 0.3, it can be considered as severe traffic congestion.
另外,encode-decode可以使用任意编码方式,可以用于加入位置和/或天气等附加状态信息。本身注意力机制在计算权重时无法表现每个时间节点间的位置信息,而卷积网络本身又对远距离的位置信息记忆模糊,通过使用encode-decode配合注意力机制和时空卷积神经网络能互相弥补缺点。In addition, encode-decode can use any encoding method, which can be used to add additional status information such as location and/or weather. The attention mechanism itself cannot express the location information between each time node when calculating the weight, and the convolutional network itself has a vague memory of the long-distance location information. By using encode-decode with the attention mechanism and the space-time convolutional neural network make up for each other's shortcomings.
在一些实施例中,一个染色体单元相当于是一种模型结构,不同的组合生成了无数种网络结构的可能方案。一个染色体单元相当于是这个方案的实例,通过筛选迭代个体的方式,能够验证方案的优越性,通过细微的改变,例如,变异,生成新个体等,能够拓展对优势组合的可能性。最终迭代完成的方案即为相对最符合当前场景的模型设计。In some embodiments, a chromosome unit is equivalent to a model structure, and different combinations generate countless possible solutions of the network structure. A chromosomal unit is equivalent to an instance of this scheme. By screening and iterating individuals, the superiority of the scheme can be verified, and through subtle changes, such as mutation and generation of new individuals, the possibility of combining advantages can be expanded. The final iterative solution is the model design that is most suitable for the current scene.
本公开实施例中,使用时空卷积网络模型配合注意力机制,让以往只能进行的短期预测通过动态的注意力权重让网络学习到重点,能够扩大输入时间段的长度,进而能够提高预测长时间数据的准确性;且使用时空卷积网络模型配合注意力机制,通过对权重的学习区别于之前的标准化方式,让学习更加高效,能够间接减少训练时长和计算量;并且,使用了encode-decode配合注意力机制让网络可以学习到时间跨度间的关联关系,并且在编码时加入节假日或休息日或天气等额外状态信息来帮助模型区分不同状态下的数据差异;这样,使用了进化算法进行网络结构级的优化,具有普适性,即对任意路口均可使用本方案,能够减少人员调参设计的成本。In the embodiment of the present disclosure, the spatio-temporal convolutional network model is used in combination with the attention mechanism to allow the network to learn key points through dynamic attention weights, which can only be used in the past for short-term predictions, and can expand the length of the input time period, thereby improving the prediction time The accuracy of time data; and use the spatio-temporal convolutional network model with the attention mechanism to make the learning more efficient by learning the weight different from the previous standardized method, which can indirectly reduce the training time and calculation amount; and, using encode- Decode cooperates with the attention mechanism so that the network can learn the correlation between time spans, and add additional state information such as holidays or rest days or weather when encoding to help the model distinguish data differences in different states; in this way, an evolutionary algorithm is used. The optimization at the network structure level is universal, that is, this solution can be used for any intersection, which can reduce the cost of personnel adjustment and design.
参见图7,图7是本公开实施例提供的一种交通状态预测装置的结构示意图,如图7所示,交通状态预测装置200包括:Referring to FIG. 7, FIG. 7 is a schematic structural diagram of a traffic state prediction device provided by an embodiment of the present disclosure. As shown in FIG. 7, the traffic state prediction device 200 includes:
生成部分201,被配置为生成多个染色体单元,每个所述染色体单元用于表征一类时空卷积网络模型;The generating part 201 is configured to generate a plurality of chromosome units, each of which is used to represent a class of spatio-temporal convolutional network models;
计算部分202,被配置为基于样本集分别计算所述多个染色体单元中每个所述染色体单元对应的时空卷积网络模型的损失值;The calculation part 202 is configured to separately calculate the loss value of the spatio-temporal convolutional network model corresponding to each of the chromosome units in the plurality of chromosome units based on the sample set;
更新部分203,被配置为依据所述多个染色体单元对应的时空卷积网络模型的损失值更新所述多个染色体单元,并返回执行所述基于样本集分别计算所述多个染色体单元中每个所述染色体单元对应的时空卷积网络模型的损失值的步骤,直至确定满足预设条件的目标染色体单元;The update part 203 is configured to update the plurality of chromosome units according to the loss values of the spatio-temporal convolutional network models corresponding to the plurality of chromosome units, and return to perform the calculation based on the sample set for each of the plurality of chromosome units. The step of the loss value of the spatiotemporal convolutional network model corresponding to each of the chromosomal units, until the target chromosomal unit satisfying the preset condition is determined;
确定部分204,被配置为基于所述目标染色体单元对应的时空卷积网络模型确定预先训练的时空卷积网络模型;The determining part 204 is configured to determine a pre-trained spatiotemporal convolutional network model based on the spatiotemporal convolutional network model corresponding to the target chromosome unit;
预测部分205,被配置为基于所述预先训练的时空卷积网络模型预测交通状态。The prediction part 205 is configured to predict the traffic state based on the pre-trained spatio-temporal convolutional network model.
在一些实施例中,所述染色体单元包括如下至少一项:In some embodiments, the chromosomal unit comprises at least one of the following:
层数比特位,观测域比特位,扩展因子比特位;Layer number bits, observation domain bits, expansion factor bits;
其中,所述层数比特位被配置为表征所述时空卷积网络模型的隐藏层的层数,所述观测域比特位被配置为表征每个所述隐藏层的观测域,所述扩展因子比特位被配置为表征每个所述隐藏层的卷积扩展因子。Wherein, the number of layers bit is configured to represent the number of hidden layers of the spatio-temporal convolutional network model, the observation field bit is configured to represent the observation field of each hidden layer, and the expansion factor Bits are configured to characterize the convolutional dilation factor of each of said hidden layers.
在一些实施例中,所述更新部分203包括:In some embodiments, the update section 203 includes:
排序子部分,被配置为按照所述多个染色体单元对应的时空卷积网络模型的损失值从高至低对所述多个染色体单元进行排序;The sorting subpart is configured to sort the multiple chromosome units from high to low according to the loss values of the spatio-temporal convolutional network models corresponding to the multiple chromosome units;
生成子部分,被配置为基于前M1个染色体单元生成M2个第一染色体单元,M1和M2均为正整数,M1大于或等于M2;The generating subpart is configured to generate M2 first chromosome units based on the first M1 chromosome units, where both M1 and M2 are positive integers, and M1 is greater than or equal to M2;
替换子部分,被配置为将所述多个染色体单元中后M2个染色体单元替换为所述M2个第一染色体单元。The replacement subpart is configured to replace the last M2 chromosome units among the plurality of chromosome units with the M2 first chromosome units.
在一些实施例中,所述生成子部分,还被配置为:In some embodiments, the generation subsection is further configured to:
对前M1个染色体单元进行杂交处理,得到至少一个杂交染色体单元;Perform hybridization processing on the first M1 chromosome units to obtain at least one hybrid chromosome unit;
对所述前M1个染色体单元进行变异处理,得到至少一个变异染色体单元;performing mutation processing on the first M1 chromosomal units to obtain at least one mutated chromosomal unit;
其中,所述M2个第一染色体单元包括所述至少一个杂交染色体单元和所述至少一个变异染色体单元。Wherein, the M2 first chromosome units include the at least one hybrid chromosome unit and the at least one variant chromosome unit.
在一些实施例中,所述目标染色体单元为更新次数达到第一预设次数后排序在最前的染色体单元;In some embodiments, the target chromosomal unit is the chromosomal unit that ranks first after the number of updates reaches the first preset number;
或者,or,
所述目标染色体单元为更新过程中连续M3次排序位于最前的染色体单元,M3大于或等于第二预设次数。The target chromosomal unit is the first chromosomal unit sorted for M3 consecutive times during the updating process, and M3 is greater than or equal to the second preset number of times.
在一些实施例中,所述预测部分205,还被配置为:In some embodiments, the prediction part 205 is further configured to:
将目标路段在当前时刻之前的N个预测时刻的真实交通状态输入所述预先训练的时空卷积网络模型;其中,所述时空卷积网络模型包括输入层,输出层及连接在所述输入层与所述输出层之间的多个隐藏层,所述输入层用于输入在当前时刻之前的N个预测时刻的真实交通状态,所述多个隐藏层中每个隐藏层的输出均基于时空注意力机制分别对每个所述隐藏层的输入进行卷积计算获得,N为正整数;Input the real traffic state of the target road section at N predicted moments before the current moment into the pre-trained spatio-temporal convolutional network model; A plurality of hidden layers between the output layer, the input layer is used to input the real traffic state of N prediction moments before the current moment, and the output of each hidden layer in the plurality of hidden layers is based on the space-time The attention mechanism performs convolution calculation on the input of each hidden layer, and N is a positive integer;
基于所述输出层的输出确定所述目标路段在当前时刻之后的预测时刻的预测交通状态。The predicted traffic state of the target road segment at a predicted time after the current time is determined based on the output of the output layer.
在一些实施例中,所述输入层还用于输入附加状态信息,所述附加状态信息用于表征所述交通状态所属的环境特征;In some embodiments, the input layer is also used to input additional state information, the additional state information is used to characterize the environmental characteristics to which the traffic state belongs;
所述多个隐藏层包括第一隐藏层,所述第一隐藏层与所述输入层连接,所述第一隐藏层用于对所述在当前时刻之前的N个预测时刻的真实交通状态与所述附加状态信息进行融合。The multiple hidden layers include a first hidden layer, the first hidden layer is connected to the input layer, and the first hidden layer is used to compare the real traffic state and The additional state information is fused.
其中,交通状态预测装置能够实现图1的方法实施例中实现的各个过程,且能达到 相同的技术效果,这里不再进行描述。Wherein, the traffic state predicting device can realize each process realized in the method embodiment of Fig. 1, and can achieve the same technical effect, no longer describe here.
如图8所示,本公开实施例还提供了一种电子设备300,包括:处理器301、存储器302及存储在所述存储器302上并可在所述处理器301上运行的程序,所述程序被所述处理器301执行时实现上述交通状态预测方法实施例的各个过程,且能达到相同的技术效果,这里不再进行描述。As shown in FIG. 8 , an embodiment of the present disclosure also provides an electronic device 300, including: a processor 301, a memory 302, and a program stored in the memory 302 and executable on the processor 301, the When the program is executed by the processor 301, each process of the above-mentioned embodiment of the traffic state prediction method can be realized, and the same technical effect can be achieved, so no further description is given here.
本公开实施例还提供一种计算机可读存储介质,计算机可读存储介质上存储有计算机程序,该计算机程序被处理器执行时实现上述交通状态预测方法实施例的各个过程,且能达到相同的技术效果,这里不再进行描述。其中,所述的计算机可读存储介质,如只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等。Embodiments of the present disclosure also provide a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, each process of the above-mentioned embodiment of the traffic state prediction method can be achieved, and the same The technical effect will not be described here. Wherein, the computer-readable storage medium is, for example, a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a magnetic disk or an optical disk, and the like.
本公开实施例提供一种计算机程序,所述计算机程序包括计算机可读代码,在所述计算机可读代码在电子设备中运行的情况下,所述电子设备的处理器执行用于实现上述所述的交通状态预测方法实施例的各个过程,且能达到相同的技术效果,这里不再进行描述。An embodiment of the present disclosure provides a computer program, the computer program includes computer-readable codes, and when the computer-readable codes run in an electronic device, the processor of the electronic device executes to implement the above-mentioned Each process of the embodiment of the traffic state prediction method can achieve the same technical effect, and will not be described here again.
在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。As used herein, the terms "comprises," "comprises," or any other variation thereof are intended to encompass a non-exclusive inclusion such that a process, method, article, or apparatus that includes a set of elements includes not only those elements, but also includes the elements not expressly included. other elements listed, or also include elements inherent in such a process, method, article, or device. Without further limitations, an element defined by the phrase "comprising a ..." does not preclude the presence of additional identical elements in the process, method, article, or apparatus comprising that element.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本公开的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本公开各个实施例所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus a necessary general-purpose hardware platform, and of course also by hardware, but in many cases the former is better implementation. Based on such an understanding, the technical solution of the present disclosure can be embodied in the form of a software product in essence or the part that contributes to the prior art, and the computer software product is stored in a storage medium (such as ROM/RAM, disk, CD) contains several instructions to enable a terminal (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in various embodiments of the present disclosure.
上面结合附图对本公开的实施例进行了描述,但是本公开并不局限于上述的具体实施方式,上述的公开实施方式仅仅是示意性的,而不是限制性的,本领域的普通技术人员在本公开的启示下,在不脱离本公开宗旨和权利要求所保护的范围情况下,还可做出很多形式,均属于本公开的保护之内。The embodiments of the present disclosure have been described above in conjunction with the accompanying drawings, but the present disclosure is not limited to the above-mentioned specific embodiments. The above-mentioned disclosed embodiments are only illustrative, not restrictive. Under the inspiration of the present disclosure, without departing from the purpose of the present disclosure and the protection scope of the claims, many forms can be made, all of which are within the protection of the present disclosure.
本公开提供一种交通状态预测方法、装置、设备、介质及程序,涉及智能交通技术领域,所述方法包括:生成多个染色体单元,每个染色体单元用于表征一类时空卷积网络模型;基于样本集分别计算多个染色体单元中每个染色体单元对应的时空卷积网络模型的损失值;依据多个染色体单元对应的时空卷积网络模型的损失值更新多个染色体单元,并返回执行基于样本集分别计算多个染色体单元中每个染色体单元对应的时空卷积网络模型的损失值的步骤,直至确定满足预设条件的目标染色体单元;基于目标染色体单元对应的时空卷积网络模型确定预先训练的时空卷积网络模型;基于预先训练的时空卷积网络模型预测交通状态。本公开能够提高预测交通状态的准确性。The present disclosure provides a traffic state prediction method, device, equipment, medium and program, which relate to the field of intelligent transportation technology. The method includes: generating a plurality of chromosome units, each chromosome unit is used to represent a class of spatio-temporal convolutional network model; Calculate the loss value of the time-space convolutional network model corresponding to each chromosome unit in multiple chromosome units based on the sample set; update multiple chromosome units according to the loss value of the time-space convolutional network model corresponding to multiple chromosome units, and return to execute based on The step of calculating the loss value of the time-space convolutional network model corresponding to each chromosome unit in the sample set, until the target chromosome unit that meets the preset conditions is determined; based on the time-space convolutional network model corresponding to the target chromosome unit Trained spatio-temporal convolutional network model; predict traffic status based on pre-trained spatio-temporal convolutional network model. The present disclosure can improve the accuracy of predicting the traffic state.
Claims (11)
- 一种交通状态预测方法,所述方法包括:A traffic state prediction method, the method comprising:生成多个染色体单元,每个所述染色体单元用于表征一类时空卷积网络模型;Generate a plurality of chromosome units, each of which is used to represent a class of spatio-temporal convolutional network models;基于样本集分别计算所述多个染色体单元中每个所述染色体单元对应的时空卷积网络模型的损失值;Calculate the loss value of the spatio-temporal convolutional network model corresponding to each of the chromosome units in the plurality of chromosome units based on the sample set;依据所述多个染色体单元对应的时空卷积网络模型的损失值更新所述多个染色体单元,并返回执行所述基于样本集分别计算所述多个染色体单元中每个所述染色体单元对应的时空卷积网络模型的损失值的步骤,直至确定满足预设条件的目标染色体单元;Updating the plurality of chromosome units according to the loss values of the spatio-temporal convolutional network models corresponding to the plurality of chromosome units, and returning to performing the calculation based on the sample set respectively corresponding to each of the chromosome units in the plurality of chromosome units The step of the loss value of the spatio-temporal convolutional network model until the target chromosome unit satisfying the preset condition is determined;基于所述目标染色体单元对应的时空卷积网络模型确定预先训练的时空卷积网络模型;Determining a pre-trained spatiotemporal convolutional network model based on the spatiotemporal convolutional network model corresponding to the target chromosome unit;基于所述预先训练的时空卷积网络模型预测交通状态。Traffic status is predicted based on the pre-trained spatio-temporal convolutional network model.
- 根据权利要求1所述的方法,其中,所述染色体单元包括如下至少一项:The method according to claim 1, wherein the chromosomal unit comprises at least one of the following:层数比特位,观测域比特位,扩展因子比特位;Layer number bits, observation domain bits, expansion factor bits;其中,所述层数比特位用于表征所述时空卷积网络模型的隐藏层的层数,所述观测域比特位用于表征每个所述隐藏层的观测域,所述扩展因子比特位用于表征每个所述隐藏层的卷积扩展因子。Wherein, the number of layers bit is used to characterize the number of layers of the hidden layer of the spatio-temporal convolutional network model, the observation domain bit is used to characterize the observation domain of each hidden layer, and the expansion factor bit The convolutional dilation factor used to characterize each of said hidden layers.
- 根据权利要求1所述的方法,其中,所述依据所述多个染色体单元对应的时空卷积网络模型的损失值更新所述多个染色体单元,包括:The method according to claim 1, wherein updating the plurality of chromosome units according to the loss value of the spatio-temporal convolutional network model corresponding to the plurality of chromosome units comprises:按照所述多个染色体单元对应的时空卷积网络模型的损失值从高至低对所述多个染色体单元进行排序;sorting the plurality of chromosome units from high to low according to the loss values of the spatio-temporal convolutional network models corresponding to the multiple chromosome units;基于前M1个染色体单元生成M2个第一染色体单元,M1和M2均为正整数,M1大于或等于M2;Generate M2 first chromosome units based on the first M1 chromosome units, both M1 and M2 are positive integers, and M1 is greater than or equal to M2;将所述多个染色体单元中后M2个染色体单元替换为所述M2个第一染色体单元。replacing the last M2 chromosome units among the plurality of chromosome units with the M2 first chromosome units.
- 根据权利要求3所述的方法,其中,所述基于前M1个染色体单元生成M2个第一染色体单元,包括:The method according to claim 3, wherein said generating M2 first chromosome units based on the first M1 chromosome units comprises:对前M1个染色体单元进行杂交处理,得到至少一个杂交染色体单元;Perform hybridization processing on the first M1 chromosome units to obtain at least one hybrid chromosome unit;对所述前M1个染色体单元进行变异处理,得到至少一个变异染色体单元;performing mutation processing on the first M1 chromosomal units to obtain at least one mutated chromosomal unit;其中,所述M2个第一染色体单元包括所述至少一个杂交染色体单元和所述至少一个变异染色体单元。Wherein, the M2 first chromosome units include the at least one hybrid chromosome unit and the at least one variant chromosome unit.
- 根据权利要求3所述的方法,其中,所述目标染色体单元为更新次数达到第一预设次数后排序在最前的染色体单元;The method according to claim 3, wherein the target chromosome unit is the chromosome unit ranked first after the number of updates reaches the first preset number;或者,or,所述目标染色体单元为更新过程中连续M3次排序位于最前的染色体单元,M3大于或等于第二预设次数。The target chromosomal unit is the first chromosomal unit sorted for M3 consecutive times during the updating process, and M3 is greater than or equal to the second preset number of times.
- 根据权利要求1所述的方法,其中,所述基于所述预先训练的时空卷积网络模型预测交通状态,包括:The method according to claim 1, wherein the predicting traffic state based on the pre-trained spatio-temporal convolutional network model comprises:将目标路段在当前时刻之前的N个预测时刻的真实交通状态输入所述预先训练的时空卷积网络模型;其中,所述时空卷积网络模型包括输入层,输出层及连接在所述输入层与所述输出层之间的多个隐藏层,所述输入层用于输入在当前时刻之前的N个预测时刻的真实交通状态,所述多个隐藏层中每个隐藏层的输出均基于时空注意力机制分别对每个所述隐藏层的输入进行卷积计算获得,N为正整数;Input the real traffic state of the target road section at N predicted moments before the current moment into the pre-trained spatio-temporal convolutional network model; A plurality of hidden layers between the output layer, the input layer is used to input the real traffic state of N prediction moments before the current moment, and the output of each hidden layer in the plurality of hidden layers is based on the space-time The attention mechanism performs convolution calculation on the input of each hidden layer, and N is a positive integer;基于所述输出层的输出确定所述目标路段在当前时刻之后的预测时刻的预测交通状 态。Based on the output of the output layer, the predicted traffic state of the target road section at the predicted moment after the current moment is determined.
- 根据权利要求6所述的方法,其中,所述输入层还用于输入附加状态信息,所述附加状态信息用于表征所述交通状态所属的环境特征;The method according to claim 6, wherein the input layer is further used to input additional state information, and the additional state information is used to characterize the environmental characteristics to which the traffic state belongs;所述多个隐藏层包括第一隐藏层,所述第一隐藏层与所述输入层连接,所述第一隐藏层用于对所述在当前时刻之前的N个预测时刻的真实交通状态与所述附加状态信息进行融合。The multiple hidden layers include a first hidden layer, the first hidden layer is connected to the input layer, and the first hidden layer is used to compare the real traffic state and The additional state information is fused.
- 一种交通状态预测装置,所述装置包括:A traffic state prediction device, said device comprising:生成部分,被配置为生成多个染色体单元,每个所述染色体单元用于表征一类时空卷积网络模型;A generating part configured to generate a plurality of chromosome units, each of which is used to represent a class of spatio-temporal convolutional network models;计算部分,被配置为基于样本集分别计算所述多个染色体单元中每个所述染色体单元对应的时空卷积网络模型的损失值;The calculation part is configured to separately calculate the loss value of the spatio-temporal convolutional network model corresponding to each of the chromosome units in the plurality of chromosome units based on the sample set;更新部分,被配置为依据所述多个染色体单元对应的时空卷积网络模型的损失值更新所述多个染色体单元,并返回执行所述基于样本集分别计算所述多个染色体单元中每个所述染色体单元对应的时空卷积网络模型的损失值的步骤,直至确定满足预设条件的目标染色体单元;The update part is configured to update the plurality of chromosome units according to the loss value of the spatio-temporal convolutional network model corresponding to the plurality of chromosome units, and return to perform the calculation of each of the plurality of chromosome units based on the sample set. The step of the loss value of the spatio-temporal convolutional network model corresponding to the chromosomal unit, until the target chromosomal unit satisfying the preset condition is determined;确定部分,被配置为基于所述目标染色体单元对应的时空卷积网络模型确定预先训练的时空卷积网络模型;The determining part is configured to determine a pre-trained spatiotemporal convolutional network model based on the spatiotemporal convolutional network model corresponding to the target chromosome unit;预测部分,被配置为基于所述预先训练的时空卷积网络模型预测交通状态。The prediction part is configured to predict the traffic state based on the pre-trained spatio-temporal convolutional network model.
- 一种电子设备,包括:处理器、存储器及存储在所述存储器上并可在所述处理器上运行的程序,所述程序被所述处理器执行时实现如权利要求1至7中任一项所述的交通状态预测方法。An electronic device, comprising: a processor, a memory, and a program stored on the memory and operable on the processor, when the program is executed by the processor, any one of claims 1 to 7 can be realized. The traffic state prediction method described in the item.
- 一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1至7中任一项所述的交通状态预测方法。A computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the traffic state prediction method according to any one of claims 1 to 7 is implemented.
- 一种计算机程序,所述计算机程序包括计算机可读代码,在所述计算机可读代码在电子设备中运行的情况下,所述电子设备的处理器执行用于实现如权利要求1至7中任一项所述的交通状态预测方法。A computer program, said computer program comprising computer readable code, in the case of said computer readable code running in an electronic device, a processor of said electronic device executes to implement any one of claims 1 to 7 A described traffic state prediction method.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111382079.5 | 2021-11-22 | ||
CN202111382079.5A CN113821985B (en) | 2021-11-22 | 2021-11-22 | Traffic state prediction method and device and electronic equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2023088131A1 true WO2023088131A1 (en) | 2023-05-25 |
Family
ID=78917933
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2022/130549 WO2023088131A1 (en) | 2021-11-22 | 2022-11-08 | Traffic state prediction method and apparatus, and device, medium and program |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN113821985B (en) |
WO (1) | WO2023088131A1 (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113821985B (en) * | 2021-11-22 | 2022-02-22 | 中移(上海)信息通信科技有限公司 | Traffic state prediction method and device and electronic equipment |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107180530A (en) * | 2017-05-22 | 2017-09-19 | 北京航空航天大学 | A kind of road network trend prediction method based on depth space-time convolution loop network |
CN110674987A (en) * | 2019-09-23 | 2020-01-10 | 北京顺智信科技有限公司 | Traffic flow prediction system and method and model training method |
WO2020123552A1 (en) * | 2018-12-10 | 2020-06-18 | Life Technologies Corporation | Deep basecaller for sanger sequencing |
CN112669606A (en) * | 2020-12-24 | 2021-04-16 | 西安电子科技大学 | Traffic flow prediction method for training convolutional neural network by utilizing dynamic space-time diagram |
CN113033786A (en) * | 2021-05-21 | 2021-06-25 | 北京航空航天大学 | Fault diagnosis model construction method and device based on time convolution network |
CN113821985A (en) * | 2021-11-22 | 2021-12-21 | 中移(上海)信息通信科技有限公司 | Traffic state prediction method and device and electronic equipment |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040044633A1 (en) * | 2002-08-29 | 2004-03-04 | Chen Thomas W. | System and method for solving an optimization problem using a neural-network-based genetic algorithm technique |
US10940863B2 (en) * | 2018-11-01 | 2021-03-09 | GM Global Technology Operations LLC | Spatial and temporal attention-based deep reinforcement learning of hierarchical lane-change policies for controlling an autonomous vehicle |
CN111353313A (en) * | 2020-02-25 | 2020-06-30 | 四川翼飞视科技有限公司 | Emotion analysis model construction method based on evolutionary neural network architecture search |
CN111666991A (en) * | 2020-05-28 | 2020-09-15 | 平安医疗健康管理股份有限公司 | Convolutional neural network-based pattern recognition method and device and computer equipment |
CN113393461B (en) * | 2021-08-16 | 2021-12-07 | 北京大学第三医院(北京大学第三临床医学院) | Method and system for screening metaphase chromosome image quality based on deep learning |
CN113408505B (en) * | 2021-08-19 | 2022-06-14 | 北京大学第三医院(北京大学第三临床医学院) | Chromosome polarity identification method and system based on deep learning |
-
2021
- 2021-11-22 CN CN202111382079.5A patent/CN113821985B/en active Active
-
2022
- 2022-11-08 WO PCT/CN2022/130549 patent/WO2023088131A1/en unknown
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107180530A (en) * | 2017-05-22 | 2017-09-19 | 北京航空航天大学 | A kind of road network trend prediction method based on depth space-time convolution loop network |
WO2020123552A1 (en) * | 2018-12-10 | 2020-06-18 | Life Technologies Corporation | Deep basecaller for sanger sequencing |
CN110674987A (en) * | 2019-09-23 | 2020-01-10 | 北京顺智信科技有限公司 | Traffic flow prediction system and method and model training method |
CN112669606A (en) * | 2020-12-24 | 2021-04-16 | 西安电子科技大学 | Traffic flow prediction method for training convolutional neural network by utilizing dynamic space-time diagram |
CN113033786A (en) * | 2021-05-21 | 2021-06-25 | 北京航空航天大学 | Fault diagnosis model construction method and device based on time convolution network |
CN113821985A (en) * | 2021-11-22 | 2021-12-21 | 中移(上海)信息通信科技有限公司 | Traffic state prediction method and device and electronic equipment |
Also Published As
Publication number | Publication date |
---|---|
CN113821985B (en) | 2022-02-22 |
CN113821985A (en) | 2021-12-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112216108B (en) | Traffic prediction method based on attribute-enhanced space-time graph convolution model | |
CN110766942B (en) | Traffic network congestion prediction method based on convolution long-term and short-term memory network | |
CN112863180B (en) | Traffic speed prediction method, device, electronic equipment and computer readable medium | |
CN110599766B (en) | Road traffic jam propagation prediction method based on SAE-LSTM-SAD | |
CN114519932B (en) | Regional traffic condition integrated prediction method based on space-time relation extraction | |
CN113905391A (en) | Ensemble learning network traffic prediction method, system, device, terminal, and medium | |
CN111145541A (en) | Traffic flow data prediction method, storage medium, and computer device | |
CN113762595B (en) | Traffic time prediction model training method, traffic time prediction method and equipment | |
CN107145991B (en) | Time-varying random network dynamic path searching method considering road section correlation | |
CN110428614B (en) | Traffic jam heat degree space-time prediction method based on non-negative tensor decomposition | |
CN113780665B (en) | Private car stay position prediction method and system based on enhanced recurrent neural network | |
CN114202120A (en) | Urban traffic travel time prediction method aiming at multi-source heterogeneous data | |
WO2023088131A1 (en) | Traffic state prediction method and apparatus, and device, medium and program | |
CN111242395B (en) | Method and device for constructing prediction model for OD (origin-destination) data | |
CN112966871A (en) | Traffic jam prediction method and system based on convolution long-short term memory neural network | |
CN112084240B (en) | Intelligent identification and linkage treatment method and system for group renting | |
CN113159414A (en) | Traffic speed prediction method based on timing diagram neural network | |
CN112766603A (en) | Traffic flow prediction method, system, computer device and storage medium | |
CN114461931A (en) | User trajectory prediction method and system based on multi-relation fusion analysis | |
CN112562312A (en) | GraphSAGE traffic network data prediction method based on fusion characteristics | |
CN116311880A (en) | Traffic flow prediction method and equipment based on local-global space-time feature fusion | |
CN113192325B (en) | Traffic incident correlation analysis method and system | |
Ragapriya et al. | Machine Learning Based House Price Prediction Using Modified Extreme Boosting | |
CN116824868A (en) | Method, device, equipment and medium for identifying illegal parking points and predicting congestion of vehicles | |
CN114372627B (en) | Urban vehicle travel time estimation method based on hybrid deep learning framework |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 22894668 Country of ref document: EP Kind code of ref document: A1 |