A method for deploying a network model, computer equipment, and storage medium.
By converting the network model into an intermediate model adapted to the device to be deployed, and adjusting the operator connection order or type, the compatibility and computational efficiency issues between different network frameworks are resolved, and the performance optimization of the target network model on the device to be deployed is achieved.
Patent Information
- Application Number
- CN202310199461.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-24
- Publication Date
- 2025-10-31
- Estimated Expiration
- 2043-02-24
AI Technical Summary
Improving the performance of target network models deployed on devices presents challenges, particularly in terms of compatibility and computational efficiency across different network frameworks.
The target network model is obtained by converting the network model into an intermediate network model that adapts to the network framework of the device to be deployed, and by converting the operator connection order or operator type in response to the need for adjusting the computational load, and then deploying it to the device to be deployed.
It reduces the computational load and time consumption of the target network model, improves the computational and deployment efficiency of the model, and optimizes the performance of the model on the device to be deployed.
Smart Images

Figure CN116306866B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of model deployment technology, specifically to a method for deploying a network model, a computer device, and a storage medium. Background Technology
[0002] With the rapid development of the field of artificial intelligence, the application scenarios of deep learning network models are increasing. How to improve the performance of the target network model deployed on the device to be deployed has become an urgent problem to be solved. Summary of the Invention
[0003] This application provides a method for deploying a network model, a computer device, and a storage medium, which can improve the performance of a target network model deployed to a device to be deployed.
[0004] To solve the above-mentioned technical problems, the technical solution adopted in this application is: to provide a method for deploying a network model, the method comprising: obtaining a network model; converting the network model into an intermediate network model adapted to the network framework of the device to be deployed; converting the operator connection order or operator type of the intermediate network model in response to the computational load adjustment requirements to obtain a target network model; and sending the target network model to the device to be deployed so that the device to be deployed can complete the deployment of the target network model.
[0005] To solve the above-mentioned technical problems, another technical solution adopted in this application is: to provide a computer device, the computer device including a memory and a processor connected to each other, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, it is used to implement the deployment method of the network model in the above-mentioned technical solution.
[0006] To solve the above-mentioned technical problems, another technical solution adopted in this application is to provide a computer-readable storage medium for storing a computer program, which, when executed by a processor, is used to implement the deployment method of the network model in the above-mentioned technical solution.
[0007] The beneficial effects of this application through the above scheme are as follows: A network model is obtained, then converted into an intermediate network model adapted to the network framework of the device to be deployed. In response to the need for adjusting computational load, the operator connection order or operator type of the intermediate network model is converted to obtain the target network model. The target network model is then sent to the device to be deployed, enabling the device to complete the deployment of the target network model. By adjusting the operator connection order or operator type, the computational load of the target network model can be reduced, thereby reducing the computational time of the target network model, improving the computational efficiency of the target network model, and ultimately optimizing the performance of the target network model deployed to the device to be deployed, while significantly improving model deployment efficiency. Attached Figure Description
[0008] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Wherein:
[0009] Figure 1 This is a flowchart illustrating an embodiment of the network model deployment method provided in this application;
[0010] Figure 2 This is a schematic diagram of the framework operator mapping relationship between ONNX, Caffee, and the device to be deployed, provided in this application;
[0011] Figure 3 This is a flowchart illustrating another embodiment of the network model deployment method provided in this application;
[0012] Figure 4 This is a schematic diagram of the intermediate network model provided in this application;
[0013] Figure 5 This is a schematic diagram of the structure of an embodiment of the target network model provided in this application;
[0014] Figure 6 This is a schematic diagram of another embodiment of the target network model provided in this application;
[0015] Figure 7 This is a flowchart illustrating steps 71-74 provided in this application;
[0016] Figure 8 This is a diagram of the operator connection structure provided in this application;
[0017] Figure 9 This is a schematic diagram of the structure of an embodiment of the computer device provided in this application;
[0018] Figure 10 This is a schematic diagram of an embodiment of the computer-readable storage medium provided in this application. Detailed Implementation
[0019] The present application will now be described in further detail with reference to the accompanying drawings and embodiments. It should be particularly noted that the following embodiments are for illustrative purposes only and do not limit the scope of the application. Similarly, the following embodiments are only some, not all, embodiments of the present application, and all other embodiments obtained by those skilled in the art without inventive effort are within the scope of protection of the present application.
[0020] In this application, the reference to "embodiment" means that a specific feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0021] It should be noted that the terms "first," "second," and "third" in this application are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of indicated technical features. Therefore, a feature defined as "first," "second," or "third" may explicitly or implicitly include at least one of that feature. In the description of this application, "multiple" means at least two, such as two, three, etc., unless otherwise explicitly specified. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.
[0022] Please see Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the network model deployment method provided in this application, the method comprising:
[0023] Step 11: Obtain the network model.
[0024] The network model can be a trained deep learning network model to be deployed. It can be an image processing model, such as an image recognition model or an image classification model, etc., which will not be listed here.
[0025] Step 12: Convert the network model into an intermediate network model that adapts to the network framework of the device to be deployed.
[0026] Generally, the network framework of the trained network model differs from that required by the device to be deployed. By converting the network model into an intermediate network model adapted to the network framework of the device, compatibility between the network model and the device can be achieved. This allows the device to recognize the network model under the corresponding network framework, facilitating its subsequent deployment. Common network frameworks include Convolutional Architecture for Fast Feature Embedding (Caffe) and Open Neural Network Exchange (ONNX), among others, which will not be listed here.
[0027] In one embodiment, based on a preset multi-frame operator mapping relationship, each operator in the network model can be converted into an operator adapted to the network framework of the device to be deployed, thereby obtaining an intermediate network model. By referring to the preset multi-frame operator mapping relationship, the network framework of the network model can be converted, eliminating the need to install multiple network framework environments. This makes it applicable to various model conversion environments, supports conversion scenarios for different network frameworks, simplifies the network framework conversion process, and improves the conversion efficiency of the model's network framework.
[0028] Understandably, before transforming the operators in a network model, the model information can be determined first. Then, based on the model information, each layer structure in the network model can be converted into corresponding operators. For example, convolutional layers can be converted into corresponding convolution operators, and fully connected layers into corresponding fully connected operators. Then, based on a preset multi-frame operator mapping relationship, each operator in the network model can be converted into an operator adapted to the network framework of the device to be deployed, thus obtaining an intermediate network model. Furthermore, the operator connection relationships can be determined based on the input and output data names of each layer in the model information.
[0029] Step 12 can be used to convert the various operators in the network model into operators that perform the same functions under the network framework adapted to the device to be deployed. Please refer to [link to relevant documentation]. Figure 2 ,by Figure 2 The above step 12 is illustrated using the example of the mapping relationship between ONNX, Caffee, and the framework operator of the device to be deployed.
[0030] Figure 2The dimension compression operator (squeeze) and dimension expansion operator (unsqueeze) in the ONNX framework and the dimension transformation operator (reshape) in the Caffe framework are operators that implement the same functionality. The squeeze operator reduces data dimensions while keeping the data volume constant; the unsqueeze operator increases data dimensions while keeping the data volume constant; and the reshape operator changes data dimensions while keeping the data volume constant. The network framework adapted to the device to be deployed also uses the reshape operator to implement the above functionality. Therefore, the squeeze and unsqueeze operators in the ONNX framework network model can be converted to reshape operators, while the reshape operator remains unchanged in the Caffe framework network model. Similarly, other operators in the network model can be transformed according to the mapping relationships of other operators. Then, the connection relationships between each operator are determined based on the input and output data names of each operator, thus obtaining an intermediate network model.
[0031] Step 13: In response to the need to adjust the computational load, the operator connection order or operator type of the intermediate network model is transformed to obtain the target network model.
[0032] In response to the need for computational load adjustment, the operator connection order or operator type of the intermediate network model is transformed to obtain the target network model. Specifically, when the computational load of the intermediate network model is large, it indicates that there is a need to adjust the computational load of the intermediate network model. At this time, the operator connection order or operator type of the intermediate network model can be transformed to optimize the computational load of the target network model, so as to obtain a target network model with a smaller computational load.
[0033] Step 14: Send the target network model to the device to be deployed so that the device to be deployed can complete the deployment of the target network model.
[0034] The target network model is used for deployment on the device to be deployed. The target network model can be sent to the device to enable deployment, resulting in a target network model with lower computational complexity, thereby improving the performance of the target network model subsequently deployed on the device. Taking an image recognition model as an example, the optimization operations on the image recognition model in the above embodiments can significantly reduce the computation time of the image recognition model, optimize its image recognition performance, improve its image recognition efficiency, and thus improve the image recognition efficiency of the target network model on the device to be deployed. Simultaneously, by reducing the computational complexity of the target network model, its size is reduced, thereby improving the deployment efficiency of the target network model.
[0035] This embodiment first obtains a network model, then converts it into an intermediate network model adapted to the network framework of the device to be deployed. In response to the need to adjust the computational load, the operator connection order or operator type of the intermediate network model is converted to obtain the target network model. The target network model is then sent to the device to be deployed so that the device can complete the deployment of the target network model. By adjusting the operator connection order or operator type, the computational load of the target network model can be reduced, thereby reducing the computation time of the target network model, improving the computational efficiency of the target network model, and thus optimizing the performance of the target network model deployed to the device to be deployed, while greatly improving the model deployment efficiency.
[0036] In one embodiment, step 14 may include: compiling the target network model into an executable file, and then sending the executable file to the device to be deployed, so that the device to be deployed can configure the executable file and complete the deployment of the target network model on the device to be deployed. Specifically, for different devices to be deployed, an executable file can be compiled using the cross-compilation tool corresponding to the device to be deployed, so that the device to be deployed can use the executable file to execute the target network model, thereby facilitating the deployment of the target network model on the device to be deployed. By converting the target network model into an executable file and then using the executable file to deploy the target network model to the device to be deployed, deployment efficiency can be greatly improved.
[0037] In one embodiment, after the device to be deployed runs the target network model using the executable file, the accuracy of the target network model can be verified to determine whether it is consistent with the original network model. This allows for the identification and correction of errors in the target network model, further ensuring the deployment accuracy of the target network model. Specifically, a similarity check can be performed on the output data of similar operators in the target network model and the original network model to obtain a check result. If the check result meets a preset check condition, it is determined that the target network model is consistent with the original network model. The similarity check includes, but is not limited to, cosine similarity. The preset check condition can be that the similarity is greater than a preset similarity threshold, which is not limited here.
[0038] In this context, "similar operators" refers to operators with the same data output name. The data output name can be used to match similar operators in the target network model with those in the original network model. The same verification data is input into both the target and original network models to perform similarity checks on the output data of similar operators. The verification results are then used to determine whether the output results of similar operators in the target and original network models are consistent. For optimization operations that change the operator connection structure, operators that are not moved do not change their data input / output names; for operators whose type changes or fusion operators, the data input / output names change.
[0039] Please see Figure 3 , Figure 3 This is a flowchart illustrating another embodiment of the network model deployment method provided in this application, the method comprising:
[0040] Step 31: Obtain the network model.
[0041] Step 31 is the same as step 11 in the above embodiments, and will not be repeated here.
[0042] Step 32: Convert the network model into an intermediate network model that adapts to the network framework of the device to be deployed.
[0043] Step 32 is the same as step 12 in the above embodiment, and will not be repeated here.
[0044] When the computational load of the intermediate network model is high, it indicates a need to adjust the computational load. For example, if the intermediate network model contains operators with high computational cost, the operator connection order or operator type can be transformed to meet this need. This can be achieved by changing the operator type of the computationally expensive operators or altering the operator connection order in the intermediate network model, thereby reducing the computational load and obtaining the target network model. The specific steps for transforming the operator connection order or operator type in response to the computational load adjustment requirement are shown in steps 33-35 below.
[0045] Step 33: In response to the existence of a data transformation operator in the intermediate network model with a computational complexity greater than a preset computational threshold, determine whether there exists a first operator in the algorithm library with a smaller computational complexity than the data transformation operator and which performs the same operator function.
[0046] Whether the intermediate network model needs computational adjustment can be determined by checking if there are data transformation operators in the intermediate network model with computational complexity exceeding a preset threshold. The preset threshold can be customized based on actual conditions and is not limited here. In response to the presence of data transformation operators with computational complexity exceeding the preset threshold in the intermediate network model, it is determined that the intermediate network model needs computational adjustment. Then, it is checked whether there is a first operator in the algorithm library with less computational complexity than the data transformation operator and performing the same operator function, to determine whether to convert the operator type. Specifically, the algorithm library can be a custom-updated algorithm database, which can store operators implementing various operator functions. There can be one, two, or more operators implementing the same operator function, which is not limited here.
[0047] Furthermore, the data transformation operator can be an operator that implements the function of data parameter transformation. The data parameters can include, but are not limited to, data format and data dimension. For example, the unsqueeze operator, squeeze operator, and reshape operator that implement data dimension transformation mentioned above will not be listed here.
[0048] Step 34: If there is a first operator in the algorithm library that has a smaller computational load than the data conversion operator and performs the same function, then replace the data conversion operator with the first operator.
[0049] If a first operator exists in the algorithm library that has a smaller computational load than the data transformation operator and performs the same function, the data transformation operator can be replaced with the first operator to obtain the target network model. This reduces the computational load of the data transformation operator in the target network model and thus optimizes the performance of the target network model.
[0050] Step 35: If there is no first operator in the algorithm library that has a smaller computational load than the data conversion operator and performs the same function, then adjust the position of the data conversion operator.
[0051] If there is no first operator in the algorithm library that has a smaller computational load than the data transformation operator and performs the same function, the position of the data transformation operator can be adjusted to obtain the target network model, thereby reducing the computational load of the target network model. The target network model can then be sent to the device to be deployed, enabling the device to deploy the target network model, thus improving the performance of the target network model deployed on the device and increasing the model deployment efficiency.
[0052] Specifically, the steps for adjusting the position of the data transformation operator may include: in response to the output data value of a data operation operator preceding the data transformation operator being greater than the input data value, the data transformation operator may be adjusted to precede the data operation operator, and the operation parameters of the operators following the data transformation operator may be modified to ensure that the output data of each operator remains unchanged before and after the adjustment of the data transformation operator. Here, the data operation operator can be an operator that implements data operation functions, and may include, but is not limited to, fully connected operators, convolution operators, and activation function operators; the operation parameters may include, but are not limited to, the operation dimension, i.e., the axis parameter of the data operation operator.
[0053] Please see Figure 4 The following is based on Figure 4Taking the intermediate network model shown as an example, steps 33-35 above will be explained. The operator connection structure of this intermediate network model is: Long Short Term Memory (LSTM) operator + fully connected layers (FC) operator + softmax activation function operator + permute data dimension transformation operator; where the data arrangement format input to the LSTM operator is TND, where T represents time series, N represents batch size, and D represents feature information. The input data has a 3-dimensional dimension and a numerical size of 80*1*512, that is, 0-dimensional data dim0 is 80, 1-dimensional data dim1 is 1, and 2-dimensional data dim2 is 512. The axis parameter of the FC operator and the softmax operator is 2, that is, the operation is performed on the 2-dimensional data. After the above FC operator, softmax operator, and permute operator process the input data, the output data 1*80*1024 is obtained.
[0054] In response to the computational cost of the permute operator exceeding a preset threshold, the permute operator can be replaced with a data dimension transformation operator with lower computational cost, or the position of the permute operator can be adjusted. If the algorithm library contains a reshape operator with lower computational cost and the same functionality as the permute operator, where the input and output addresses of the reshape operator remain consistent, and it only modifies data dimension information without generating unnecessary computation (i.e., computational cost is zero), and the reshape operator reduces temporary memory allocation, further reducing memory usage, the permute layer can be directly replaced using a reshape layer to reduce the computational and memory usage of the intermediate network model without changing the axis parameters of the FC and softmax operators. In another implementation, such as... Figure 5 As shown, in response to the existence of a reshape operator in the algorithm library that has a smaller computational cost than the permute operator and performs the same function, the reshape layer can be used to replace the permute layer. At the same time, a reshape operator is added before the FC operator. Then, the axis parameter of the FC operator and the softmax operator after the reshape operator is adjusted to 1 to further reduce the computational cost of the target network model. By adjusting the axis parameter, the output data of each operator before and after the data transformation operator is adjusted can be kept unchanged, ensuring the accuracy of the operation and thus improving the stability of the target network model.
[0055] Understandably, the reshape operator is only applicable when the batch size is 1. When the batch size of the intermediate network model is not 1, it can be considered that the reshape operator cannot achieve the same operator function as the permute operator under the intermediate network model. In this case, an optimization scheme that adjusts the position of the data transformation operator can be executed.
[0056] Taking an input data value of 80*2*512 as an example, when the batch size of the intermediate network model is not 1 (meaning there is no operator in the algorithm library with a smaller computational load and the same functionality as the permute operator), the position of the data transformation operator can be adjusted. Specifically, first determine whether the output data value of the FC operator, which precedes the permute operator, is greater than the input data value. It can be understood that the output data value and input data value mentioned here correspond to the data operation dimension of the FC operator. The axis parameter of the FC operator is 2, so the input data value of the FC operator is 512 and the output data value is 1024. Therefore, the output data value of the FC operator is greater than the input data value. Thus, the permute operator can be adjusted to be the operator preceding the FC operator, resulting in the following... Figure 6 The target network model shown is used to reduce the computational cost of the permute operator, thereby reducing the computational and memory requirements of the target network model, and ultimately optimizing the computation time of the target network model, thus achieving performance optimization of the target network model.
[0057] The above two optimization schemes are used to Figure 4 The optimization results of the intermediate network model shown are shown in Tables 1 and 2 below:
[0058] Table 1 Comparison of computational cost before and after optimization
[0059]
[0060] Table 2 Comparison of memory usage before and after optimization
[0061]
[0062]
[0063] As shown in Tables 1 and 2 above, compared with the intermediate network model before optimization, the computational and memory usage of the FC and softmax operators remains unchanged in the optimized target network model. In the optimization scheme that replaces the permute operator, the computational cost of the permute operator is reduced by 80*1*1024, and the memory usage is reduced by 80*1024*4. In the optimization scheme that changes the position of the permute operator, the computational cost of the permute operator is reduced by 80*1*512, and the memory usage is reduced by 80*512*4. In summary, the above optimization schemes can significantly reduce the computational and memory usage of the target network model, achieving effective performance optimization of the target network model.
[0064] Please see Figure 7 In one embodiment, steps 71-74 are included before step 33.
[0065] Step 71: Merge adjacent operators in the intermediate network model that meet the fusion conditions.
[0066] The fusion condition includes: the computation time of the fused operator obtained after fusing adjacent operators is less than the sum of the minimum computation times of the adjacent operators. Specifically, the fused operator obtained after fusing adjacent operators can be compared with the sum of the minimum computation times of the preceding and following operators in the adjacent operators. If the computation time of the fused operator is less than the sum of the minimum computation times of the adjacent operators, the adjacent operators are fused to obtain the fused operator; if the adjacent operators cannot be fused or the computation time of the fused operator is greater than or equal to the sum of the minimum computation times of the adjacent operators, the adjacent operators are not fused. Understandably, in one embodiment, before determining whether adjacent operators meet the fusion condition, it can be first determined whether the adjacent operators have fusion capability. If the adjacent operators have fusion capability, then the step of determining whether the adjacent operators meet the fusion condition is executed.
[0067] Please see Figure 8 ,by Figure 8 Taking the operator connection structure shown as an example, step 71 will be introduced, where, Figure 8 The operator connection structure shown is: convolution operator (conv) + activation function operator (relu) + concatenation operator (concat). The conv operator and the relu operator are adjacent operators. If the conv operator and the relu operator satisfy the fusion condition, the conv operator and the relu operator can be combined to obtain the conv+relu fusion operator. Then, the conv+relu fusion operator and the concat operator are adjacent operators. If the conv+relu fusion operator and the concat operator satisfy the fusion condition, the conv+relu fusion operator and the concat operator can be fused to obtain the conv+relu+concat fusion operator.
[0068] Understandably, there can be two or more algorithms that implement the same operator function. Each algorithm may have a different computation time. Therefore, each operator can be implemented with different algorithms, resulting in different computation times. Thus, the minimum computation time of each operator in adjacent operators can be used as a basis to determine whether adjacent operators should be merged, so as to effectively reduce the computation time.
[0069] Step 72: Obtain the minimum computation time and data format of each operator in the intermediate network model.
[0070] Obtain the minimum computation time and data format of each operator in the intermediate network model. Here, the intermediate network model refers to the model generated after performing the operator fusion processing.
[0071] Step 73: Based on the minimum computation time and data format, determine whether adjacent operators in the intermediate network model meet the format conversion conditions.
[0072] Obtain the minimum computation time and data format of each operator in the intermediate network model, and then determine whether adjacent operators in the intermediate network model satisfy the format conversion conditions based on the minimum computation time and data format.
[0073] Specifically, we can first identify adjacent operators in the intermediate network model whose output data format is inconsistent with the input data format of the next operator. In response to finding a data format conversion operator in the conversion operator library that corresponds to the data format of the adjacent operator, we determine whether the sum of the minimum computation time of the previous operator and the computation time of the data format conversion operator is less than the target computation time. If the sum of the minimum computation time of the previous operator and the computation time of the data format conversion operator is less than the target computation time, then the adjacent operator satisfies the format conversion condition. The conversion operator library can contain multiple data format conversion operators. Taking the output data format A of the previous operator and the input data format B of the next operator as an example, we can search the conversion operator library to see if a data format conversion operator exists that converts data format A to data format B. If it exists, it means that a data format conversion operator corresponding to the data format of the adjacent operator has been matched in the conversion operator library; if it does not exist, it means that no data format conversion operator corresponding to the data format of the adjacent operator has been matched in the conversion operator library.
[0074] In one embodiment, in response to the absence of a data format conversion operator in the conversion operator library that matches the data format of an adjacent operator, a second operator is selected from the algorithm library that performs the same operator function as the next operator and whose input data format is consistent with the output data format of the previous operator, and the next operator is replaced by the second operator.
[0075] Understandably, the conversion operator library is customized by the user according to the actual application situation, and the target operation time can be the second smallest operation time of the previous operator or the time set by the user. There is no limitation here.
[0076] Step 74: If it is determined that adjacent operators in the intermediate network model meet the format conversion conditions, then insert the corresponding data format conversion operator between adjacent operators to complete the optimization of the intermediate network model.
[0077] If it is determined that adjacent operators in the intermediate network model satisfy the format conversion conditions, then corresponding data format conversion operators are inserted between adjacent operators to complete the optimization of the intermediate network model. Then, based on the obtained optimized intermediate network model, steps 33-35 above are executed to further optimize the computational and memory requirements of the intermediate network model by converting the operator connection order or operator type, thereby reducing the computation time of the intermediate network model to obtain the target network model.
[0078] This embodiment can transform data conversion operators in the intermediate network model whose computational load exceeds a preset threshold. By replacing the type of data conversion operator or adjusting its position, a target network model is obtained. This significantly reduces the computational and memory requirements of the target network model, ensuring the accuracy and stability of the intermediate network model, thereby reducing computation time and optimizing its performance. Furthermore, before performing the aforementioned computational optimization on the intermediate network model, adjacent operators can be merged by inserting corresponding data format conversion operators between them to further optimize the intermediate network model's computational performance. Finally, deploying the performance-optimized target network model improves its operational effectiveness.
[0079] Please see Figure 9 , Figure 9 This is a schematic diagram of the structure of an embodiment of the computer device provided in this application. The computer device 90 includes a memory 91 and a processor 92 that are interconnected. The memory 91 is used to store computer programs. When the computer programs are executed by the processor 92, they are used to implement the deployment method of the network model in the above embodiment.
[0080] Please see Figure 10 , Figure 10 This is a schematic diagram of an embodiment of a computer-readable storage medium provided in this application. The computer-readable storage medium 100 is used to store a computer program 101. When the computer program 101 is executed by a processor, it is used to implement the deployment method of the network model in the above embodiment.
[0081] The computer-readable storage medium 100 can be any medium capable of storing program code, such as a server, USB flash drive, external hard drive, read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0082] In the several embodiments provided in this application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed.
[0083] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0084] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0085] If the technical solution of this application involves personal information, the product using this technical solution has clearly informed the user of the personal information processing rules and obtained the user's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using this technical solution has obtained the user's separate consent before processing the sensitive personal information, and also meets the requirement of "express consent". For example, at personal information collection devices such as cameras, clear and prominent signs are set up to inform users that they have entered the scope of personal information collection and that personal information will be collected. If an individual voluntarily enters the collection scope, it is deemed that they have agreed to the collection of their personal information; or on the personal information processing device, with clear signs / information informing users of the personal information processing rules, authorization is obtained from the individual through pop-up information or by asking the individual to upload their personal information; wherein, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the types of personal information processed.
[0086] The above description is merely an embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
Claims
1. A method for deploying a network model, characterized in that, include: Obtain the network model; The network model is then converted into an intermediate network model that adapts to the network framework of the device to be deployed. In response to the need to adjust the computational load, the operator connection order or operator type of the intermediate network model is transformed to obtain the target network model; The target network model is sent to the device to be deployed, so that the device to be deployed can complete the deployment of the target network model; The step of converting the operator connection order or operator type of the intermediate network model in response to computational load adjustment requirements includes: In response to the existence of a data conversion operator in the intermediate network model whose computational complexity is greater than a preset computational threshold, it is determined whether there is a first operator in the algorithm library that has a smaller computational complexity than the data conversion operator and performs the same operator function. If so, then the data conversion operator is replaced with the first operator; If not, the position of the data conversion operator is adjusted.
2. The deployment method of the network model according to claim 1, characterized in that, The step of adjusting the position of the data transformation operator includes: In response to the fact that the output data value of the data operation operator preceding the data conversion operator is greater than the input data value, the data conversion operator is adjusted to be the operator preceding the data operation operator, and the operation parameters of the operators following the data conversion operator are modified to ensure that the output data of each operator remains unchanged before and after the adjustment of the data conversion operator.
3. The deployment method of the network model according to claim 1, characterized in that, Prior to the step of converting the operator connection order or operator type of the intermediate network model in response to computational load adjustment requirements, the method further includes: The adjacent operators in the intermediate network model that meet the fusion conditions are fused; the fusion conditions include: the computation time of the fused operator after the adjacent operators are fused is less than the sum of the minimum computation times of the adjacent operators; Obtain the minimum computation time and data format of each operator in the intermediate network model; Based on the minimum computation time and the data format, determine whether the adjacent operators in the intermediate network model satisfy the format conversion conditions; If so, then insert the corresponding data format conversion operator between the adjacent operators to complete the optimization of the intermediate network model.
4. The deployment method of the network model according to claim 3, characterized in that, The step of determining whether adjacent operators in the intermediate network model satisfy the format conversion conditions based on the minimum computation time and the data format includes: Identify adjacent operators from the intermediate network model whose output data format is inconsistent with the input data format of the next operator; In response to finding a data format conversion operator in the conversion operator library that corresponds to the data format of the adjacent operator, determine whether the sum of the minimum computation time of the previous operator and the computation time of the data format conversion operator is less than the target computation time; If so, then the adjacent operators are determined to satisfy the format conversion condition; In response to the absence of a matching data format conversion operator in the conversion operator library that corresponds to the data format of the adjacent operator, a second operator is selected from the algorithm library that performs the same operator function as the subsequent operator and whose input data format is consistent with the output data format of the preceding operator, and the subsequent operator is replaced by the second operator.
5. The method for deploying the network model according to claim 1, characterized in that, The step of converting the network model into an intermediate network model adapted to the network framework of the device to be deployed includes: Based on a preset multi-frame operator mapping relationship, each operator in the network model is converted into an operator that adapts to the network framework of the device to be deployed, thus obtaining the intermediate network model.
6. The method for deploying the network model according to claim 1, characterized in that, The step of sending the target network model to the device to be deployed, so that the device to be deployed can complete the deployment of the target network model, includes: Compile the target network model into an executable file; The executable file is sent to the device to be deployed, so that the device to be deployed can configure the executable file and complete the deployment of the target network model on the device to be deployed.
7. The method for deploying the network model according to claim 6, characterized in that, The method further includes: After the device to be deployed runs the target network model using the executable file, the similarity between the output data of the target network model and the output data of the same type of operators in the network model is checked to obtain the check result; wherein the same type of operators are operators with the same data output name. In response to the verification result satisfying the preset verification conditions, it is determined that the target network model is consistent with the network model.
8. A computer device, characterized in that, It includes an interconnected memory and a processor, wherein the memory is used to store a computer program, which, when executed by the processor, is used to implement the deployment method of the network model according to any one of claims 1-7.
9. A computer-readable storage medium for storing a computer program, characterized in that, When executed by a processor, the computer program is used to implement the deployment method of the network model according to any one of claims 1-7.
Citation Information
Patent Citations
Model conversion method, model conversion equipment and storage medium
CN114896950A
Model conversion method and device under different frameworks, equipment and storage medium
CN115328541A