CN-121981178-A - Intelligent control algorithm deployment method based on embedded neural network processor
Abstract
The invention provides an intelligent control algorithm deployment method based on an embedded neural network processor, which comprises the steps of analyzing calculation power of a neural network chip, analyzing calculation requirements of the neural network required by flight control, taking main influence factors of calculation speed of the neural network into consideration based on a matrix multiplication analysis result, performing time-consuming test by using a GPU (graphic processing unit) and a CPU (Central processing unit) calculation network, correcting the test result to obtain corrected calculation time, completing on-loop flight control deployment of the neural network processor if the corrected calculation time meets control period requirements, completing on-loop flight control deployment scheme based on the neural network processor, and completing flight control simulation analysis to realize intelligent control algorithm deployment based on the embedded neural network processor. By applying the technical scheme of the invention, the technical problem that the existing embedded processor can only be realized in a serial computing mode in intelligent computing, the neural network computing needs to execute multi-layer nested loops, and the real-time requirement of the intelligent computing is difficult to meet is solved.
Inventors
- LI YU
- ZHAO JINGCHAO
- CHU XIANYING
- CHEN CONG
- XU BAOHUA
Assignees
- 北京空天技术研究所
Dates
- Publication Date
- 20260505
- Application Date
- 20251215
Claims (10)
- 1. The intelligent control algorithm deployment method based on the embedded neural network processor is characterized by comprising the following steps of: Testing the calculation power of a neural network chip by adopting cuBlas, pytorch algorithm, and analyzing matrix multiplication; Analyzing the calculation requirement of the neural network required by the flight control, based on a matrix multiplication analysis result, taking the main influence factor of the calculation speed of the neural network into consideration, adopting a GPU and a CPU calculation network to perform time-consuming test and correcting the test result to obtain corrected calculation time, and if the corrected calculation time meets the control period requirement, turning to a third step; Step three, completing the on-loop flight control deployment of the neural network processor, including Arm control comprehensive control machine deployment, neural network chip deployment and flight control program deployment; And step four, completing flight control simulation analysis based on an in-loop flight control deployment scheme of the neural network processor, and realizing intelligent control algorithm deployment based on the embedded neural network processor.
- 2. The intelligent control algorithm deployment method based on the embedded neural network processor according to claim 1, wherein in the second step, analyzing the calculation requirement of the neural network required by the flight control specifically comprises: Reading state data such as flight attack angle, flight speed and the like from a serial port or other communication equipment; Pre-processing the flight data, including data standardization, normalization and the like, wherein the pre-processing is performed in a CPU; Transmitting the processed data to the GPU and distributing the processed data to each thread; Performing parallel computation on all the connection layers layer by layer in the GPU, and putting the computation result of each all the connection layers into nonlinear activation function computation; Returning the calculated result to the CPU for post-processing, and obtaining corresponding expected output according to data scaling of the [ -1,1] range output by the neural network; the CPU sends out data through communication equipment such as serial ports.
- 3. The method for deploying an intelligent control algorithm based on an embedded neural network processor according to claim 2, wherein in the second step, performing a time-consuming test by using a GPU and a CPU computing network specifically comprises: Defining a neural network, defining a fully connected neural network through a pytorch library, and defining a linear layer and a fully connected layer; Defining a computing device, computing a network in the Arm chip, defining the device as a "CPU", computing the network in the neural network chip, defining the device as a "cuda"; placing neural network input data, transmitting the state data input by the network to equipment used for calculating the neural network, and transmitting the data to a Graphic Processing Unit (GPU) video memory through PCIe (peripheral component interconnect express) when calculating in a neural network chip; The equipment is preheated, equipment such as a GPU (graphics processing unit), a CPU (Central processing Unit) and the like can enter a dormant state when not in use, and network preheating computing equipment needs to be operated in advance before testing; recording a start time stamp; Network forward calculation, namely, 6000 forward calculations are repeated each time in order to avoid inaccurate test time of single network calculation, and the calculation is finished to obtain an average value; And recording the ending time stamp, calculating the network operation average time length, and finishing the time-consuming test.
- 4. The intelligent control algorithm deployment method based on the embedded neural network processor according to claim 3, wherein in the second step, the corrected calculation time estimation formula is PeakFlopS =3% > F clk ·N sm ·T ins ×2=7.07 GFlopS Time= Flops/PeakFlopS, where F clk is the operating frequency of the GPU core, N sm is the number of GPU SMs, T ins is the instruction throughput of a specific type of data, when the data precision is FP32, it is CUDACore number, peakFlops is the GPU peak computing capability, flops is the floating point computing speed, GFlops represents 10 hundred million floating point operations per second.
- 5. The method for deploying intelligent control algorithm based on embedded neural network processor according to any one of claims 1-4, wherein in the third step, the Arm control comprehensive control machine deployment specifically comprises the steps of keeping the controller program in the Arm control comprehensive control machine consistent with the original program, receiving the flight state data from the dynamics simulation machine, sending the flight state data to the neural network chip, and sending the rudder deflection data from the neural network chip to the dynamics simulation machine, essentially moving the original controller calculation part to the neural network for calculation.
- 6. The intelligent control algorithm deployment method based on the embedded neural network processor according to claim 5, wherein in the third step, the neural network chip deployment specifically comprises: Defining network computing equipment, and deploying preprocessing, post-processing and network reasoning into different equipment of a CPU and a GPU for execution; Network deployment, in which the trained network is stored in a pth format under an operation address, and the network is loaded through a load_state_subject instruction in a pytorch environment; Defining a unpacking program, wherein the data read from the serial port by python through polling is multi-frame continuous data, and unpacking the data through defining a decode function; Defining a receiving thread, wherein communication in python is realized through the polling thought, simultaneous execution of a serial port receiving thread and a sending thread is realized through multi-thread concurrency in python, two threads are started in a main function, and data is waited for being transmitted to an excitation thread; defining a sending thread, responding to the data transmitted in the queue by the sending thread according to the first-in first-out principle, analyzing the float format by the receiving thread, taking out the data from the queue by the sending thread, and packaging and sending the data to the GPU.
- 7. The intelligent control algorithm deployment method based on the embedded neural network processor according to claim 6, wherein in the third step, the flight control program deployment specifically comprises the steps of selecting a flight control neural network trained by a TD3 algorithm in a cruise section of an aircraft, inputting errors, error change rates and integral of errors of attack angle instruction tracking by the network, outputting rudder deflection signals into the aircraft, firstly setting simulation step length to be 0.005s on the ground after ground training is finished, eliminating exploring noise of the TD3 algorithm, carrying out network offline test, deploying the flight control neural network into an ARM control integrated control computer chip after test is successful, testing with a simulator and a controller, and comparing test results.
- 8. The method for deploying intelligent control algorithm based on embedded neural network processor according to claim 7, wherein in the fourth step, the dynamics updating flight state of the aircraft is calculated in the dynamics simulator as the start of the control period, the flight state data is transmitted to the control comprehensive control machine through the DMA serial port after calculation is completed, the angle of attack deviation and the angle of attack deviation integration are calculated in the control comprehensive control machine after waiting for 5ms from the last calculation, the result is transmitted to the neural network chip Jetson nano immediately after calculation is completed, the neural network chip immediately starts preprocessing and network forward calculation after data reception is completed, the result is transmitted back to the control comprehensive control machine after calculation is completed, and the result is converted into rudder deviation signal and transmitted to the dynamics simulator.
- 9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor executes the steps of the computer program to implement the embedded neural network processor based intelligent control algorithm deployment method according to any of claims 1 to 8.
- 10. A computer readable storage medium storing a computer program, wherein the computer program when executed by a processor implements the steps of the embedded neural network processor-based intelligent control algorithm deployment method according to any one of claims 1 to 8.
Description
Intelligent control algorithm deployment method based on embedded neural network processor Technical Field The invention relates to the technical field of neural networks, in particular to an intelligent control algorithm deployment method based on an embedded neural network processor. Background With the combination of artificial intelligence technology and aircrafts, neural network application gradually appears in the fields of aircraft decision/guidance control and the like, and aircrafts face the forward calculation requirement of an online neural network. In the traditional intelligent computing field, the computing unit consists of a GPU or TPU computing array deployed on the ground, has high performance, high computing density, high power consumption and large occupied area, can bear training and reasoning tasks, and returns data after the equipment returns to the cloud computing through a cloud training network and a deployment network. However, in the guidance and control of the aircraft, the real-time requirement is high, the data transmission to the cloud end is impossible, the low-delay and high-bandwidth edge type neural network processor is required, the navigation data, situation information and the like are transmitted in the aircraft through a serial port and other data transmission modes, the neural network reasoning is completed at the aircraft end, and the ground cloud computing is only responsible for command and decision. However, the existing embedded processor can only be realized by adopting a serial computing mode in intelligent computing, the neural network computing needs to execute multi-layer nested circulation, the real-time requirement of intelligent computing is difficult to meet, the combination way of the novel embedded edge neural network processor (Neural Processing Unit, NPU) and the aircraft needs to be researched, the computing power of the embedded neural network processor is analyzed, and a foundation is laid for the intelligent technology of the aircraft. Disclosure of Invention The invention provides an intelligent control algorithm deployment method based on an embedded neural network processor, which can solve the technical problems that the existing embedded processor can only be realized in a serial computing mode in intelligent computing, the neural network computing needs to execute multi-layer nested loops, and the real-time requirement of the intelligent computing is difficult to meet. According to one aspect of the invention, an intelligent control algorithm deployment method based on an embedded neural network processor is provided, the intelligent control algorithm deployment method based on the embedded neural network processor comprises the steps of firstly testing calculation power of a neural network chip by adopting cuBlas, pytorch algorithm, analyzing matrix multiplication, secondly analyzing calculation requirements of the neural network required by flight control, based on matrix multiplication analysis results, considering main influencing factors of calculation speed of the neural network, performing time-consuming test by adopting a GPU and a CPU calculation network and correcting the test results to obtain corrected calculation time, if the corrected calculation time meets control period requirements, switching to the step III, if the corrected calculation time does not meet the control period requirements, adjusting the neural network parameters, repeating the steps until the corrected calculation time meets the control period requirements, thirdly, completing on-loop flight control deployment of the neural network processor, including Arm control comprehensive control computer deployment, neural network chip deployment and flight control program deployment, and fourthly, completing on-loop flight control deployment scheme based on the neural network processor, and realizing intelligent control algorithm deployment based on the embedded neural network processor. Further, in the second step, the calculation requirement of the neural network required by flight control is analyzed, specifically, the method comprises the steps of reading state data such as flight attack angle and flight speed from a serial port or other communication equipment, preprocessing the flight data, including data standardization, normalization and the like, the preprocessing is performed in a CPU, the processed data are transmitted to a GPU and distributed to each thread, parallel calculation is performed on all connection layers layer by layer in the GPU, the calculation result of each all connection layer is put into a nonlinear activation function calculation, the calculation result is returned to the CPU for post-processing, the corresponding expected output is obtained through scaling of data in a range of < -1,1 > output by the neural network, and the CPU sends the data through the serial port and other communication equipment. Further, in the second step, the t