Intelligent multi-unmanned aerial vehicle cooperative defense penetration micro-service method
Through the Flask framework and the PyTorch deep learning framework, an intelligent multi-drone collaborative penetration microservice is constructed, which solves the problem of deploying intelligent multi-drone collaborative penetration algorithms in drones and achieves lightweight and easy-to-use networked collaboration. Penetration capabilities get rid of computational complexity and load limitations.
Patent Information
- Application Number
- CN202411295432.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-18
- Publication Date
- 2024-10-22
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing technology makes it difficult to deploy intelligent multi-UAV collaborative penetration algorithms in UAVs. In particular, the deep learning framework requires a graphics processor, resulting in increased computing burden and equipment weight, and a lack of detailed engineering implementation plans.
The Flask framework is used to build an intelligent multi-UAV collaborative penetration microservice, which provides intelligent multi-UAV collaborative penetration services through the network. The PyTorch deep learning framework and the Flask toolkit are used to realize the analysis of UAV status data and the creation of action lists. JSON response, simplifying resource requirements and deployment process.
It realizes the networked intelligent multi-UAV collaborative penetration capability, gets rid of computational complexity and load limitations, and provides a lightweight and easy-to-use intelligent multi-UAV collaborative penetration solution.
Smart Images

Figure CN118819482A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of multi-agent reinforcement learning, and in particular to an intelligent multi-UAV collaborative penetration microservice method. Background Art
[0002] The intelligent multi-UAV collaborative penetration capability is a key component of the unmanned confrontation system and an important capability system. However, due to the limitations of the payload and information fusion capabilities of the UAV, it is difficult to deploy the intelligent multi-UAV collaborative penetration algorithm on each UAV, especially when using a deep learning framework, which requires a graphics processor to run, increasing the computing burden of the device and adding extra weight. In order to solve this problem, how to build an intelligent multi-UAV collaborative penetration microservice and provide intelligent multi-UAV collaborative penetration services to the UAV swarm through the network is the focus of current research.
[0003] In the article "Heterogeneous Multi-UAV Collaborative Penetration Method Based on MA2IDDPG Algorithm" published by Chang Xin et al. in Hebei Industrial Science and Technology, based on the DDPG method, multiple DDPG frameworks are set according to the number of UAVs, and initial collaborative capabilities are formed through traction training, and then the penetration strategy is further optimized through the exploration capability of the intelligent framework. However, this method focuses on algorithm and framework research, and does not provide an engineering implementation plan.
[0004] In the patent "A method for multi-UAV coordinated penetration with heterogeneous multi-agent reinforcement learning" applied by the 54th Institute of China Electronics Technology Group Corporation, with the authorization announcement number CN113822409B, the multi-UAV coordinated penetration is achieved by migrating the training of the agent from the traction game scenario to the result description game scenario and gradually relaxing the description refinement of the reward function. However, the patent does not provide detailed methods for how to deploy and use this capability.
[0005] In the article "Multi-jammer collaborative resource allocation method for formation penetration" published by Yan Junkun et al. in the Journal of Xidian University, the paper focused on the performance-driven multi-jammer collaborative resource allocation method in the collaborative penetration process, established a collaborative resource optimization model, and had good rapid solution capabilities. However, this method focuses on allocating jamming resources from the perspective of jamming effect evaluation to support the construction of formation penetration capabilities, and also does not provide detailed methods for how to deploy and use this capability.
[0006] In the patent "Allocation Method and Device for Coordinated Low-Altitude Penetration of Multiple Heterogeneous UAVs" applied by the University of Aerospace Engineering of the Strategic Support Force of the Chinese People's Liberation Army, with the authorization announcement number CN117008641B, the method of allocating a set of heterogeneous UAVs realizes the coordinated low-altitude penetration of multiple heterogeneous UAVs, and gives the result of the allocation decision device for the coordinated low-altitude penetration of heterogeneous multiple UAVs. However, the patent only describes the component modules of the decision device, and does not give a detailed method for using the decision device by the UAV. Summary of the invention
[0007] In view of this, the present invention proposes a microservice method for intelligent multi-UAV collaborative penetration. The method uses the flask framework to build microservices, has low resource requirements, and has simple construction and use processes, so that the intelligent multi-UAV collaborative penetration capability is freed from the limitations of being a device component.
[0008] The technical solution adopted by the present invention is:
[0009] An intelligent multi-UAV collaborative penetration microservice method comprises the following steps:
[0010] Step 1: Build an intelligent multi-UAV collaborative penetration microservice based on the flask framework; the specific method is:
[0011] Step 1-1: Import Flask, request and jsonify toolkits from the flask framework;
[0012] Step 1-2: Use the app function provided by Flask to create a flask application instance;
[0013] app = Flask(__name__)
[0014] Step 1-3: Define the intelligent multi-UAV collaborative penetration function;
[0015] Step 1-4: Bind the intelligent multi-UAV collaborative penetration to the specified URL path to complete the construction of the intelligent multi-UAV collaborative penetration microservice;
[0016] Step 1-5: Set the intelligent multi-UAV collaborative penetration microservice startup function;
[0017] Step 2: Provide intelligent multi-UAV collaborative penetration microservices based on the Flask framework.
[0018] Furthermore, in steps 1-3, the working mode of the intelligent multi-UAV coordinated penetration function is as follows:
[0019] Use the get_json() function provided by the request toolkit to obtain the multi-drone status data DATA in the http request content and parse it into the Numpy data type;
[0020] Use the loading function provided by the PyTorch deep learning framework to import the trained intelligent multi-UAV collaborative penetration model instance and parameters;
[0021] The intelligent multi-UAV cooperative penetration model instance is placed on the image processor through the .cuda() function of the PyTorch deep learning framework;
[0022] Use the eval function of the PyTorch deep learning framework to set the intelligent multi-UAV collaborative penetration model instance to evaluation mode;
[0023] Traverse each element data in the multi-UAV state data DATA as the input of the intelligent multi-UAV collaborative penetration model instance, and use the action list action_list of each UAV as the output result return value of the model;
[0024] Call the jsonify tool, which returns a JSON response containing a list of actions for each drone, and sets the HTTP status code to 200.
[0025] Furthermore, the specific methods of steps 1-4 are:
[0026] The @app.route decorator is used to bind the intelligent multi-UAV collaborative penetration function to the specified URL path; the decorator is placed before and adjacent to the intelligent multi-UAV collaborative penetration function; when a request matches the URL path, flask will call the intelligent multi-UAV collaborative penetration function; in addition, the parameters of the decorator are set to only allow POST requests to be received through the HTTP method.
[0027] Furthermore, the specific method of step 2 is:
[0028] Step 2-1: Run the service startup function as the main program
[0029] Run the app.run() function through if __name__ == '__main__';
[0030] Step 2-2: Respond to the request and return the action list of each drone
[0031] The multi-UAV coordinated command and control node that needs to conduct coordinated penetration uses the post function in the requests toolkit to send an application; the post function is set with the URL path and multi-UAV status data DATA, and the DATA is sent in the form of a dictionary in JSON format;
[0032] The intelligent multi-UAV collaborative penetration microservice monitors the port to see if there is a route and request for the corresponding service. If so, the intelligent multi-UAV collaborative penetration function is run and the UAV action information is returned to the applicant's res variable in the form of a JSON string.
[0033] The beneficial effects of the present invention are:
[0034] 1. The present invention hosts the intelligent multi-UAV collaborative penetration program based on the flask framework. Key nodes such as control nodes in the UAV group that need to implement intelligent multi-UAV collaborative penetration in the network can send UAV status data to the intelligent multi-UAV collaborative penetration service through HTTP post request and then return the UAV action.
[0035] 2. The present invention realizes the networked intelligent multi-UAV collaborative penetration capability, freeing the formation of UAV collaborative capability from the limitations of calculation complexity and load. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 The figure is a flow chart of a method according to an embodiment of the present invention.
[0037] Figure 2 Schematic diagram of the track formed in the embodiment of the present invention. DETAILED DESCRIPTION
[0038] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments.
[0039] An intelligent multi-UAV collaborative penetration microservice method, the overall process is as follows Figure 1 As shown, the specific steps include:
[0040] Step 1: Build an intelligent multi-UAV collaborative penetration microservice based on the flask framework.
[0041] Step 1-1: Import the Flask, request, and jsonify toolkits from the flask framework:
[0042] The import code is:
[0043] from flask import Flask, request, jsonify
[0044] Step 1-2: Use the app function provided by Flask to create a flask application instance:
[0045] Use the app function provided by Flask to create a Flask application instance. The __name__ parameter is the name of the application module. Flask uses __name__ to determine the location of the service. The code is:
[0046] app = Flask(__name__)
[0047] Step 1-3: Define the intelligent multi-UAV collaborative penetration function penetrate. The specific working method of the penetrate function is:
[0048] The get_json() function provided by the request toolkit is used to obtain the multi-UAV status data in the request content. The status data is a Python list data type. The number of elements in the list is the same as the number of UAVs. Each element in the list is the status data of each UAV, including the current UAV number, the 2D position of the red base, the 2D position of the red interception agent, the 2D position of the blue interception agent, and the 2D position of the blue attack agent. The code is:
[0049] DATA = request.get_json()
[0050] Use the loading function provided by the PyTorch deep learning framework to import the trained intelligent multi-UAV collaborative penetration model instance and parameters. The code is:
[0051] from reinforcement.ddpg.ddpg import DDPG
[0052] For the network structure and training process of the intelligent multi-UAV collaborative penetration model, please refer to the paper "Heterogeneous Multi-UAV Collaborative Penetration Method Based on MA2IDDPG Algorithm" published by Chang Xin et al. in Hebei Industrial Science and Technology.
[0053] Load the trained model hyperparameters to generate an intelligent multi-UAV collaborative penetration model instance;
[0054] net= DDPG(a_dim=2, s_dim=9, a_bound=1)
[0055] Among them, a_dim indicates that the action dimension of the UAV is 2, that is, the azimuth and distance in the penetration scenario; s_dim indicates that the state information dimension of the UAV is 9, including the current UAV number, the two-dimensional position of the red base, the two-dimensional position of the red intercept agent, the two-dimensional position of the blue intercept agent, and the two-dimensional position of the blue attack agent; a_bound indicates that the absolute value of the maximum displacement range is 1, that is, the displacement range is [-1, 1].
[0056] Load the trained model parameters:
[0057] net.load_state_dict(torch.load('net.pth'))
[0058] Where 'net.pth' is the stored model parameter file.
[0059] Put the model on the graphics processing unit (GPU) through the .cuda() function of the PyTorch deep learning framework:
[0060] net.cuda()
[0061] Use the eval function of the PyTorch deep learning framework to set the model to evaluation mode:
[0062] net.eval()
[0063] Traverse each element data in DATA as the input of the model, and the action list action_list of each drone is returned as the output result of the model:
[0064] action_list = []
[0065] For Data in DATA:
[0066] Data = torch.unsqueeze(torch.FloatTensor(Data), 0)
[0067] action = net(Data.cuda())[0].detach().cpu()
[0068] action = np.clip(np.random.normal(action, 0), -1* a_bound, a_bound)
[0069] action_list.append(action)
[0070] Call the jsonify tool, return a JSON response containing action_list, and set the HTTP status code to 200:
[0071] return jsonify(action_list), 200.
[0072] Step 1-4: Bind the recognition function to the specified URL path:
[0073] Use the @app.route decorator to bind the penetrate function to the specified URL path. The decorator is placed before and immediately after the penetrate function. When a request matches this path, Flask will call the penetrate function. In addition, set the decorator parameter Method=['POST'] to only allow POST requests via the HTTP method:
[0074] @app.route(' / penetrate', methods=['POST']) .
[0075] Step 1-5: Set the intelligent multi-UAV coordinated penetration service startup function:
[0076] Call the app.run() function and set the host, port, and debug parameters. In host, set the corresponding IP address of the service. In this example, it is set to http: / / 192.168.0.107. Port is used to specify the port number that the application listens on. In this example, it is set to 5001. debug is a Boolean variable used to set whether to enable the debug mode. Set True to debug.
[0077] Step 2: Provide intelligent multi-UAV collaborative penetration microservices based on the flask framework:
[0078] Step 2-1: Start the main program:
[0079] By if __name__ == '__main__', run the app.run() function to start the service.
[0080] Step 2-2: Respond to the request and return the action list of each drone:
[0081] For key nodes such as multi-UAV coordinated command and control nodes that need to conduct coordinated penetration, the post function in the requests toolkit is used to send an application. The status data of each UAV is stored in DATA. In the post function, the URL path and status data DATA need to be set. DATA is as follows:
[0082] [[1 -9.0 0.0 -8.0 0.0 6.0 -0.9 9.0 -1.0],
[0083] [2 -9.0 0.0 -8.0 0.0 6.0 -0.9 9.0 -1.0]]
[0084] DATA is sent in the form of a list, where the blue intercepting agent is numbered 1 and the blue attacking agent is numbered 2.
[0085] Convert DATA to JSON format:
[0086] DATA = json.dumps(DATA)
[0087] Send a POST request using HTTP method:
[0088] requests.post(url= 'http: / / 192.168.0.107:5001 / penetrate', json=DATA)
[0089] The intelligent multi-UAV collaborative penetration service monitors the port to see if there is a route and request for the corresponding service. When the request path matches 'http: / / 192.168.0.107:5001 / penetrate', Flask will call the penetrate function and return the action list action_list of each UAV to the applicant's res variable in the form of a JSON string:
[0090] res = requests.post(url=web, json= DATA)
[0091] In this embodiment, the res value is [[-1.0, -1.0], [-1.0, -1.0]], indicating that the two-dimensional action of the blue intercepting agent is [-1.0, -1.0] and the two-dimensional action of the blue attacking agent is [-1.0, -1.0].
[0092] After the complete confrontation, the track formed is as follows Figure 2 As shown, it is consistent with the experimental results in the paper, indicating that the intelligent multi-UAV collaborative penetration microservice method proposed in the present invention is effective and can accurately provide intelligent multi-UAV collaborative penetration capability.
[0093] In summary, the present invention is based on the flask framework to host the intelligent multi-UAV collaborative penetration program. In the network, key nodes such as control nodes in the UAV group that need to implement intelligent multi-UAV collaborative penetration can send the UAV status data to the intelligent multi-UAV collaborative penetration service through HTTP post request, and then return the UAV action. This method realizes the networked intelligent multi-UAV collaborative penetration capability, and frees the formation of UAV collaborative capability from the limitations of computational complexity and load.
Claims
1. An intelligent multi-UAV collaborative penetration microservice method, It is characterized in that The following steps are involved: Step 1: Build an intelligent multi-UAV collaborative penetration microservice based on the flask framework; the specific method is: Step 1-1: Import Flask, request and jsonify toolkits from the flask framework; Step 1-2: Use the app function provided by Flask to create a flask application instance; app = Flask(__name__) Step 1-3: Define the intelligent multi-UAV collaborative penetration function; Step 1-4: Bind the intelligent multi-UAV collaborative penetration to the specified URL path to complete the construction of the intelligent multi-UAV collaborative penetration microservice; Step 1-5: Set the intelligent multi-UAV collaborative penetration microservice startup function; Step 2: Provide intelligent multi-UAV collaborative penetration microservices based on the Flask framework.
2. According to the intelligent multi-UAV collaborative penetration microservice method of claim 1, It is characterized in that In steps 1-3, the working mode of the intelligent multi-UAV coordinated penetration function is as follows: Use the get_json() function provided by the request toolkit to obtain the multi-drone status data DATA in the http request content and parse it into the Numpy data type; Use the loading function provided by the PyTorch deep learning framework to import the trained intelligent multi-UAV collaborative penetration model instance and parameters; The intelligent multi-UAV cooperative penetration model instance is placed on the image processor through the .cuda() function of the PyTorch deep learning framework; Use the eval function of the PyTorch deep learning framework to set the intelligent multi-UAV collaborative penetration model instance to evaluation mode; Traverse each element data in the multi-UAV state data DATA as the input of the intelligent multi-UAV collaborative penetration model instance, and use the action list action_list of each UAV as the output result return value of the model; Call the jsonify tool, which returns a JSON response containing a list of actions for each drone, and sets the HTTP status code to 200.
3. According to the intelligent multi-UAV collaborative penetration microservice method of claim 1, It is characterized in that The specific methods of steps 1-4 are: The @app.route decorator is used to bind the intelligent multi-UAV collaborative penetration function to the specified URL path; the decorator is placed before and adjacent to the intelligent multi-UAV collaborative penetration function; when a request matches the URL path, flask will call the intelligent multi-UAV collaborative penetration function; in addition, the parameters of the decorator are set to only allow POST requests to be received through the HTTP method.
4. According to the intelligent multi-UAV collaborative penetration microservice method of claim 1, It is characterized in that The specific method of step 2 is: Step 2-1: Run the service startup function as the main program Run the app.run() function through if __name__ == '__main__'; Step 2-2: Respond to the request and return the action list of each drone The multi-UAV coordinated command and control node that needs to conduct coordinated penetration uses the post function in the requests toolkit to send an application; the post function is set with the URL path and multi-UAV status data DATA, and the DATA is sent in the form of a dictionary in JSON format; The intelligent multi-UAV collaborative penetration microservice monitors the port to see if there is a route and request for the corresponding service. If so, the intelligent multi-UAV collaborative penetration function is run and the UAV action information is returned to the applicant's res variable in the form of a JSON string.
Citation Information
Patent Citations
A Multi-UAV Cooperative Penetration Method Based on Heterogeneous Multi-Agent Reinforcement Learning
CN113822409B
Allocation method and device for coordinated low-altitude penetration of multiple heterogeneous UAVs
CN117008641B
Lightweight command and control network key node intelligent identification service construction method
CN118433239A
