Model training method and device, storage medium and electronic equipment
By identifying and screening model differences and encrypting model slices of secure vehicles in vehicle-road collaboration system, the security threat problem of malicious vehicles to the federated learning model is solved, and the overall security of the model is improved.
Patent Information
- Application Number
- CN202411931876.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-04-18
AI Technical Summary
In a vehicle-road collaboration environment, the existence of malicious vehicles will have a negative impact on the global model of federated learning, causing the security of the model to be threatened.
By determining the encrypted model slices and model differences of the candidate vehicles in the target roadside unit, aggregation and screening are performed, identification information of the safe vehicle is identified, and safe aggregation of model parameters is performed based on this.
Improve the security of the model obtained by federated learning, prevent malicious vehicles from causing damage to the model, and ensure the overall safety of the model.
Smart Images

Figure CN119849662A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of vehicle networking technology, and in particular, to a model training method, device, storage medium and electronic device. Background Art
[0002] In a vehicle-road collaborative environment, due to the mobility and private attributes of the vehicles themselves, it is impossible to guarantee that all vehicles participating in federated learning are honest and safe. The presence of malicious vehicles will have a negative impact on the global model of federated learning, making federated learning vulnerable to backdoor attacks. Summary of the invention
[0003] The purpose of the present invention is to provide a model training method, device, storage medium and electronic device, which can improve the security of the model obtained by federated learning.
[0004] In order to achieve the above objectives, in a first aspect, the present disclosure provides a model training method, which is applied to a target roadside unit, wherein the target roadside unit is any roadside unit in a vehicle-road cooperative system, and the method includes:
[0005] In the case where it is determined that any candidate vehicle has completed the training of the model to be trained, determining a first encrypted model slice of the candidate vehicle for the model to be trained, the candidate vehicle being a vehicle that receives the random parameters sent by the target roadside unit;
[0006] For any candidate vehicle, determine a first model difference corresponding to the candidate vehicle, where the first model difference corresponding to a candidate vehicle represents a model difference between a first encrypted model slice of the candidate vehicle and first encrypted model slices of other candidate vehicles;
[0007] Aggregating the first encrypted model slices of each candidate vehicle to obtain a first aggregated model slice corresponding to the target roadside unit;
[0008] Sending the first model differences and the first aggregated model slices respectively corresponding to the candidate vehicles to the server, so that the server determines a safe vehicle whose model parameters meet a preset parameter difference condition from the candidate vehicles respectively corresponding to the roadside units based on the first model differences and the first aggregated model slices sent by different roadside units;
[0009] Receiving identification information of the safety vehicle sent by the server, and aggregating first encrypted model slices of each safety vehicle corresponding to the identification information to obtain second aggregated model slices;
[0010] The second aggregate model slice is sent to the server, so that the server obtains the target model parameters of the model to be trained based on each of the second aggregate model slices sent by different roadside units.
[0011] In a second aspect, the present disclosure provides a model training method, which is applied to a server in a vehicle-road cooperative system, and the method includes:
[0012] Receive the first model difference corresponding to each candidate vehicle and the first aggregated model slice corresponding to the roadside unit sent by the roadside unit, wherein the first model difference corresponding to any candidate vehicle sent by a roadside unit is determined by the roadside unit based on the model difference between the first encrypted model slice of the candidate vehicle for the model to be trained and the first encrypted model slices of other candidate vehicles when it is determined that the candidate vehicle has completed the training of the model to be trained. The first aggregated model slice corresponding to a roadside unit is obtained by aggregating the first encrypted model slices of each candidate vehicle by the roadside unit. The candidate vehicle corresponding to a roadside unit is a vehicle that receives the random parameters sent by the roadside unit;
[0013] Based on the differences of the first models sent by different roadside units and the first aggregated model slices sent by different roadside units, determining a safe vehicle whose model parameters meet a preset parameter difference condition from the candidate vehicles corresponding to each roadside unit;
[0014] Sending the identification information of the safety vehicle to each roadside unit, so that each roadside unit aggregates the first encrypted model slices of each safety vehicle based on the identification information to obtain a second aggregated model slice;
[0015] The second aggregate model slice sent by the roadside unit is received, and based on each of the second aggregate model slices sent by different roadside units, target model parameters of the model to be trained are obtained.
[0016] In a third aspect, the present disclosure provides a model training method, which is applied to a safety vehicle in a vehicle-road cooperative system, wherein the safety vehicle is any vehicle in the vehicle-road cooperative system, and the method includes:
[0017] Get the model to be trained;
[0018] Training the model to be trained based on local vehicle data to obtain original model parameters;
[0019] Obtaining random model parameters based on a preset random number generation algorithm and random parameters sent by the received roadside unit;
[0020] Obtaining a second encrypted model slice based on the encryption key, the original model parameters, and each of the random model parameters;
[0021] The second encrypted model slice is sent to the roadside unit, the second encrypted model slice is used by the roadside unit to determine the first model difference, the first model difference is used by the server to determine the safe vehicle, the roadside unit is also used to aggregate the first encrypted model slices of each safe vehicle to obtain a second aggregated model slice, and the server is also used to obtain the target model parameters of the model to be trained based on each of the second aggregated model slices sent by different roadside units.
[0022] In a fourth aspect, an embodiment of the present disclosure provides a model training device, including:
[0023] A first determination module is used to determine a first encrypted model slice of the candidate vehicle for the model to be trained when it is determined that any candidate vehicle has completed training of the model to be trained, wherein the candidate vehicle is a vehicle that receives the random parameters sent by the target roadside unit;
[0024] A second determination module is used to determine, for any candidate vehicle, a first model difference corresponding to the candidate vehicle, wherein the first model difference corresponding to a candidate vehicle represents a model difference between a first encrypted model slice of the candidate vehicle and first encrypted model slices of other candidate vehicles;
[0025] A third determination module is used to aggregate the first encrypted model slices of each candidate vehicle to obtain a first aggregated model slice corresponding to the target roadside unit;
[0026] A first sending module, configured to send the first model differences and the first aggregated model slices respectively corresponding to each candidate vehicle to a server, so that the server determines a safe vehicle whose model parameters meet a preset parameter difference condition from the candidate vehicles respectively corresponding to each roadside unit based on the first model differences and the first aggregated model slices sent by different roadside units;
[0027] A first aggregation module is used to receive the identification information of the safety vehicle sent by the server, and aggregate the first encrypted model slices of each safety vehicle corresponding to the identification information to obtain a second aggregated model slice;
[0028] The second sending module is used to send the second aggregate model slice to the server, so that the server obtains the target model parameters of the model to be trained based on the respective second aggregate model slices sent by different roadside units.
[0029] In a fifth aspect, an embodiment of the present disclosure provides a model training device, including:
[0030] A second receiving module is used to receive the first model differences corresponding to each candidate vehicle and the first aggregated model slice corresponding to the roadside unit sent by the roadside unit, wherein the first model difference corresponding to any candidate vehicle sent by a roadside unit is determined by the roadside unit based on the model difference between the first encrypted model slice of the candidate vehicle for the model to be trained and the first encrypted model slices of other candidate vehicles when it is determined that the candidate vehicle has completed the training of the model to be trained. The first aggregated model slice corresponding to a roadside unit is obtained by aggregating the first encrypted model slices of each candidate vehicle by the roadside unit, and the candidate vehicle corresponding to a roadside unit is a vehicle that receives the random parameters sent by the roadside unit;
[0031] A fourth determination module, configured to determine, from candidate vehicles corresponding to each roadside unit, a safe vehicle whose model parameters satisfy a preset parameter difference condition based on the differences between the first models sent by different roadside units and the first aggregated model slices sent by different roadside units;
[0032] a fifth sending module, configured to send the identification information of the safety vehicle to each roadside unit, so that each roadside unit aggregates the first encrypted model slices of each safety vehicle based on the identification information to obtain a second aggregated model slice;
[0033] The third receiving module is used to receive the second aggregate model slice sent by the roadside unit, and obtain the target model parameters of the model to be trained based on each of the second aggregate model slices sent by different roadside units.
[0034] In a sixth aspect, an embodiment of the present disclosure provides a model training device, including:
[0035] An acquisition module is used to obtain the model to be trained;
[0036] A sixth determination module, used for training the model to be trained based on local vehicle data to obtain original model parameters;
[0037] A seventh determination module, configured to obtain a random model parameter based on a preset random number generation algorithm and a random parameter received from a roadside unit;
[0038] An eighth determination module, configured to obtain a second encrypted model slice based on the encryption key, the original model parameters and each of the random model parameters;
[0039] An eighth sending module is used to send the second encrypted model slice to the roadside unit, the second encrypted model slice is used by the roadside unit to determine the first model difference, the first model difference is used by the server to determine the safe vehicle, the roadside unit is also used to aggregate the first encrypted model slices of each safe vehicle to obtain a second aggregated model slice, and the server is also used to obtain the target model parameters of the model to be trained based on each of the second aggregated model slices sent by different roadside units.
[0040] In a seventh aspect, an embodiment of the present disclosure provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method described in any one of the first to third aspects.
[0041] In an eighth aspect, an embodiment of the present disclosure provides an electronic device, including:
[0042] a memory having a computer program stored thereon;
[0043] A processor is used to execute the computer program in the memory to implement the steps of the method described in any one of the first to third aspects.
[0044] Through the above technical solution, safe vehicles are first screened out through the first model difference and the first aggregation model, and then the final model is further aggregated based on the model of the safe vehicle, thereby improving the security of the model obtained by federated learning.
[0045] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The accompanying drawings are used to provide a further understanding of the present disclosure and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the present disclosure but do not constitute a limitation of the present disclosure. In the accompanying drawings:
[0047] Figure 1 It is a schematic diagram of an application scenario shown in an exemplary embodiment of the present disclosure.
[0048] Figure 2 It is a flowchart of a model training method shown in an exemplary embodiment of the present disclosure.
[0049] Figure 3 It is a flowchart of another model training method shown in an exemplary embodiment of the present disclosure.
[0050] Figure 4 It is a flowchart of another model training method shown in an exemplary embodiment of the present disclosure.
[0051] Figure 5It is a flowchart of another model training method shown in an exemplary embodiment of the present disclosure.
[0052] Figure 6 It is a block diagram of a model training device shown in an exemplary embodiment of the present disclosure.
[0053] Figure 7 It is a block diagram of another model training device shown in an exemplary embodiment of the present disclosure.
[0054] Figure 8 It is a block diagram of another model training device shown in an exemplary embodiment of the present disclosure.
[0055] Fig. 9 It is a block diagram of an electronic device shown in an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0056] The specific implementation of the present disclosure is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described herein is only used to illustrate and explain the present disclosure, and is not used to limit the present disclosure.
[0057] Figure 1 is a schematic diagram of a vehicle-road cooperative system proposed in an embodiment of the present disclosure. The model training method of the embodiment of the present disclosure can be applied to the vehicle-road cooperative system, such as Figure 1 As shown, the vehicle-road cooperative system may include multiple RSUs (Road Side Units) 110, vehicles 120, and servers 130. Among them, the road side unit 110 undertakes the model aggregation task, the server 130 undertakes the key distribution and certain encryption and decryption tasks, and the vehicle 120 provides data and training models.
[0058] Specifically, the server may be a third-party server, whose main function is to provide security guarantee for the communication between the vehicle and the roadside unit. Meanwhile, the server has a wide communication range and can communicate with each roadside unit and the vehicles under its coverage.
[0059] The roadside unit is one of the infrastructures in the Internet of Vehicles and is also the initiator of the federated learning (FL) task. It has a certain computing power. These roadside units have a relatively stable communication link and can communicate wirelessly with vehicles within a certain range. In the embodiment of this disclosure, it is assumed that each roadside unit has a unique label j.
[0060] The vehicle is the subject of the federated learning task, and its main role is to provide data and training models. With certain computing power and communication capabilities, it can communicate with the roadside unit through V2X (Vehicle to Everything) and can communicate with the server through the network. Similarly, it is assumed that each vehicle also has a unique identity tag i. In addition, in the disclosed embodiment, it is assumed that most vehicles are honest, but a small number of vehicles become malicious vehicles due to their own reasons or being invaded, and will launch a backdoor attack on the federated learning, thereby causing the model obtained through the federated learning to have security issues.
[0061] Federated Learning is a distributed machine learning method that allows multiple participants (such as mobile devices, edge devices, or different organizations) to jointly train a global model without sharing their original data. This approach aims to address data privacy and security issues while leveraging decentralized data resources to improve model performance.
[0062] Before describing the model training method of the present disclosure in detail, some scenario conditions involved in the embodiments of the present disclosure are first described.
[0063] The server can run a homomorphic encryption algorithm, obtain a pair of public keys (i.e., encryption keys) pk and private keys (i.e., decryption keys) sk by inputting security parameters and dimensions, and broadcast the obtained public key pk to all other participants in the federated learning, including roadside units and communicative vehicles. In addition, the addition homomorphic operation Add() and the multiplication homomorphic operation Mul() are also used in the disclosed embodiment.
[0064] The roadside unit can generate a series of random parameters, which are recorded as These random parameters correspond one-to-one to vehicles, and the roadside unit can send the random number generation algorithm and random parameters to the vehicle.
[0065] Here, the random number generation algorithm can be expressed as Indicates inputting a random parameter Output a random model parameter of d dimensions. In the disclosed embodiment, the dimension of the pseudo-random number is set to be the same as the dimension of the model parameter, so that the vehicle can generate the random model parameter according to the received random number generation algorithm and random parameters.
[0066] In the disclosed embodiment, the random number generation algorithm has the following characteristics: when the input random parameters are unknown, the generated random model parameters are computationally indistinguishable from uniform extraction in the output space; when the random parameters are constant, the generated random model parameters are reproducible.
[0067] Vehicles can move freely and may pass through different roadside units during the movement, so that the same vehicle can receive random parameters sent by different roadside units, and further, the same vehicle can become a candidate vehicle for different roadside units.
[0068] Figure 2 is a flow chart of a model training method according to an exemplary embodiment of the present disclosure. The model training method is applied to Figure 1 The vehicle-road cooperative system shown in Figure 2. Figure 2 , the model training method includes:
[0069] S201, the target vehicle obtains a model to be trained.
[0070] The target vehicle is any vehicle participating in federated learning. The target vehicle can receive the initialization model of this round, that is, the model to be trained, from the roadside unit or server.
[0071] S202: The target vehicle trains the to-be-trained model based on the local vehicle data to obtain original model parameters.
[0072] After receiving the model to be trained, the target vehicle can train the model to be trained based on the local vehicle data to obtain the original model parameters. Here, the original model parameters can be assumed to be a d-dimensional parameter set, where d is greater than or equal to 2.
[0073] S203: The target vehicle obtains random model parameters based on a preset random number generation algorithm and random parameters received from the roadside unit.
[0074] The target vehicle can use a random number generation algorithm to process each random parameter received to obtain a corresponding random model parameter, so that the target vehicle can generate random model parameters corresponding to the random parameters sent by each roadside unit.
[0075] Here, the preset random number generation algorithms sent by different roadside units to the vehicle may be the same algorithm or different algorithms, which is not limited here.
[0076] When different roadside units send different preset random number generation algorithms to a vehicle, the target vehicle can obtain the random model parameters corresponding to the roadside unit based on the preset random number generation algorithm and random parameters sent by the same roadside unit.
[0077] S204: The target vehicle obtains a second encrypted model slice based on the encryption key, the original model parameters and various random model parameters.
[0078] After obtaining the encryption key, the original model parameters and each random model parameter, the target vehicle can obtain a second encrypted model slice based on the encryption key, the original model parameters and each random model parameter.
[0079] In some embodiments, since the random model parameters have the same dimension as the original model parameters, for example, both are d dimensions, the target vehicle can slice the original model parameters through each random model parameter, where the slice processing refers to subtracting the value of the random model parameter from the original model parameter. Therefore, model slicing can be understood as the model parameters after subtracting each random model parameter from the original model parameter.
[0080] In some implementations, the process of slicing the original model parameters by each random model parameter to obtain the model slices can be expressed by the following formula:
[0081]
[0082] Here, it is assumed that the federated learning is currently in round l. represents the model slice of round l obtained by target vehicle i, represents the original model parameters of the target vehicle i in round l, R i Indicates the roadside unit that sent random parameters to target vehicle i.
[0083] It should be noted that, in the embodiments of the present disclosure, unless otherwise specified, the addition and subtraction processing between two model parameters refers to the addition and subtraction processing between the corresponding dimensions of the two model parameters.
[0084] After the target vehicle divides the original model parameters through various random model parameters to obtain model slices, the encryption key can be continued to be used to encrypt the model slices to obtain encrypted model slices, which are referred to as second encrypted model slices in the disclosed embodiment.
[0085] Since the roadside unit does not have the decryption key, the roadside unit cannot obtain the actual content of the model slice based on the second encrypted model slice. Therefore, even if the roadside units collude with each other and obtain each other's preset random number generation algorithms and random parameters, they cannot guess the original model parameters, thereby avoiding the leakage of the original model parameters and protecting the model parameters.
[0086] In some implementations, the target vehicle uses an encryption key to encrypt the model slice to obtain a second encrypted model slice, which can be expressed by the following formula:
[0087]
[0088] In the above formula, by combining the public key pk and the plaintext Enter the encryption algorithm Enc() to get the second encryption model slice
[0089] S205: The target vehicle sends a second encrypted model slice to the roadside unit.
[0090] After obtaining the second encrypted model slice, the target vehicle can send the second encrypted model slice to any roadside unit according to a preset strategy. For example, the second encrypted model slice can be sent to the roadside unit currently communicating. For another example, when there are multiple roadside units currently communicating, a roadside unit with the best communication quality is selected to send the second encrypted model slice.
[0091] S206: When the target roadside unit determines that any candidate vehicle has completed training of the model to be trained, the target roadside unit determines a first encrypted model slice of the candidate vehicle for the model to be trained.
[0092] The target roadside unit is any roadside unit.
[0093] Here, there may be multiple ways for the target roadside unit to determine that the candidate vehicle has completed the training of the to-be-trained model.
[0094] In some embodiments, the target roadside unit can determine that the candidate vehicle has completed the training of the model to be trained when it receives the second encrypted model slice sent by its candidate vehicle. In this case, the target roadside unit can further obtain the first encrypted model slice based on the second encrypted model slice and the third encrypted model slice.
[0095] For the random parameters sent to any candidate vehicle, the target road test unit can use a random number generation algorithm to process them to obtain corresponding random model parameters, so that the target roadside unit can generate random model parameters corresponding to each candidate vehicle. After obtaining the random model parameters corresponding to each candidate vehicle, each random model parameter can be encrypted to obtain a third encrypted model slice corresponding to each candidate vehicle.
[0096] In some embodiments, the target roadside unit may add the second encryption model slice and the third encryption model slice to obtain the first encryption model slice. Since the second encryption model slice and the third encryption model slice are both ciphertexts, the addition here may be an addition operation valid for the ciphertext, i.e., an addition homomorphic operation Add(). In addition, it should be noted that in subsequent embodiments, the process involving the addition or concatenation of ciphertext data may be processed using an addition homomorphic operation.
[0097] In some implementations, the roadside unit j determines that the second encrypted model slice has been uploaded to itself The process of slicing the first encrypted model of the candidate vehicle i for the model to be trained can be expressed by the following formula:
[0098]
[0099] in, represents the first encrypted model slice of the candidate vehicle i determined by the roadside unit j for the model to be trained, Represents the third encrypted model slice corresponding to the candidate vehicle i generated by the roadside unit j.
[0100] In other embodiments, the target roadside unit can determine that the candidate vehicle has completed the training of the model to be trained when it receives a notification message sent by other roadside units. In this case, the target roadside unit can further obtain the first encrypted model slice based on a preset random number generation algorithm, an encryption key, and random parameters sent to the candidate vehicle.
[0101] In the disclosed embodiment, after receiving the second encrypted model slice sent by the candidate vehicle, the roadside unit can send a notification message to other roadside units to indicate that it has received the second encrypted model slice sent by a certain vehicle. Thus, other roadside units can determine that the vehicle has completed the training of the model to be trained based on the notification message.
[0102] For candidate vehicles that have not uploaded the second encrypted model slice to themselves, the target roadside unit can directly determine the third encrypted model slice corresponding to the candidate vehicle as the first encrypted model slice. That is, the target roadside unit obtains the third encrypted model slice corresponding to the candidate vehicle based on the preset random number generation algorithm, encryption key and random parameters sent to the candidate vehicle, and then uses the third encrypted model slice as the first encrypted model slice of the candidate vehicle for the model to be trained.
[0103] In some implementations, the process in which the roadside unit j determines the first encrypted model slice of the model to be trained for the candidate vehicle i that has not uploaded the second encrypted model slice to itself can be expressed by the following formula:
[0104]
[0105] S207: The target roadside unit scales the first encrypted model slice of each candidate vehicle to obtain a fourth encrypted model slice.
[0106] In some embodiments, the target roadside unit may use the first encrypted scaling factor obtained by consensus between the server and the roadside unit to scale the first encrypted model slices of each candidate vehicle to obtain fourth encrypted model slices of each candidate vehicle.
[0107] In some implementations, the process in which the target roadside unit scales the first encrypted model slice of each candidate vehicle by the first encrypted scaling factor to obtain the fourth encrypted model slice of each candidate vehicle can be expressed by the following formula:
[0108]
[0109] in, represents the fourth encrypted model slice of candidate vehicle i calculated by roadside unit j in the lth round of training, [r l ] represents the first encryption scaling factor, and Mul represents multiplication homomorphism, which is a multiplication operation valid for ciphertext.
[0110] Here, the server can send a first encrypted random parameter to the roadside unit. At the same time, each roadside unit can generate a second encrypted random parameter and transmit its second encrypted random parameter to all roadside units through communication. Finally, all roadside units can reach a consensus on the same first encrypted scaling factor.
[0111] In some implementations, the process of the target roadside unit obtaining the first encryption scaling factor can be expressed by the following formula:
[0112]
[0113] Among them, [r l ] represents the first encryption scaling factor, [r ts ] represents the first encrypted random parameter sent by the server, represents the second encrypted random parameter generated by roadside unit j, and M represents the set of roadside units.
[0114] S208: The target roadside unit sends the fourth encrypted model slices of each candidate vehicle to the server.
[0115] S209: The server splices the fourth encrypted model slices for the same candidate vehicle sent by different roadside units to obtain a scaled encrypted model of the same candidate vehicle.
[0116] Since the same vehicle can be a candidate vehicle for multiple roadside units, the fourth encrypted model slices of a certain vehicle may exist in multiple roadside units. In this case, the server can splice the fourth encrypted model slices corresponding to the same vehicle. For example, the server can splice the fourth encrypted model slices corresponding to vehicle i in multiple roadside units to obtain a scaled encrypted model of vehicle i.
[0117] In some embodiments, the fourth encrypted model slices corresponding to the same vehicle are spliced together, which can be done by using an additive homomorphic operation.
[0118] In some implementations, the server splices the fourth encrypted model slices corresponding to vehicle i to obtain the scaled encrypted model of vehicle i, which can be expressed by the following formula:
[0119]
[0120] in, represents the scaled encrypted model of vehicle i in the lth round of training, and N represents the set of vehicles participating in federated learning.
[0121] S210 , the server obtains, for any candidate vehicle, the symbol category of each model parameter of the candidate vehicle based on the decryption key and the scaled encryption model of the candidate vehicle.
[0122] Here, the server can use the decryption key to decrypt the scaled encryption model to obtain specific model parameter values. Since a scaled encryption model is used, even if the server decrypts and obtains specific model parameter values, since the server does not know the first encrypted scaling factor, the model parameter values obtained by the server are not accurate model parameter values. Only the signs of the model parameters can be accurately obtained. Therefore, the security of the federated learning process can be guaranteed while obtaining the signs of the model parameters.
[0123] In some embodiments, the model parameter categories may include 0, positive, and negative values. In this case, the server may classify each dimension parameter of each vehicle model separately, and then obtain a set of k-th dimension parameter symbols of all vehicles, represented as The parameter set of each dimension is divided into three sets: P k0 , P k+ , P k- Among them, P k0 represents the set of 0 values, P k+ represents a positive value set, P k- Represents a negative value set.
[0124] S211, the server sends the symbol category of each model parameter of each candidate vehicle to the roadside unit.
[0125] For example, the server may send the P of each candidate vehicle to the roadside unit. k0 , P k+ , P k- Collection, through P k0 , P k+ , P k- A collection can represent symbolic categories for individual model parameters.
[0126] S212: The target roadside unit determines, for any candidate vehicle, a first model difference corresponding to the candidate vehicle.
[0127] After the aforementioned step S206, the target roadside unit can determine the first encrypted model slice of any candidate vehicle of the target roadside unit for the model to be trained. Further, for any candidate vehicle of the target roadside unit, the target roadside unit can determine the first model difference corresponding to the candidate vehicle based on the first encrypted model slice of each candidate vehicle.
[0128] The first model difference may be a set of differences corresponding to each dimension of the model to be trained.
[0129] In some implementations, in order to improve the accuracy of calculating the first model difference, for any candidate vehicle, determining the first model difference corresponding to the candidate vehicle may include the following steps:
[0130] Determine a first model parameter associated with the k-th dimensional model parameter of the candidate vehicle from the k-th dimensional model parameters of other candidate vehicles, wherein when the k-th dimensional model parameter of other candidate vehicles and the k-th dimensional model parameter of the candidate vehicle belong to the same symbol category, the k-th dimensional model parameter of the other candidate vehicle is the first model parameter associated with the k-th dimensional model parameter of the candidate vehicle; obtain the k-th dimensional difference of the candidate vehicle based on the value of the k-th dimensional model parameter of the candidate vehicle and the value of the first model parameter associated with the k-th dimensional model parameter of the candidate vehicle; and obtain the first model difference corresponding to the candidate vehicle based on each dimensional difference of the candidate vehicle.
[0131] Here, by selecting the first model parameter associated with the k-th dimensional model parameter of the candidate vehicle, and then obtaining the k-th dimensional difference of the candidate vehicle based on the value of the k-th dimensional model parameter of the candidate vehicle and the value of the first model parameter associated with the k-th dimensional model parameter of the candidate vehicle, that is, only the same-dimensional model parameters of the same symbol category are selected to calculate the difference of the model parameters of this dimension. Compared with calculating the k-th dimensional model difference value between the k-th dimensional model parameters of the candidate vehicle and the k-th dimensional model parameters of all other candidate vehicles, the accuracy of calculating the k-th dimensional model difference value can be improved, thereby improving the accuracy of calculating the first model difference corresponding to the candidate vehicle.
[0132] In some embodiments, considering that the server may reversely derive accurate model parameters based on the first model differences corresponding to each received candidate vehicle, thereby reducing the security of the federated learning process, therefore, in some embodiments, the target roadside unit can obtain the second encrypted scaling factor based on the third encrypted random parameters sent by other roadside units and the third encrypted random parameters generated by the target roadside unit, and then scale each dimensional difference of the candidate vehicle by the second encrypted scaling factor to obtain the scaled each dimensional difference of the candidate vehicle, and then obtain the first model difference corresponding to the candidate vehicle based on each dimensional difference of the candidate vehicle after scaling.
[0133] Here, each roadside unit can also generate a third encrypted random parameter, and transmit its third encrypted random parameter to all roadside units through communication. Finally, all roadside units can reach a consensus on the same second encrypted scaling factor.
[0134] In some implementations, the process of the target roadside unit obtaining the second encrypted scaling factor can be expressed by the following formula:
[0135]
[0136] Among them, [r s ] represents the second encryption scaling factor, Represents the third encrypted random parameter generated by roadside unit j.
[0137] In some implementations, the process of the target roadside unit determining the first model difference corresponding to any candidate vehicle can be expressed by the following formula:
[0138]
[0139] in, represents the k-th dimension difference corresponding to candidate vehicle i, represents the k-th dimension model parameter of candidate vehicle i, represents the first model parameter associated with the k-th dimensional model parameter of candidate vehicle i, and p represents the set of other vehicles in the roadside unit that belong to the same symbol category as the k-th dimensional model parameter of candidate vehicle i in terms of the k-th dimensional model parameter.
[0140] Here, you can use Representative Set in, Represents the first model difference corresponding to candidate vehicle i.
[0141] S213: The target roadside unit aggregates the first encrypted model slices of each candidate vehicle to obtain a first aggregated model slice corresponding to the target roadside unit.
[0142] Also, considering that the server may reversely derive accurate model parameters based on the received first encrypted model slices of each candidate vehicle, thereby reducing the security of the federated learning process, therefore, in some embodiments, the target roadside unit may scale the first encrypted model slices of each candidate vehicle by the second encryption scaling factor to obtain the fifth encrypted model slices of each candidate vehicle, and then aggregate the fifth encrypted model slices of each candidate vehicle to obtain the first aggregated model slice corresponding to the target roadside unit.
[0143] Here, continuing to use the second encryption scaling factor to scale the first encrypted model slices of each candidate vehicle can improve the accuracy of subsequent server determination of safe vehicles.
[0144] In some implementations, the process in which the target roadside unit obtains the first aggregated model slice corresponding to the target roadside unit can be expressed by the following formula:
[0145]
[0146] in, Indicates that roadside unit j corresponds to the first aggregated model slice in round l.
[0147] S214: The target roadside unit sends the first model difference and the first aggregated model slice corresponding to each candidate vehicle to the server.
[0148] S215: The server obtains a second model difference between the same candidate vehicle and other candidate vehicles based on the decrypted first model differences corresponding to the same candidate vehicle.
[0149] After receiving the first model differences corresponding to each candidate vehicle sent by the roadside unit, the server can decrypt the first model differences using the decryption key to obtain the decrypted first model differences corresponding to each candidate vehicle, and then accumulate the decrypted first model differences corresponding to the same candidate vehicle to obtain the second model differences between the same candidate vehicle and other candidate vehicles.
[0150] In some embodiments, the process of obtaining the second model difference between the same candidate vehicle and other candidate vehicles based on the decrypted first model differences corresponding to the same candidate vehicle by the server can be expressed by the following formula:
[0151]
[0152] Among them, dv i,p represents the second model difference between candidate vehicle i and other candidate vehicles, dv i,p The j-th dimension parameter in is expressed as Dec() represents the decryption algorithm.
[0153] S216: The server obtains an average value of each dimension of the model parameter of the to-be-trained model based on the first aggregated model slices sent by different roadside units.
[0154] In some embodiments, after receiving each first aggregate model slice sent by different roadside units, the server can first aggregate each first aggregate model slice to obtain the sum of the model parameters of all candidate vehicles participating in federated learning, that is, the third aggregate model slice. Then, the third aggregate model slice can be decrypted based on the decryption key to obtain the decrypted aggregate model slice. Then, based on the decrypted aggregate model parameters and the number of candidate vehicles participating in federated learning, the average value of the model to be trained can be further obtained. The average value of the parameters of the model to be trained includes the average value of the model parameters of each dimension.
[0155] In some implementations, the process of obtaining the average value of each dimension of the model parameter of the to-be-trained model based on the first aggregated model slices sent by different roadside units can be expressed by the following formula:
[0156]
[0157] Among them, Avg m Represents the average value of the parameters of the model to be trained, Avg m The k-th dimension parameter in is expressed as [N] represents the number of vehicles participating in federated learning.
[0158] S217: The server determines, for any candidate vehicle, a quantitative difference between the candidate vehicle and other candidate vehicles in each dimension of model parameters.
[0159] The quantized difference between the candidate vehicle and other candidate vehicles in each dimension of the model parameter may include at least one of a quantized difference in symbol category and a quantized difference in model parameter value. Here, the quantized difference in symbol category corresponding to each dimension of the model parameter may be referred to as a first sub-quantized difference, and the quantized difference in model parameter value corresponding to each dimension of the model parameter may be referred to as a second sub-quantized difference.
[0160] In some implementations, the server may determine the first sub-quantized difference in each dimension of the model parameter corresponding to any candidate vehicle and other candidate vehicles based on the sign category of each model parameter of each candidate vehicle.
[0161] In some embodiments, for any candidate vehicle, the total number of candidate vehicles having different signs from the candidate vehicle in the k-th dimension model parameter can be obtained, and then the total number is determined as the first sub-quantized difference between the candidate vehicle and the other candidate vehicles corresponding to the k-th dimension model parameter.
[0162] In some embodiments, the process of determining the first sub-quantization difference between the model parameters of the k-th dimension corresponding to the candidate vehicle i and other candidate vehicles can be expressed by the following formula:
[0163]
[0164] in, represents the first subquantized difference of the model parameters of the kth dimension corresponding to candidate vehicle i and other candidate vehicles, |-P i k | represents the total number of other vehicles that belong to different symbol categories from the k-th dimension model parameters of candidate vehicle i.
[0165] In some embodiments, the server can obtain, for any candidate vehicle, the second sub-quantized difference in each dimension of model parameters between the candidate vehicle and other candidate vehicles based on the second model difference of the candidate vehicle and the average value of each dimension of model parameters of the model to be trained.
[0166] In some embodiments, the server may first obtain the ratio of the sub-difference corresponding to the k-dimensional model parameter of the candidate vehicle and the average value of the corresponding k-dimensional model parameter in the model to be trained, and then determine the quantitative difference between the k-dimensional model parameter of the candidate vehicle and other candidate vehicles based on the ratio and the size of the preset value.
[0167] In some embodiments, the server may determine the ratio as the quantized difference between the model parameters of the candidate vehicle and other candidate vehicles corresponding to the k-th dimension when the ratio is less than a preset value, and determine the preset value as the quantized difference between the model parameters of the candidate vehicle and other candidate vehicles corresponding to the k-th dimension when the ratio is greater than or equal to the preset value.
[0168] In some implementations, the preset value may be 1, for example.
[0169] In some embodiments, the server obtains the second sub-quantized difference of the model parameters of each dimension between the candidate vehicle i and other candidate vehicles based on the second model difference of the candidate vehicle i and the average value of the model parameters of each dimension of the model to be trained for the candidate vehicle i, which can be expressed by the following formula:
[0170]
[0171] in, Represents the second sub-quantized difference between the model parameters of the kth dimension corresponding to candidate vehicle i and other candidate vehicles.
[0172] For any candidate vehicle, based on the second model difference of the candidate vehicle and the average value of each dimension of the model parameter of the model to be trained, the quantitative difference in each dimension of the model parameter corresponding to the candidate vehicle and other candidate vehicles is obtained.
[0173] In some embodiments, when the quantized difference between the candidate vehicle and other candidate vehicles in each dimension of model parameters includes both a first sub-quantized difference and a second sub-quantized difference, the server can further obtain the quantized difference between the candidate vehicle and other candidate vehicles in each dimension of model parameters based on the first sub-quantized difference and the second sub-quantized difference between the candidate vehicle and other candidate vehicles in each dimension of model parameters.
[0174] In some implementations, the server may add the first sub-quantization difference and the second sub-quantization difference of the model parameters of the k-th dimension corresponding to the candidate vehicle and other candidate vehicles, thereby obtaining the quantization difference of the model parameters of the k-th dimension corresponding to the candidate vehicle and other candidate vehicles. This process can be expressed by the following formula:
[0175]
[0176] in, represents the quantitative difference between the model parameters of the kth dimension corresponding to the candidate vehicle i and other candidate vehicles, It represents the first sub-quantization difference between the model parameters of the k-th dimension corresponding to the candidate vehicle i and other candidate vehicles, and it represents the second sub-quantization difference between the model parameters of the k-th dimension corresponding to the candidate vehicle i and other candidate vehicles.
[0177] S218: For any dimensional model parameter, the server determines the maximum value of the quantized difference between each candidate vehicle and other candidate vehicles corresponding to the dimensional model parameter as the target value of the dimensional model parameter.
[0178] After step S217, the server can obtain the quantitative differences of each candidate vehicle and other candidate vehicles in each dimension of model parameters. Then, the server can find the largest quantitative difference from the quantitative differences of each dimension of model parameters, and then determine the largest quantitative difference as the target value of the model parameter of that dimension.
[0179] In some embodiments, for any dimensional model parameter, the server determines the maximum value of the quantized difference between each candidate vehicle and other candidate vehicles corresponding to the dimensional model parameter as the target value of the dimensional model parameter, which can be expressed by the following formula:
[0180]
[0181] Among them, q k Represents the target value of the k-th dimension model parameter.
[0182] S219, the server performs clustering based on the target value of each dimension of the model parameter to obtain multiple clusters, each cluster including the target value corresponding to one or more model parameter dimensions.
[0183] After step S218, the server can obtain a set of target values of each dimension of the model parameter, which can be expressed as q={q 1 ,q 2 ,…,q d}. Then, each target value can be clustered to obtain multiple clusters.
[0184] In some implementations, the k-means algorithm may be used to cluster each target value. For example, the number of clusters may be set to grow from 2 until the silhouette coefficient of the dm+1 class is less than that of the dm class or when dm=d-1, to obtain a clustering result.
[0185] S220: The server determines, for any cluster, average values of target values corresponding to the model parameter dimensions in the cluster, and determines, from among the multiple clusters, a cluster with the largest corresponding average value as a target cluster.
[0186] After step S219, the server can obtain multiple clusters, each cluster includes target values corresponding to one or more model parameter dimensions. Then, the average value of the target value in each cluster can be calculated respectively, and then, the cluster with the largest corresponding average value can be determined as the target cluster from the multiple clusters.
[0187] For example, it is assumed that the model parameter dimensions included in the target cluster are represented as {p1, p2, ..., p b}, where pb represents the b-th cluster.
[0188] S221, the server determines a safe vehicle for any candidate vehicle based on the quantized difference of the candidate vehicle in the target dimension and the median value of the target value of the model parameter in each dimension.
[0189] Here, the target dimension is the model parameter dimension included in the target cluster.
[0190] After step S219, the server can obtain a set of target values for each dimension of the model parameter. Further, the server can calculate the median value of the target value of each dimension of the model parameter, and then determine the safe vehicle based on the quantitative difference of the candidate vehicle corresponding to the target dimension and the calculated median value.
[0191] In some embodiments, the server may compare the target value of the target dimension (i.e., the model parameter dimension included in the target cluster) of the candidate vehicle with the calculated median value. Whenever the target value of a target dimension is greater than the median value, the target number corresponding to the candidate vehicle is increased by 1. Thus, after comparing the target values of all target dimensions of the candidate vehicle with the calculated median value respectively, the target number corresponding to the candidate vehicle can be obtained.
[0192] Furthermore, by repeating the above process, the target number of times corresponding to each candidate vehicle can be obtained. After the target number of times corresponding to each candidate vehicle is obtained, a safe vehicle can be determined from each candidate vehicle according to the target number of times.
[0193] In some implementations, the target times may be sorted in ascending order, and then the top x targets are selected. l The candidate vehicle corresponding to the target number is regarded as a safe vehicle.
[0194] S222, the server sends identification information of the safety vehicle to each roadside unit.
[0195] S223: The target roadside unit aggregates the first encrypted model slices of each safe vehicle corresponding to the identification information to obtain a second aggregated model slice.
[0196] After obtaining the identification information, the target roadside unit can determine the safe vehicle according to the identification information, and then further aggregate the first encrypted model slices of each safe vehicle to obtain a second aggregated model slice.
[0197] It should be noted that the target roadside unit does not necessarily have the first encrypted model slices of all safe vehicles. In this case, the target roadside unit can only aggregate the first encrypted model slices of the safe vehicles it owns.
[0198] S224: The target roadside unit sends the second aggregated model slice to the server.
[0199] S225: Obtain target model parameters of the model to be trained based on the second aggregated model slices sent by different roadside units.
[0200] In some embodiments, after receiving the second aggregated model slices sent by different roadside units, the server can aggregate the second aggregated model slices sent by different roadside units. The aggregation result here represents the model parameters of all safety vehicle training. Therefore, after obtaining the aggregation result, the aggregation result can be divided by the number of safety vehicles to obtain the final target model parameters of the model to be trained.
[0201] In some implementations, the process of obtaining the target model parameters of the model to be trained based on the second aggregated model slices sent by different roadside units by the server can be expressed by the following formula:
[0202]
[0203] in, represents the target model parameters of round l, represents the second aggregate model slice corresponding to the safety vehicle j, [A list ]Number of safety vehicles.
[0204] After the above steps S201-S225, the training process of the l-th round model in federated learning is completed. When the l+1-th round model training is performed, the target model parameters obtained in the l-th round model training can be used as the model parameters of the model to be trained in the l+1-th round model training.
[0205] In the above technical solution, the server and the roadside unit interact and collaborate to calculate the quantitative difference of each dimensional parameter of the model to evaluate and screen the models uploaded by each vehicle, and finally obtain the model that is most likely to be an honest vehicle to aggregate and obtain the final model, thereby improving the security of the model obtained by federated learning.
[0206] In addition, each vehicle modifies (cuts) the original model parameters according to the parameters sent by the roadside unit, so that the relevant original model parameters are only known to the vehicle and the roadside unit, and the intermediate calculation and aggregation process are completed in the encryption process, without leaking any random model parameters or model parameter fragments (model slices) saved by any roadside unit to other roadside units. In the aggregation process, the only place involving the final model parameters is the final aggregation result of the safe vehicle. This means that if there is only one honest roadside unit among the roadside units interacting with each other, even if all other roadside units collude with each other, they can only get the parameters obtained by the colluding roadside units, and these colluding roadside units cannot obtain the accurate model parameters of any related vehicles before cutting. Therefore, by adopting the technical solution of the embodiment of the present disclosure, when there is any honest roadside unit in the set of roadside units interacting with each other, the parameters of the vehicle can be protected from being obtained by other parties, thereby further improving the security of the model obtained by federated learning.
[0207] In addition, since the vehicle directly uploads its own model after splitting it, even if a subsequent vehicle is disconnected, it will not affect the aggregation and calculation of the uploaded parameters. Federated learning services can be provided on roads with a high rate of vehicle disconnections. Moreover, compared with traditional federated learning services applied to the Internet of Vehicles, since vehicle disconnections will cause a large amount of additional calculations to restore the disconnected vehicle, the method of the embodiment of the present disclosure reduces the resource consumption of federated learning services.
[0208] Figure 3 is a flow chart of a model training method according to an exemplary embodiment of the present disclosure. The model training method is applied to Figure 1 Any roadside unit of the vehicle-road cooperative system shown in the figure. Figure 3 , the model training method includes:
[0209] S310: When it is determined that any candidate vehicle has completed the training of the model to be trained, determine the first encrypted model slice of the candidate vehicle for the model to be trained.
[0210] Among them, the candidate vehicle is a vehicle that receives the random parameters sent by the target roadside unit.
[0211] The detailed process of step S310 can refer to the description of the aforementioned step S206, which will not be repeated here.
[0212] S320: For any candidate vehicle, determine a first model difference corresponding to the candidate vehicle.
[0213] Among them, the first model difference corresponding to a candidate vehicle represents the model difference between the first encrypted model slice of the candidate vehicle and the first encrypted model slices of other candidate vehicles.
[0214] The detailed process of step S320 can refer to the description of the aforementioned steps S207-S212, which will not be repeated here.
[0215] S330, aggregate the first encrypted model slices of each candidate vehicle to obtain a first aggregated model slice corresponding to the target roadside unit.
[0216] The detailed process of step S330 can refer to the description of the aforementioned step S213, which will not be repeated here.
[0217] S340, sending the first model differences and the first aggregate model slices corresponding to each candidate vehicle to the server, so that the server determines a safe vehicle whose model parameters meet the preset parameter difference conditions from the candidate vehicles corresponding to each roadside unit based on the first model differences and the first aggregate model slices sent by different roadside units.
[0218] The detailed process of step S340 can refer to the description of the aforementioned steps S214-S221, which will not be repeated here.
[0219] S350, receiving identification information of the safety vehicle sent by the server, and aggregating the first encrypted model slices of each safety vehicle corresponding to the identification information to obtain second aggregated model slices.
[0220] The detailed process of step S350 can refer to the description of the aforementioned steps S222-S223, which will not be repeated here.
[0221] S360: Send the second aggregate model slice to the server, so that the server obtains the target model parameters of the model to be trained based on the second aggregate model slices sent by different roadside units.
[0222] Among them, the detailed process of step S360 can refer to the description of the aforementioned steps S224-S225, which will not be repeated here.
[0223] By adopting the above technical solution, safe vehicles are first screened out through the first model difference and the first aggregation model, and then the final model is further aggregated based on the model of the safe vehicle, thereby improving the security of the model obtained by federated learning.
[0224] The model training method of the embodiment of the present disclosure may also include the following steps:
[0225] Upon receiving the second encrypted model slice sent by any candidate vehicle, determining that the candidate vehicle has completed the training of the model to be trained;
[0226] Accordingly, determining the first encrypted model slice of the candidate vehicle for the model to be trained may include the following steps:
[0227] Based on the second encrypted model slice and the third encrypted model slice, a first encrypted model slice is obtained; wherein, the second encrypted model slice is obtained by the candidate vehicle based on the encryption key, the original model parameters and various random model parameters, the original model parameters are model parameters obtained by training the candidate vehicle on the training model, a random model parameter is generated by the candidate vehicle based on a preset random number generation algorithm and a random parameter sent by a roadside unit, and the third encrypted model slice is generated by the roadside unit based on a preset random number generation algorithm, an encryption key and random parameters sent to the candidate vehicle.
[0228] The detailed process of this embodiment can refer to the description of the aforementioned step S206, which will not be repeated here.
[0229] The model training method of the embodiment of the present disclosure may also include the following steps:
[0230] Upon receiving a notification message sent by other roadside units, determining that the candidate vehicle has completed the training of the model to be trained; wherein the notification message is sent by other roadside units to the roadside unit upon receiving a second encrypted model slice sent by the candidate vehicle, the second encrypted model slice is obtained by the candidate vehicle based on an encryption key, an original model parameter and various random model parameters, the original model parameter is a model parameter obtained by training the model to be trained by the candidate vehicle, and a random model parameter is generated by the candidate vehicle based on a preset random number generation algorithm and a random parameter sent by a received roadside unit;
[0231] Accordingly, determining the first encrypted model slice of the candidate vehicle for the model to be trained may include the following steps:
[0232] Based on a preset random number generation algorithm, an encryption key, and random parameters sent to the candidate vehicle, a first encrypted model slice is obtained.
[0233] The detailed process of this embodiment can refer to the description of the aforementioned step S206, which will not be repeated here.
[0234] In some implementations, the model training method of the embodiment of the present disclosure may further include the following steps:
[0235] Scaling the first encrypted model slice of each candidate vehicle to obtain a fourth encrypted model slice;
[0236] Sending the fourth encrypted model slices of each candidate vehicle to the server, so that the server splices the fourth encrypted model slices for the same candidate vehicle sent by different roadside units to obtain the scaled encrypted model of the same candidate vehicle, and obtains the symbol category of each model parameter of each candidate vehicle based on the decryption key and the scaled encrypted models of each candidate vehicle;
[0237] Receiving the symbol category of each model parameter of each candidate vehicle sent by the server;
[0238] Accordingly, for any candidate vehicle, determining the first model difference corresponding to the candidate vehicle may include the following steps:
[0239] Determining a first model parameter associated with the k-th dimensional model parameter of the candidate vehicle from the k-th dimensional model parameters of other candidate vehicles, wherein when the k-th dimensional model parameter of the other candidate vehicles and the k-th dimensional model parameter of the candidate vehicle belong to the same symbol category, the k-th dimensional model parameter of the other candidate vehicle is the first model parameter associated with the k-th dimensional model parameter of the candidate vehicle;
[0240] Obtaining a k-th dimensional difference of the candidate vehicle based on a value of a k-th dimensional model parameter of the candidate vehicle and a value of a first model parameter associated with the k-th dimensional model parameter of the candidate vehicle;
[0241] Based on each dimension difference of the candidate vehicle, a first model difference corresponding to the candidate vehicle is obtained.
[0242] The detailed process of this embodiment can refer to the description of the aforementioned steps S207-S212, which will not be repeated here.
[0243] In some implementations, scaling the first encrypted model slices of each candidate vehicle to obtain a fourth encrypted model slice may include the following steps:
[0244] Obtain a first encrypted random parameter sent by the server and a second encrypted random parameter sent by other roadside units;
[0245] Obtaining a first encrypted scaling factor based on the first encrypted random parameter, the second encrypted random parameter sent by the other roadside units, and the second encrypted random parameter generated by the target roadside unit;
[0246] The first encrypted model slices of each candidate vehicle are scaled by the first encryption scaling factor to obtain fourth encrypted model slices of each candidate vehicle.
[0247] The detailed process of this embodiment can refer to the description of the aforementioned step S207, which will not be repeated here.
[0248] In some implementations, the model training method of the embodiment of the present disclosure may further include the following steps:
[0249] Obtaining a second encrypted scaling factor based on the third encrypted random parameter sent by the other roadside units and the third encrypted random parameter generated by the target roadside unit;
[0250] Scaling each dimension difference of the candidate vehicle respectively by a second encrypted scaling coefficient to obtain each dimension difference of the candidate vehicle after scaling;
[0251] Accordingly, based on each dimension difference of the candidate vehicle, a first model difference corresponding to the candidate vehicle is obtained, including:
[0252] Based on the scaled difference of each dimension of the candidate vehicle, obtaining a first model difference corresponding to the candidate vehicle;
[0253] Accordingly, the first encrypted model slices of each candidate vehicle are aggregated to obtain the first aggregate corresponding to the target roadside unit; the first encrypted model slices of each candidate vehicle are respectively scaled by the second encryption scaling factor to obtain the fifth encrypted model slices of each candidate vehicle;
[0254] The fifth encrypted model slices of each candidate vehicle are aggregated to obtain a first aggregated model slice corresponding to the target roadside unit.
[0255] The detailed process of this embodiment can refer to the description of the aforementioned steps S212-S213, which will not be repeated here.
[0256] In some implementations, the model training method of the embodiment of the present disclosure may further include the following steps:
[0257] When a communication connection is established with any vehicle, random parameters are sent to the vehicle so that after the vehicle completes the training of the model to be trained, the second encrypted model slice of the vehicle for the model to be trained is determined based on the encryption key, the original model parameters obtained through training, the preset random number generation algorithm and the received random model parameters. The second encrypted model slice is used by the roadside unit to determine the first encrypted model slice of the candidate vehicle for the model to be trained.
[0258] The detailed process of this embodiment can refer to the description of the aforementioned steps S201-S206, which will not be repeated here.
[0259] Figure 4 is a flow chart of a model training method according to an exemplary embodiment of the present disclosure. The model training method is applied to Figure 1 The server in the vehicle-road cooperative system shown in FIG. Figure 4 , the model training method includes:
[0260] S410, receiving first model differences corresponding to each candidate vehicle and a first aggregated model slice corresponding to the roadside unit, which are sent by the roadside unit.
[0261] Among them, the first model difference corresponding to any candidate vehicle sent by a roadside unit is determined by the roadside unit based on the model difference between the first encrypted model slice of the candidate vehicle for the model to be trained and the first encrypted model slices of other candidate vehicles when it determines that the candidate vehicle has completed the training of the model to be trained. The first aggregated model slice corresponding to a roadside unit is obtained by aggregating the first encrypted model slices of each candidate vehicle by the roadside unit. The candidate vehicle corresponding to a roadside unit is the vehicle that receives the random parameters sent by the roadside unit.
[0262] The detailed process of step S410 can refer to the description of the aforementioned steps S206-S214, which will not be repeated here.
[0263] S420, based on the first model differences sent by different roadside units and the first aggregated model slices sent by different roadside units, determine a safe vehicle whose model parameters meet a preset parameter difference condition from the candidate vehicles corresponding to each roadside unit.
[0264] The detailed process of step S420 can refer to the description of the aforementioned steps S215-S221, which will not be repeated here.
[0265] S430: Send identification information of the safety vehicle to each roadside unit, so that each roadside unit aggregates the first encrypted model slices of each safety vehicle based on the identification information to obtain second aggregated model slices.
[0266] The detailed process of step S430 can refer to the description of the aforementioned steps S222-S223, which will not be repeated here.
[0267] S440, receiving the second aggregate model slice sent by the roadside unit, and obtaining the target model parameters of the model to be trained based on the respective second aggregate model slices sent by different roadside units.
[0268] The detailed process of step S440 can refer to the description of the aforementioned steps S224-S225, which will not be repeated here.
[0269] By adopting the above technical solution, safe vehicles are first screened out through the first model difference and the first aggregation model, and then the final model is further aggregated based on the model of the safe vehicle, thereby improving the security of the model obtained by federated learning.
[0270] In some implementations, based on the differences between the first models sent by different roadside units and the first aggregated model slices sent by different roadside units, determining a safe vehicle whose model parameters satisfy a preset parameter difference condition from candidate vehicles corresponding to each roadside unit may include the following steps:
[0271] Based on the decrypted first model differences corresponding to the same candidate vehicle, the second model differences between the same candidate vehicle and other candidate vehicles are obtained; based on the first aggregated model slices sent by different roadside units, the average value of the model parameters of each dimension of the model to be trained is obtained; for any candidate vehicle, based on the second model difference of the candidate vehicle and the average value of the model parameters of each dimension of the model to be trained, the quantitative difference in the model parameters of each dimension between the candidate vehicle and other candidate vehicles is obtained; based on the quantitative difference in the model parameters of each dimension between each candidate vehicle and other candidate vehicles, safe vehicles whose model parameters meet the preset parameter difference conditions are determined from the candidate vehicles corresponding to each roadside unit.
[0272] The detailed process of this embodiment can refer to the description of the aforementioned steps S215-S221, which will not be repeated here.
[0273] In some implementations, obtaining an average value of each dimension of the model parameter of the to-be-trained model based on each first aggregated model slice sent by different roadside units may include the following steps:
[0274] Aggregate the first aggregate model slices sent by different target roadside units to obtain a third aggregate model slice; decrypt the third aggregate model slice based on the decryption key to obtain a decrypted aggregate model slice; based on the decrypted aggregate model slice and the number of candidate vehicles, obtain an average value of the model to be trained, and the average value of the model to be trained includes the average value of each dimensional model parameter.
[0275] The detailed process of this embodiment can refer to the description of the aforementioned step S216, which will not be repeated here.
[0276] In some embodiments, the second model difference includes a sub-difference corresponding to each dimension of the model parameter. In this case, for any candidate vehicle, based on the second model difference of the candidate vehicle and the average value of each dimension of the model parameter of the to-be-trained model, obtaining the quantized difference of each dimension of the model parameter between the candidate vehicle and other candidate vehicles may include the following steps:
[0277] For the k-th dimensional model parameters of the candidate vehicle, obtain the ratio of the sub-difference corresponding to the k-th dimensional model parameters of the candidate vehicle and the average value of the corresponding k-th dimensional model parameters in the model to be trained; based on the size of the ratio and the preset value, determine the quantitative difference between the candidate vehicle and other candidate vehicles corresponding to the k-th dimensional model parameters.
[0278] The detailed process of this embodiment can refer to the description of the aforementioned step S217, which will not be repeated here.
[0279] In some embodiments, determining the quantitative difference between the candidate vehicle and other candidate vehicles in the k-th dimension model parameters based on the ratio and the preset value may include the following steps:
[0280] When the ratio is less than a preset value, the ratio is determined as the quantitative difference between the model parameters of the candidate vehicle and other candidate vehicles corresponding to the k-th dimension; when the ratio is greater than or equal to the preset value, the preset value is determined as the quantitative difference between the model parameters of the candidate vehicle and other candidate vehicles corresponding to the k-th dimension.
[0281] The detailed process of this embodiment can refer to the description of the aforementioned step S217, which will not be repeated here.
[0282] In some embodiments, for any candidate vehicle, based on the second model difference of the candidate vehicle and the average value of each dimension of the model parameter of the to-be-trained model, obtaining the quantitative difference of each dimension of the model parameter between the candidate vehicle and other candidate vehicles may include the following steps:
[0283] Based on the sign category of each model parameter of each candidate vehicle, determine the first sub-quantization difference of the model parameters in each dimension between any candidate vehicle and other candidate vehicles; for any candidate vehicle, based on the second model difference of the candidate vehicle and the average value of the model parameters in each dimension of the model to be trained, obtain the second sub-quantization difference of the model parameters in each dimension between the candidate vehicle and other candidate vehicles; for any candidate vehicle, based on the first sub-quantization difference and the second sub-quantization difference of the model parameters in each dimension between the candidate vehicle and other candidate vehicles, obtain the quantization difference of the model parameters in each dimension between the candidate vehicle and other candidate vehicles.
[0284] The detailed process of this embodiment can refer to the description of the aforementioned step S217, which will not be repeated here.
[0285] In some embodiments, based on the quantified difference in each dimension of the model parameters of each candidate vehicle and other candidate vehicles, determining a safe vehicle whose model parameters satisfy a preset parameter difference condition from the candidate vehicles corresponding to each roadside unit may include the following steps:
[0286] For any dimensional model parameter, the maximum value of the quantized difference between each candidate vehicle and other candidate vehicles corresponding to the model parameter of this dimension is determined as the target value of the model parameter of this dimension; clustering is performed based on the target value of each dimensional model parameter to obtain multiple clusters, each cluster includes target values corresponding to one or more model parameter dimensions; for any cluster, the average value of the target values corresponding to the model parameter dimensions in the cluster is determined, and the cluster with the largest corresponding average value is determined as the target cluster from the multiple clusters; for any candidate vehicle, the safe vehicle is determined based on the quantized difference of the candidate vehicle corresponding to the target dimension and the median value of the target value of each dimensional model parameter, and the target dimension is the model parameter dimension included in the target cluster.
[0287] The detailed process of this embodiment can refer to the description of the aforementioned steps S218-S221, which will not be repeated here.
[0288] In some embodiments, for any candidate vehicle, determining a safe vehicle based on the quantized difference of the candidate vehicle in the target dimension and the median value of the target value of the model parameter in each dimension may include the following steps:
[0289] For any candidate vehicle, determine the target number corresponding to the candidate vehicle, where if the quantized difference of the candidate vehicle in a target dimension is greater than the median value, the target number is increased by 1; based on the target numbers corresponding to each candidate vehicle, determine the safe vehicle from each candidate vehicle.
[0290] The detailed process of this embodiment can refer to the description of the aforementioned step S221, which will not be repeated here.
[0291] In some implementations, the model training method of the embodiment of the present disclosure may further include the following steps:
[0292] Receive the fourth encrypted model slice of each candidate vehicle sent by the roadside unit, where the fourth encrypted model slice is obtained by scaling the first encrypted model slice of the candidate vehicle by the roadside unit; splice the scaled encrypted model of the same candidate vehicle based on the fourth encrypted model slices for the same candidate vehicle sent by different roadside units; for any candidate vehicle, obtain the symbol category of each model parameter of the candidate vehicle based on the decryption key and the scaled encrypted model of the candidate vehicle; send the symbol category of each model parameter of each candidate vehicle to the roadside unit, so that the roadside unit determines the first model difference corresponding to each candidate vehicle based on the symbol category of each model parameter of the candidate vehicle and the first encrypted model slice of each candidate vehicle.
[0293] The detailed process of this embodiment can refer to the description of the aforementioned steps S207-S212, which will not be repeated here.
[0294] In some implementations, the model training method of the embodiment of the present disclosure may further include the following steps:
[0295] A first encrypted random parameter is sent to a roadside unit so that any roadside unit obtains a first encrypted scaling factor based on the first encrypted random parameter, the second encrypted random parameter sent by other roadside units, and the second encrypted random parameter generated by the roadside unit, and encrypts and scales the first encrypted model slice of each candidate vehicle by the first encrypted scaling factor to obtain a fourth encrypted model slice of each candidate vehicle.
[0296] The detailed process of this embodiment can refer to the description of the aforementioned step S207, which will not be repeated here.
[0297] Figure 5 is a flow chart of a model training method according to an exemplary embodiment of the present disclosure. The model training method is applied to Figure 5 Any vehicle in the vehicle-road cooperative system shown. Figure 5 , the model training method includes:
[0298] S510, obtaining a model to be trained.
[0299] S520, training the model to be trained based on the local vehicle data to obtain original model parameters.
[0300] S530, obtaining random model parameters based on a preset random number generation algorithm and random parameters received from the roadside unit.
[0301] S540, obtaining a second encrypted model slice based on the encryption key, the original model parameters and each random model parameter.
[0302] S550: Send the second encrypted model slice to the roadside unit.
[0303] Among them, the second encrypted model slice is used by the roadside unit to determine the first model difference, the first model difference is used by the server to determine the safe vehicle, the roadside unit is also used to aggregate the first encrypted model slices of each safe vehicle to obtain the second aggregated model slice, and the server is also used to obtain the target model parameters of the model to be trained based on the second aggregated model slices sent by different roadside units.
[0304] Among them, the detailed description of steps S510-S550 can refer to the description of the aforementioned steps S201-S225, which will not be repeated here.
[0305] By adopting the above technical solution, safe vehicles are first screened out through the first model difference and the first aggregation model, and then the final model is further aggregated based on the model of the safe vehicle, thereby improving the security of the model obtained by federated learning.
[0306] Based on the same inventive concept, an embodiment of the present disclosure provides a model training device. Figure 6 is a block diagram of a model training device 600 shown in an exemplary embodiment of the present disclosure, referring to Figure 6 , the model training device 600 includes:
[0307] The first determination module 601 is used to determine the first encrypted model slice of the candidate vehicle for the model to be trained when it is determined that any candidate vehicle has completed the training of the model to be trained, and the candidate vehicle is a vehicle that receives the random parameters sent by the target roadside unit.
[0308] The second determination module 602 is used to determine, for any candidate vehicle, a first model difference corresponding to the candidate vehicle, where the first model difference corresponding to a candidate vehicle represents a model difference between the first encrypted model slice of the candidate vehicle and the first encrypted model slices of other candidate vehicles.
[0309] The third determination module 603 is used to aggregate the first encrypted model slices of each candidate vehicle to obtain a first aggregated model slice corresponding to the target roadside unit.
[0310] The first sending module 604 is used to send the first model differences and the first aggregate model slices corresponding to each candidate vehicle to the server, so that the server determines a safe vehicle whose model parameters meet the preset parameter difference conditions from the candidate vehicles corresponding to each roadside unit based on the first model differences and the first aggregate model slices sent by different roadside units.
[0311] The first aggregation module 605 is used to receive the identification information of the safety vehicle sent by the server, and aggregate the first encrypted model slices of each safety vehicle corresponding to the identification information to obtain second aggregated model slices.
[0312] The second sending module 606 is used to send the second aggregate model slice to the server, so that the server obtains the target model parameters of the model to be trained based on the second aggregate model slices sent by different roadside units.
[0313] Optionally, the model training device 600 further includes:
[0314] A fourth determination module is used to determine, upon receiving the second encrypted model slice sent by any candidate vehicle, that the candidate vehicle has completed the training of the model to be trained;
[0315] Accordingly, the first determining module 601 includes:
[0316] A first determining submodule, configured to obtain the first encrypted model slice based on the second encrypted model slice and the third encrypted model slice;
[0317] Among them, the second encrypted model slice is obtained by the candidate vehicle based on the encryption key, the original model parameters and various random model parameters, the original model parameters are the model parameters obtained by the candidate vehicle by training the model to be trained, a random model parameter is generated by the candidate vehicle based on a preset random number generation algorithm and a random parameter sent by a roadside unit, and the third encrypted model slice is generated by the roadside unit based on the preset random number generation algorithm, the encryption key and the random parameter sent to the candidate vehicle.
[0318] Optionally, the model training device 600 further includes:
[0319] The fifth determination module is used to determine that the candidate vehicle has completed the training of the model to be trained when receiving a notification message sent by other roadside units; wherein the notification message is sent by the other roadside unit to the roadside unit when receiving the second encrypted model slice sent by the candidate vehicle, the second encrypted model slice is obtained by the candidate vehicle based on the encryption key, the original model parameters and various random model parameters, the original model parameters are model parameters obtained by the candidate vehicle through training the model to be trained, and a random model parameter is generated by the candidate vehicle based on a preset random number generation algorithm and a random parameter sent by a roadside unit.
[0320] Accordingly, the first determining module 601 includes:
[0321] The second determination submodule is used to obtain the first encryption model slice based on a preset random number generation algorithm, an encryption key, and a random parameter sent to the candidate vehicle.
[0322] Optionally, the model training device 600 further includes:
[0323] A first scaling module, configured to scale the first encrypted model slice of each candidate vehicle to obtain a fourth encrypted model slice;
[0324] a third sending module, configured to send the fourth encrypted model slices of each candidate vehicle to a server, so that the server obtains a scaled encrypted model of the same candidate vehicle by splicing the fourth encrypted model slices for the same candidate vehicle sent by different roadside units, and obtains a symbol category of each model parameter of each candidate vehicle based on a decryption key and the scaled encrypted models of each candidate vehicle;
[0325] A first receiving module, configured to receive the symbol category of each model parameter of each candidate vehicle sent by the server;
[0326] Accordingly, the second determining module 602 includes:
[0327] A third determination submodule is used to determine a first model parameter associated with the k-th dimensional model parameter of the candidate vehicle from the k-th dimensional model parameters of other candidate vehicles, wherein when the k-th dimensional model parameters of other candidate vehicles and the k-th dimensional model parameters of the candidate vehicle belong to the same symbol category, the k-th dimensional model parameters of other candidate vehicles are the first model parameters associated with the k-th dimensional model parameters of the candidate vehicle;
[0328] a fourth determination submodule, configured to obtain a k-th dimension difference of the candidate vehicle based on a value of a k-th dimension model parameter of the candidate vehicle and a value of a first model parameter associated with the k-th dimension model parameter of the candidate vehicle;
[0329] The fifth determination submodule is used to obtain a first model difference corresponding to the candidate vehicle based on each dimension difference of the candidate vehicle.
[0330] Optionally, the first scaling module includes:
[0331] A first acquisition unit, used to acquire a first encrypted random parameter sent by the server and a second encrypted random parameter sent by other roadside units;
[0332] A first determining unit, configured to obtain a first encrypted scaling factor based on the first encrypted random parameter, a second encrypted random parameter sent by another roadside unit, and a second encrypted random parameter generated by the target roadside unit;
[0333] A scaling unit is used to scale the first encrypted model slice of each candidate vehicle by the first encryption scaling coefficient to obtain the fourth encrypted model slice of each candidate vehicle.
[0334] Optionally, the model training device 600 further includes:
[0335] A sixth determination module, configured to obtain a second encrypted scaling factor based on the third encrypted random parameter sent by the other roadside units and the third encrypted random parameter generated by the target roadside unit;
[0336] A second scaling module, used for scaling each dimension difference of the candidate vehicle by the second encrypted scaling coefficient to obtain each dimension difference of the candidate vehicle after scaling;
[0337] Accordingly, the fifth determining submodule includes:
[0338] A second determining unit, configured to obtain a first model difference corresponding to the candidate vehicle based on the scaled difference in each dimension of the candidate vehicle;
[0339] The third determination module 603 includes:
[0340] a scaling submodule, configured to scale the first encrypted model slice of each candidate vehicle by the second encryption scaling coefficient to obtain a fifth encrypted model slice of each candidate vehicle;
[0341] The aggregation submodule is used to aggregate the fifth encrypted model slices of each candidate vehicle to obtain a first aggregated model slice corresponding to the target roadside unit.
[0342] Optionally, the model training device 600 further includes:
[0343] The fourth sending module is used to send random parameters to any vehicle when a communication connection is established with the vehicle, so that the vehicle can determine the second encrypted model slice of the vehicle for the model to be trained based on the encryption key, the original model parameters obtained through training, the preset random number generation algorithm and the received random model parameters after completing the training of the model to be trained. The second encrypted model slice is used by the roadside unit to determine the first encrypted model slice of the candidate vehicle for the model to be trained.
[0344] Based on the same inventive concept, an embodiment of the present disclosure provides a model training device. Figure 7 is a block diagram of a model training device 700 shown in an exemplary embodiment of the present disclosure, referring to Figure 7 , the model training device 700 includes:
[0345] The second receiving module 701 is used to receive the first model difference corresponding to each candidate vehicle and the first aggregated model slice corresponding to the roadside unit sent by the roadside unit, wherein the first model difference corresponding to any candidate vehicle sent by a roadside unit is determined by the roadside unit based on the model difference between the first encrypted model slice of the candidate vehicle for the model to be trained and the first encrypted model slices of other candidate vehicles when it is determined that the candidate vehicle has completed the training of the model to be trained. The first aggregated model slice corresponding to a roadside unit is obtained by aggregating the first encrypted model slices of each candidate vehicle by the roadside unit. The candidate vehicle corresponding to a roadside unit is the vehicle that receives the random parameters sent by the roadside unit.
[0346] The fourth determination module 702 is used to determine a safe vehicle whose model parameters meet preset parameter difference conditions from the candidate vehicles corresponding to each roadside unit based on the differences between the first models sent by different roadside units and the first aggregated model slices sent by different roadside units.
[0347] The fifth sending module 703 is used to send the identification information of the safety vehicle to each roadside unit, so that each roadside unit aggregates the first encrypted model slices of each safety vehicle based on the identification information to obtain a second aggregated model slice.
[0348] The third receiving module 704 is used to receive the second aggregate model slice sent by the roadside unit, and obtain the target model parameters of the model to be trained based on each of the second aggregate model slices sent by different roadside units.
[0349] Optionally, the fourth determining module 702 includes:
[0350] A sixth determination submodule, configured to obtain a second model difference between the same candidate vehicle and other candidate vehicles based on the decrypted first model differences corresponding to the same candidate vehicle;
[0351] a seventh determination submodule, configured to obtain an average value of each dimension of the model parameter of the to-be-trained model based on each of the first aggregated model slices sent by different roadside units;
[0352] an eighth determination submodule, configured to obtain, for any candidate vehicle, a quantized difference in each dimension of the model parameters between the candidate vehicle and other candidate vehicles based on the second model difference of the candidate vehicle and an average value of each dimension of the model parameters of the to-be-trained model;
[0353] The ninth determination submodule is used to determine a safe vehicle whose model parameters meet a preset parameter difference condition from the candidate vehicles corresponding to each roadside unit based on the quantitative difference in each dimension of the model parameters corresponding to each candidate vehicle and other candidate vehicles.
[0354] Optionally, the seventh determining submodule includes:
[0355] an aggregation unit, configured to aggregate the first aggregation model slices sent by different target roadside units to obtain a third aggregation model slice;
[0356] A decryption unit, configured to decrypt the third aggregate model slice based on a decryption key to obtain a decrypted aggregate model slice;
[0357] The third determination unit is used to obtain an average value of the model to be trained based on the decrypted aggregate model slice and the number of candidate vehicles, where the average value of the model to be trained includes an average value of each dimensional model parameter.
[0358] Optionally, the second model difference includes a sub-difference corresponding to a model parameter in each dimension; and the eighth determination submodule includes:
[0359] A second acquisition unit is used to acquire, for the k-th dimensional model parameter of the candidate vehicle, a ratio of a sub-difference corresponding to the k-th dimensional model parameter of the candidate vehicle to an average value of the corresponding k-th dimensional model parameter in the to-be-trained model;
[0360] The fourth determination unit is used to determine the quantitative difference between the model parameters of the candidate vehicle and other candidate vehicles corresponding to the k-th dimension based on the size of the ratio and the preset value.
[0361] Optionally, the fourth determination unit is also used to determine the ratio as the quantized difference between the model parameters of the candidate vehicle and other candidate vehicles corresponding to the kth dimension when the ratio is less than the preset value; and to determine the preset value as the quantized difference between the model parameters of the candidate vehicle and other candidate vehicles corresponding to the kth dimension when the ratio is greater than or equal to the preset value.
[0362] Optionally, the eighth determining submodule includes:
[0363] A fifth determination unit, configured to determine, based on the sign categories of the model parameters of the candidate vehicles, a first sub-quantization difference between any candidate vehicle and other candidate vehicles corresponding to the model parameters in each dimension;
[0364] a sixth determining unit, configured to obtain, for any candidate vehicle, a second sub-quantized difference in each dimension of the model parameters of the candidate vehicle and other candidate vehicles based on the second model difference of the candidate vehicle and an average value of each dimension of the model parameters of the to-be-trained model;
[0365] The seventh determination unit is used to obtain, for any candidate vehicle, the quantized difference in each dimension of the model parameters between the candidate vehicle and other candidate vehicles based on the first sub-quantized difference and the second sub-quantized difference in each dimension of the model parameters between the candidate vehicle and other candidate vehicles.
[0366] Optionally, the ninth determining submodule includes:
[0367] An eighth determination unit is used to determine, for any dimensional model parameter, the maximum value of the quantized difference between each candidate vehicle and other candidate vehicles corresponding to the dimensional model parameter as the target value of the dimensional model parameter;
[0368] a ninth determining unit, configured to perform clustering based on the target value of each dimension of the model parameter to obtain a plurality of clusters, each cluster including the target value corresponding to one or more model parameter dimensions;
[0369] a tenth determining unit, configured to determine, for any cluster, an average value of the target values respectively corresponding to the model parameter dimensions in the cluster, and determine, from the multiple clusters, a cluster having the largest average value as a target cluster;
[0370] An eleventh determination unit is used to determine the safe vehicle for any candidate vehicle based on the quantized difference of the candidate vehicle corresponding to the target dimension and the median value of the target value of the model parameter in each dimension, where the target dimension is the model parameter dimension included in the target cluster.
[0371] Optionally, the eleventh determination unit is also used to determine the target number corresponding to any candidate vehicle, wherein if the quantitative difference of the candidate vehicle in one of the target dimensions is greater than the median value, the target number is increased by 1; based on the target numbers corresponding to each candidate vehicle, the safe vehicle is determined from each candidate vehicle.
[0372] Optionally, the apparatus 700 further includes:
[0373] a sixth sending module, configured to receive a fourth encrypted model slice of each candidate vehicle sent by a roadside unit, wherein the fourth encrypted model slice is obtained by scaling the first encrypted model slice of the candidate vehicle by the roadside unit;
[0374] A splicing module, configured to splice the fourth encrypted model slices for the same candidate vehicle sent by different roadside units to obtain a scaled encrypted model of the same candidate vehicle;
[0375] a fifth determination module, configured to obtain, for any candidate vehicle, a symbol category of each model parameter of the candidate vehicle based on a decryption key and a scaled encryption model of the candidate vehicle;
[0376] The seventh sending module is used to send the symbol category of each model parameter of each candidate vehicle to the roadside unit, so that the roadside unit determines the first model difference corresponding to each candidate vehicle based on the symbol category of each model parameter of the candidate vehicle and the first encrypted model slice of each candidate vehicle.
[0377] Optionally, the apparatus 700 further includes:
[0378] The seventh sending module is used to send the first encrypted random parameter to the roadside unit, so that any roadside unit can obtain the first encrypted scaling factor based on the first encrypted random parameter, the second encrypted random parameter sent by other roadside units and the second encrypted random parameter generated by the roadside unit, and encrypt and scale the first encrypted model slices of each candidate vehicle by the first encrypted scaling factor to obtain the fourth encrypted model slices of each candidate vehicle.
[0379] Based on the same inventive concept, an embodiment of the present disclosure provides a model training device. Figure 8 is a block diagram of a model training device 800 shown in an exemplary embodiment of the present disclosure, referring to Figure 8 , the model training device 800 includes:
[0380] The acquisition module 801 is used to acquire the model to be trained.
[0381] The sixth determination module 802 is used to train the model to be trained based on local vehicle data to obtain original model parameters.
[0382] The seventh determination module 803 is used to obtain random model parameters based on a preset random number generation algorithm and random parameters received from the roadside unit.
[0383] The eighth determination module 804 is used to obtain a second encrypted model slice based on the encryption key, the original model parameters and each of the random model parameters.
[0384] The eighth sending module 805 is used to send the second encrypted model slice to the roadside unit, the second encrypted model slice is used by the roadside unit to determine the first model difference, the first model difference is used by the server to determine the safe vehicle, the roadside unit is also used to aggregate the first encrypted model slices of each safe vehicle to obtain a second aggregated model slice, and the server is also used to obtain the target model parameters of the model to be trained based on each of the second aggregated model slices sent by different roadside units.
[0385] Based on the same inventive concept, an embodiment of the present disclosure also provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the model training method described in any embodiment of the present disclosure are implemented.
[0386] Based on the same inventive concept, the present disclosure also provides an electronic device, including:
[0387] a memory having a computer program stored thereon;
[0388] A processor is used to execute the computer program in the memory to implement the steps of the model training method described in any embodiment of the present disclosure.
[0389] Fig. 9 FIG. 9 is a block diagram of an electronic device 900 according to an exemplary embodiment. Fig. 9 As shown, the electronic device 900 may include: a processor 901 and a memory 902. The electronic device 900 may also include one or more of a multimedia component 903, an input / output (I / O) interface 904, and a communication component 905.
[0390] Among them, the processor 901 is used to control the overall operation of the electronic device 900 to complete all or part of the steps in the above-mentioned model training method. The memory 902 is used to store various types of data to support the operation of the electronic device 900, and these data may include, for example, instructions for any application or method used to operate on the electronic device 900, and application-related data, such as contact data, sent and received messages, pictures, audio, video, etc. The memory 902 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random Access Memory, referred to as SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, referred to as EEPROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory, referred to as EPROM), programmable read-only memory (Programmable Read-Only Memory, referred to as PROM), read-only memory (Read-Only Memory, referred to as ROM), magnetic memory, flash memory, disk or optical disk. The multimedia component 903 may include a screen and an audio component. The screen may be, for example, a touch screen, and the audio component is used to output and / or input audio signals. For example, the audio component may include a microphone, which is used to receive external audio signals. The received audio signal may be further stored in the memory 902 or sent through the communication component 905. The audio component also includes at least one speaker for outputting audio signals. The I / O interface 904 provides an interface between the processor 901 and other interface modules, and the above-mentioned other interface modules may be keyboards, mice, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 905 is used for wired or wireless communication between the electronic device 900 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G or 4G, or a combination of one or more of them, so the corresponding communication component 905 may include: Wi-Fi module, Bluetooth module, NFC module.
[0391] In an exemplary embodiment, the electronic device 900 can be implemented by one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), controllers, microcontrollers, microprocessors or other electronic components to execute the above-mentioned model training method.
[0392] In another exemplary embodiment, a computer-readable storage medium including program instructions is also provided, and when the program instructions are executed by a processor, the steps of the above-mentioned model training method are implemented. For example, the computer-readable storage medium can be the above-mentioned memory 902 including program instructions, and the above-mentioned program instructions can be executed by the processor 901 of the electronic device 900 to complete the above-mentioned model training method.
[0393] In another exemplary embodiment, a computer program product is also provided, which includes a computer program that can be executed by a programmable device, and the computer program has a code portion for executing the above-mentioned model training method when executed by the programmable device.
[0394] The preferred embodiments of the present disclosure are described in detail above in conjunction with the accompanying drawings; however, the present disclosure is not limited to the specific details in the above embodiments. Within the technical concept of the present disclosure, a variety of simple modifications can be made to the technical solution of the present disclosure, and these simple modifications all fall within the protection scope of the present disclosure.
[0395] It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the present disclosure will not further describe various possible combinations.
[0396] In addition, various embodiments of the present disclosure may be arbitrarily combined, and as long as they do not violate the concept of the present disclosure, they should also be regarded as the contents disclosed by the present disclosure.
Claims
1. A model training method, characterized in that: Applied to a target roadside unit, the target roadside unit is any roadside unit in a vehicle-road cooperative system, the method includes: In the case where it is determined that any candidate vehicle has completed the training of the model to be trained, determining a first encrypted model slice of the candidate vehicle for the model to be trained, the candidate vehicle being a vehicle that receives the random parameters sent by the target roadside unit; For any candidate vehicle, determine a first model difference corresponding to the candidate vehicle, where the first model difference corresponding to a candidate vehicle represents a model difference between a first encrypted model slice of the candidate vehicle and first encrypted model slices of other candidate vehicles; Aggregating the first encrypted model slices of each candidate vehicle to obtain a first aggregated model slice corresponding to the target roadside unit; Sending the first model differences and the first aggregated model slices respectively corresponding to the candidate vehicles to the server, so that the server determines a safe vehicle whose model parameters meet a preset parameter difference condition from the candidate vehicles respectively corresponding to the roadside units based on the first model differences and the first aggregated model slices sent by different roadside units; Receiving identification information of the safety vehicle sent by the server, and aggregating first encrypted model slices of each safety vehicle corresponding to the identification information to obtain second aggregated model slices; The second aggregate model slice is sent to the server, so that the server obtains the target model parameters of the model to be trained based on each of the second aggregate model slices sent by different roadside units.
2. The method according to claim 1, characterized in that The method further comprises: Upon receiving the second encrypted model slice sent by any candidate vehicle, determining that the candidate vehicle has completed the training of the model to be trained; The determining of a first encrypted model slice of the candidate vehicle for the model to be trained includes: Obtaining the first encrypted model slice based on the second encrypted model slice and the third encrypted model slice; Among them, the second encrypted model slice is obtained by the candidate vehicle based on the encryption key, the original model parameters and various random model parameters, the original model parameters are the model parameters obtained by the candidate vehicle by training the model to be trained, a random model parameter is generated by the candidate vehicle based on a preset random number generation algorithm and a random parameter sent by a roadside unit, and the third encrypted model slice is generated by the roadside unit based on the preset random number generation algorithm, the encryption key and the random parameter sent to the candidate vehicle.
3. The method according to claim 1, characterized in that The method further comprises: Upon receiving a notification message sent by another roadside unit, determining that the candidate vehicle has completed training of the to-be-trained model; Wherein, the notification message is sent by the other roadside unit to the roadside unit when receiving the second encrypted model slice sent by the candidate vehicle, the second encrypted model slice is obtained by the candidate vehicle based on the encryption key, the original model parameters and various random model parameters, the original model parameters are model parameters obtained by the candidate vehicle by training the model to be trained, and a random model parameter is generated by the candidate vehicle based on a preset random number generation algorithm and a random parameter sent by a received roadside unit; The determining of a first encrypted model slice of the candidate vehicle for the model to be trained includes: The first encrypted model slice is obtained based on a preset random number generation algorithm, an encryption key, and random parameters sent to the candidate vehicle.
4. The method according to claim 1, characterized in that: The method further comprises: Scaling the first encrypted model slice of each of the candidate vehicles to obtain a fourth encrypted model slice; Sending the fourth encrypted model slices of each candidate vehicle to a server, so that the server obtains a scaled encrypted model of the same candidate vehicle based on the fourth encrypted model slices for the same candidate vehicle sent by different roadside units, and obtains a symbol category of each model parameter of each candidate vehicle based on a decryption key and the scaled encrypted models of each candidate vehicle; receiving the symbol category of each model parameter of each candidate vehicle sent by the server; The step of determining, for any candidate vehicle, a first model difference corresponding to the candidate vehicle includes: Determining a first model parameter associated with the k-th dimensional model parameter of the candidate vehicle from the k-th dimensional model parameters of other candidate vehicles, wherein when the k-th dimensional model parameter of the other candidate vehicles and the k-th dimensional model parameter of the candidate vehicle belong to the same symbol category, the k-th dimensional model parameter of the other candidate vehicle is the first model parameter associated with the k-th dimensional model parameter of the candidate vehicle; Obtaining a k-th dimensional difference of the candidate vehicle based on a value of a k-th dimensional model parameter of the candidate vehicle and a value of a first model parameter associated with the k-th dimensional model parameter of the candidate vehicle; Based on each dimension difference of the candidate vehicle, a first model difference corresponding to the candidate vehicle is obtained.
5. The method according to claim 4, characterized in that Scaling the first encrypted model slice of each candidate vehicle to obtain a fourth encrypted model slice includes: Obtain a first encrypted random parameter sent by the server and a second encrypted random parameter sent by other roadside units; Obtaining a first encrypted scaling factor based on the first encrypted random parameter, the second encrypted random parameter sent by other roadside units, and the second encrypted random parameter generated by the target roadside unit; The first encrypted model slices of each candidate vehicle are scaled by the first encryption scaling factor to obtain the fourth encrypted model slices of each candidate vehicle; and / or, The method further comprises: Obtaining a second encrypted scaling factor based on the third encrypted random parameter sent by the other roadside units and the third encrypted random parameter generated by the target roadside unit; Scaling each dimension difference of the candidate vehicle by the second encrypted scaling coefficient to obtain each dimension difference of the candidate vehicle after scaling; The obtaining, based on each dimensional difference of the candidate vehicle, a first model difference corresponding to the candidate vehicle comprises: Based on the scaled difference of each dimension of the candidate vehicle, obtaining a first model difference corresponding to the candidate vehicle; The aggregating the first encrypted model slices of each candidate vehicle to obtain a first aggregated model slice corresponding to the target roadside unit includes: Scaling the first encrypted model slice of each candidate vehicle by the second encryption scaling factor to obtain a fifth encrypted model slice of each candidate vehicle; The fifth encrypted model slices of each of the candidate vehicles are aggregated to obtain a first aggregated model slice corresponding to the target roadside unit.
6. A model training method, characterized in that: Applied to a server in a vehicle-road cooperative system, the method comprises: Receive the first model difference corresponding to each candidate vehicle and the first aggregated model slice corresponding to the roadside unit sent by the roadside unit, wherein the first model difference corresponding to any candidate vehicle sent by a roadside unit is determined by the roadside unit based on the model difference between the first encrypted model slice of the candidate vehicle for the model to be trained and the first encrypted model slices of other candidate vehicles when it is determined that the candidate vehicle has completed the training of the model to be trained. The first aggregated model slice corresponding to a roadside unit is obtained by aggregating the first encrypted model slices of each candidate vehicle by the roadside unit. The candidate vehicle corresponding to a roadside unit is a vehicle that receives the random parameters sent by the roadside unit; Based on the differences of the first models sent by different roadside units and the first aggregated model slices sent by different roadside units, determining a safe vehicle whose model parameters meet a preset parameter difference condition from the candidate vehicles corresponding to each roadside unit; Sending the identification information of the safety vehicle to each roadside unit, so that each roadside unit aggregates the first encrypted model slices of each safety vehicle based on the identification information to obtain a second aggregated model slice; The second aggregate model slice sent by the roadside unit is received, and based on each of the second aggregate model slices sent by different roadside units, target model parameters of the model to be trained are obtained.
7. The method according to claim 6, characterized in that The method of determining a safe vehicle whose model parameters satisfy a preset parameter difference condition from candidate vehicles respectively corresponding to each roadside unit based on the differences between each first model sent by different roadside units and each first aggregated model slice sent by different roadside units includes: Based on the decrypted first model differences corresponding to the same candidate vehicle, obtaining a second model difference between the same candidate vehicle and other candidate vehicles; Based on the first aggregated model slices sent by different roadside units, an average value of each dimension of the model parameter of the to-be-trained model is obtained; For any candidate vehicle, based on the second model difference of the candidate vehicle and the average value of each dimension of the model parameter of the to-be-trained model, obtain the quantitative difference in each dimension of the model parameter between the candidate vehicle and other candidate vehicles; Based on the quantified difference in each dimension of model parameters between each candidate vehicle and other candidate vehicles, safe vehicles whose model parameters meet preset parameter difference conditions are determined from the candidate vehicles corresponding to each roadside unit.
8. The method according to claim 7, characterized in that The obtaining an average value of each dimension of the model parameter of the to-be-trained model based on each of the first aggregated model slices sent by different roadside units includes: Aggregating the first aggregated model slices sent by different target roadside units to obtain a third aggregated model slice; Decrypting the third aggregate model slice based on the decryption key to obtain a decrypted aggregate model slice; Based on the decrypted aggregate model slice and the number of candidate vehicles, an average value of the model to be trained is obtained, wherein the average value of the model to be trained includes an average value of each dimensional model parameter; and / or, The second model difference includes a sub-difference corresponding to each dimension of the model parameter; for any candidate vehicle, based on the second model difference of the candidate vehicle and the average value of each dimension of the model parameter of the to-be-trained model, obtaining the quantized difference of each dimension of the model parameter between the candidate vehicle and other candidate vehicles, including: For the k-th dimensional model parameter of the candidate vehicle, obtaining a ratio of a sub-difference corresponding to the k-th dimensional model parameter of the candidate vehicle to an average value of the corresponding k-th dimensional model parameter in the to-be-trained model; Based on the ratio and the preset value, determining the quantitative difference between the candidate vehicle and other candidate vehicles in the k-th dimension model parameters; and / or, The step of obtaining, for any candidate vehicle, a quantized difference in each dimension of the model parameters between the candidate vehicle and other candidate vehicles based on the second model difference of the candidate vehicle and the average value of each dimension of the model parameters of the to-be-trained model, comprises: Based on the symbol categories of each model parameter of each candidate vehicle, determining a first sub-quantized difference in each dimension of the model parameter corresponding to any candidate vehicle and other candidate vehicles; For any candidate vehicle, based on the second model difference of the candidate vehicle and the average value of each dimension of the model parameter of the to-be-trained model, obtain a second sub-quantized difference in each dimension of the model parameter of the candidate vehicle and other candidate vehicles; For any candidate vehicle, based on the first sub-quantization difference and the second sub-quantization difference of each dimension of the model parameter corresponding to the candidate vehicle and other candidate vehicles, the quantization difference of each dimension of the model parameter corresponding to the candidate vehicle and other candidate vehicles is obtained; and / or, The method of determining a safe vehicle whose model parameters satisfy a preset parameter difference condition from the candidate vehicles corresponding to each roadside unit based on the quantized difference in each dimension of the model parameters corresponding to each candidate vehicle and other candidate vehicles respectively, comprises: For any dimensional model parameter, the maximum value of the quantized difference between each candidate vehicle and other candidate vehicles corresponding to the dimensional model parameter is determined as the target value of the dimensional model parameter; Clustering is performed based on the target value of each dimension of the model parameter to obtain a plurality of clusters, each cluster including the target value corresponding to one or more model parameter dimensions; For any cluster, determine the average values of the target values respectively corresponding to the model parameter dimensions in the cluster, and determine the cluster with the largest average value from the multiple clusters as the target cluster; For any candidate vehicle, the safe vehicle is determined based on the quantized difference of the candidate vehicle corresponding to the target dimension and the median value of the target value of the model parameter in each dimension, where the target dimension is the model parameter dimension included in the target cluster.
9. The method according to claim 8, characterized in that The step of determining the safe vehicle for any candidate vehicle based on the quantized difference of the candidate vehicle in the target dimension and the median value of the target value of the model parameter in each dimension includes: For any candidate vehicle, determine the target number corresponding to the candidate vehicle, wherein if the quantized difference of the candidate vehicle in one of the target dimensions is greater than the median value, the target number is increased by 1; The safe vehicle is determined from the candidate vehicles based on the target times respectively corresponding to the candidate vehicles.
10. The method according to any one of claims 6 to 9, characterized in that: The method further comprises: Receiving a fourth encrypted model slice of each candidate vehicle sent by a roadside unit, where the fourth encrypted model slice is obtained by scaling the first encrypted model slice of the candidate vehicle by the roadside unit; Based on the fourth encrypted model slices for the same candidate vehicle sent by different roadside units, splicing to obtain a scaled encrypted model of the same candidate vehicle; For any candidate vehicle, based on the decryption key and the scaled encrypted model of the candidate vehicle, obtain the symbol category of each model parameter of the candidate vehicle; The symbol categories of each model parameter of each candidate vehicle are sent to the roadside unit, so that the roadside unit determines the first model difference corresponding to each candidate vehicle based on the symbol categories of each model parameter of the candidate vehicle and the first encrypted model slice of each candidate vehicle.
11. A model training method, characterized in that: Applied to a target vehicle in a vehicle-road cooperative system, the target vehicle is any vehicle in the vehicle-road cooperative system, and the method includes: Get the model to be trained; Training the model to be trained based on local vehicle data to obtain original model parameters; Obtaining random model parameters based on a preset random number generation algorithm and random parameters sent by the received roadside unit; Obtaining a second encrypted model slice based on the encryption key, the original model parameters, and each of the random model parameters; The second encrypted model slice is sent to the roadside unit, the second encrypted model slice is used by the roadside unit to determine the first model difference, the first model difference is used by the server to determine the safe vehicle, the roadside unit is also used to aggregate the first encrypted model slices of each safe vehicle to obtain a second aggregated model slice, and the server is also used to obtain the target model parameters of the model to be trained based on each of the second aggregated model slices sent by different roadside units.
12. A model training device, characterized in that: The device comprises: A first determination module is used to determine a first encrypted model slice of the candidate vehicle for the model to be trained when it is determined that any candidate vehicle has completed training of the model to be trained, wherein the candidate vehicle is a vehicle that receives the random parameters sent by the target roadside unit; A second determination module is used to determine, for any candidate vehicle, a first model difference corresponding to the candidate vehicle, wherein the first model difference corresponding to a candidate vehicle represents a model difference between a first encrypted model slice of the candidate vehicle and first encrypted model slices of other candidate vehicles; A third determination module is used to aggregate the first encrypted model slices of each candidate vehicle to obtain a first aggregated model slice corresponding to the target roadside unit; A first sending module, configured to send the first model differences and the first aggregated model slices respectively corresponding to each candidate vehicle to a server, so that the server determines a safe vehicle whose model parameters meet a preset parameter difference condition from the candidate vehicles respectively corresponding to each roadside unit based on the first model differences and the first aggregated model slices sent by different roadside units; A first aggregation module is used to receive the identification information of the safety vehicle sent by the server, and aggregate the first encrypted model slices of each safety vehicle corresponding to the identification information to obtain a second aggregated model slice; The second sending module is used to send the second aggregate model slice to the server, so that the server obtains the target model parameters of the model to be trained based on the respective second aggregate model slices sent by different roadside units.
13. A model training device, characterized in that: The device comprises: A second receiving module is used to receive the first model differences corresponding to each candidate vehicle and the first aggregated model slice corresponding to the roadside unit sent by the roadside unit, wherein the first model difference corresponding to any candidate vehicle sent by a roadside unit is determined by the roadside unit based on the model difference between the first encrypted model slice of the candidate vehicle for the model to be trained and the first encrypted model slices of other candidate vehicles when it is determined that the candidate vehicle has completed the training of the model to be trained. The first aggregated model slice corresponding to a roadside unit is obtained by aggregating the first encrypted model slices of each candidate vehicle by the roadside unit, and the candidate vehicle corresponding to a roadside unit is a vehicle that receives the random parameters sent by the roadside unit; A fourth determination module, configured to determine, from candidate vehicles corresponding to each roadside unit, a safe vehicle whose model parameters satisfy a preset parameter difference condition based on the differences between the first models sent by different roadside units and the first aggregated model slices sent by different roadside units; a fifth sending module, configured to send the identification information of the safety vehicle to each roadside unit, so that each roadside unit aggregates the first encrypted model slices of each safety vehicle based on the identification information to obtain a second aggregated model slice; The third receiving module is used to receive the second aggregate model slice sent by the roadside unit, and obtain the target model parameters of the model to be trained based on each of the second aggregate model slices sent by different roadside units.
14. A model training device, characterized in that: The device comprises: An acquisition module is used to obtain the model to be trained; A sixth determination module, used for training the model to be trained based on local vehicle data to obtain original model parameters; A seventh determination module, configured to obtain a random model parameter based on a preset random number generation algorithm and a random parameter received from a roadside unit; An eighth determination module, configured to obtain a second encrypted model slice based on the encryption key, the original model parameters and each of the random model parameters; An eighth sending module is used to send the second encrypted model slice to the roadside unit, the second encrypted model slice is used by the roadside unit to determine the first model difference, the first model difference is used by the server to determine the safe vehicle, the roadside unit is also used to aggregate the first encrypted model slices of each safe vehicle to obtain a second aggregated model slice, and the server is also used to obtain the target model parameters of the model to be trained based on each of the second aggregated model slices sent by different roadside units.
15. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.
16. An electronic device, characterized in that: include: a memory having a computer program stored thereon; A processor, configured to execute the computer program in the memory to implement the steps of the method according to any one of claims 1 to 11.