A segmentation calculation method of neural network in mesh network scenario
By dividing the device layers in a mesh network scenario and performing neural network segmentation algorithms, and using an orderly optimal solution-reserved genetic algorithm for collaborative calculations, the problems of limited network bandwidth and large computing delay are solved, and efficient neural network computing and fast response are achieved.
Patent Information
- Application Number
- CN202210136875.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-15
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2042-02-15
AI Technical Summary
In the case of limited network bandwidth, it is difficult to achieve the demand for low latency for neural network applications, and the computing delay of a single edge device is too large, resulting in slow response speed.
By dividing the device layer in a mesh network scenario and using an ordered optimal solution-preserved genetic algorithm to perform neural network segmentation algorithm, the neural network can be synergistically calculated among multiple edge devices, and the sub-neural network is segmented and deployed to reduce the computing load.
It greatly reduces the computing load of edge devices, improves computing speed, reduces the response time of neural network applications at the edge, and meets the needs of low latency.
Smart Images

Figure CN114528986B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of edge computing and computer communications, and specifically relates to a neural network segmentation calculation method in a mesh network scenario. The method is used to perform a neural network calculation process in the absence of cloud computing or limited network bandwidth. Background Art
[0002] With the rise of artificial intelligence and the popularity of neural network applications, more and more devices can support neural network applications. Various types of applications such as image classification, speech recognition, and natural language processing are becoming more and more popular in various types of user terminal devices. Faced with a large number of user requests and an increasingly heavy network transmission burden, how to increase the response speed of neural network applications and improve request processing capabilities are technical difficulties that need to be solved at present.
[0003] Neural network technology is an effective way to implement artificial intelligence applications. Current artificial intelligence applications often use a series of neural network layers to build models, so this model is also called a deep neural network. Each layer of a deep neural network is composed of neurons that can produce nonlinear outputs based on the input and output data of the neurons. The neurons in the input layer receive data and propagate it to the middle layer (also called the hidden layer). Then, the neurons in the middle layer generate a weighted sum of the input data and output the weighted sum using a specific activation function, and then propagate the output to the output layer. The final result is displayed in the output layer. Deep neural networks have more complex and abstract layers than general machine learning models, and can learn advanced features to achieve high-precision task reasoning. There are three common structures of deep neural networks: fully connected layers (FNN), convolutional neural network layers (CNN), and recurrent neural network layers (RNN).
[0004] At present, a considerable number of neural network applications require high computing power, so tasks such as image recognition and speech recognition are often deployed in the cloud for computing. However, when user requests are frequent or the network is congested, the data transmission delay will increase significantly, thereby reducing the response speed of neural network applications. Therefore, when the network bandwidth is limited, the network transmission delay overhead accounts for a higher proportion than the delay caused by cloud computing. In addition, in some special scenarios, such as when the wide area network is disconnected or the cloud server is down, cloud computing will become unavailable. At this time, edge computing as a supplement to cloud computing becomes particularly important.
[0005] Edge computing is an emerging research field that aims to push cloud services from the core of the network to network edge devices closer to the requester, such as network base stations, routers, etc. Its core purpose is to provide computing services to the requester while being as close to the requesting terminal as possible. Compared with cloud computing, edge computing can complement cloud computing, reduce network burden, speed up response speed, and reduce communication latency, but at the same time, there will be more computing latency overhead when processing the same task. Faced with tasks such as neural networks that require high computing resources, edge computing of a single edge device is often limited by computing bottlenecks, resulting in excessive computing latency.
[0006] The existing technology has edge routers that can form a mesh network and provide computing power. A mesh network is a way to transmit data and control instructions between network nodes through dynamic routing. In the mesh network scenario, multiple edge devices, such as edge routers, form a mesh network. They have a good communication environment and can adaptively adjust the connection according to the actual communication situation. Specifically, this network can keep the connection between each node intact. When a node in the network topology fails or cannot be served, this architecture allows the use of a "jump" method to form a new route and send the information to the transmission destination. At present, the edge routers that constitute the mesh network often serve as a bridge for forwarding information and act as an information pipeline. As an edge device close to the requester, its computing power also needs to be explored.
[0007] Distributed computing breaks down applications into many small parts by segmenting neural networks and assigning them to multiple computers for processing, which can save overall computing time and reduce the computing load on the machine.
[0008] Therefore, there is an urgent need for an edge-to-edge collaborative computing technology to treat these edge devices as a computing cluster to segment and deploy larger-scale neural network models. Summary of the invention
[0009] The purpose of the present invention is to provide a segmentation calculation method for a neural network in a mesh network scenario, so as to significantly reduce the computing load of edge devices and improve the computing speed, thereby solving the demand for low latency in neural network applications in scenarios with limited network bandwidth.
[0010] In order to achieve the above object, the present invention provides a segmentation calculation method of a neural network in a mesh network scenario, comprising:
[0011] S1: Divide the mesh network into device layers to obtain device layer information;
[0012] S2: executing a neural network segmentation algorithm according to the device layer information and the neural network layer information of the neural network to obtain a segmentation solution that meets the latency requirement;
[0013] S3: Deploy neural network segmentation based on device layer information and a segmentation scheme that meets latency requirements.
[0014] The step S1 comprises:
[0015] S11: Select at least one edge device in the mesh network and mark it as an edge device of the first device layer;
[0016] S12: Let i=1, where parameter i is the ordinal number of the device layer;
[0017] S13: Mark the edge devices that are directly connected to the edge devices of the i-th device layer and have not been marked as edge devices of the i+1-th device layer;
[0018] S14: Determine whether there are any edge devices that have not been marked. If yes, set i=i+1 and execute step S13. Otherwise, end step S1.
[0019] The device layer information includes the total number of device layers after the mesh network is divided, and the number of edge devices in each device layer.
[0020] The neural network layer information is obtained based on a trained neural network to be segmented, and includes the number of neural network layers in the neural network and the layer type of each neural network layer.
[0021] In step S2, the neural network segmentation algorithm is an ordered optimal solution retaining genetic algorithm.
[0022] The step S2 comprises:
[0023] S21: Determine the number of segmentation points according to the number of device layers, and express all segmentation schemes of the neural network to be segmented; meanwhile, define a final fitness function corresponding to the segmentation scheme, wherein the final fitness function is based on a time delay fitness function and an ordered fitness function;
[0024] S22: The genetic algorithm is executed by taking the segmentation scheme as an individual and the final fitness function corresponding to the segmentation scheme as the individual fitness; and in the process of executing the genetic algorithm, the optimal solution is retained, and finally a segmentation scheme that meets the delay requirement is obtained.
[0025] The kth partitioning scheme x k for:
[0026]
[0027] in, l is the total number of layers in the neural network, Represents the position of the jth segmentation point of the kth segmentation scheme, 1≤j≤n-1, k represents the ordinal number of the segmentation scheme, and n is the total number of device layers;
[0028] The delay fitness function f delay (x k )for:
[0029]
[0030] Among them, x k represents the kth segmentation scheme; T comp is the computational latency of the entire neural network on the edge device, is the communication delay between the jth device layer and the j+1th device layer, n represents the total number of device layers; σ(x) is the compression function;
[0031]
[0032] Ordered fitness function f order (x k )for:
[0033] f order (x k )=σ(r(x k )),
[0034] r(x k ) is the reverse number; I(x>y) is the indicator function;
[0035]
[0036] The final fitness function f fitness (x k ) is: f fitness (x k )=αf delay (x k ),
[0037] Among them, α is the weight.
[0038] The calculation delay T comp It is obtained by actually running each neural network layer of the entire neural network once on each edge device; the communication delay is obtained according to the output data volume of each neural network layer of the neural network and the bandwidth between two adjacent device layers.
[0039] The step S22 comprises:
[0040] S221: Initialize genetic algebra p; initialized genetic algebra p=0;
[0041] S222: Generate an initial population pop(0), and calculate the individual fitness of all segmentation schemes in the initial population pop(0);
[0042] S223: If there is a partitioning scheme in the current p-th generation population pop(p) that meets the delay requirement, return the partitioning scheme that meets the delay requirement and end step S2, otherwise continue to execute step S224;
[0043] S224: take p+1 as the updated genetic generation p;
[0044] S225: According to the genetic strategy, individuals from the p-1 generation population pop(p-1) are selected for hybridization, mutation, and replication to obtain the p-generation population pop(p), and the optimal solution is retained;
[0045] S226: If the individual fitness of the merit individual e(p-1) of the p-1th generation is better than that of the pth generation e(p), one of the individuals is randomly replaced by e(p-1), and then the merit e(p) of this generation is recorded; otherwise, the merit e(p) of this generation is directly recorded;
[0046] S227: Calculate the individual fitness of the p-th generation population pop(p), and return to step S223.
[0047] The step S3 includes: the sub-neural networks divided in the segmentation scheme are deployed backward in sequence according to the order of each device layer in the device layer information, and the final user's request is sent to the first device layer, and the result is finally obtained after layer-by-layer processing.
[0048] The segmented computing method of the neural network of the present invention in the mesh network scenario divides the device layer, and through the edge device collaborative computing technology, the same sub-neural network can be deployed on the same device layer composed of multiple edge devices through the connection of edge devices for collaborative computing; this computing mode can greatly reduce the computing load of edge devices and improve the computing speed, thereby accelerating the response speed of neural network applications at the edge, and solving the demand for low latency in neural network applications in scenarios with limited network bandwidth.
[0049] In addition, the present invention divides the neural network through a certain method, allowing each device layer composed of edge devices to calculate a part of the neural network respectively. Through collaborative calculations between multiple device layers, the computing load of edge devices in a single device layer can be alleviated, thereby improving the computing efficiency of edge devices. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 It is an overall flow chart of the segmentation calculation method of the neural network of the present invention in the mesh network scenario.
[0051] Figure 2It is a principle diagram of the partitioning device layer of the segmentation calculation method of the neural network in the mesh network scenario of the present invention.
[0052] Figure 3 It is a flow chart of step S22 of the segmentation calculation method of the neural network in the mesh network scenario of the present invention.
[0053] Figure 4 It is a schematic diagram of a scenario of neural network segmentation deployment of the neural network segmentation calculation method of the present invention in a mesh network scenario.
[0054] Figure 5 It is a diagram of the overall deployment effect after segmentation deployment using the segmentation calculation method of the neural network of the present invention in a mesh network scenario. DETAILED DESCRIPTION
[0055] The preferred embodiments of the present invention are given below in conjunction with the accompanying drawings and described in detail.
[0056] The present invention provides a segmentation calculation method for a neural network in a mesh network scenario, which uses edge devices that constitute the mesh network as computing devices and only uses the collaborative computing of multiple groups of edge devices, without the need to consider the collaborative computing of edge devices and the cloud separately. This patent is suitable for neural network application scenarios with low latency requirements and high response speed requirements.
[0057] like Figure 1 The figure shows the overall process of a segmentation calculation method of a neural network in a mesh network scenario of the present invention.
[0058] In general, the segmentation calculation method of the neural network in the mesh network scenario includes the following steps:
[0059] Step S1: Divide the mesh network into device layers to obtain device layer information;
[0060] For the edge devices that make up the mesh network, the present invention defines the concept of device layer. Edge devices in the same device layer will run the same sub-neural network, while edge devices in different device layers will collaborate in neural network calculations. The concept of device layer is first proposed in the present invention, and its purpose is to divide the mesh network into a hierarchical structure to adapt to the hierarchical structure of the neural network and facilitate the subsequent segmentation and deployment of the neural network on the mesh network.
[0061] The step S1 specifically includes:
[0062] Step S11: selecting at least one edge device in the mesh network and marking it as an edge device of the first device layer;
[0063] See Figure 2,In a mesh network (some literature calls it a mesh network), each edge device will be directly connected to at least one ,nearby edge device, and eventually the connections between the edge devices will form a mesh structure, thus becoming a mesh network.
[0064] This mesh network is essentially a graph structure. Any two edge devices can communicate with each other directly or indirectly. If the two devices are directly connected, they can communicate directly through the channel. If there is no direct connection between the two devices, they can communicate indirectly by forwarding data through other devices. According to graph theory, for a mesh structure, there is at least one connected forwarding path between any two edge devices. Among them, direct connection is defined as: edge device A and edge device B are directly connected through a channel (for example, A and B are connected by optical fiber, or a wireless channel is directly established between A and B). Figure 2 For example, although device 2 and device 3 are not directly connected, they can communicate by forwarding data through device 1.
[0065] Step S12: let i=1, where the parameter i means the ordinal number of the device layer;
[0066] Step S13: Mark the edge devices that are directly connected to the edge devices of the i-th device layer and have not been marked as edge devices of the i+1-th device layer;
[0067] Step S14: Determine whether there are any edge devices that have not been marked. If yes, set i=i+1 and execute step S13. Otherwise, it means that the device layer division is completed, so end step S1.
[0068] That is to say, the device layer needs to manually select some devices as the first layer, and then recursively select the second layer and the third layer. Figure 2 A device layer division method is shown. Figure 2 For example, in step S11 and step S12, device 1 is selected, and the device layer number is marked as layer 1. In step S13, device 1 searches for a device directly connected to itself, and if the device has not been marked with a layer number, it is marked as layer 2. Since devices 2 and 3 are directly connected to device 1, they are both marked as edge devices of the second device layer. This process is repeated until all devices are marked with device layer numbers.
[0069] The obtained device layer information includes the total number of device layers after the mesh network is divided, and the number of edge devices in each device layer, which reflects the division method of the device layer.
[0070] Therefore, through the above steps, the edge devices that make up the mesh network can be quickly divided into a linear hierarchical structure, so that for edge devices located in the same device layer, they execute tasks in parallel, and edge devices located in different layers collaborate to calculate the neural network.
[0071] Step S2: executing a neural network segmentation algorithm according to the device layer information and the neural network layer information of the neural network to obtain a segmentation scheme that meets the latency requirement;
[0072] The neural network layer information is obtained based on the trained neural network to be segmented, including the number of neural network layers in the neural network and the layer type of each neural network layer. This edge-edge collaborative computing mode of the neural network does not make any requirements on the neural network and can be of any type.
[0073] After the device layer is divided, the neural network layer information needs to be determined based on the device layer information. Different segmentation methods will have different delays. In order to find the best neural network segmentation method, the neural network segmentation algorithm adopted in the present invention is an ordered optimal solution retaining genetic algorithm to ultimately obtain a segmentation solution that meets the delay requirements.
[0074] The step S2 comprises:
[0075] Step S21: Determine the number of segmentation points according to the number of device layers, and express all segmentation schemes of the neural network to be segmented; meanwhile, define a final fitness function corresponding to the segmentation scheme, wherein the final fitness function is based on a time delay fitness function and an ordered fitness function;
[0076] Assume that the neural network we want to segment is L = {l 1 ,l 2 …,l l That is, for a neural network with a total of l layers, the mesh network of edge devices is divided into n device layers, so we need to select n-1 split points to split the neural network. For the kth split scheme x k , which can be written as:
[0077]
[0078] in, l is the total number of layers in the neural network, Represents the position of the jth segmentation point of the kth segmentation scheme (i.e., the number of neural network layers corresponding to the segmentation point), 1≤j≤n-1, k represents the ordinal number of the segmentation scheme, and n is the total number of device layers.
[0079] The total number of splitting schemes is a combinatorial problem. Assuming there is a 10-layer neural network and 2 device layers, then 1 split point is needed to split the neural network into two, deployed on device layer 1 and device layer 2 respectively. In general, for a neural network with 1 layer, if there are n-1 splitting points to be set, the total number of schemes is That is, the range of the ordinal number k of the partitioning scheme is It is necessary to find the optimal segmentation solution.
[0080] The device layers are not equivalent, and the order of the device layers should be consistent with the order of the neural network. That is, for the n sub-neural networks of the neural network divided by n-1 split points, the first sub-neural network should be deployed on the first device layer, the second sub-neural network should be deployed on the second device layer, and so on.
[0081] Let's take a specific example. Assuming the number of neural network layers is 10 and the device layer has 4 layers, three split points are needed. Then x 1 ={1,5,7} is a possible partitioning scheme, which means that the partitioning points of the neural network are selected at layers 1, 5, and 7. That is, the first layer of the neural network is deployed on the first layer of the device layer, the second to fifth layers of the neural network are deployed on the second layer of the device layer, the sixth to seventh layers of the neural network are deployed on the third layer of the device layer, and the eighth to tenth layers of the neural network are deployed on the fourth layer of the device layer.
[0082] For any split point We note that it is independent of the order of the split points. For example, and The two partitioning schemes {1,7,5} and {5,7,1} are essentially the same as x. 1 The same is that the neural network is segmented on the 1st, 5th, and 7th layers. However, a genetic algorithm is used to search for the segmentation scheme k in the following text. When generating offspring, the genetic algorithm will treat these solutions with different orders but the same essence as different solutions. Therefore, if a simple genetic algorithm is used to solve the problem, repeated solutions will be blindly searched in the solution space, which will increase the algorithm's runtime delay. In order to optimize the iteration speed of the genetic algorithm, the concept of the order of the solution is introduced, and a genetic algorithm for retaining the ordered optimal solution is proposed, so that the genetic algorithm is constrained to solve the problem in the ordered solution space as much as possible, thereby speeding up the iteration speed and ensuring the optimal solution as much as possible.
[0083] In the genetic algorithm, for any partitioning scheme x k , its fitness reflects the probability of the solution being retained. The higher the fitness, the higher the probability of being retained in the algorithm. For the neural network segmentation problem, there are two factors that affect the fitness: 1) The current segmentation scheme xk The corresponding delay, the smaller the delay, the higher the fitness; 2) The current segmentation scheme x k The corresponding degree of order, the higher the degree of order, the higher the fitness.
[0084] First, we define the delay fitness function f delay (x k )for:
[0085]
[0086] Among them, x k represents the kth segmentation scheme; T comp is the computational latency of the entire neural network on the edge device, is the communication delay between the jth device layer and the j+1th device layer, and n represents the total number of device layers.
[0087] Compression function x is only used to illustrate the function. When x>0, σ(x) can compress it to the range of (0,1), and as x increases, σ(x) decreases, so the fitness calculation can be completed well from the perspective of delay.
[0088] Among them, the calculation delay T comp The result is obtained by running each neural network layer of the entire neural network once on each edge device. For example, for a 10-layer neural network, the first edge device runs once and counts the running time of each neural network layer, which is saved locally in the form of an array, which may be recorded as floatT 1
[10] , then when the 1-2 layers of the entire neural network are running on device 1, the computational latency of the 1-2 layers is T 1 [0]+T 1 [1].
[0089] Similarly, communication delay It is obtained based on the output data volume of each neural network layer and the bandwidth between two adjacent device layers: The output data volume of each neural network layer is also recorded in an array intD 1
[10] , the bandwidth between the first device layer and the next layer device is denoted as B, then the communication delay can be recorded as Here, because the array starts counting from 0, T 1 [1], D 1 [1] represents the amount of output data corresponding to the second layer of the neural network.
[0090] Second, we need to define the ordered fitness function f order(x k ), in order to reflect a partitioning scheme x k To determine the degree of order of a sequence, we first define the number of inversions of the sequence. Its reverse number r(x k ) is defined as:
[0091]
[0092] in is the indicator function.
[0093] r(x k ) reflects the partitioning scheme x k The higher the disorder of the sequence, the higher the disorder. k ), so with the help of the inverse number, we can construct the ordered fitness function f order (x k )for:
[0094] f order (x k )=σ(r(x k )),
[0095] Therefore, the lower the disorder, the more ordered the fitness function f order (x k ) value is higher.
[0096] In this way, the two fitness functions can be used to select the segmentation scheme x k In the solution space, the partitioning scheme x with small delay will be preferred. k At the same time, it can avoid repeated solutions by selecting the lowest possible disorder, which can speed up the convergence. Therefore, the final fitness function f fitness (x k ) is defined as:
[0097] f fitness (x k )=αf delay (x k )+(1-α)f order (x k ),
[0098] Among them, α is the weight, which depends on whether we want to give priority to solutions with smaller delays or to ordered solutions in the actual process.
[0099] Step S22: The genetic algorithm is executed by taking the segmentation scheme as an individual and the final fitness function corresponding to the segmentation scheme as the individual fitness; and in the process of executing the genetic algorithm, the optimal solution is retained to finally obtain a segmentation scheme that meets the delay requirement.
[0100] Based on the ordered fitness function f order (x k ) Finally, we designed an ordered optimal solution-retaining genetic algorithm to calculate the final fitness function f fitness (x k ), we use the ordered fitness function f order (x k ) to process. In addition, compared with the simple genetic algorithm, we propose to forcibly retain the optimal solution in the previous generation during the copy operation. The specific definition is as follows:
[0101] If in a genetic algorithm, the number of generations is p, the optimal individual e(p) of the pth generation is called a merit individual; if in a genetic algorithm, the merit individual e(p) of the pth generation is better than e(p+1) of the p+1th generation, then using e(p) to replace any individual in the p+1th generation (including replacing the merit individual of the p+1th generation) is called an optimal solution retention operation.
[0102] Therefore, the overall process of step S22 (i.e., the ordered optimal solution preserving genetic algorithm) is as follows:
[0103] Step S221: Initialize the genetic algebra p;
[0104] Among them, the initialized genetic generation number p = 0;
[0105] Step S222: generate an initial population pop(0), and calculate the individual fitness of all segmentation schemes in the initial population pop(0);
[0106] Among them, the individual fitness is obtained using the final fitness function.
[0107] The initial population generates a fixed number of random solutions for the partitioning scheme. The number of random solutions is a hyperparameter in the genetic algorithm and is determined by the user according to the specific situation. For example, in the experiment, we set the number of random solutions for the partitioning scheme of the initial population to 1000, that is, 1000 individuals were initialized. Specifically, for the partitioning scheme At this time, the range of the ordinal number k of the segmentation scheme is 1-1000.
[0108] Step S223: If there is a partitioning scheme in the current p-th generation population pop(p) that meets the delay requirement, return to the partitioning scheme that meets the delay requirement and end step S2, otherwise continue to execute step S224;
[0109] The latency requirement is related to the specific task and is determined according to the task requirements. For example, for a neural network for image recognition, we expect it to complete the calculation within 1 second, so the latency requirement is 1 second.
[0110] Step S224: taking p+1 as the updated genetic generation p, i.e. setting p=p+1;
[0111] It should be noted that, in some embodiments, Figure 3 As shown, step S224 can also be performed after the following step S226, except that p-1 in step S225 and step S226 needs to be changed to p, and p needs to be changed to p+1.
[0112] Step S225: select individuals from the p-1 generation population pop(p-1) for hybridization, mutation, and replication according to the genetic strategy to obtain the p-th generation population pop(p), and retain the optimal solution;
[0113] The number of individuals in the population pop(p) is the same in each generation.
[0114] The specific order of operations to obtain the p-th generation population pop(p) is crossover, mutation, and replication. The specific operations are as follows:
[0115] 1) Hybridization
[0116] For the pop(p-1) population, suppose there are 1000 individuals. First, 500 pairs of individuals are formed by randomly pairing them up.
[0117] For each pair of individuals, perform the following operations: randomly select subsequences of the same length and exchange them. Take the following as an example:
[0118] For a pair of individuals, {1, 2, 3, 4, 5}, {10, 11, 12, 13, 14}, randomly generate a subsequence, here {2, 3, 4}, {12, 13, 14}. Then exchange them, and finally get two new individuals {1, 12, 13, 14, 5}, {10, 11, 2, 3, 4}.
[0119] Therefore, in the end, 500 pairs of old individuals will produce 500 pairs of new individuals.
[0120] 2) Mutation
[0121] For these 1000 pairs of individuals, one tenth of the individuals are randomly selected, and one of these individuals is randomly selected and exchanged with the adjacent position.
[0122] 3) Copy
[0123] For 1000 pairs of individuals, calculate their fitness and sort them from large to small in fitness order, and copy and retain the first 1000 individuals as pop(p). And,
[0124] Step S226: If the individual fitness of the merit individual e(p-1) of the p-1th generation is better than that of e(p) of the pth generation (i.e., the individual fitness is higher), one of the individuals is randomly replaced by e(p-1), and then the merit e(p) of this generation is recorded; otherwise, no replacement is performed, and the merit e(p) of this generation is directly recorded;
[0125] Step S227: Calculate the individual fitness of the p-th generation population pop(p), and return to step S223.
[0126] Step S3: Perform neural network segmentation deployment according to device layer information and a segmentation scheme that meets latency requirements;
[0127] Step S3 includes:
[0128] The sub-neural networks divided in the segmentation scheme are deployed backward in sequence according to the order of each device layer in the device layer information. The final user's request is sent to the first device layer, and the result is finally obtained after layer-by-layer processing.
[0129] Figure 4 A specific situation of neural network segmentation deployment is shown. In the mesh network composed of 5 edge devices, 3 device layers are divided. The user's request is transmitted between the device layers, and finally passes through the first sub-neural network (i.e. sub-model 1), the second sub-neural network (i.e. sub-model 2), and the third sub-neural network (i.e. sub-model 3) in sequence to finally obtain the complete processing result.
[0130] Simulation Results
[0131] The present invention sets up 5 edge devices through simulation, divides a total of 4 device layers, builds a 34-layer VGG network for segmentation deployment, and after orderly optimal solution retention genetic algorithm processing, the final segmentation points are divided into 6, 15, 31, and 33 layers. The overall deployment effect after segmentation can be seen in Figure 5 .
[0132] The input data is processed using a 1080×1260 image. The following Table 1 compares the ordered optimal solution-retaining genetic algorithm proposed in step S2 of the present invention with the existing algorithm. It can be seen that compared with the simple genetic algorithm and the ordinary optimal solution-retaining algorithm, the ordered optimal solution-retaining genetic algorithm proposed in this patent has a better convergence value and a faster convergence speed, and can therefore perform faster and better segmentation and deployment of the neural network.
[0133] Table 1 Comparison between the ordered optimal solution preserving genetic algorithm and existing algorithms
[0134]
[0135] Table 2 below shows the processing time of the VGG network segmented and deployed by the segmentation calculation method of the neural network proposed in the present invention in the mesh network scenario. Compared with other segmentation methods, it can be seen that compared with uniform segmentation and deployment of the neural network, or random segmentation and deployment of the neural network, the segmentation calculation method of the neural network proposed in this patent in the mesh network scenario can bring better latency optimization and better performance improvement for the collaborative computing of neural networks at the edge.
[0136] Table 2 Comparison of the segmentation calculation method of neural network in mesh network scenario with other segmentation methods
[0137]
[0138] The above is only a preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. The above embodiments of the present invention can also be modified in various ways. All simple, equivalent changes and modifications made according to the claims and the description of the present invention fall within the scope of protection of the claims of the present invention. The contents not described in detail in the present invention are all conventional technical contents.
Claims
1. A segmentation calculation method of a neural network in a mesh network scenario, characterized in that: include: Step S1: Divide the mesh network into device layers to obtain device layer information; Step S2: executing a neural network segmentation algorithm according to the device layer information and the neural network layer information of the neural network to obtain a segmentation scheme that meets the latency requirement; Step S3: Perform neural network segmentation deployment according to device layer information and a segmentation scheme that meets latency requirements; In the step S2, the neural network segmentation algorithm is an ordered optimal solution retaining genetic algorithm; The step S2 comprises: Step S21: Determine the number of segmentation points according to the number of device layers, and express all segmentation schemes of the neural network to be segmented; meanwhile, define a final fitness function corresponding to the segmentation scheme, wherein the final fitness function is based on a time delay fitness function and an ordered fitness function; Step S22: The segmentation scheme is used as an individual, and the final fitness function corresponding to the segmentation scheme is used as the individual fitness to execute the genetic algorithm; and in the process of executing the genetic algorithm, the optimal solution is retained, and finally a segmentation scheme that meets the delay requirement is obtained; The kth partitioning scheme x k for: in, l is the total number of layers in the neural network, Represents the position of the jth segmentation point of the kth segmentation scheme, 1≤j≤n-1, k represents the ordinal number of the segmentation scheme, and n is the total number of device layers; The delay fitness function f delay (x k )for: Among them, x k represents the kth segmentation scheme; T comp is the computational latency of the entire neural network on the edge device, is the communication delay between the jth device layer and the j+1th device layer, n represents the total number of device layers; σ(x) is the compression function; Ordered fitness function f order (x k )for: r(x k ) is the reverse number; I(x>y) is the indicator function; The final fitness function f fitness (x k )for: f fitness (x k )=αf delay (x k ), Among them, α is the weight; The calculation delay T comp It is obtained by actually running each neural network layer of the entire neural network once on each edge device; the communication delay is obtained according to the output data volume of each neural network layer of the neural network and the bandwidth between two adjacent device layers.
2. The segmentation calculation method of a neural network in a mesh network scenario according to claim 1 is characterized in that: The step S1 comprises: Step S11: selecting at least one edge device in the mesh network and marking it as an edge device of the first device layer; Step S12: let i=1, where parameter i is the ordinal number of the device layer; Step S13: Mark the edge devices that are directly connected to the edge devices of the i-th device layer and have not been marked as edge devices of the i+1-th device layer; Step S14: Determine whether there are any edge devices that have not been marked. If yes, set i=i+1 and execute step S13; otherwise, end step S1.
3. The segmentation calculation method of a neural network in a mesh network scenario according to claim 1 is characterized in that: The device layer information includes the total number of device layers after the mesh network is divided, and the number of edge devices in each device layer.
4. The segmentation calculation method of a neural network in a mesh network scenario according to claim 1, characterized in that: The neural network layer information is obtained based on a trained neural network to be segmented, and includes the number of neural network layers in the neural network and the layer type of each neural network layer.
5. The segmentation calculation method of a neural network in a mesh network scenario according to claim 1, characterized in that: The step S22 comprises: Step S221: Initialize the genetic generation number p; the initialized genetic generation number p=0; Step S222: generate an initial population pop(0), and calculate the individual fitness of all segmentation schemes in the initial population pop(0); Step S223: If there is a partitioning scheme in the current p-th generation population pop(p) that meets the delay requirement, return to the partitioning scheme that meets the delay requirement and end step S2, otherwise continue to execute step S224; Step S224: taking p+1 as the updated genetic generation number p; Step S225: select individuals from the p-1 generation population pop(p-1) for hybridization, mutation, and replication according to the genetic strategy to obtain the p-th generation population pop(p), and retain the optimal solution; Step S226: If the individual fitness of the merit individual e(p-1) of the p-1th generation is better than that of the pth generation e(p), one of the individuals is randomly replaced by e(p-1), and then the merit e(p) of this generation is recorded; otherwise, the merit e(p) of this generation is directly recorded; Step S227: Calculate the individual fitness of the p-th generation population pop(p), and return to step S223.
6. The segmentation calculation method of a neural network in a mesh network scenario according to claim 1, characterized in that: The step S3 includes: the sub-neural networks divided in the segmentation scheme are deployed backward in sequence according to the order of each device layer in the device layer information, and the final user's request is sent to the first device layer, and the result is finally obtained after layer-by-layer processing.
Citation Information
Patent Citations
Chaos genetic BP neural network image segmentation method based on Arnold transformation
CN107330902A
Image identification cooperative computation method and system based on neural network
CN108255605A