CN116560828A - Task processing method, device, computer equipment, storage medium and program product - Google Patents
Task processing method, device, computer equipment, storage medium and program product Download PDFInfo
- Publication number
- CN116560828A CN116560828A CN202310127379.1A CN202310127379A CN116560828A CN 116560828 A CN116560828 A CN 116560828A CN 202310127379 A CN202310127379 A CN 202310127379A CN 116560828 A CN116560828 A CN 116560828A
- Authority
- CN
- China
- Prior art keywords
- unmanned aerial
- aerial vehicle
- type
- preset
- resource allocation
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000003672 processing method Methods 0.000 title abstract description 18
- 238000013468 resource allocation Methods 0.000 claims abstract description 208
- 238000012545 processing Methods 0.000 claims abstract description 196
- 238000000034 method Methods 0.000 claims abstract description 56
- 238000012549 training Methods 0.000 claims abstract description 54
- 238000004590 computer program Methods 0.000 claims abstract description 26
- 230000008569 process Effects 0.000 claims abstract description 24
- 238000004364 calculation method Methods 0.000 claims description 140
- 238000005265 energy consumption Methods 0.000 claims description 45
- 239000002245 particle Substances 0.000 claims description 36
- 238000004422 calculation algorithm Methods 0.000 claims description 33
- 230000006870 function Effects 0.000 claims description 22
- 230000005540 biological transmission Effects 0.000 claims description 12
- 230000004931 aggregating effect Effects 0.000 claims description 7
- 238000005457 optimization Methods 0.000 description 32
- 230000006854 communication Effects 0.000 description 26
- 238000004891 communication Methods 0.000 description 25
- 238000010586 diagram Methods 0.000 description 7
- 230000002776 aggregation Effects 0.000 description 5
- 238000004220 aggregation Methods 0.000 description 5
- 238000010801 machine learning Methods 0.000 description 3
- 238000011144 upstream manufacturing Methods 0.000 description 3
- 230000009471 action Effects 0.000 description 2
- 230000015572 biosynthetic process Effects 0.000 description 2
- 230000008859 change Effects 0.000 description 2
- 238000013500 data storage Methods 0.000 description 2
- 238000005562 fading Methods 0.000 description 2
- 230000003068 static effect Effects 0.000 description 2
- NAWXUBYGYWOOIX-SFHVURJKSA-N (2s)-2-[[4-[2-(2,4-diaminoquinazolin-6-yl)ethyl]benzoyl]amino]-4-methylidenepentanedioic acid Chemical compound C1=CC2=NC(N)=NC(N)=C2C=C1CCC1=CC=C(C(=O)N[C@@H](CC(=C)C(O)=O)C(O)=O)C=C1 NAWXUBYGYWOOIX-SFHVURJKSA-N 0.000 description 1
- OKTJSMMVPCPJKN-UHFFFAOYSA-N Carbon Chemical compound [C] OKTJSMMVPCPJKN-UHFFFAOYSA-N 0.000 description 1
- 240000007594 Oryza sativa Species 0.000 description 1
- 235000007164 Oryza sativa Nutrition 0.000 description 1
- 230000001154 acute effect Effects 0.000 description 1
- 230000006978 adaptation Effects 0.000 description 1
- 230000003044 adaptive effect Effects 0.000 description 1
- 238000004458 analytical method Methods 0.000 description 1
- 230000033228 biological regulation Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000004927 fusion Effects 0.000 description 1
- 230000014509 gene expression Effects 0.000 description 1
- 229910021389 graphene Inorganic materials 0.000 description 1
- 238000002372 labelling Methods 0.000 description 1
- 230000007786 learning performance Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000006116 polymerization reaction Methods 0.000 description 1
- 235000009566 rice Nutrition 0.000 description 1
- 230000011218 segmentation Effects 0.000 description 1
- 230000003595 spectral effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N20/00—Machine learning
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- Mathematical Physics (AREA)
- Computing Systems (AREA)
- Artificial Intelligence (AREA)
- Evolutionary Computation (AREA)
- Biophysics (AREA)
- Computational Linguistics (AREA)
- Biomedical Technology (AREA)
- General Health & Medical Sciences (AREA)
- Molecular Biology (AREA)
- Life Sciences & Earth Sciences (AREA)
- Health & Medical Sciences (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Medical Informatics (AREA)
- Traffic Control Systems (AREA)
Abstract
The application relates to a task processing method, a task processing device computer devices, storage media, and computer program products. The method comprises the following steps: acquiring a task to be processed of an unmanned aerial vehicle group; inputting a task to be processed into a preset federal learning model to process the task, and generating a task processing result; the preset federal learning model is obtained by training the initial federal learning model based on a preset resource allocation strategy; the preset resource allocation strategy is a resource allocation strategy corresponding to the minimum processing time delay of the unmanned aerial vehicle group when the initial federal learning model is adopted to process tasks; and outputting a task processing result of the unmanned aerial vehicle group. When the preset federal learning model is used for task processing, the processing time of the unmanned aerial vehicle group is shorter, so that the acquired task to be processed is input into the preset federal learning model for task processing, and a task processing result can be generated faster. Therefore, the method can improve the efficiency of executing the task to be processed by adopting the federal learning model.
Description
Technical Field
The present application relates to the field of federal learning technology, and in particular, to a task processing method, apparatus, computer device, storage medium, and computer program product.
Background
Unmanned aerial vehicle has advantages such as deployment is quick, the action is controllable, the network is nimble, wide application in each field, for example, unmanned aerial vehicle can be applied to in the field of task processing. And with the wide application of various machine learning networks in various fields, the accuracy of task processing can be improved by adopting a federal learning model when tasks to be processed are executed based on unmanned aerial vehicles.
In the process of executing the task to be processed based on the unmanned aerial vehicle, along with the continuous expansion of the size of the unmanned aerial vehicle group and the size of the task to be processed, communication data is also continuously increased. However, when using the federal learning model, communication data needs to be transmitted between each learning node and the server.
As the communication data increases, the transmission efficiency and the calculation efficiency of the communication data decrease continuously, that is, the processing delay of the communication data increases continuously. Then, in the process of executing the task to be processed by adopting the traditional federal learning model, as the processing time delay of the communication data is continuously increased, the performance of the federal learning model is also reduced. Finally, the efficiency of executing the task to be processed by adopting the federal learning model is reduced.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a task processing method, apparatus, computer device, computer readable storage medium, and computer program product that are capable of employing a federal learning model to perform efficiency of a task to be processed.
In a first aspect, the present application provides a task processing method. The method comprises the following steps:
acquiring a task to be processed of an unmanned aerial vehicle group;
inputting the task to be processed into a preset federal learning model for task processing, and generating a task processing result; the preset federal learning model is obtained by training an initial federal learning model based on a preset resource allocation strategy; the preset resource allocation strategy is a resource allocation strategy corresponding to the minimum processing time delay of the unmanned aerial vehicle group when the initial federal learning model is adopted for task processing;
and outputting a task processing result of the unmanned aerial vehicle group.
In one embodiment, the unmanned aerial vehicle group includes a first type unmanned aerial vehicle and a second type unmanned aerial vehicle; the generating process of the preset federal learning model comprises the following steps:
determining a first type of target unmanned aerial vehicle from the first type of unmanned aerial vehicles according to initial model parameters of the initial federal learning model;
Determining a calculation mode of a preset resource allocation strategy according to the size relation between the number of each unmanned aerial vehicle in the first type of target unmanned aerial vehicle and the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle;
according to the calculation mode of the preset resource allocation strategy, calculating the CPU frequency and signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group;
performing resource allocation on each unmanned aerial vehicle according to the CPU frequency and the signal power of each unmanned aerial vehicle, and training the initial federal learning model based on each unmanned aerial vehicle after resource allocation to generate the preset federal learning model.
In one embodiment, the determining, according to the initial model parameters of the initial federal learning model, a first type of target unmanned aerial vehicle from the first type of unmanned aerial vehicles includes:
acquiring initial model parameters of the initial federal learning model;
aiming at each unmanned aerial vehicle in the first type of unmanned aerial vehicle, calculating the local gradient of the unmanned aerial vehicle according to the loss function of the initial federal learning model;
judging whether each unmanned aerial vehicle in the first type unmanned aerial vehicle meets the conditions corresponding to the first type target unmanned aerial vehicle according to the number of the first type unmanned aerial vehicles, the initial model parameters, the local gradient of the unmanned aerial vehicle and the preset proportion; the preset proportion is the duty ratio of a preset first type target unmanned aerial vehicle in the first type unmanned aerial vehicle;
And if the unmanned aerial vehicle meets the conditions corresponding to the first type target unmanned aerial vehicle, taking the unmanned aerial vehicle as the first type target unmanned aerial vehicle.
In one embodiment, the preset resource allocation policy includes a first preset resource allocation policy and a second preset resource allocation policy; the determining a calculation mode of a preset resource allocation strategy according to the size relation between the number of unmanned aerial vehicles in the first type of target unmanned aerial vehicles and the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicles comprises:
acquiring the number of each unmanned aerial vehicle in the first type of target unmanned aerial vehicle;
if the number of unmanned aerial vehicles in the first type of target unmanned aerial vehicle is smaller than the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle, determining a calculation mode corresponding to the first preset resource allocation strategy as a calculation mode of the preset resource allocation strategy;
and if the number of the unmanned aerial vehicles in the first type of target unmanned aerial vehicle is equal to the total number of the unmanned aerial vehicles in the first type of unmanned aerial vehicle, determining a calculation mode corresponding to the second preset resource allocation strategy as the calculation mode of the preset resource allocation strategy.
In one embodiment, the calculating, according to the calculating manner of the preset resource allocation policy, the CPU frequency and the signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group includes:
Calculating the processing energy consumption of each unmanned aerial vehicle in the unmanned aerial vehicle group according to the initial CPU frequency and the initial signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group; the processing energy consumption comprises transmission energy consumption of each unmanned aerial vehicle and calculation energy consumption of each unmanned aerial vehicle;
acquiring a first constraint condition of the processing energy consumption, a second constraint condition of the CPU frequency and a third constraint condition of the signal power;
according to the first constraint condition, the second constraint condition, the third constraint condition and the calculation mode of the preset resource allocation strategy, calculating the minimum processing time delay of the unmanned aerial vehicle group by adopting a particle swarm algorithm;
and determining the CPU frequency and the signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group according to the minimum processing time delay.
In one embodiment, if the computing manner of the preset resource allocation policy includes a first computing manner and a second computing manner, the minimum processing delay includes a first minimum processing delay and a second minimum processing delay; the calculating the minimum processing delay by adopting a particle swarm algorithm according to the first constraint condition, the second constraint condition, the third constraint condition and the calculation mode of the preset resource allocation strategy comprises the following steps:
If the number of unmanned aerial vehicles in the first type of target unmanned aerial vehicle is smaller than the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle, calculating a first minimum processing time delay of the unmanned aerial vehicle group by adopting a particle swarm algorithm according to the first constraint condition, the second constraint condition, the third constraint condition and a first calculation mode corresponding to the first preset resource allocation strategy;
if the number of unmanned aerial vehicles in the first type of target unmanned aerial vehicle is equal to the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle, calculating a second minimum processing time delay of the unmanned aerial vehicle group by adopting a particle swarm algorithm according to the first constraint condition, the second constraint condition, the third constraint condition and a second calculation mode corresponding to the second preset resource allocation strategy.
In one embodiment, the performing resource allocation on each unmanned aerial vehicle according to the CPU frequency and the signal power of each unmanned aerial vehicle, and training the initial federal learning model based on each unmanned aerial vehicle after the resource allocation, to generate the preset federal learning model includes:
performing primary resource allocation on the unmanned aerial vehicles according to the CPU frequency and the signal power of each unmanned aerial vehicle, and generating intermediate model parameters of the initial federal learning model based on each unmanned aerial vehicle after the primary resource allocation;
If the intermediate model parameters do not meet the preset model parameter conditions and the iteration times do not meet the preset iteration times, carrying out iterative computation by taking the intermediate model parameters as new initial model parameters, and generating new CPU frequency and new signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group; performing next resource allocation on the unmanned aerial vehicles according to new CPU frequency and new signal power of each unmanned aerial vehicle, and generating new intermediate model parameters of the initial federal learning model based on each unmanned aerial vehicle after the next resource allocation until the new intermediate model parameters meet the preset model parameter conditions or the iteration times meet the preset iteration times; taking the new intermediate model parameters as target model parameters of the initial federal learning model; the preset model parameter condition is that the intermediate model parameter tends to converge;
and generating the preset federal learning model according to the target model parameters.
In one embodiment, the first class of unmanned aerial vehicle further includes a first class of preset unmanned aerial vehicle; generating intermediate model parameters of the initial federal learning model by each unmanned aerial vehicle based on the first resource allocation, including:
Based on each unmanned aerial vehicle after the first resource allocation, calculating the local gradient of each unmanned aerial vehicle in the first class of unmanned aerial vehicles;
determining a first type of preset unmanned aerial vehicle from the first type of unmanned aerial vehicles according to the size relation between the number of unmanned aerial vehicles in the first type of target unmanned aerial vehicles and the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicles;
uploading the local gradient of each unmanned aerial vehicle in the first type of preset unmanned aerial vehicle to the second type of unmanned aerial vehicle according to the preset resource allocation strategy, and aggregating the local gradient of each unmanned aerial vehicle in the first type of preset unmanned aerial vehicle to generate a global gradient of the second type of unmanned aerial vehicle;
and updating the initial model parameters of the initial federal learning model by adopting a gradient descent algorithm according to the global gradient of the second class unmanned aerial vehicle, generating the intermediate model parameters, and broadcasting the intermediate model parameters to each unmanned aerial vehicle in the first class unmanned aerial vehicle.
In one embodiment, the determining, according to the size relationship between the number of each unmanned aerial vehicle in the first type of target unmanned aerial vehicle and the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle, the first type of preset unmanned aerial vehicle from the first type of unmanned aerial vehicles includes:
If the number of unmanned aerial vehicles in the first type of target unmanned aerial vehicle is smaller than the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle, taking all unmanned aerial vehicles in the first type of unmanned aerial vehicle except the first type of target unmanned aerial vehicle as the first type of preset unmanned aerial vehicle;
and if the number of each unmanned aerial vehicle in the first type of target unmanned aerial vehicle is equal to the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle, taking any unmanned aerial vehicle in the first type of unmanned aerial vehicle as the first type of preset unmanned aerial vehicle.
In a second aspect, the present application further provides a task processing device. The device comprises:
the task to be processed acquisition module is used for acquiring tasks to be processed of the unmanned aerial vehicle group;
the task processing result generation module is used for inputting the task to be processed into a preset federal learning model to process the task and generating a task processing result; the preset federal learning model is obtained by training an initial federal learning model based on a preset resource allocation strategy; the preset resource allocation strategy is a resource allocation strategy corresponding to the minimum processing time delay of the unmanned aerial vehicle group when the initial federal learning model is adopted for task processing;
and the task processing result output module is used for outputting the task processing result of the unmanned aerial vehicle group.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor implementing the steps of the method in any of the embodiments of the first aspect described above when the processor executes the computer program.
In a fourth aspect, the present application also provides a computer-readable storage medium. The computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the method in any of the embodiments of the first aspect described above.
In a fifth aspect, the present application also provides a computer program product. The computer program product comprising a computer program which, when executed by a processor, implements the steps of the method in any of the embodiments of the first aspect described above.
The task processing method, the device, the computer equipment, the storage medium and the computer program product acquire the task to be processed of the unmanned aerial vehicle group; inputting a task to be processed into a preset federal learning model to process the task, and generating a task processing result; the preset federal learning model is obtained by training the initial federal learning model based on a preset resource allocation strategy; the preset resource allocation strategy is a resource allocation strategy corresponding to the minimum processing time delay of the unmanned aerial vehicle group when the initial federal learning model is adopted to process tasks; and outputting a task processing result of the unmanned aerial vehicle group. The preset federal learning model is obtained by training the initial federal learning model based on the preset resource allocation strategy, and the preset resource allocation strategy is the resource allocation strategy corresponding to the minimum processing time delay of the unmanned aerial vehicle group when the initial federal learning model is adopted for task processing, so that the processing time of the unmanned aerial vehicle group is shorter when the preset federal learning model is used for task processing. Therefore, the acquired task to be processed is input into the preset federal learning model to process the task, and a task processing result can be generated faster. Therefore, the method and the device can improve the efficiency of executing the task to be processed by adopting the federal learning model.
Drawings
FIG. 1 is an application environment diagram of a task processing method in one embodiment;
FIG. 2 is a flow diagram of a task processing method in one embodiment;
FIG. 3 is a schematic diagram of a structure of a unmanned aerial vehicle group according to an embodiment;
FIG. 4 is a flowchart illustrating a preset federal learning model generation step according to another embodiment;
FIG. 5 is a flow chart of a first class of target drone determination steps in one embodiment;
FIG. 6 is a flowchart illustrating a calculation method determining step of a preset resource allocation policy in one embodiment;
FIG. 7 is a flowchart of a CPU frequency and signal power calculation step in one embodiment;
FIG. 8 is a flow chart of the target model parameter acquisition step of the initial federal learning model in one embodiment;
FIG. 9 is a flow chart of an intermediate model parameter generation step in one embodiment;
FIG. 10 is a flow chart of a task processing method in an alternative embodiment;
FIG. 11 is a schematic flow diagram of model training in one embodiment;
FIG. 12 is a block diagram of a task processing device in one embodiment;
fig. 13 is an internal structural view of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
Unmanned aerial vehicle has advantages such as deployment is quick, the action is controllable, the network is nimble, wide application in each field, for example, unmanned aerial vehicle can be applied to in the field of task processing. And with the wide application of various machine learning networks in various fields, the accuracy of task processing can be improved by adopting a federal learning model when tasks to be processed are executed based on unmanned aerial vehicles.
In the process of executing the task to be processed based on the unmanned aerial vehicle, along with the continuous expansion of the size of the unmanned aerial vehicle group and the size of the task to be processed, communication data is also continuously increased. However, when using the federal learning model, communication data needs to be transmitted between each learning node and the server.
As the communication data increases, the transmission efficiency and the calculation efficiency of the communication data decrease continuously, that is, the processing delay of the communication data increases continuously. Then, in the process of executing the task to be processed by adopting the traditional federal learning model, as the processing time delay of the communication data is continuously increased, the performance of the federal learning model is also reduced. Finally, the efficiency of executing the task to be processed by adopting the federal learning model is reduced.
The task processing method provided by the embodiment of the application can be applied to an application environment shown in fig. 1. Wherein the terminal 102 communicates with the server 104 via a network. The data storage system may store data that the server 104 needs to process. The data storage system may be integrated on the server 104 or may be located on a cloud or other network server. The server 104 acquires a task to be processed of the unmanned aerial vehicle group from the terminal 102; the server 104 inputs the task to be processed into a preset federal learning model to process the task, and a task processing result is generated; the preset federal learning model is obtained by training the initial federal learning model based on a preset resource allocation strategy; the preset resource allocation strategy is a resource allocation strategy corresponding to the minimum processing time delay of the unmanned aerial vehicle group when the initial federal learning model is adopted to process tasks; the server 104 outputs the task processing result of the unmanned aerial vehicle group. The terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, internet of things devices, and portable wearable devices, where the internet of things devices may be smart speakers, smart televisions, smart air conditioners, smart vehicle devices, and the like. The portable wearable device may be a smart watch, smart bracelet, headset, or the like. The server 104 may be implemented as a stand-alone server or as a server cluster of multiple servers.
In one embodiment, as shown in fig. 2, a task processing method is provided, and the method is applied to the server 104 in fig. 1 for illustration, and includes the following steps:
step 220, obtaining a task to be processed of the unmanned aerial vehicle group.
Fig. 3 is a schematic structural diagram of a unmanned aerial vehicle group in an embodiment, as shown in fig. 3. In the federal learning model based on the unmanned aerial vehicle group, one pilot unmanned aerial vehicle UAV L and M follower unmanned aerial vehicles UAVs can be usedForming a unmanned aerial vehicle group. Of course, the number of follower unmanned aerial vehicles is not limited in the embodiment of the application. In the unmanned aerial vehicle group, the flying heights of the unmanned aerial vehicles are fixed, and the flying directions are the same. The unmanned aerial vehicle group can keep a preset formation in the air and fly at a constant speed in the same direction at a certain flying height. The pilot drone may work in concert with the follower drone, using the federal learning model to perform the task to be processed. The task to be processed refers to a task which can be processed through the federal learning model, and the task to be processed comprises a target recognition task, a data classification task and the like. An object recognition task refers to a task that implements a distinction of a particular object (or type of object) from other objects (or other types of objects). Alternatively, the server 104 may determine the task to be processed of the unmanned aerial vehicle group from a plurality of preset tasks on the terminal 102, so that the server 104 may obtain the task to be processed of the unmanned aerial vehicle group.
Step 240, inputting the task to be processed into a preset federal learning model for task processing, and generating a task processing result; the preset federal learning model is obtained by training the initial federal learning model based on a preset resource allocation strategy; the preset resource allocation strategy is a resource allocation strategy corresponding to the minimum processing time delay of the unmanned aerial vehicle group when the initial federal learning model is adopted for task processing.
The federal learning model is a distributed machine learning model, and the core idea is to implement distributed model training among a plurality of data sources or learning nodes with local data, and construct a global model based on virtual fusion data only by exchanging model parameters or intermediate results on the premise of not exchanging the local data or sample data, thereby realizing balance of data privacy protection and data sharing calculation. Federal science ofThe general architecture of the learning model includes a parameter server and a plurality of learning nodes, in this embodiment, the parameter server corresponds to the pilot unmanned aerial vehicle UAV L in the federal learning model based on the unmanned aerial vehicle group, and the plurality of learning nodes corresponds to the M follower unmanned aerial vehicles UAV in the federal learning model based on the unmanned aerial vehicle group
Optionally, the server 104 may input the task to be processed into a preset federal learning model to perform task processing, and generate a task processing result. The preset federal learning model is obtained by training the initial federal learning model based on a preset resource allocation strategy. The preset resource allocation strategy is a resource allocation strategy corresponding to the minimum processing time delay of the unmanned aerial vehicle group when the initial federal learning model is adopted for task processing. Therefore, the preset federal learning model with the minimum unmanned aerial vehicle group processing time during task processing can be obtained by training the initial federal learning model by using the preset resource configuration strategy.
And step 260, outputting a task processing result of the unmanned aerial vehicle group.
Alternatively, the server 104 may output the task processing results of the unmanned aerial vehicle group to the terminal 102, so that the user may view the task processing results of the unmanned aerial vehicle group from the terminal 102. The task processing result of the unmanned aerial vehicle group comprises all targets, preset targets or special targets and labeling information of the preset targets or the special targets.
In the task processing method, a task to be processed of the unmanned aerial vehicle group is obtained; inputting a task to be processed into a preset federal learning model to process the task, and generating a task processing result; the preset federal learning model is obtained by training the initial federal learning model based on a preset resource allocation strategy; the preset resource allocation strategy is a resource allocation strategy corresponding to the minimum processing time delay of the unmanned aerial vehicle group when the initial federal learning model is adopted to process tasks; and outputting a task processing result of the unmanned aerial vehicle group. The preset federal learning model is obtained by training the initial federal learning model based on the preset resource allocation strategy, and the preset resource allocation strategy is the resource allocation strategy corresponding to the minimum processing time delay of the unmanned aerial vehicle group when the initial federal learning model is adopted for task processing, so that the processing time of the unmanned aerial vehicle group is shorter when the preset federal learning model is used for task processing. Therefore, the acquired task to be processed is input into the preset federal learning model to process the task, and a task processing result can be generated faster. Therefore, the method and the device can improve the efficiency of executing the task to be processed by adopting the federal learning model.
In one embodiment, as shown in fig. 4, the unmanned aerial vehicle group includes a first type unmanned aerial vehicle and a second type unmanned aerial vehicle; the generation process of the preset federal learning model comprises the following steps:
step 420, determining a first type of target unmanned aerial vehicle from the first type of unmanned aerial vehicles according to initial model parameters of the initial federal learning model.
Optionally, the unmanned aerial vehicle group includes a first type unmanned aerial vehicle and a second type unmanned aerial vehicle. In the embodiment of the application, M follower unmanned aerial vehicles UAVsThe first class of unmanned aerial vehicles is referred to as a pilot unmanned aerial vehicle UAV L and the second class of unmanned aerial vehicles is referred to as a pilot unmanned aerial vehicle. Wherein, including M unmanned aerial vehicle in the unmanned aerial vehicle of first class, M unmanned aerial vehicle includes a plurality of target unmanned aerial vehicle of first class. The first class of target unmanned aerial vehicle represents a first class of unmanned aerial vehicle that contributes less to global model updating within a certain training round. In the embodiment of the application, the first type of target unmanned aerial vehicle may also be called a lazy node. Thus, based on the initial model parameters of the initial federal learning model, the server 104 may determine a first type of target drone from the first type of drone.
Step 440, determining a calculation mode of a preset resource allocation strategy according to the size relation between the number of each unmanned aerial vehicle in the first type of target unmanned aerial vehicle and the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle.
Optionally, the server 104 may obtain the number of each unmanned aerial vehicle in the first type of target unmanned aerial vehicle according to the determined first type of target unmanned aerial vehicle. And the server 104 may determine that the total number of drones in the first class of drones is M. Then, according to the size relationship between the number of each unmanned aerial vehicle in the first type of target unmanned aerial vehicle and the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle, the server 104 can determine whether each unmanned aerial vehicle in the first type of unmanned aerial vehicle is the first type of target unmanned aerial vehicle, thereby determining the calculation mode of the preset resource allocation strategy. The computing mode of the preset resource allocation strategy is a computing mode of the resource allocation strategy corresponding to the minimum processing time delay of the unmanned aerial vehicle group when the initial federal learning model is adopted for task processing.
Step 460, calculating the CPU frequency and the signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group according to the calculation mode of the preset resource allocation strategy.
Optionally, since the calculation mode of the preset resource allocation policy includes at least one calculation mode, the server 104 may calculate the CPU frequency and the signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group corresponding to the calculation mode of the preset resource allocation policy according to the calculation mode of the preset resource allocation policy. The CPU frequency and the signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group are corresponding to the minimum processing time delay of the unmanned aerial vehicle group when the initial federal learning model is adopted for task processing.
And 480, carrying out resource allocation on each unmanned aerial vehicle according to the CPU frequency and the signal power of each unmanned aerial vehicle, and training the initial federal learning model based on each unmanned aerial vehicle after the resource allocation to generate a preset federal learning model.
Optionally, according to the CPU frequency and the signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group corresponding to the minimum processing time delay of the unmanned aerial vehicle group, the server 104 may configure the corresponding CPU frequency and signal power for each unmanned aerial vehicle. Then, the server 104 may train the model parameters of the initial federal learning model based on the initial model parameters of each unmanned aerial vehicle and the initial federal learning model after the resource configuration, and generate the target model parameters of the initial federal learning model, thereby generating the preset federal learning model.
In this embodiment, first, according to initial model parameters of an initial federal learning model, a first type of target unmanned aerial vehicle can be determined from first type of unmanned aerial vehicles. And secondly, determining a calculation mode of a preset resource allocation strategy according to the size relation between the number of each unmanned aerial vehicle in the first type of target unmanned aerial vehicle and the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle, and calculating the CPU frequency and the signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group according to the calculation mode of the preset resource allocation strategy. And then, carrying out resource allocation on each unmanned aerial vehicle according to the CPU frequency and the signal power of each unmanned aerial vehicle, so that different resource allocation can be carried out on each unmanned aerial vehicle according to the number of the first type of target unmanned aerial vehicles contained in the first type of unmanned aerial vehicles. Furthermore, based on the training of the initial federal learning model by each unmanned aerial vehicle after different resource configurations, a corresponding preset federal learning model can be generated.
In one embodiment, as shown in fig. 5, determining a first type of target drone from the first type of drone based on initial model parameters of an initial federal learning model, includes:
step 520, initial model parameters of an initial federal learning model are obtained.
Alternatively, in the embodiment of the present application, w may be used to represent the global model parameters of the unmanned aerial vehicle UAV L of the second class, where w is used m Representation of unmanned aerial vehicle UAV of the first typeIs used for the local model parameters of the mobile terminal. The server 104 may obtain initial model parameters of the initial federal learning model from the initial federal learning model.
Step 540, for each unmanned aerial vehicle in the first class of unmanned aerial vehicles, calculating a local gradient of the unmanned aerial vehicle according to a loss function of the initial federal learning model.
Optionally, first, for each unmanned aerial vehicle UAV of the first classThe server 104 may pass local model parameters w corresponding to each local model m De-processing input data x m,i (i∈{1,…,N m -j) to obtain the desired output data y m,i (i∈{1,2,…,N m }) at which point data set D m The calculation formula of the local loss function is shown in the following formula (1):
wherein D is m Representation of unmanned aerial vehicle UAV of the first typeIs used to determine the local data set of the (c),N m representing a local dataset D m The amount of data contained in the data; x is x m,i Representing input data, y m,i Representing output data; f (w) m ;x m,i ,y m,i ) Representing input data x m,i And output data y m,i A corresponding loss function for characterizing the loss result after prediction of each sample; f (F) m (w m ) Representing a local dataset D m Upper local model parameters w m A corresponding local loss function.
Second, the server 104 may provide a second type of UAV to the first type of UAVAnd (3) carrying out weighted average on the local loss function to obtain a global loss function. The calculation formula of the global loss function is shown in the following formula (2):
wherein F (w) represents a global loss function corresponding to the global model parameter w; d represents a sample total dataset of a first class of drones,F m (w m ) Representing a local dataset D m Upper local model parameters w m A corresponding local loss function. The loss function of the initial federal learning model comprises a global corresponding to the global model parameter wLoss function and local data set D m Upper local model parameters w m A corresponding local loss function.
The goal of federal learning is to find the target model parameters that minimize the global loss function, where the target model parameters can be expressed as w * =argminf (w). Wherein w is * Representing the target model parameters, argminF (w) represents the variable value at which F (w) takes the minimum value.
Then, for each of the first class of drones, the server 104 may calculate a local gradient for the drone based on the loss function of the initial federal learning model. The calculation formula of the local gradient of the unmanned plane is shown in the following formula (3):
Wherein g m,t Representing the local gradient of the drone,representing a local data set D for the t-th round m The local loss function is used for gradient calculation.
Step 560, judging whether each unmanned aerial vehicle in the first type unmanned aerial vehicle meets the condition corresponding to the first type target unmanned aerial vehicle according to the number of the first type unmanned aerial vehicles, the initial model parameters, the local gradient of the unmanned aerial vehicle and the preset proportion; the preset proportion is the duty ratio of the preset first type of target unmanned aerial vehicle in the first type of unmanned aerial vehicle.
In step 580, if the unmanned aerial vehicle meets the condition corresponding to the first type target unmanned aerial vehicle, the unmanned aerial vehicle is used as the first type target unmanned aerial vehicle.
Optionally, in order to reduce a communication link during data transmission, the first class target unmanned aerial vehicle is set in the first class unmanned aerial vehicle, and the first class target unmanned aerial vehicle can also be called a lazy node, and the first class target unmanned aerial vehicle represents the first class unmanned aerial vehicle with smaller contribution to global model updating in a certain training round. Each first type of target unmanned aerial vehicle is marked as M neg The first type of target unmanned aerial vehicle is recorded asEach first class target unmanned aerial vehicle M neg The set of componentsThus, a first class of target drones M neg Is defined as shown in the following formula (4):
Wherein M is neg A first type of target drone is represented,gradient representing target drone of first class in turn t-1,/for example>Representing the global gradient at turn t-1, M representing the first class of drones.
Deforming the formula (4) to obtain the following formula (5):
wherein,,representing the second norm of the gradient of the target unmanned aerial vehicle of the first type of the t-1 turn, M neg Represents a first type of target unmanned aerial vehicle, delta represents a learning rate, M represents a first type of unmanned aerial vehicle, and w t Initial global model parameters representing the t-th round, w t-1 Representing the initial global model parameters for the t-1 th round.
Due to the global model parameters w of the global model in a sufficient number of training rounds t Tends to converge, so w in equation (5) can be taken as t -w t-1 Approximately w t-1 -w t-2 . And according to the mean inequality, the formula (5) is deformed to obtain the following formula (6):
let M neg =βm, and the formula (6) is modified to obtain the following formula (7):
wherein,,representing a local gradient of a first class of unmanned aerial vehicle; beta represents a preset proportion, wherein the preset proportion is the duty ratio of a preset first type of target unmanned aerial vehicle in the first type of unmanned aerial vehicle; n (N) m The number of unmanned aerial vehicles of the first type is represented, and N represents the number of unmanned aerial vehicles. The remaining parameters are described in the above embodiments, and are not described herein.
Therefore, the server 104 may determine whether each unmanned aerial vehicle in the first class of unmanned aerial vehicles meets the condition corresponding to the first class of target unmanned aerial vehicles according to the number of unmanned aerial vehicles in the first class, the initial model parameters, the local gradient of the unmanned aerial vehicles and the preset proportion, that is, the server 104 may determine whether the inequality (7) is satisfied. If the unmanned aerial vehicle meets the condition corresponding to the first type target unmanned aerial vehicle, namely, the inequality (7) is satisfied, the unmanned aerial vehicle is used as the first type target unmanned aerial vehicle.
In the embodiment, first, initial model parameters of an initial federal learning model are obtained, and for each unmanned aerial vehicle in a first class of unmanned aerial vehicles, a local gradient of the unmanned aerial vehicle is calculated according to a loss function of the initial federal learning model; and then, judging whether each unmanned aerial vehicle in the first type unmanned aerial vehicle meets the conditions corresponding to the first type target unmanned aerial vehicle according to the number of the first type unmanned aerial vehicles, the initial model parameters, the local gradient of the unmanned aerial vehicle and the preset proportion. If the unmanned aerial vehicle meets the conditions corresponding to the first type of target unmanned aerial vehicle, the unmanned aerial vehicle is used as the first type of target unmanned aerial vehicle, and the first type of unmanned aerial vehicle with smaller contribution to global model updating in a certain training round can be determined.
In one embodiment, as shown in fig. 6, the preset resource allocation policies include a first preset resource allocation policy and a second preset resource allocation policy; according to the size relation between the number of each unmanned aerial vehicle in the first type of target unmanned aerial vehicle and the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle, determining a calculation mode of a preset resource allocation strategy, wherein the calculation mode comprises the following steps:
step 620, obtaining the number of each unmanned aerial vehicle in the first class of target unmanned aerial vehicles.
Optionally, the server 104 may obtain the number of each unmanned aerial vehicle in the first type of target unmanned aerial vehicle from the determined first type of target unmanned aerial vehicle, that is, the server 104 may obtain the number of the first type of target unmanned aerial vehicles included in the first type of unmanned aerial vehicle. The server 104 may then determine a size relationship between the number of each drone in the first class of target drones and the total number of drones in the first class of drones.
In step 640, if the number of unmanned aerial vehicles in the first class of target unmanned aerial vehicles is smaller than the total number of unmanned aerial vehicles in the first class of unmanned aerial vehicles, determining the calculation mode corresponding to the first preset resource allocation strategy as the calculation mode of the preset resource allocation strategy.
Optionally, if the number of each unmanned aerial vehicle in the first type of target unmanned aerial vehicle is smaller than the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle, the first type of unmanned aerial vehicle is indicated to include not only the first type of target unmanned aerial vehicle, but also the first type of unmanned aerial vehicle with relatively large contribution to global model updating in a certain training round. At this time, the server 104 may select a first preset resource configuration policy from the preset resource configuration policies, and determine a calculation mode corresponding to the first preset resource configuration policy. Then, the server 104 may determine the calculation mode corresponding to the first preset resource configuration policy as the calculation mode of the preset resource configuration policy.
The step of determining the computing mode corresponding to the first preset resource allocation strategy is as follows: first, in order to reduce the signal interference that unmanned aerial vehicle crowd receives to improve unmanned aerial vehicle crowd's stability in the communication process, the communication between unmanned aerial vehicle adopts directional antenna to realize in this application embodiment. The server 104 may determine that the unmanned aerial vehicle UAV of the first type is in the practical condition due to wind direction interference and other mechanical interference, which may cause deviation of the flight angle of the unmanned aerial vehicleAnd an actual included angle is formed between the unmanned aerial vehicle UAV L and the second class UAV L when a communication link is established. The calculation formula of the actual included angle setting when the communication link is established is shown as the following formula (8):
wherein θ m,L Represented in a first class of unmanned aerial vehicle UAVsThe actual included angle is formed when a communication link is established between the unmanned aerial vehicle UAV L of the second type and the unmanned aerial vehicle UAV L of the second type; v m Representing the flight direction, v, of each unmanned aerial vehicle in a first class of unmanned aerial vehicles UAvm L Representing the flight direction of the unmanned aerial vehicle UAV L of the second class, < >>Representing an acute angle formed between a connection line (or extension line) of UAvm and UAV L and a flight direction (or extension line) of the unmanned aerial vehicle, i.e. an initial angle between UAvm and UAV L, and> representing deviation, deviation->Obeying Gaussian distribution->
Second, the antenna aperture is determined from the square of the cosine function. In antenna theory, aperture (or effective area) is a parameter that characterizes the efficiency of an antenna to receive radio wave power. The calculation formula of the antenna aperture is shown in the following formula (9):
Wherein G is m,L (θ m,L ) And the antenna aperture corresponding to the actual included angle is represented.
To simplify the calculation, the above formula (9) is subjected to a segmentation process to obtain the following formula (10):
wherein G is min Antenna gain, C e {1, …, C } representing the side lobes, C is a constant associated with the segment.
Thirdly, according to the shannon formula and the antenna caliber, calculating the uplink data rate and the downlink data rate. The calculation formulas of the uplink data rate and the downlink data rate are respectively shown in the following formulas (11) and (12):
wherein,,representing upstream data rate,/->Representing the downstream data rate; p is p m Representing the signal power of UAvm, p m ∈(0,p max );p L Signal power, p, representing UAV L L ∈(0,p max );Represents upstream bandwidth of UAVm, +.>Representing the downstream bandwidth of UAV L; h is a m,L Rey fading channel gain, h, representing UAvm to UAV L L,m The rice fading channel gains representing UAV L to UAVm; alpha represents the path lossConsumption index, gamma 0 Represents the noise power spectral density, and d represents the distance between UAVm and UAV L.
Fourth, according to the number of the first unmanned aerial vehicles and the initial CPU frequency of UAvm, the local gradient calculation time is calculated. The calculation formula of the local gradient calculation time of UAvm in a certain round is shown as the following formula (13):
wherein,,representing the local gradient calculation time, N, of UAvm in a certain round m Representing the number of unmanned aerial vehicles of the first type c m Representing the number of revolutions, f, of the CPU required in UAvm to calculate a sample data gradient m Representing the initial CPU frequency of UAvm, f m ∈(f min ,f max )。
Fifth, according to the uplink data rate, the local gradient uploading time is calculated. The calculation formula of the local gradient uploading time of UAvm in a certain round is shown as the following formula (14):
wherein,,the UAvm local gradient uploading time in a certain round is represented; g I m The i represents the total data volume for the UAVm corresponding to the local gradient. Assuming that the local gradient data includes x elements and the average number of bits per gradient data element x is y, g m |=xy。Representing the upstream data rate; lambda (lambda) m Indicating whether UAvm participates in the uploading of gradient data of the round, lambda m = {0,1}, where λ m =1 indicates UAVm participates in the uploading of gradient data of the present round, λ m =0 means UAVm does not participate in the bookUploading the round gradient data.
Sixth, a global gradient aggregate time is calculated from the total data volume of the initial CPU frequency local gradients of the UAV L. The calculation formula of the global gradient aggregation time of the UAV L in a certain round is shown as the following formula (15):
wherein,,representing the global gradient aggregation time of UAV L in a certain round, c 0 Representing the computational complexity of gradient aggregation; f (f) L Representing the initial CPU frequency of UAVL, f L ∈(f min ,f max );M 0 Representing the number of unmanned aerial vehicle devices involved in the model aggregation.
Seventh, the gradient update time is calculated from the initial CPU frequency of the UAV L. The calculation formula of the global gradient update time of the UAV L in a certain round is shown as the following formula (16):
wherein,,representing the global gradient update time, c ', of UAV L over a certain round' L Representing the computational complexity of the gradient update, f L Representing the initial CPU frequency of the UAVL.
Eighth, a broadcast time is calculated according to the downlink data rate. The calculation formula of the global parameter broadcasting time of the UAV L in a certain round is shown as the following formula (17):
wherein,,representing UAVsL global parameter broadcast time within a certain round;Representing the downstream data rate; the |w| represents the data amount of the global parameter. Assuming that the global parameter data includes x elements and the average number of bits per parameter data element is y, |w|=xy.
And ninth, generating UAvm total delay for completing one federation study according to the local gradient calculation time, the local gradient uploading time, the global gradient aggregation time, the gradient updating time and the broadcasting time. The formula of the total delay for UAvm to complete one federal study is shown as the following formula (18):
wherein T is m Indicating the total delay for UAVm to complete a round of federal learning. The remaining parameters are described in the above embodiments, and are not described herein.
If the number of unmanned aerial vehicles in the first type of target unmanned aerial vehicle is smaller than the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle, determining that the delay of one round of federal learning is the total delay corresponding to the UAV m with the largest delay, and taking the total delay corresponding to the UAV m with the largest delay as a calculation mode corresponding to a first preset resource allocation strategy. The calculation mode T (T) corresponding to the first preset resource allocation policy is shown in the following formula (19):
in step 660, if the number of unmanned aerial vehicles in the first class of target unmanned aerial vehicles is equal to the total number of unmanned aerial vehicles in the first class of unmanned aerial vehicles, determining the calculation mode corresponding to the second preset resource allocation strategy as the calculation mode of the preset resource allocation strategy.
Optionally, if the number of unmanned aerial vehicles in the first class of target unmanned aerial vehicles is equal to the total number of unmanned aerial vehicles in the first class of unmanned aerial vehicles, the method indicates that the first class of unmanned aerial vehicles only includes updating the contribution ratio to the global model in a certain training roundA first, smaller class of target drones. At this time, when the UAV L does not receive the gradient upload, one or more unmanned aerial vehicle devices are randomly selected from the first class of unmanned aerial vehicles for gradient upload after a preset time interval Δt. Suppose that the selected unmanned aerial vehicle device is m 0 The calculation formula of the federal learning total delay of the round is shown as the following formula (20):
wherein T (T) represents the federal learning total delay of the round,representation of UAvm 0 Local gradient calculation time in a certain round, < >>Representation of UAvm 0 Local gradient upload time in a certain round, Δt represents a preset time interval.
If the number of each unmanned aerial vehicle in the first type of target unmanned aerial vehicle is equal to the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle, the server 104 may determine the federal learning total delay of the round as a calculation mode corresponding to the second preset resource allocation policy. Then, the server 104 may determine the calculation mode corresponding to the second preset resource configuration policy as the calculation mode of the preset resource configuration policy.
In this embodiment, first, the number of each unmanned aerial vehicle in the first class of target unmanned aerial vehicles is obtained; then, if the number of unmanned aerial vehicles in the first type of target unmanned aerial vehicle is smaller than the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle, determining a calculation mode corresponding to a first preset resource allocation strategy as a calculation mode of the preset resource allocation strategy; if the number of the unmanned aerial vehicles in the first type of target unmanned aerial vehicle is equal to the total number of the unmanned aerial vehicles in the first type of unmanned aerial vehicle, determining a calculation mode corresponding to the second preset resource allocation strategy as a calculation mode of the preset resource allocation strategy, and accordingly determining calculation modes of different preset resource allocation strategies according to the size relation between the number of the unmanned aerial vehicles in the first type of target unmanned aerial vehicle and the total number of the unmanned aerial vehicles in the first type of unmanned aerial vehicle.
In one embodiment, as shown in fig. 7, according to a calculation manner of a preset resource allocation policy, calculating a CPU frequency and a signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group includes:
step 720, calculating the processing energy consumption of each unmanned aerial vehicle in the unmanned aerial vehicle group according to the initial CPU frequency and the initial signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group; the processing energy consumption comprises transmission energy consumption of each unmanned aerial vehicle and calculation energy consumption of each unmanned aerial vehicle.
Optionally, the server 104 may calculate the processing energy consumption of each unmanned aerial vehicle in the unmanned aerial vehicle group according to the initial CPU frequency and the initial signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group. The processing energy consumption comprises transmission energy consumption of each unmanned aerial vehicle and calculation energy consumption of each unmanned aerial vehicle. In a certain round, the calculation formulas of the energy consumption of each unmanned aerial vehicle are shown as the following formulas (21) and (22):
wherein,,representing the computational energy consumption of UAvm, +.>Representing the calculated energy consumption of the UAV L; k represents a first positive constant and σ represents a second positive constant; f (f) m Representing the initial CPU frequency of UAvm, f L Representing an initial CPU frequency of UAV L;Representing the time of local gradient computation of UAvm in a certain round, +.>Representing UAV L globally within a certain turnGradient polymerization time >Representing the global gradient update time of the UAV L within a certain round.
In a certain round, the calculation formulas of the transmission energy consumption of each unmanned aerial vehicle are shown as the following formulas (23) and (24):
wherein,,representing the transmission energy consumption of UAvm, +.>Representing the transmission energy consumption of the UAV L; p is p m Representing the signal power of UAvm, p L Signal power representing UAV L;Representing UAvm local gradient upload time in a certain round,/for a certain period>Representing the global parameter airtime of the UAV L within a certain round.
Step 740, obtaining the first constraint condition of the processing energy consumption, the second constraint condition of the CPU frequency and the third constraint condition of the signal power.
Optionally, the server 104 may take the processing energy consumption, the CPU frequency and the signal power of each unmanned aerial vehicle as optimization variables, so as to minimize the total delay of federal learning in each round, thereby obtaining a first constraint condition of the processing energy consumption, a second constraint condition of the CPU frequency and a third constraint condition of the signal power, and obtaining the optimization problem according to the first constraint condition of the processing energy consumption, the second constraint condition of the CPU frequency and the third constraint condition of the signal power. The optimization problem P1 is represented by the following formulas (25) to (31):
0≤p L ≤p mac ,#(28)
f min ≤f L ≤f max ,#(29)
wherein, the above formula (25) represents an optimization target, namely, the CPU frequency and the signal power of each unmanned aerial vehicle are optimized, so that the total time delay of the federal learning of each round is minimized; the above formula (26) represents a third constraint condition corresponding to the signal power of UAVm, and the above formula (27) represents a second constraint condition corresponding to the CPU frequency of UAVm; the above formula (28) represents a third constraint condition corresponding to the signal power of the UAV L, and the above formula (29) represents a second constraint condition corresponding to the CPU frequency of the UAV L; the above formula (30) represents a first constraint corresponding to the processing energy consumption of UAVm, and the above formula (31) represents a first constraint corresponding to the processing energy consumption of UAV L.
Step 760, calculating the minimum processing delay of the unmanned aerial vehicle group by adopting a particle swarm algorithm according to the first constraint condition, the second constraint condition, the third constraint condition and the calculation mode of the preset resource allocation strategy.
Optionally, according to the first constraint condition, the second constraint condition, the third constraint condition, and the calculation mode of the preset resource allocation policy, the server 104 may optimize the optimization problem P1, and calculate the minimum processing delay of the unmanned aerial vehicle group by adopting the particle swarm algorithm. Because the calculation modes of the preset resource allocation policies include more than one calculation mode, the server 104 can calculate the minimum processing delay of the unmanned aerial vehicle group corresponding to the calculation modes of the preset resource allocation policies by adopting the particle swarm algorithm according to the calculation modes of different preset resource allocation policies.
And step 780, determining the CPU frequency and the signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group according to the minimum processing time delay.
Optionally, since the minimum processing delay is calculated based on the first constraint condition of the processing energy consumption, the second constraint condition of the CPU frequency, and the third constraint condition of the signal power, the server 104 may determine, according to the calculated minimum processing delay, the CPU frequency and the signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group under the condition that the processing delay is minimum. The CPU frequency and signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group are the CPU frequency and signal power of each unmanned aerial vehicle which minimize the processing time delay.
In this embodiment, first, according to an initial CPU frequency and an initial signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group, processing energy consumption of each unmanned aerial vehicle in the unmanned aerial vehicle group is calculated, and a first constraint condition of processing energy consumption, a second constraint condition of CPU frequency and a third constraint condition of signal power are obtained; and then, according to the first constraint condition, the second constraint condition, the third constraint condition and the calculation mode of the preset resource allocation strategy, the minimum processing time delay of the unmanned aerial vehicle group can be calculated by adopting a particle swarm algorithm, so that the CPU frequency and the signal power corresponding to each unmanned aerial vehicle in the unmanned aerial vehicle group under the condition of minimum processing time delay can be determined according to the calculated minimum processing time delay. Therefore, in the following steps, the model training is carried out by adopting the CPU frequency and the signal power corresponding to each unmanned aerial vehicle under the condition of minimum processing time delay, so that the time of the model training can be reduced, and the efficiency of the model training is improved.
In one embodiment, if the computing modes of the preset resource allocation policy include a first computing mode and a second computing mode, the minimum processing delay includes a first minimum processing delay and a second minimum processing delay; according to the first constraint condition, the second constraint condition, the third constraint condition and the calculation mode of the preset resource allocation strategy, calculating the minimum processing time delay by adopting a particle swarm algorithm, wherein the method comprises the following steps:
Step 762, if the number of each unmanned aerial vehicle in the first class of target unmanned aerial vehicles is smaller than the total number of unmanned aerial vehicles in the first class of unmanned aerial vehicles, calculating a first minimum processing time delay of the unmanned aerial vehicle group by adopting a particle swarm algorithm according to the first constraint condition, the second constraint condition, the third constraint condition and a first calculation mode corresponding to a first preset resource allocation strategy.
Optionally, when the computing modes of the preset resource allocation policy include the first computing mode and the second computing mode, the minimum processing delay includes a first minimum processing delay and a second minimum processing delay. The first preset resource allocation strategy corresponds to a first calculation mode, and the first calculation mode corresponds to a first minimum processing time delay; the second preset resource allocation strategy corresponds to a second computing mode, and the second computing mode corresponds to a second minimum processing time delay. If the number of unmanned aerial vehicles in the first class of target unmanned aerial vehicles is smaller than the total number of unmanned aerial vehicles in the first class of unmanned aerial vehicles, the server 104 can calculate the first minimum processing time delay of the unmanned aerial vehicle group by adopting a particle swarm algorithm according to the first constraint condition, the second constraint condition, the third constraint condition and the first calculation mode corresponding to the first preset resource allocation strategy.
The step of calculating the first minimum processing delay of the unmanned aerial vehicle group is as follows: first, the optimization problem P1 is substituted into the formula (19) to obtain a first optimization problem. The first optimization problem (P1.1) is represented by the following formulas (32) to (38):
0≤p L ≤p max ,#(35)
f min ≤f L ≤f max ,#(36)
one sub-optimization problem (P2.1) and a second sub-optimization problem (P2.2), and for P respectively m ,f m And p L ,f L And (5) carrying out optimization solution. The first sub-optimization problem (P2.1) and the second sub-optimization problem (P2.2) are represented by the following formulas (39) to (46):
s.t.0≤p L ≤p max ,#(44)
f min ≤f L ≤f max ,#(45)
in solving, taking the first sub-optimization problem (P2.1) as an example, first, a set of solutions (m 0 ,p m0 ,f m0 ) All have inequality (47) established:
due to (m) 0 ,p m0 ,f m0 ) Can be m 0 Taking m to maximize the left of inequality (47), will (p m0 ,f m0 ) Taken as the one that minimizes the right of inequality (47) to correspond to (p m ,f m ) Thus, inequality (48):
next, substituting inequality (49) into each of the above-described related expressions, the first sub-optimization problem (P2.1) can be converted into the following sub-optimization problem (P3.1):
at this time, by setting one m for (P3.1), the following sub-optimization problem (P4.1) can be obtained:
similarly, for the second sub-optimization problem (P2.2), the second sub-optimization problem (P2.2) can be converted into a sub-optimization problem (P3.2) and a sub-optimization problem (P4.2):
s.t.0≤p L ≤p max ,#(58)
f min ≤f L ≤f max ,#(59)
s.t.0≤p L ≤p max ,#(62)
f min ≤f L ≤f max ,#(63)
Then, aiming at each unmanned aerial vehicle UAV m of the first type, respectively solving a sub-optimization problem (P4.1) and a sub-optimization problem (P4)And 2) taking the m value which maximizes the result corresponding to the optimization problem. Finally, adding the time of the maximum m value corresponding to the first unmanned aerial vehicle UAV m and the time corresponding to the second unmanned aerial vehicle UAVL to obtain the minimum total delay of the federal learning of the current turn, namely the first minimum processing delay of the unmanned aerial vehicle group is
In the embodiment of the application, the particle swarm algorithm can be used for solving the sub-optimization problem (P4.1) and the sub-optimization problem (P4.2). The update formula of the particle swarm algorithm is shown in the following formula (65) and the following formula (66):
wherein,,representing the velocity of particle i at the k+1th iteration,/and>representing the corresponding solution of particle i at the k+1th iteration; χ represents a limiting factor for limiting the particle velocity, w is a control weight; c 1 Representing learning factors derived from the particles themselves, c 2 Representing learning factors derived from between the particles and other particles;And->Is two at [0,1 ]]Random numbers of (a); p (P) i k Indicating that the ith particle gets the solution corresponding to the adaptation value at the kth iteration, ++>Is shown inAnd all particles acquire solutions corresponding to the adaptive values in the kth iteration. The above equation (65) is used to update the current speed and the above equation (66) is used to update the current solution.
In step 764, if the number of each unmanned aerial vehicle in the first class of target unmanned aerial vehicles is equal to the total number of unmanned aerial vehicles in the first class of unmanned aerial vehicles, calculating a second minimum processing time delay of the unmanned aerial vehicle group by adopting a particle swarm algorithm according to the first constraint condition, the second constraint condition, the third constraint condition and a second calculation mode corresponding to a second preset resource allocation strategy.
Optionally, since the second preset resource allocation policy corresponds to a second calculation manner, and the second calculation manner corresponds to a second minimum processing time delay, if the number of each unmanned aerial vehicle in the first type of target unmanned aerial vehicle is equal to the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle, the server 104 may calculate the second minimum processing time delay of the unmanned aerial vehicle group by adopting the particle swarm algorithm according to the first constraint condition, the second constraint condition, the third constraint condition, and the second calculation manner corresponding to the second preset resource allocation policy.
According to the calculation step of the first minimum processing time delay of the unmanned aerial vehicle group, the step of calculating the second minimum processing time delay of the unmanned aerial vehicle group can be obtained by the same method comprises the following steps: first, the optimization problem P1 is substituted into the formula (20) to obtain a second optimization problem. The second optimization problem (P1.2) is represented by the following formulas (67) to (73):
0≤p L ≤p max ,#(70)
f min ≤f L ≤f max ,#(71)
The subsequent calculation step is the same as the calculation step of the first minimum processing delay, and will not be described here again. Thereby obtaining the minimum total delay of the federal learning of the current round, namely the second minimum processing delay of the unmanned aerial vehicle group is
In this embodiment, if the number of each unmanned aerial vehicle in the first class of target unmanned aerial vehicles is smaller than the total number of unmanned aerial vehicles in the first class of unmanned aerial vehicles, according to the first constraint condition, the second constraint condition, the third constraint condition and a first calculation mode corresponding to the first preset resource allocation policy, calculating a first minimum processing time delay of the unmanned aerial vehicle group by adopting a particle swarm algorithm; if the number of unmanned aerial vehicles in the first type of target unmanned aerial vehicle is equal to the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle, calculating a second minimum processing time delay of the unmanned aerial vehicle group by adopting a particle swarm algorithm according to a second calculation mode corresponding to the first constraint condition, the second constraint condition, the third constraint condition and a second preset resource allocation strategy. Therefore, the minimum processing time delay corresponding to different preset resource allocation strategies can be calculated according to the size relation between the number of unmanned aerial vehicles in the first type of target unmanned aerial vehicle and the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle.
In one embodiment, as shown in fig. 8, performing resource allocation on each unmanned aerial vehicle according to the CPU frequency and the signal power of each unmanned aerial vehicle, and training an initial federal learning model based on each unmanned aerial vehicle after the resource allocation, to generate a preset federal learning model, including:
and step 820, performing resource allocation on the unmanned aerial vehicles according to the CPU frequency and the signal power of each unmanned aerial vehicle, and generating intermediate model parameters of the initial federal learning model based on each unmanned aerial vehicle after the resource allocation.
Optionally, according to the CPU frequency and signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group corresponding to the minimum processing time delay of the unmanned aerial vehicle group, the server 104 may configure the corresponding CPU frequency and signal power for each unmanned aerial vehicle, so as to perform the first resource configuration for the unmanned aerial vehicle according to the CPU frequency and signal power of each unmanned aerial vehicle. Then, the server 104 may perform model training of the initial federal learning model for the first round on the initial model parameters of the initial federal learning model based on each unmanned aerial vehicle after the first resource allocation, thereby generating intermediate model parameters of the initial federal learning model.
Step 840, judging whether the intermediate model parameter meets the preset model parameter condition and whether the iteration number meets the preset iteration number;
Step 860, if the intermediate model parameter does not meet the preset model parameter condition and the iteration number does not meet the preset iteration number, performing iterative computation by taking the intermediate model parameter as a new initial model parameter, and generating a new CPU frequency and a new signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group;
returning to step 820, performing next resource allocation on the unmanned aerial vehicle according to the new CPU frequency and the new signal power of each unmanned aerial vehicle, and generating new intermediate model parameters of the initial federal learning model based on each unmanned aerial vehicle after the next resource allocation until the new intermediate model parameters meet the preset model parameter conditions or the iteration times meet the preset iteration times; the preset model parameter condition is that the intermediate model parameter tends to converge;
proceeding to step 880, taking the new intermediate model parameters as the target model parameters of the initial federal learning model;
step 890, generating a preset federal learning model according to the target model parameters.
Alternatively, the server 104 may determine whether the intermediate model parameter satisfies the preset model parameter condition and whether the iteration number satisfies the preset iteration number. If the intermediate model parameters do not meet the preset model parameter conditions and the iteration times do not meet the preset iteration times, performing iterative computation by taking the intermediate model parameters as new initial model parameters, namely, firstly, determining a new first type target unmanned aerial vehicle from the first type unmanned aerial vehicles according to the initial model parameters of the new initial federal learning model; secondly, determining a calculation mode of a new preset resource allocation strategy according to the size relation between the number of each unmanned aerial vehicle in the new first type of target unmanned aerial vehicle and the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle; thirdly, calculating new CPU frequency and new signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group according to a calculation mode of a new preset resource allocation strategy, so as to obtain the new CPU frequency and the new signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group; then, carrying out next resource allocation on the unmanned aerial vehicles according to the new CPU frequency and the new signal power of each unmanned aerial vehicle, and generating new intermediate model parameters of the initial federal learning model based on each unmanned aerial vehicle after the next resource allocation until the new intermediate model parameters meet the preset model parameter conditions or the iteration times meet the preset iteration times, and stopping iteration at the moment; and taking the new intermediate model parameters as target model parameters of the initial federal learning model. Finally, the server 104 may replace the initial model parameters of the initial federal learning model with the target model parameters of the initial federal learning model according to the target model parameters of the initial federal learning model, thereby generating the preset federal learning model. The preset model parameter condition is that the intermediate model parameters tend to converge.
In the embodiment, first, performing primary resource allocation on unmanned aerial vehicles according to CPU frequency and signal power of each unmanned aerial vehicle, and generating intermediate model parameters of an initial federal learning model based on each unmanned aerial vehicle after the primary resource allocation; if the intermediate model parameters do not meet the preset model parameter conditions and the iteration times do not meet the preset iteration times, carrying out iterative computation by taking the intermediate model parameters as new initial model parameters, and generating new CPU frequency and new signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group; performing next resource allocation on the unmanned aerial vehicles according to the new CPU frequency and the new signal power of each unmanned aerial vehicle, and generating new intermediate model parameters of the initial federal learning model based on each unmanned aerial vehicle after the next resource allocation until the new intermediate model parameters meet preset model parameter conditions or the iteration times meet preset iteration times; taking the new intermediate model parameters as target model parameters of an initial federal learning model; and then, generating a preset federal learning model according to the target model parameters, so that training of an initial federal learning model can be performed based on the CPU frequency, the signal power and the initial model parameters of the initial federal learning model of each unmanned aerial vehicle corresponding to the minimum processing time delay of the unmanned aerial vehicle group.
In one embodiment, as shown in fig. 9, the first type of unmanned aerial vehicle further includes a first type of preset unmanned aerial vehicle; generating intermediate model parameters of an initial federal learning model based on each unmanned aerial vehicle after the first resource allocation, including:
step 920, calculating a local gradient of each unmanned aerial vehicle in the first class of unmanned aerial vehicles based on each unmanned aerial vehicle after the first resource allocation.
Alternatively, in general, the calculation formula of the local gradient of each unmanned plane in the first class unmanned plane UAVm is shown in the above formula (3). After the first resource allocation is performed on each unmanned aerial vehicle, the server 104 may calculate the local gradient of each unmanned aerial vehicle in the first class of unmanned aerial vehicles, where the calculation formula of the local gradient of each unmanned aerial vehicle isMultiplying by the CPU frequency of each drone. Wherein (1)>Representing a local data set D for the t-th round m The local loss function performs gradient calculation, and the CPU frequency of each unmanned aerial vehicle is the CPU frequency corresponding to each unmanned aerial vehicle after resource allocation.
Step 940, determining a first type of preset unmanned aerial vehicle from the first type of unmanned aerial vehicles according to the size relation between the number of unmanned aerial vehicles in the first type of target unmanned aerial vehicles and the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicles.
Optionally, the server 104 may obtain the number of each unmanned aerial vehicle in the first type of target unmanned aerial vehicle according to the determined first type of target unmanned aerial vehicle. And the server 104 may determine that the total number of drones in the first class of drones is M. Then, according to the size relationship between the number of each unmanned aerial vehicle in the first type of target unmanned aerial vehicle and the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle, the server 104 can determine whether each unmanned aerial vehicle in the first type of unmanned aerial vehicle is the first type of target unmanned aerial vehicle, so as to determine the first type of preset unmanned aerial vehicle from the first type of unmanned aerial vehicle.
Step 960, uploading the local gradient of each unmanned aerial vehicle in the first type of preset unmanned aerial vehicle to the second type of unmanned aerial vehicle according to the preset resource allocation strategy, and aggregating the local gradient of each unmanned aerial vehicle in the first type of preset unmanned aerial vehicle to generate the global gradient of the second type of unmanned aerial vehicle.
Optionally, according to different preset resource allocation policies, the server 104 may establish a communication link between the first type of preset unmanned aerial vehicle and the second type of unmanned aerial vehicle according to the corresponding preset resource allocation policies, so as to upload the local gradient of each unmanned aerial vehicle in the first type of preset unmanned aerial vehicle to the second type of unmanned aerial vehicle according to the signal power corresponding to the preset resource allocation policies. Then, the server 104 may aggregate the local gradients of each unmanned aerial vehicle in the first type of preset unmanned aerial vehicle uploaded to the second type of unmanned aerial vehicle, to generate a global gradient of the second type of unmanned aerial vehicle. In the embodiment of the present application, the manner of aggregating the local gradients of each unmanned aerial vehicle is to perform weighted average on the local gradients of each unmanned aerial vehicle. The calculation formula of the global gradient of the second class of unmanned aerial vehicle is shown as the following formula (74):
step 980, updating the initial model parameters of the initial federal learning model by adopting a gradient descent algorithm according to the global gradient of the second class unmanned aerial vehicle, generating intermediate model parameters, and broadcasting the intermediate model parameters to each unmanned aerial vehicle in the first class unmanned aerial vehicle.
Optionally, according to the global gradient of the second class unmanned aerial vehicle, the server 104 may update the initial model parameters of the initial federal learning model using a gradient descent algorithm, thereby generating intermediate model parameters. The update formula of the model parameters is shown in the following formula (75):
wherein w is t Representing model parameters after the t-th round update, w t-1 Representing model parameters before the t-1 turn update, delta representing learning rate,representing the global gradient at round t-1.
The server 104 may then broadcast the updated model parameters (i.e., the intermediate model parameters) to each of the first class of drones UAVm.
In the embodiment, first, based on each unmanned aerial vehicle after the first resource allocation, calculating a local gradient of each unmanned aerial vehicle in the first class of unmanned aerial vehicles; secondly, determining a first type of preset unmanned aerial vehicle from the first type of unmanned aerial vehicles according to the size relation between the number of unmanned aerial vehicles in the first type of target unmanned aerial vehicles and the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicles; uploading the local gradient of each unmanned aerial vehicle in the first type of preset unmanned aerial vehicle to the second type of unmanned aerial vehicle according to a preset resource allocation strategy, and aggregating the local gradient of each unmanned aerial vehicle in the first type of preset unmanned aerial vehicle to generate a global gradient of the second type of unmanned aerial vehicle; and finally, updating initial model parameters of the initial federal learning model by adopting a gradient descent algorithm according to the global gradient of the second class unmanned aerial vehicle, generating intermediate model parameters, and broadcasting the intermediate model parameters to each unmanned aerial vehicle in the first class unmanned aerial vehicle. Therefore, the initial model parameters of the initial federal learning model can be updated according to the CPU frequency and the signal power corresponding to each unmanned aerial vehicle after the first resource allocation, and the intermediate model parameters of the initial federal learning model can be obtained.
In one embodiment, determining a first type of preset unmanned aerial vehicle from the first type of unmanned aerial vehicles according to a size relationship between a number of unmanned aerial vehicles in the first type of target unmanned aerial vehicles and a total number of unmanned aerial vehicles in the first type of unmanned aerial vehicles, includes:
in step 942, if the number of unmanned aerial vehicles in the first class of target unmanned aerial vehicles is smaller than the total number of unmanned aerial vehicles in the first class of unmanned aerial vehicles, each unmanned aerial vehicle in the first class of unmanned aerial vehicles except the first class of target unmanned aerial vehicles is used as a first class of preset unmanned aerial vehicles.
Optionally, if the number of each unmanned aerial vehicle in the first type of target unmanned aerial vehicle is smaller than the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle, the first type of unmanned aerial vehicle is indicated to include not only the first type of target unmanned aerial vehicle, but also the first type of unmanned aerial vehicle with relatively large contribution to global model updating in a certain training round. At this time, the server 104 may determine the unmanned aerial vehicle that is not the first type target unmanned aerial vehicle of the first type unmanned aerial vehicle as the first type preset unmanned aerial vehicle, that is, the server 104 may use the first type unmanned aerial vehicle that has a relatively large contribution to global model update in a certain training round as the first type preset unmanned aerial vehicle.
In step 944, if the number of each unmanned aerial vehicle in the first type of target unmanned aerial vehicle is equal to the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle, any unmanned aerial vehicle in the first type of unmanned aerial vehicle is used as the first type of preset unmanned aerial vehicle.
Optionally, if the number of each unmanned aerial vehicle in the first type of target unmanned aerial vehicle is equal to the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle, the first type of target unmanned aerial vehicle with smaller contribution to global model updating in a certain training round is only included in the first type of unmanned aerial vehicle. At this time, gradient uploading is not performed in a certain training round. In order to ensure normal use of the federal learning model and to avoid that some first-class unmanned aerial vehicles do not participate in communication in more rounds to affect effective formation of the unmanned aerial vehicle group, when the UAV L does not receive gradient uploading, one or more unmanned aerial vehicle devices are randomly selected from the first-class unmanned aerial vehicles for gradient uploading through a preset time interval Δt, that is, the server 104 can take any unmanned aerial vehicle in the first-class unmanned aerial vehicle as the first-class preset unmanned aerial vehicle. The first type of preset unmanned aerial vehicle represents a first type of unmanned aerial vehicle for gradient uploading. Of course, the preset time interval Δt and the reference index for selecting one or more unmanned aerial vehicles for gradient uploading may be determined according to the actual scene.
In this embodiment, if the number of unmanned aerial vehicles in the first class of target unmanned aerial vehicles is smaller than the total number of unmanned aerial vehicles in the first class of unmanned aerial vehicles, each unmanned aerial vehicle in the first class of unmanned aerial vehicles except the first class of target unmanned aerial vehicles is used as a first class of preset unmanned aerial vehicles; if the number of each unmanned aerial vehicle in the first type of target unmanned aerial vehicle is equal to the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle, any unmanned aerial vehicle in the first type of unmanned aerial vehicle is used as a first type of preset unmanned aerial vehicle, and accordingly the corresponding first type of preset unmanned aerial vehicle can be determined from the first type of unmanned aerial vehicle according to the size relation between the number of each unmanned aerial vehicle in the first type of target unmanned aerial vehicle and the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle.
In an alternative embodiment, as shown in fig. 10, a task processing method is provided, which is illustrated by taking the application of the method to the server 104 in fig. 1 as an example, and includes the following steps:
step 1002, acquiring a task to be processed of a unmanned aerial vehicle group;
step 1004, obtaining initial model parameters of an initial federal learning model;
step 1006, for each unmanned aerial vehicle in the first class of unmanned aerial vehicles, calculating a local gradient of the unmanned aerial vehicle according to a loss function of the initial federal learning model;
step 1008, judging whether each unmanned aerial vehicle in the first type unmanned aerial vehicle meets the conditions corresponding to the first type target unmanned aerial vehicle according to the number of the first type unmanned aerial vehicles, the initial model parameters, the local gradients of the unmanned aerial vehicles and the preset proportion; the preset proportion is the duty ratio of the preset first type of target unmanned aerial vehicle in the first type of unmanned aerial vehicle;
step 1010, if the unmanned aerial vehicle meets the condition corresponding to the first type target unmanned aerial vehicle, using the unmanned aerial vehicle as the first type target unmanned aerial vehicle;
step 1012, obtaining the number of each unmanned aerial vehicle in the first type of target unmanned aerial vehicle;
step 1014, if the number of unmanned aerial vehicles in the first class of target unmanned aerial vehicles is smaller than the total number of unmanned aerial vehicles in the first class of unmanned aerial vehicles, determining a calculation mode corresponding to the first preset resource allocation strategy as a calculation mode of the preset resource allocation strategy;
Step 1016, if the number of each unmanned aerial vehicle in the first type of target unmanned aerial vehicle is equal to the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle, determining the calculation mode corresponding to the second preset resource allocation strategy as the calculation mode of the preset resource allocation strategy;
step 1018, calculating the processing energy consumption of each unmanned aerial vehicle in the unmanned aerial vehicle group according to the initial CPU frequency and the initial signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group; the processing energy consumption comprises transmission energy consumption of each unmanned aerial vehicle and calculation energy consumption of each unmanned aerial vehicle;
step 1020, obtaining a first constraint condition of processing energy consumption, a second constraint condition of CPU frequency and a third constraint condition of signal power;
step 1022, if the number of each unmanned aerial vehicle in the first class of target unmanned aerial vehicles is smaller than the total number of unmanned aerial vehicles in the first class of unmanned aerial vehicles, calculating a first minimum processing time delay of the unmanned aerial vehicle group by adopting a particle swarm algorithm according to the first constraint condition, the second constraint condition, the third constraint condition and a first calculation mode corresponding to a first preset resource allocation strategy;
step 1024, if the number of each unmanned aerial vehicle in the first class of target unmanned aerial vehicles is equal to the total number of unmanned aerial vehicles in the first class of unmanned aerial vehicles, calculating a second minimum processing time delay of the unmanned aerial vehicle group by adopting a particle swarm algorithm according to the first constraint condition, the second constraint condition, the third constraint condition and a second calculation mode corresponding to a second preset resource allocation strategy;
Step 1026, determining the CPU frequency and signal power of each unmanned plane in the unmanned plane group according to the minimum processing time delay;
step 1028, performing first resource allocation on the unmanned aerial vehicles according to the CPU frequency and the signal power of each unmanned aerial vehicle, and calculating the local gradient of each unmanned aerial vehicle in the first class unmanned aerial vehicle based on each unmanned aerial vehicle after the first resource allocation;
step 1030, if the number of unmanned aerial vehicles in the first class of target unmanned aerial vehicles is smaller than the total number of unmanned aerial vehicles in the first class of unmanned aerial vehicles, taking each unmanned aerial vehicle without the first class of target unmanned aerial vehicles in the first class of unmanned aerial vehicles as a first class of preset unmanned aerial vehicles;
step 1032, if the number of each unmanned aerial vehicle in the first type of target unmanned aerial vehicle is equal to the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle, taking any unmanned aerial vehicle in the first type of unmanned aerial vehicle as a first type of preset unmanned aerial vehicle;
step 1034, uploading the local gradient of each unmanned aerial vehicle in the first type of preset unmanned aerial vehicle to the second type of unmanned aerial vehicle according to the preset resource allocation strategy, and aggregating the local gradient of each unmanned aerial vehicle in the first type of preset unmanned aerial vehicle to generate the global gradient of the second type of unmanned aerial vehicle;
step 1036, updating initial model parameters of the initial federal learning model by adopting a gradient descent algorithm according to the global gradient of the second class unmanned aerial vehicle, generating intermediate model parameters, and broadcasting the intermediate model parameters to each unmanned aerial vehicle in the first class unmanned aerial vehicle;
Step 1038, if the intermediate model parameter does not meet the preset model parameter condition and the iteration number does not meet the preset iteration number, performing iterative computation by taking the intermediate model parameter as a new initial model parameter, and generating a new CPU frequency and a new signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group; performing next resource allocation on the unmanned aerial vehicles according to the new CPU frequency and the new signal power of each unmanned aerial vehicle, and generating new intermediate model parameters of the initial federal learning model based on each unmanned aerial vehicle after the next resource allocation until the new intermediate model parameters meet preset model parameter conditions or the iteration times meet preset iteration times; taking the new intermediate model parameters as target model parameters of an initial federal learning model; the preset model parameter condition is that the intermediate model parameter tends to converge;
step 1040, generating a preset federal learning model according to the target model parameters;
step 1042, inputting the task to be processed into a preset federal learning model to process the task, and generating a task processing result; the preset federal learning model is obtained by training the initial federal learning model based on a preset resource allocation strategy; the preset resource allocation strategy is a resource allocation strategy corresponding to the minimum processing time delay of the unmanned aerial vehicle group when the initial federal learning model is adopted to process tasks;
Step 1044, outputting a task processing result of the unmanned aerial vehicle group.
Alternatively, as shown in fig. 11, fig. 11 is a schematic flow chart of model training in one embodiment. When a model training of a federal learning model is started, firstly, whether each unmanned aerial vehicle in the first type unmanned aerial vehicle meets the conditions corresponding to the first type target unmanned aerial vehicle is judged. If each unmanned aerial vehicle in the first type unmanned aerial vehicle does not meet the conditions corresponding to the first type target unmanned aerial vehicle, a first preset resource allocation strategy corresponding to the unmanned aerial vehicle signal power and the CPU frequency is obtained through solving (P1.1), and local gradient calculation is carried out on all the first type unmanned aerial vehicles according to the first preset resource allocation strategy. And secondly, carrying out gradient uploading on the first type preset unmanned aerial vehicle representing all the target unmanned aerial vehicles which are not the first type. Then, the second type unmanned aerial vehicle is used for updating global model parameters, and global parameters are broadcast to all the first type unmanned aerial vehicles; if each unmanned aerial vehicle in the first type unmanned aerial vehicle meets the conditions corresponding to the first type target unmanned aerial vehicle, a second preset resource allocation strategy corresponding to the unmanned aerial vehicle signal power and the CPU frequency is obtained through solving (P1.2), and local gradient calculation is carried out on all the first type unmanned aerial vehicles according to the second preset resource allocation strategy. And secondly, randomly selecting one or more first-type target unmanned aerial vehicles to carry out gradient uploading. And then, using the second type unmanned aerial vehicle to update global model parameters, and broadcasting global parameters to all the first type unmanned aerial vehicles. And finally, judging whether the global parameter reaches a preset model training termination condition. If the global parameter reaches a preset model training termination condition, finishing model training; if the global parameter does not reach the preset model training termination condition, returning to the step of judging whether each unmanned aerial vehicle in the first unmanned aerial vehicle meets the condition corresponding to the first target unmanned aerial vehicle in the first step, and executing the model training process circularly until the global parameter reaches the preset model training termination condition. The preset model training termination condition may be the convergence of the global parameter or the reaching of a set training round.
In the task processing method, a node selection strategy is provided, and certain learning nodes (namely first class unmanned aerial vehicles) with smaller contribution to global gradients skip the communication of the current round by introducing the concept of lazy nodes (namely first class unmanned aerial vehicles), so that the establishment of a communication link is effectively reduced, and the time of model training is shortened. In addition, the embodiment of the application also provides a minimum time delay unmanned aerial vehicle network resource allocation strategy based on the particle swarm optimization, and because the gradient-based client scheduling strategy can reflect the influence of each unmanned aerial vehicle on the federal learning performance, a better solution can be obtained by considering the federal learning time delay, the minimum time delay unmanned aerial vehicle network resource allocation strategy based on the particle swarm optimization can be adopted, the optimization of the federal learning calculation and the training time delay can be considered under the constraint of certain training energy consumption, the model training result with the minimum processing time delay and good performance can be obtained, and therefore, the high communication efficiency and the calculation efficiency of federal learning can be improved.
It should be understood that, although the steps in the flowcharts related to the above embodiments are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a task processing device for realizing the task processing method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation of one or more embodiments of the task processing device provided below may refer to the limitation of the task processing method hereinabove, and will not be repeated herein.
In one embodiment, as shown in fig. 12, there is provided a task processing device 1200 including: a task to be processed acquisition module 1220, a task processing result generation module 1240, and a task processing result output module 1260, wherein:
the task to be processed obtaining module 1220 is configured to obtain a task to be processed of the unmanned aerial vehicle group.
The task processing result generating module 1240 is configured to input a task to be processed into a preset federal learning model to perform task processing, and generate a task processing result; the preset federal learning model is obtained by training the initial federal learning model based on a preset resource allocation strategy; the preset resource allocation strategy is a resource allocation strategy corresponding to the minimum processing time delay of the unmanned aerial vehicle group when the initial federal learning model is adopted for task processing.
The task processing result output module 1260 is configured to output a task processing result of the unmanned aerial vehicle group.
In one embodiment, the unmanned aerial vehicle group comprises a first type unmanned aerial vehicle and a second type unmanned aerial vehicle; the task processing device 1200 further includes:
the first type target unmanned aerial vehicle determining module is used for determining the first type target unmanned aerial vehicle from the first type unmanned aerial vehicle according to initial model parameters of an initial federal learning model;
the computing mode determining module is used for determining a computing mode of a preset resource allocation strategy according to the size relation between the number of each unmanned aerial vehicle in the first type of target unmanned aerial vehicle and the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle;
the calculation module is used for calculating the CPU frequency and the signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group according to a calculation mode of a preset resource allocation strategy;
the preset federal learning model generation module is used for carrying out resource allocation on each unmanned aerial vehicle according to the CPU frequency and the signal power of each unmanned aerial vehicle, and training the initial federal learning model based on each unmanned aerial vehicle after the resource allocation to generate a preset federal learning model.
In one embodiment, the first class of target drone determination module includes:
the initial model parameter acquisition unit is used for acquiring initial model parameters of an initial federal learning model;
The first calculation unit is used for calculating the local gradient of each unmanned aerial vehicle in the first class of unmanned aerial vehicles according to the loss function of the initial federal learning model;
the judging unit is used for judging whether each unmanned aerial vehicle in the first type unmanned aerial vehicle meets the conditions corresponding to the first type target unmanned aerial vehicle according to the number of the first type unmanned aerial vehicles, the initial model parameters, the local gradients of the unmanned aerial vehicles and the preset proportion; the preset proportion is the duty ratio of the preset first type of target unmanned aerial vehicle in the first type of unmanned aerial vehicle;
the first type target unmanned aerial vehicle determining unit is used for taking the unmanned aerial vehicle as the first type target unmanned aerial vehicle if the unmanned aerial vehicle meets the condition corresponding to the first type target unmanned aerial vehicle.
In one embodiment, the preset resource allocation policies include a first preset resource allocation policy and a second preset resource allocation policy; the calculation mode determining module comprises:
the number acquisition unit is used for acquiring the number of each unmanned aerial vehicle in the first type of target unmanned aerial vehicle;
the first calculation mode determining unit is used for determining a calculation mode corresponding to a first preset resource configuration strategy as a calculation mode of the preset resource configuration strategy if the number of unmanned aerial vehicles in the first type of target unmanned aerial vehicles is smaller than the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicles;
And the second calculation mode determining unit is used for determining the calculation mode corresponding to the second preset resource configuration strategy as the calculation mode of the preset resource configuration strategy if the number of unmanned aerial vehicles in the first type of target unmanned aerial vehicles is equal to the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicles.
In one embodiment, the computing module includes:
the processing energy consumption calculation unit is used for calculating the processing energy consumption of each unmanned aerial vehicle in the unmanned aerial vehicle group according to the initial CPU frequency and the initial signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group; the processing energy consumption comprises transmission energy consumption of each unmanned aerial vehicle and calculation energy consumption of each unmanned aerial vehicle;
the constraint condition acquisition unit is used for acquiring a first constraint condition of processing energy consumption, a second constraint condition of CPU frequency and a third constraint condition of signal power;
the minimum processing time delay calculation unit is used for calculating the minimum processing time delay of the unmanned aerial vehicle group by adopting a particle swarm algorithm according to the first constraint condition, the second constraint condition, the third constraint condition and a calculation mode of a preset resource allocation strategy;
and the CPU frequency and signal power determining unit is used for determining the CPU frequency and signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group according to the minimum processing time delay.
In one embodiment, if the computing modes of the preset resource allocation policy include a first computing mode and a second computing mode, the minimum processing delay includes a first minimum processing delay and a second minimum processing delay; the minimum processing delay calculation unit includes:
the first minimum processing time delay calculation subunit is configured to calculate, according to a first constraint condition, a second constraint condition, a third constraint condition and a first calculation mode corresponding to a first preset resource allocation policy, a first minimum processing time delay of the unmanned aerial vehicle group by adopting a particle swarm algorithm if the number of unmanned aerial vehicles in the first type of target unmanned aerial vehicle is smaller than the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle;
and the second minimum processing time delay calculation subunit is configured to calculate, according to the first constraint condition, the second constraint condition, the third constraint condition and a second calculation mode corresponding to a second preset resource allocation policy, a second minimum processing time delay of the unmanned aerial vehicle group by adopting a particle swarm algorithm if the number of unmanned aerial vehicles in the first type of target unmanned aerial vehicles is equal to the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicles.
In one embodiment, the preset federal learning model generation module includes:
the intermediate model parameter generating unit is used for carrying out first resource allocation on the unmanned aerial vehicles according to the CPU frequency and the signal power of each unmanned aerial vehicle, and generating intermediate model parameters of an initial federal learning model based on each unmanned aerial vehicle after the first resource allocation;
The iteration unit is used for carrying out iterative computation by taking the intermediate model parameter as a new initial model parameter if the intermediate model parameter does not meet the preset model parameter condition and the iteration number does not meet the preset iteration number, so as to generate new CPU frequency and new signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group; performing next resource allocation on the unmanned aerial vehicles according to the new CPU frequency and the new signal power of each unmanned aerial vehicle, and generating new intermediate model parameters of the initial federal learning model based on each unmanned aerial vehicle after the next resource allocation until the new intermediate model parameters meet preset model parameter conditions or the iteration times meet preset iteration times; taking the new intermediate model parameters as target model parameters of an initial federal learning model; the preset model parameter condition is that the intermediate model parameter tends to converge;
the preset federal learning model generation unit is used for generating a preset federal learning model according to the target model parameters.
In one embodiment, the first class of unmanned aerial vehicle further comprises a first class of preset unmanned aerial vehicle; the intermediate model parameter generation unit includes:
the second calculation subunit is used for calculating the local gradient of each unmanned aerial vehicle in the first class of unmanned aerial vehicles based on each unmanned aerial vehicle after the first resource allocation;
The first type preset unmanned aerial vehicle determining subunit is used for determining the first type preset unmanned aerial vehicle from the first type unmanned aerial vehicle according to the size relation between the number of each unmanned aerial vehicle in the first type target unmanned aerial vehicle and the total number of unmanned aerial vehicles in the first type unmanned aerial vehicle;
the global gradient generation subunit is used for uploading the local gradient of each unmanned aerial vehicle in the first type of preset unmanned aerial vehicle to the second type of unmanned aerial vehicle according to a preset resource allocation strategy, and aggregating the local gradient of each unmanned aerial vehicle in the first type of preset unmanned aerial vehicle to generate the global gradient of the second type of unmanned aerial vehicle;
and the intermediate model parameter generation subunit is used for updating the initial model parameters of the initial federal learning model by adopting a gradient descent algorithm according to the global gradient of the second class unmanned aerial vehicle, generating intermediate model parameters, and broadcasting the intermediate model parameters to each unmanned aerial vehicle in the first class unmanned aerial vehicle.
In one embodiment, the first type of preset drone determination subunit includes:
the first determining subunit is configured to, if the number of each unmanned aerial vehicle in the first type of target unmanned aerial vehicles is smaller than the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicles, take each unmanned aerial vehicle in the first type of unmanned aerial vehicles except the first type of target unmanned aerial vehicles as a first type of preset unmanned aerial vehicles;
And the second determining subunit is configured to take any unmanned aerial vehicle in the first type of unmanned aerial vehicle as a first type of preset unmanned aerial vehicle if the number of unmanned aerial vehicles in the first type of target unmanned aerial vehicle is equal to the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle.
The various modules in the task processing device described above may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, and the internal structure of which may be as shown in fig. 13. The computer device includes a processor, a memory, an Input/Output interface (I/O) and a communication interface. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface is connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is for storing task processing data. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a task processing method.
It will be appreciated by those skilled in the art that the structure shown in fig. 13 is merely a block diagram of a portion of the structure associated with the present application and is not limiting of the computer device to which the present application applies, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the method embodiments described above when the computer program is executed.
In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored which, when executed by a processor, carries out the steps of the method embodiments described above.
In an embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the steps of the method embodiments described above.
It should be noted that, the user information (including, but not limited to, user equipment information, user personal information, etc.) and the data (including, but not limited to, data for analysis, stored data, presented data, etc.) referred to in the present application are information and data authorized by the user or sufficiently authorized by each party, and the collection, use and processing of the related data are required to comply with the related laws and regulations and standards of the related countries and regions.
Those skilled in the art will appreciate that implementing all or part of the above-described methods in accordance with the embodiments may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the various embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the various embodiments provided herein may include at least one of relational databases and non-relational databases. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processors referred to in the embodiments provided herein may be general purpose processors, central processing units, graphics processors, digital signal processors, programmable logic units, quantum computing-based data processing logic units, etc., without being limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples represent only a few embodiments of the present application, which are described in more detail and are not thereby to be construed as limiting the scope of the present application. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application shall be subject to the appended claims.
Claims (13)
1. A method of task processing, the method comprising:
acquiring a task to be processed of an unmanned aerial vehicle group;
inputting the task to be processed into a preset federal learning model for task processing, and generating a task processing result; the preset federal learning model is obtained by training an initial federal learning model based on a preset resource allocation strategy; the preset resource allocation strategy is a resource allocation strategy corresponding to the minimum processing time delay of the unmanned aerial vehicle group when the initial federal learning model is adopted for task processing;
And outputting a task processing result of the unmanned aerial vehicle group.
2. The method of claim 1, wherein the group of unmanned aerial vehicles comprises a first type of unmanned aerial vehicle and a second type of unmanned aerial vehicle; the generating process of the preset federal learning model comprises the following steps:
determining a first type of target unmanned aerial vehicle from the first type of unmanned aerial vehicles according to initial model parameters of the initial federal learning model;
determining a calculation mode of a preset resource allocation strategy according to the size relation between the number of each unmanned aerial vehicle in the first type of target unmanned aerial vehicle and the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle;
according to the calculation mode of the preset resource allocation strategy, calculating the CPU frequency and signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group;
performing resource allocation on each unmanned aerial vehicle according to the CPU frequency and the signal power of each unmanned aerial vehicle, and training the initial federal learning model based on each unmanned aerial vehicle after resource allocation to generate the preset federal learning model.
3. The method of claim 2, wherein determining a first class of target drones from the first class of drones based on initial model parameters of the initial federal learning model comprises:
Acquiring initial model parameters of the initial federal learning model;
aiming at each unmanned aerial vehicle in the first type of unmanned aerial vehicle, calculating the local gradient of the unmanned aerial vehicle according to the loss function of the initial federal learning model;
judging whether each unmanned aerial vehicle in the first type unmanned aerial vehicle meets the conditions corresponding to the first type target unmanned aerial vehicle according to the number of the first type unmanned aerial vehicles, the initial model parameters, the local gradient of the unmanned aerial vehicle and the preset proportion; the preset proportion is the duty ratio of a preset first type target unmanned aerial vehicle in the first type unmanned aerial vehicle;
and if the unmanned aerial vehicle meets the conditions corresponding to the first type target unmanned aerial vehicle, taking the unmanned aerial vehicle as the first type target unmanned aerial vehicle.
4. The method of claim 2, wherein the predetermined resource allocation policy comprises a first predetermined resource allocation policy and a second predetermined resource allocation policy; the determining a calculation mode of a preset resource allocation strategy according to the size relation between the number of unmanned aerial vehicles in the first type of target unmanned aerial vehicles and the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicles comprises:
acquiring the number of each unmanned aerial vehicle in the first type of target unmanned aerial vehicle;
If the number of unmanned aerial vehicles in the first type of target unmanned aerial vehicle is smaller than the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle, determining a calculation mode corresponding to the first preset resource allocation strategy as a calculation mode of the preset resource allocation strategy;
and if the number of the unmanned aerial vehicles in the first type of target unmanned aerial vehicle is equal to the total number of the unmanned aerial vehicles in the first type of unmanned aerial vehicle, determining a calculation mode corresponding to the second preset resource allocation strategy as the calculation mode of the preset resource allocation strategy.
5. The method according to claim 2, wherein the calculating the CPU frequency and the signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group according to the calculation mode of the preset resource allocation policy includes:
calculating the processing energy consumption of each unmanned aerial vehicle in the unmanned aerial vehicle group according to the initial CPU frequency and the initial signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group; the processing energy consumption comprises transmission energy consumption of each unmanned aerial vehicle and calculation energy consumption of each unmanned aerial vehicle;
acquiring a first constraint condition of the processing energy consumption, a second constraint condition of the CPU frequency and a third constraint condition of the signal power;
According to the first constraint condition, the second constraint condition, the third constraint condition and the calculation mode of the preset resource allocation strategy, calculating the minimum processing time delay of the unmanned aerial vehicle group by adopting a particle swarm algorithm;
and determining the CPU frequency and the signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group according to the minimum processing time delay.
6. The method of claim 5, wherein if the computing means of the preset resource allocation policy includes a first computing means and a second computing means, the minimum processing delay includes a first minimum processing delay and a second minimum processing delay; the calculating the minimum processing delay by adopting a particle swarm algorithm according to the first constraint condition, the second constraint condition, the third constraint condition and the calculation mode of the preset resource allocation strategy comprises the following steps:
if the number of unmanned aerial vehicles in the first type of target unmanned aerial vehicle is smaller than the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle, calculating a first minimum processing time delay of the unmanned aerial vehicle group by adopting a particle swarm algorithm according to the first constraint condition, the second constraint condition, the third constraint condition and a first calculation mode corresponding to the first preset resource allocation strategy;
If the number of unmanned aerial vehicles in the first type of target unmanned aerial vehicle is equal to the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle, calculating a second minimum processing time delay of the unmanned aerial vehicle group by adopting a particle swarm algorithm according to the first constraint condition, the second constraint condition, the third constraint condition and a second calculation mode corresponding to the second preset resource allocation strategy.
7. The method of any one of claims 2-6, wherein the performing resource allocation on each unmanned aerial vehicle according to the CPU frequency and the signal power of each unmanned aerial vehicle, and training the initial federal learning model based on each unmanned aerial vehicle after resource allocation, and generating the preset federal learning model comprises:
performing primary resource allocation on the unmanned aerial vehicles according to the CPU frequency and the signal power of each unmanned aerial vehicle, and generating intermediate model parameters of the initial federal learning model based on each unmanned aerial vehicle after the primary resource allocation;
if the intermediate model parameters do not meet the preset model parameter conditions and the iteration times do not meet the preset iteration times, carrying out iterative computation by taking the intermediate model parameters as new initial model parameters, and generating new CPU frequency and new signal power of each unmanned aerial vehicle in the unmanned aerial vehicle group; performing next resource allocation on the unmanned aerial vehicles according to new CPU frequency and new signal power of each unmanned aerial vehicle, and generating new intermediate model parameters of the initial federal learning model based on each unmanned aerial vehicle after the next resource allocation until the new intermediate model parameters meet the preset model parameter conditions or the iteration times meet the preset iteration times; taking the new intermediate model parameters as target model parameters of the initial federal learning model; the preset model parameter condition is that the intermediate model parameter tends to converge;
And generating the preset federal learning model according to the target model parameters.
8. The method of claim 7, wherein the first class of drones further comprises a first class of preset drones; generating intermediate model parameters of the initial federal learning model by each unmanned aerial vehicle based on the first resource allocation, including:
based on each unmanned aerial vehicle after the first resource allocation, calculating the local gradient of each unmanned aerial vehicle in the first class of unmanned aerial vehicles;
determining a first type of preset unmanned aerial vehicle from the first type of unmanned aerial vehicles according to the size relation between the number of unmanned aerial vehicles in the first type of target unmanned aerial vehicles and the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicles;
uploading the local gradient of each unmanned aerial vehicle in the first type of preset unmanned aerial vehicle to the second type of unmanned aerial vehicle according to the preset resource allocation strategy, and aggregating the local gradient of each unmanned aerial vehicle in the first type of preset unmanned aerial vehicle to generate a global gradient of the second type of unmanned aerial vehicle;
and updating the initial model parameters of the initial federal learning model by adopting a gradient descent algorithm according to the global gradient of the second class unmanned aerial vehicle, generating the intermediate model parameters, and broadcasting the intermediate model parameters to each unmanned aerial vehicle in the first class unmanned aerial vehicle.
9. The method of claim 8, wherein the determining a first type of preset drone from the first type of drones according to a size relationship between a number of each drone in the first type of target drones and a total number of drones in the first type of drones, comprises:
if the number of unmanned aerial vehicles in the first type of target unmanned aerial vehicle is smaller than the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle, taking all unmanned aerial vehicles in the first type of unmanned aerial vehicle except the first type of target unmanned aerial vehicle as the first type of preset unmanned aerial vehicle;
and if the number of each unmanned aerial vehicle in the first type of target unmanned aerial vehicle is equal to the total number of unmanned aerial vehicles in the first type of unmanned aerial vehicle, taking any unmanned aerial vehicle in the first type of unmanned aerial vehicle as the first type of preset unmanned aerial vehicle.
10. A task processing device, the device comprising:
the task to be processed acquisition module is used for acquiring tasks to be processed of the unmanned aerial vehicle group;
the task processing result generation module is used for inputting the task to be processed into a preset federal learning model to process the task and generating a task processing result; the preset federal learning model is obtained by training an initial federal learning model based on a preset resource allocation strategy; the preset resource allocation strategy is a resource allocation strategy corresponding to the minimum processing time delay of the unmanned aerial vehicle group when the initial federal learning model is adopted for task processing;
And the task processing result output module is used for outputting the task processing result of the unmanned aerial vehicle group.
11. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any one of claims 1 to 9 when the computer program is executed.
12. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 9.
13. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any one of claims 1 to 9.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310127379.1A CN116560828A (en) | 2023-02-02 | 2023-02-02 | Task processing method, device, computer equipment, storage medium and program product |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310127379.1A CN116560828A (en) | 2023-02-02 | 2023-02-02 | Task processing method, device, computer equipment, storage medium and program product |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116560828A true CN116560828A (en) | 2023-08-08 |
Family
ID=87502623
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310127379.1A Pending CN116560828A (en) | 2023-02-02 | 2023-02-02 | Task processing method, device, computer equipment, storage medium and program product |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116560828A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117289725A (en) * | 2023-11-27 | 2023-12-26 | 清华大学 | Unmanned plane distributed general calculation integrated resource scheduling method and device |
-
2023
- 2023-02-02 CN CN202310127379.1A patent/CN116560828A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117289725A (en) * | 2023-11-27 | 2023-12-26 | 清华大学 | Unmanned plane distributed general calculation integrated resource scheduling method and device |
CN117289725B (en) * | 2023-11-27 | 2024-02-27 | 清华大学 | Unmanned plane distributed general calculation integrated resource scheduling method and device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Deng et al. | Intelligent delay-aware partial computing task offloading for multiuser industrial Internet of Things through edge computing | |
Yang et al. | Privacy-preserving federated learning for UAV-enabled networks: Learning-based joint scheduling and resource management | |
CN109948029B (en) | Neural network self-adaptive depth Hash image searching method | |
CN110362380B (en) | Network shooting range-oriented multi-objective optimization virtual machine deployment method | |
CN111176820B (en) | Deep neural network-based edge computing task allocation method and device | |
CN113395654A (en) | Method for task unloading and resource allocation of multiple unmanned aerial vehicles of edge computing system | |
CN112118287A (en) | Network resource optimization scheduling decision method based on alternative direction multiplier algorithm and mobile edge calculation | |
Lu et al. | Automating deep neural network model selection for edge inference | |
CN110531996B (en) | Particle swarm optimization-based computing task unloading method in multi-micro cloud environment | |
CN116560828A (en) | Task processing method, device, computer equipment, storage medium and program product | |
CN113962161B (en) | Optimal QoS service selection method and device based on black oligopolistic optimization algorithm | |
CN116187483A (en) | Model training method, device, apparatus, medium and program product | |
CN114492746A (en) | Federal learning acceleration method based on model segmentation | |
CN113238867A (en) | Federated learning method based on network unloading | |
Liu et al. | Task offloading optimization of cruising UAV with fixed trajectory | |
Liu et al. | Hastening stream offloading of inference via multi-exit dnns in mobile edge computing | |
Fan et al. | Cb-dsl: Communication-efficient and byzantine-robust distributed swarm learning on non-iid data | |
Zhang et al. | A hybrid fast inference approach with distributed neural networks for edge computing enabled UAV swarm | |
CN118095410A (en) | Federal learning parameter efficient fine-tuning method and device for neural network architecture search | |
Sun | Distributed optimal scheduling in UAV swarm network | |
CN107995027B (en) | Improved quantum particle swarm optimization algorithm and method applied to predicting network flow | |
CN110610231A (en) | Information processing method, electronic equipment and storage medium | |
CN113378369B (en) | Path planning and task scheduling method based on unmanned aerial vehicle calculation unloading | |
Zhu et al. | Client selection for federated learning using combinatorial multi-armed bandit under long-term energy constraint | |
Liu et al. | DNN Partitioning, Task Offloading, and Resource Allocation in Dynamic Vehicular Networks: A Lyapunov-Guided Diffusion-Based Reinforcement Learning Approach |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |