A lightweight command and control network key node intelligent identification service construction method
Through the Flask framework and PyTorch deep learning model, a lightweight command and control network key node intelligent identification service is constructed, which solves the problem of difficulty in identifying key nodes in the existing technology, achieves networked services and high-performance identification capabilities, and reduces resources Demand and delays.
Patent Information
- Application Number
- CN202410888598.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-04
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2044-07-04
AI Technical Summary
Existing technology is difficult to realize the intelligent identification of key nodes in lightweight command and control networks through full platforms and full equipment, and lacks detailed engineering implementation plans and networked service descriptions.
The Flask framework is used to build a lightweight command and control network key node intelligent identification service. By importing the Flask framework, the key node identification function is defined, and the model of the PyTorch deep learning framework is used for identification. The HTTP POST request method is used to provide network services and realize key nodes. identification and return.
It realizes the ability to identify key nodes of the networked intelligent command and control network, freeing the node identification ability from the limitations of rigid system connections, reducing resource requirements and delays, improving the degree of modularity and customization, and is suitable for high-performance and low-latency professionals. field projects.
Smart Images

Figure CN118433239B
Abstract
Description
Technical Field
[0001] The invention relates to a method for constructing a lightweight command and control network key node intelligent identification service, and belongs to the field of communication reconnaissance and artificial intelligence. Background Art
[0002] The ability to intelligently identify key nodes in command and control networks is an important component of situational awareness and intelligence reconnaissance systems, and platforms generally require key node identification capabilities. However, due to limitations in platform capabilities and device computing power, it is impossible to popularize key node identification capabilities through full platform and full equipment deployment. In order to solve this problem, how to build a lightweight command and control network key node intelligent identification service and extend the ability to identify key nodes of all devices and platforms in the network through networked services has become the focus of current research.
[0003] In the article "Complex Network Node Importance Evaluation Method Based on Tsallis Entropy" published in "Acta Physica Sinica", Yang Songqing et al. introduced Tsallis entropy theory into the evaluation of complex node importance, realized the importance ranking of nodes, and thus provided the ability to identify key nodes. However, this method is a preface study and no engineering implementation plan is given.
[0004] In the article "Complex Network Node Identification Based on Multi-Indicator Decision-Making" published by Wang Limei et al. in the Journal of Lanzhou University of Arts and Sciences (Natural Science Edition), an evaluation system for key nodes was constructed to achieve the screening of key nodes. However, this research method is also a method for application in engineering.
[0005] In the patent "A method for identifying key nodes based on path planning tasks" applied by the Institute of Systems Engineering of the Chinese People's Liberation Army Academy of Military Sciences, with the authorization announcement number CN116882607B, according to the characteristics of drone path planning, not only a total threat probability model is constructed, but also the action space information, state space information, reward function information and initialization parameter information of the drone are used to train the network model and realize key node identification. However, the patent does not provide detailed methods for how to deploy and use the key node identification capability.
[0006] In the patent application of the National University of Defense Technology of the People's Liberation Army of China, entitled "Adaptive Network Recovery Method, Device and Equipment Based on Key Node Identification", with the authorization announcement number CN115801549B, the graph neural network is used to aggregate the features of nodes in the network and their adjacent nodes to obtain multiple key nodes, which can realize key node identification. However, the patent only describes the method deployed in a computer, and does not provide a description of its ability to provide networked services and the implementation process. Summary of the invention
[0007] In view of this, the present invention proposes a lightweight command and control network key node intelligent identification service construction method. Compared with the service built with Django and Spring framework, this method is more lightweight, has lower resource requirements and latency, frees the intelligent node identification capability from the limitation of being a rigidly connected component of the system, and improves the degree of modularity by reducing the complexity of data interaction.
[0008] The technical solution adopted by the present invention is:
[0009] A method for constructing a lightweight command and control network key node intelligent identification service includes the following steps:
[0010] Step 1: Build an intelligent command and control network key node identification service based on the Flask framework; the specific method is:
[0011] Step 1-1: Import the Flask framework;
[0012] Step 1-2: Use the app function provided by Flask to create a Flask application instance;
[0013] Step 1-3: Define key node identification function;
[0014] Step 1-4: Bind the key node identification function to the specified URL path to complete the construction of the key node identification service of the intelligent command and control network;
[0015] Step 1-5: Set the intelligent command and control network key node identification service as the main program;
[0016] Step 2: Provide key node identification service of intelligent command and control network based on Flask framework.
[0017] Furthermore, in steps 1-3, the key node identification function works as follows:
[0018] Get the data in the request content through the get_json() function provided by the request toolkit and parse it into a Python dictionary data type;
[0019] Use the loading function provided by the PyTorch deep learning framework to import the trained command and control network key node identification model instance and parameters;
[0020] Put the recognition model into the specified image processor through the device function of the PyTorch deep learning framework;
[0021] Use the eval function of the PyTorch deep learning framework to set the model to evaluation mode;
[0022] Use data as the input of the model, and node as the output of the model and the recognition return value;
[0023] Calling the jsonify tool returns a JSON response containing the identified node and sets the HTTP status code to 200.
[0024] Furthermore, the specific methods of steps 1-4 are:
[0025] The @app.route decorator is used to bind the key node identification function to the specified URL path. The decorator is placed before and adjacent to the key node identification function. When a request matches the URL path, Flask will call the key node identification function. In addition, the parameters of the decorator are set to only allow POST requests to be received through the HTTP method.
[0026] Furthermore, the specific method of step 2 is:
[0027] Step 2-1: Start the main program
[0028] Run the app.run() function by if __name__ == '__main__'
[0029] Step 2-2: Respond to the request and return the recognition result
[0030] The device system or subsystem that needs the key node identification capability uses the post function in the requests toolkit to send the identification application; wherein the post function is set with the URL path and the data to be identified DATA, and the data to be identified DATA is sent in the form of a dictionary in JSON format;
[0031] The key node identification service listening port of the intelligent command and control network determines whether there is a route and request corresponding to the identification service. If so, the key node identification function is run and the identified key node is returned to the applicant's res variable in the form of a JSON string.
[0032] The beneficial effects of the present invention are:
[0033] 1. The present invention is based on the Flask framework to host the command and control network key node intelligent identification program. The device that needs to identify the key node in the network can send the command and control network interconnection relationship data obtained by reconnaissance to the intelligent identification service through the HTTP post request method, and then return the identification result. This method realizes the networked intelligent command and control network key node identification capability, freeing the node identification capability from the limitation of having to be a rigidly connected component of the system.
[0034] 2. Compared with services built using Django and Spring frameworks, the present invention contains fewer components and libraries, is more lightweight, has lower resource requirements and latency, frees the intelligent node recognition capability from the limitation of having to be a rigidly connected component of the system, and improves the degree of modularity by reducing the complexity of data interaction.
[0035] 3. The present invention has a high degree of customization, allowing developers to freely select and add required libraries and plug-ins without being restricted by the framework, allowing full control over project structure and configuration, and is suitable for professional field projects such as command and control network key node identification that require high customization, high performance and low latency.
[0036] 4. Due to the lightweight characteristics of Flask, cross-language system components within the system no longer need to use shared memory and other methods to exchange data with each other. The function can be integrated using local HTTP access, which improves the modular use of capabilities and greatly reduces the complexity of assembly and data interaction between subsystems. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 The figure is a flow chart of a method according to an embodiment of the present invention.
[0038] Figure 2 The figure is a schematic diagram of the structure of a command and control network in an embodiment of the present invention. DETAILED DESCRIPTION
[0039] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments.
[0040] A lightweight command and control network key node intelligent identification service construction method, the overall process is as follows Figure 1 As shown, the specific steps include:
[0041] Step 1: Build an intelligent command and control network key node identification service based on the Flask framework.
[0042] Step 1-1: Import the Flask framework:
[0043] Import the Flask framework and the Flask, request, and jsonify tools provided by the framework. The command statement is:
[0044] from Flask import Flask, request, jsonify
[0045] Step 1-2: Create a Flask application instance:
[0046] 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 command statement is:
[0047] app = Flask(__name__)
[0048] Step 1-3: Define the key node recognition function recognition. The specific working method of the recognition function is:
[0049] Get the data in the request content through the get_json() function provided by the request toolkit and parse it into a Python dictionary data type. The command statement is:
[0050] data = request.get_json()
[0051] Use the load function provided by the PyTorch deep learning framework to import the trained deep learning-based command and control network key node identification model instance net and parameters. The command statement is:
[0052] from model import DenSeResNet
[0053] The network structure and training process of the command and control network key node identification model can be referred to the Chinese patent application number CN202111332644.7 "A method for identifying key nodes in a command and control network based on deep learning".
[0054] Load the trained model hyperparameters to generate a command and control network key node identification model instance;
[0055] net=DenSeResNet(in_channel=3, out_channel=4, stride=1, downsample=None, expansion=4, groups=2, width_per_group=64, num_classes=5).double()
[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 recognition model into the specified image processor (GPU) through the to function of the PyTorch deep learning framework:
[0060] net.to('cuda')
[0061] Use the eval function of the PyTorch deep learning framework to set the model to evaluation mode:
[0062] net.eval()
[0063] Use data as the input of the model, and node as the output of the model and the recognition return value:
[0064] with torch.no_grad():
[0065] outputs = net(DATA.to(device))
[0066] node= torch.max(outputs, dim=1)[1].data.cpu().numpy()
[0067] Calling the jsonify tool returns a JSON response containing the identified node and sets the HTTP status code to 200:
[0068] return jsonify(node), 200 .
[0069] Step 1-4: Bind the recognition function to the specified URL path:
[0070] Use the @app.route decorator to bind the recognition function to the specified URL path. The decorator is placed before and immediately after the recognition function. When a request matches this path, Flask will call the recognition function. In addition, set the decorator parameter Method=['POST'] to only allow POST requests via the HTTP method:
[0071] @app.route(' / recognition', methods=['POST']) .
[0072] Step 1-5: Set the built intelligent command and control network key node identification service as the main program:
[0073] Call the app.run() function and set the host, port, and debug parameters. In host, set the corresponding IP address of this service to http: / / 192.168.0.107. Port is used to specify the port number that the application listens on, which is set to 5000. debug is used as a Boolean variable to set whether to enable the debug mode, and True is assigned to debug.
[0074] Step 2: Provide key node identification service of intelligent command and control network based on Flask framework:
[0075] Step 2-1: Start the main program:
[0076] By if __name__ == '__main__', run the app.run() function to start the service.
[0077] Step 2-2: Respond to the request and return the recognition result:
[0078] Equipment systems or subsystems that need key node identification capabilities use the post function in the requests toolkit to send requests. The command and control network structure that requires key node identification is as follows: Figure 2 As shown in the figure, the communication relationship and communication type data DATA between the command and control network nodes obtained by communication reconnaissance. In the post function, the URL path and the data to be identified DATA need to be set, and DATA is as follows: [[[0.000 0.070 0.078 0.021 0.046] [0.073 0.000 0.047 0.000 0.000] [0.031 0.000 0.000 0.000 0.000] [0.066 0.000 0.000 0.000 0.000] [0.094 0.000 0.000 0.000 0.000]] [[0.000 0.041 0.067 0.034 0.016] [0.010 0.000 0.000 0.000 0.000] [0.012 0.000 0.000 0.000 0.000] [0.001 0.000 0.000 0.000 0.000] [0.005 0.000 0.000 0.000 0.000]] [[0.000 0.072 0.073 0.048 0.013] [0.015 0.000 0.000 0.000 0.000] [0.042 0.000 0.000 0.000 0.000] [0.045 0.000 0.000 0.000 0.000 [0.028 0.000 0.000 0.000 0.000 ]]]
[0094] Send DATA data in the form of a dictionary, where the key is 'data' and the corresponding value is the data to be identified. Convert DATA to JSON format:
[0095] dict = json.dumps(dict)
[0096] Send a POST request using HTTP method:
[0097] requests.post(url=web, json=dict)
[0098] The key node recognition service listening port of the intelligent command and control network determines whether there is a corresponding route and request for the recognition service. When the request path matches 'http: / / 192.168.0.107:5000 / recognition', Flask will call the recognition function and return the recognized key node node to the applicant's res variable in the form of a JSON string:
[0099] res = requests.post(url=web, json=dict)
[0100] In this embodiment, the res value is 0, indicating that the identified key node is node 0 among the nodes to be identified.
[0101] In summary, the present invention implements a command and control network key node intelligent identification program hosted based on the Flask framework. The device that needs to identify the key node in the network can send the command and control network interconnection relationship data obtained by reconnaissance to the intelligent identification service of the specified network address through the HTTP post request method, thereby obtaining the identification result. Compared with the service built with Django and Spring frameworks, this method is more lightweight, has lower resource requirements and latency, frees the intelligent node identification capability from the limitation of being a rigidly connected component of the system, and improves the degree of modularity by reducing the complexity of data interaction.
Claims
1. A lightweight command and control network key node intelligent identification service construction method, It is characterized in that The following steps are involved: Step 1: Build an intelligent command and control network key node identification service based on the Flask framework; the specific method is: Step 1-1: Import the Flask framework; Step 1-2: Use the app function provided by Flask to create a Flask application instance; Step 1-3: Define the key node identification function; the key node identification function works as follows: Get the data in the request content through the get_json() function provided by the request toolkit and parse it into a Python dictionary data type; Use the loading function provided by the PyTorch deep learning framework to import the trained command and control network key node identification model instance and parameters; Put the recognition model into the specified image processor through the device function of the PyTorch deep learning framework; Use the eval function of the PyTorch deep learning framework to set the model to evaluation mode; Use data as the input of the model, and node as the output of the model and the recognition return value; Call the jsonify tool, which returns a JSON response containing the identified node and sets the HTTP status code to 200. Step 1-4: Bind the key node identification function to the specified URL path to complete the construction of the key node identification service of the intelligent command and control network; the specific method is: Use the @app.route decorator to bind the key node identification function to the specified URL path; the decorator is placed before and next to the key node identification function; when a request matches the URL path, Flask will call the key node identification function; in addition, set the parameters of the decorator to only allow POST requests to be received through the HTTP method; Step 1-5: Set the intelligent command and control network key node identification service as the main program; Step 2: Provide key node identification service of intelligent command and control network based on Flask framework, specifically: Step 2-1: Start the main program Run the app.run() function by if __name__ == '__main__' Step 2-2: Respond to the request and return the recognition result The device system or subsystem that needs the key node identification capability uses the post function in the requests toolkit to send the identification application; wherein the post function is set with the URL path and the data to be identified DATA, and the data to be identified DATA is sent in the form of a dictionary in JSON format; The key node identification service listening port of the intelligent command and control network determines whether there is a route and request corresponding to the identification service. If so, the key node identification function is run and the identified key node is returned to the applicant's res variable in the form of a JSON string.
