A method and apparatus for deploying an iris algorithm model
By converting the IRIS algorithm model into an editable format and replacing or deleting unsupported operators on the TDA4 platform for quantization, the problem of deploying the IRIS algorithm model on the TDA4 platform was solved, achieving performance improvement and hardware acceleration.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING JINGWEI HIRAIN TECH CO INC
- Filing Date
- 2023-09-26
- Publication Date
- 2026-08-04
AI Technical Summary
The lack of specific methods for deploying IRIS algorithm models to the TDA4 platform in the existing technology results in low model inference performance and an inability to effectively utilize the hardware acceleration capabilities of the TDA4 platform.
All models in the IRIS algorithm model are converted into an editable first format, unsupported operators are replaced or deleted, quantization is performed, and the model is deployed to the TDA4 platform. This includes replacing the Pad operator with the Conv operator, constructing a replacement module to replace the PRelu operator, pruning the Transpose operator, etc., to ensure the effectiveness of the model running on the TDA4 platform.
The IRIS algorithm model was successfully deployed on the TDA4 platform, improving the model inference performance. Related experiments showed that the inference time was reduced by more than 50%, improving hardware acceleration efficiency.
Smart Images

Figure CN117234533B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of edge computing of artificial intelligence algorithms, and more specifically, to a method and apparatus for deploying an IRIS algorithm model. Background Technology
[0002] The IRIS algorithm, or Iris Detection Algorithm, is a multi-stage algorithm for iris detection, comprising three neural network models. The IRIS algorithm features relatively few parameters in each model and employs mostly versatile operators, making it suitable for deployment on edge AI devices. TDA4 is an embedded platform with excellent neural network model inference performance and a relatively mature development toolchain. Currently, there is no specific method for deploying IRIS algorithm models to the TDA4 platform. Summary of the Invention
[0003] In view of the above, this application provides the following technical solution:
[0004] A method for deploying an IRIS algorithm model, comprising:
[0005] All models in the IRIS algorithm model are converted into models in the first format, which are editable models.
[0006] Operators in the first format model whose errors exceed a set value after being processed by the toolchain of the first platform, or operators of the first type that are not supported by the toolchain, are replaced. The replaced operators can achieve the same function as the replaced operators.
[0007] Remove the second type of operator from the first format model that is not supported by the toolchain of the first platform;
[0008] The processed first-format model is quantized and then deployed to the first platform.
[0009] Optionally, the first type of operator includes the Pad operator, and operator replacement is performed on the first type of operator in the first format model that is not supported by the toolchain of the first platform, including:
[0010] Replace the Pad operator in all models of the first format with the Conv operator.
[0011] Optionally, replacing the Pad operator in all models of the first format with the Conv operator includes:
[0012] Constructing the weights w of the Conv operator con0 and bias B con0 , including: constructing a shape of [D pad_out D pad_inThe weights w of [1,1] con0 Set all values with indices [i, i, 0, 0] to a value of 1, and set the rest to 0; construct a shape of [D]. pad_out The paranoia of B con0 Let all values in it be 0, where D pad_in and D pad_out These represent the number of input feature map channels and the number of output feature map channels for the Pad operator, respectively.
[0013] Replace all Pad operators in the first format model with Conv operators that have been constructed with weights and biases.
[0014] Optionally, operators in the model of the first format whose errors exceed a set value after processing by the toolchain of the first platform are replaced, including:
[0015] The PRelu operators in the model of the first format are replaced with a first replacement module, which includes two Relu operators, two Mul operators and one Add operator.
[0016] Optionally, the first replacement module includes a first branch and a second branch. The first branch includes a ReLU operator, and the second branch is connected in series with a Mul operator, a ReLU operator, and another Mul operator. The outputs of the first branch and the second branch are connected to an Add operator.
[0017] Optionally, the model in the first format includes a facial calibration model. Operators in the model of the first format whose errors exceed a set value after processing by the toolchain of the first platform are replaced, including:
[0018] In the branch where the output dimension of the facial calibration model is [1,1,1,1], the Add operator that receives the output of the MaxPool operator and the output of the Conv operator is replaced by a second replacement module. The second replacement module includes three Conv operators and one Add operator.
[0019] Optionally, the second replacement module includes a first branch and a second branch. The first branch is connected to the output of the Conv operator and includes a first Conv operator. The second branch is connected to the output of the MaxPool operator and includes a second Conv operator. The outputs of the first Conv operator and the second Conv operator are connected to an Add operator, and the output of the Add operator is connected to a third Conv operator.
[0020] Optionally, the model in the first format includes a facial calibration model. Operators in the model of the first format whose errors exceed a set value after processing by the toolchain of the first platform are replaced, including:
[0021] The Conv operator with the output dimension [1,1,1,1] at the end of the facial calibration module model branch is replaced with the Mul operator, and the output of the Mul operator is used as the output of its branch, wherein the weight of the Mul operator is the same as the weight of the Conv operator.
[0022] Optionally, the second type of operator includes the Transpose operator, and the second type of operator not supported by the toolchain of the first platform in the first format model is removed, including:
[0023] The relevant structures of the Transpose operator in the model of the first format are deleted. The relevant structures of the Transpose operator are the Transpose operator itself or a structure that includes the Transpose operator and other operators.
[0024] This application also discloses a deployment device for an IRIS algorithm model, comprising:
[0025] The format conversion module is used to convert all models in the IRIS algorithm model into models in the first format, which are editable models.
[0026] The operator replacement module is used to replace operators in the first format model whose errors exceed a set value after being processed by the toolchain of the first platform or operators of the first type that are not supported by the toolchain. The replacement operator can perform the same function as the replaced operator.
[0027] The operator pruning module is used to delete second-type operators that are not supported by the toolchain of the first platform in the first format model;
[0028] The model deployment module is used to quantize the processed first-format model and deploy it to the first platform.
[0029] As can be seen from the above technical solutions, this application discloses a method and apparatus for deploying an iris algorithm model. The method includes: converting all models in the IRIS algorithm model into a first format model, where the first format model is an editable model; replacing operators in the first format model whose errors exceed a set value after processing by the toolchain of the first platform, or operators of a first type not supported by the toolchain, where the replaced operators have the same function as the replaced operators; deleting operators in the first format model that are not supported by the toolchain of the first platform; quantizing the processed first format model and deploying it to the first platform. This solution allows modification and editing of the IRIS algorithm model based on the characteristics of the first platform toolchain, enabling the trained IRIS algorithm model to be deployed on the first platform. Furthermore, it allows hardware acceleration of the model inference process to be achieved using the relevant processors on the first platform, thus improving the performance of the IRIS algorithm on the first platform. Attached Figure Description
[0030] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0031] Figure 1 This is a flowchart illustrating a deployment method for an IRIS algorithm model disclosed in an embodiment of this application;
[0032] Figure 2 This is a schematic diagram illustrating the modification of the PRelu operator disclosed in the embodiments of this application;
[0033] Figure 3 This is a schematic diagram illustrating the modification of the Add operator in the face_landmark model disclosed in an embodiment of this application;
[0034] Figure 4 This is a schematic diagram of the pruning of the face_detection_short_range model disclosed in the embodiments of this application;
[0035] Figure 5 This is a schematic diagram of the pruning of the iris_landmark model disclosed in the embodiments of this application;
[0036] Figure 6 This is a flowchart illustrating the specific deployment of an IRIS algorithm model disclosed in an embodiment of this application.
[0037] Figure 7This is a schematic diagram of the structure of a deployment device for an IRIS algorithm model disclosed in an embodiment of this application. Detailed Implementation
[0038] For the sake of clarity and citation, the explanations, abbreviations, or acronyms used in the following text are summarized below:
[0039] TDA4 is a high-performance, heterogeneous multi-core SoC with ARM Cortex-R5F, ARM Cortex-A72, C66, and C71 cores. It can deploy AUTOSARCP system, HLOS (Linux or QNX), image processing, and deep learning modules to meet the requirements of ADAS (Advanced Driving Assistance System) for real-time performance, high computing power, environmental perception, and deep learning.
[0040] ONNX: Open Neural Network Exchange, is an open file format designed for machine learning and used to store trained models.
[0041] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0042] Figure 1 This is a flowchart illustrating a deployment method for an IRIS algorithm model disclosed in an embodiment of this application. See also... Figure 1 As shown, the deployment methods for the IRIS algorithm model may include:
[0043] Step 101: Convert all models in the IRIS algorithm model into models in the first format, which are editable models.
[0044] The Chinese meaning of IRIS is iris, and the IRIS algorithm model is the iris algorithm model.
[0045] The method disclosed in this embodiment is for deploying the IRIS algorithm model on a first platform. However, the compatibility of the IRIS algorithm model with different platforms varies. This compatibility can be reflected in whether the toolchain of the first platform fully supports the operators in the IRIS algorithm model, and whether the result will produce excessive errors after processing by the toolchain of the first platform. In this embodiment, the first platform can be an edge computing platform, such as the TDA4 platform.
[0046] In this step, all models in the IRIS algorithm model are first converted into editable first format models to edit the IRIS algorithm model and make it a model that can be fully supported and suitable for the first platform toolchain.
[0047] The IRIS algorithm model includes three models: near-range face detection (face_detection_short_range), face landmark (face_landmark), and iris landmark (iris_landmark). In this step, all three models are converted into ONNX format models, and subsequent steps are based on the ONNX models obtained in this step for modification and processing.
[0048] Step 102: Replace operators in the first format model whose errors exceed a set value after being processed by the toolchain of the first platform, or operators of the first type that are not supported by the toolchain, with the replacement operators having the same function as the replaced operators.
[0049] When the toolchain on the first platform performs the corresponding processing, some operator structures in the first format model are not supported or may cause relatively large errors, resulting in poor accuracy of the final output. Therefore, it is necessary to replace these operator structures that are not supported by the toolchain or cause large errors, so as to limit the error to a certain range while implementing the corresponding algorithm, and ensure the effectiveness of subsequent IRIS algorithm model deployment on the first platform.
[0050] Step 103: Delete the second type of operator in the first format model that is not supported by the toolchain of the first platform.
[0051] Among the many operators in the IRIS algorithm model, there are some operator structures that are not supported by the toolchain of the first platform. Therefore, these operator structures can be deleted to ensure the feasibility of deploying the IRIS algorithm model on the first platform.
[0052] Step 104: Quantize the processed first-format model and deploy it to the first platform.
[0053] After editing the IRIS algorithm model into a model that can be adapted to the first platform toolchain, the first format model can be quantized to improve its subsequent execution efficiency, and then the quantized model can be deployed to the first platform.
[0054] Specifically, quantizing the processed first-format model and deploying it to the first platform may include: using the toolchain of the first platform to perform int8 quantization on the processed first-format model and deploying it to the TDA4 platform.
[0055] The deployment method of the IRIS algorithm model described in this embodiment can modify and edit the IRIS algorithm model based on the characteristics of the first platform toolchain, so that the trained IRIS algorithm model can be deployed on the first platform, and the relevant processors on the first platform can be used to realize hardware acceleration of the model inference process, thereby improving the performance of the IRIS algorithm on the first platform.
[0056] In the above embodiments, the first type of operator may include the Pad operator. Replacing the first type of operator in the first format model that is not supported by the toolchain of the first platform may include replacing the Pad operator in all the first format models with the Conv operator.
[0057] The Pad operator can be understood as a function / network layer that performs padding, and the Conv operator can be understood as a network layer that performs convolution. Let the replacement operator be conv0. The conv0 operator is a classic convolution operator, without grouped convolution, with a stride of [1,1], and without padding. Let D be the number of input and output feature map channels of the original Pad operator. pad_in and D pad_out Let w be the weights and biases in conv0. con0 and B con0 The method for constructing the weights and biases of the required conv0 operator is as follows: construct a shape of [D] pad_out D pad_in The weights w of [1,1] con0 Set all values with indices [i, i, 0, 0] to a value of 1, and set the rest to 0; construct a shape of [D]. pad_out The paranoia of B con0 Set all values to 0. Then, replace all Pad operators in the first format model with Conv operators that have been constructed with weights and biases.
[0058] In another implementation, replacing operators in the model of the first format whose errors exceed a set value after processing by the toolchain of the first platform can include: replacing the PRelu operator in the model of the first format with a first replacement module. Here, the PRelu operator is an activation layer in a neural network.
[0059] The first replacement module includes two ReLU operators, two Mul operators, and one Add operator. The first replacement module includes a first branch and a second branch. The first branch includes a ReLU operator, and the second branch has a Mul operator, a ReLU operator, and another Mul operator connected in series. The outputs of the first branch and the second branch are connected to the Add operator.
[0060] Specifically, the PRelu operator in the facial and iris calibration models can be replaced with a module consisting of two Relu operators, two Mul operators, and one Add operator, such as... Figure 2 As shown. Let the two branches in this module be Branch0 and Branch1. Branch0 has only one ReLU operator, while Branch1 has a Mul operator mul0, a ReLU operator, and another Mul operator mul1. The calculation results of the two branches are added together by the Add operator. Let D be the number of feature map channels processed by the original PReLU operator. PRelu Then the shape of the parameters in mul0 and mul1 is [1, D]. PRelu [1,1], and the weights of mul0 are all -1, while the weights of mul1 are the negatives of the corresponding values of the original PRelu operator weights. For example, if the weights of the original PRelu operator are [[1,2],[3,4]], then the weights of mul1 are [[-1,-2],[-3,-4]].
[0061] In another implementation, the model in the first format includes a facial calibration model. The operator replacement for the operator in the model in the first format whose error exceeds a set value after processing by the toolchain of the first platform can include: in the branch where the output dimension of the facial calibration model is [1,1,1,1], the Add operator that receives the output of the MaxPool operator and the output of the Conv operator is replaced by a second replacement module. The second replacement module includes three Conv operators and one Add operator.
[0062] The second replacement module includes a first branch and a second branch. The first branch is connected to the output of the Conv operator and includes a first Conv operator. The second branch is connected to the output of the MaxPool operator and includes a second Conv operator. The outputs of the first Conv operator and the second Conv operator are connected to an Add operator, and the output of the Add operator is connected to a third Conv operator.
[0063] Specifically, in the branch where the output dimension of the face calibration model is [1,1,1,1], the Add operator that receives the outputs of the MaxPool operator and the Conv operator is replaced, as follows: Figure 3 As shown, a module consisting of three Conv operators and one Add operator is used for replacement. In the original Add operator's two input branches, the branch connecting the Conv operator is designated as Branch2, and the branch connecting the Maxpool operator is designated as Branch3. In the replacement module, the Conv operator on Branch2 is conv1, and the Conv operator on Branch3 is conv2. The two are added together using the Add operator, and the result is convolved by the Conv operator conv3 before output. The three Conv operators used in the replacement are all classic convolution operators, without grouped convolution, with a stride of [1,1], and no padding. Let the number of channels in the feature map processed by the original Add operator be D. add The pseudocode for calculating the weights and biases of the three Conv operators mentioned above is shown below:
[0064] Data: D add : The number of channels in the feature map processed by the original Add operator; W conv1 :The weights of the conv1 operator; B conv1 : The bias of the conv1 operator; W conv2 : Weights of the conv2 operator; B conv2 : The bias of the conv2 operator; W conv3 :The weights of the conv3 operator; B conv3 : The bias of the conv3 operator; S W_conv1 Weight W conv1 Shape; S W_conv2 Weight W conv2 Shape; S W_conv3 Weight W conv3 Shape; S B_conv1 Bias B conv1 Shape; S B_conv2 Bias B conv2 Shape; S B_conv3 Bias B conv3 The shape.
[0065] Function: zeros(S): A function module that takes shape S as input and returns a floating-point array of shape S with all values being 0.
[0066] Result: The weights and biases of each Conv operator in the module that replaces the Add operator.
[0067] / * Construct weights and biases * /
[0068] 1S W_conv1 ←[2*D add D add 1,1]
[0069] 2S W_conv2 ←[2*D add D add 1,1]
[0070] 3S W_conv3 ←[D add ,2*D add 1,1]
[0071] 4S B_conv1 ←[2*D add ]
[0072] 5S B_conv2 ←[2*D add ]
[0073] 6S B_conv3 ←[D add ]
[0074] 7W conv1 ←zeros(S W_conv1 )
[0075] 8W conv2 ←zeros(S W_conv2 )
[0076] 9W conv3 ←zeros(S W_conv3 )
[0077] 10B conv1 ←zeros(S B_conv1 )
[0078] 11B conv2 ←zeros(S B_conv2 )
[0079] 12B conv3 ←zeros(S B_conv3 )
[0080] / * Further adjust the weights * /
[0081] 13fori←0to D add do:
[0082] 14 W conv1 [i, i, 0, 0] ← 1.0
[0083] 15 W conv2 [i+D add [i, 0, 0] ← 1.0
[0084] 16 W conv3 [i, i, 0, 0] ← 1.0
[0085] 17 W conv3 [i, i+D add ,0,0]←1.0
[0086] 18 end
[0087] In another implementation, the model in the first format includes a facial calibration model. The operator in the model in the first format whose error exceeds a set value after processing by the toolchain of the first platform is replaced. This can include: replacing the Conv operator with the output dimension [1,1,1,1] at the end of the model branch of the facial calibration module with a Mul operator, and using the output of the Mul operator as the output of its branch, wherein the weight of the Mul operator is the same as the weight of the Conv operator.
[0088] Specifically, the Conv operator with output dimension [1,1,1,1] at the end of the facial calibration model branch can be replaced with the Mul operator, and the output of the Mul operator can be used as the output of its branch. The weights of the Mul operator are the same as the weights of the Conv operator.
[0089] The reason for replacing some operators in the above implementations is to avoid the problem of excessive error in the output value of the structure at the end of the model after quantization compilation by the first platform toolchain.
[0090] Furthermore, in the aforementioned embodiments, the second type of operator includes the Transpose operator. Deleting the second type of operator, which is not supported by the toolchain of the first platform in the first format model, may include: deleting the related structure of the Transpose operator in the first format model. The related structure of the Transpose operator is the Transpose operator itself or a structure that includes the Transpose operator and other operators.
[0091] Specifically, the structure of the close-range face detection model can be pruned: the ends of each branch of the close-range face detection model are truncated before the Transpose operator, and the outputs of the Conv operators before the four Transpose operators are used as the model output, such as... Figure 4 As shown. The Transpose operator is used to swap the axes of the data. It is truncated because the toolchain currently provided by the first platform (TDA4 platform) does not support the quantization compilation of this operator.
[0092] In addition, the structure of the iris calibration module can be pruned: the Transpose operator at the end of the two branches can be deleted, and the Conv and Reshape operators before and after the original Transpose operator can be connected, such as... Figure 5 As shown. The Reshape operator is an operator that changes the shape of data without changing the data size.
[0093] Based on the above, Figure 6 This is a flowchart illustrating the specific deployment of an IRIS algorithm model disclosed in an embodiment of this application. It can be combined with... Figure 6 Understand the overall deployment process and the aforementioned related content.
[0094] Understandably, the current IRIS algorithm's neural network models directly calling the TDA4 CPU for inference takes a long time. On the other hand, the TDA4 platform's development toolchain has poor support for some operators in the IRIS models, which makes it impossible to use the tools of the first platform to quantize and compile the models. Consequently, the DSP and other cores on the TDA4 platform cannot perform hardware acceleration for the inference process of its models, which consumes a lot of time and reduces the overall running efficiency of the IRIS algorithm.
[0095] The method proposed in this embodiment enables the deployment of the IRIS algorithm on the TDA4 platform. It allows for adjustment of the neural network model structure in IRIS and hardware acceleration of model inference on the TDA4 platform, thereby improving model inference performance. Compared to direct inference on the CPU of the TDA4 platform, experiments show that deploying the IRIS algorithm model using the method proposed in this invention reduces the inference time of each IRIS model by more than 50%, fully demonstrating the feasibility and effectiveness of the method mentioned in this invention.
[0096] For the foregoing method embodiments, in order to simplify the description, they are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, because according to this application, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0097] The methods described in the above-disclosed embodiments of this application are detailed in terms of the methods. The methods of this application can be implemented by various forms of apparatus. Therefore, this application also discloses an apparatus. Specific embodiments are given below for detailed description.
[0098] Figure 7 This is a schematic diagram of the structure of a deployment device for an IRIS algorithm model disclosed in an embodiment of this application. See also... Figure 7 As shown, the deployment device 70 for the IRIS algorithm model may include:
[0099] The format conversion module 701 is used to convert all models in the IRIS algorithm model into models in a first format, where the models in the first format are editable.
[0100] The operator replacement module 702 is used to replace operators in the model of the first format whose errors exceed a set value after being processed by the toolchain of the first platform, or operators of the first type that are not supported by the toolchain, with the replacement operator having the same function as the replaced operator.
[0101] Operator trimming module 703 is used to delete second-type operators that are not supported by the toolchain of the first platform in the model of the first format.
[0102] The model deployment module 704 is used to quantize the processed first-format model and deploy it to the first platform.
[0103] The deployment device for the IRIS algorithm model described in this embodiment can modify and edit the IRIS algorithm model based on the characteristics of the first platform toolchain, so that the trained IRIS algorithm model can be deployed on the first platform and the relevant processors on the first platform can be used to realize hardware acceleration of the model inference process, thereby improving the performance of the IRIS algorithm on the first platform.
[0104] The specific implementation of the deployment device for the above-mentioned IRIS algorithm model and its various modules can be found in the corresponding sections of the method embodiments, and will not be repeated here.
[0105] The deployment device for any of the IRIS algorithm models described in the above embodiments includes a processor and a memory. The format conversion module, operator replacement module, operator pruning module, model deployment module, etc. in the above embodiments are all stored as program modules in the memory, and the processor executes the above program modules stored in the memory to realize the corresponding functions.
[0106] The processor contains a kernel, which retrieves the corresponding program modules from memory. One or more kernels can be configured, and the processing of backtracking data can be achieved by adjusting kernel parameters.
[0107] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0108] In an exemplary embodiment, a computer-readable storage medium is also provided, which can be directly loaded into the internal memory of a computer and contains software code. After being loaded and executed by the computer, the computer program can implement the steps shown in any embodiment of the deployment method of the IRIS algorithm model described above.
[0109] In an exemplary embodiment, a computer program product is also provided, which can be directly loaded into the internal memory of a computer and contains software code. After being loaded and executed by the computer, the computer program can implement the steps shown in any embodiment of the deployment method of the IRIS algorithm model described above.
[0110] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0111] It should also be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0112] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0113] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for deploying an IRIS algorithm model, characterized in that, include: All models in the IRIS algorithm model are converted into models in the first format, which are editable models. Operators in the first format model whose errors exceed a set value after processing by the toolchain of the first platform, or operators of the first type not supported by the toolchain, are replaced. The replaced operators have the same function as the replaced operators. The first type of operator includes the Pad operator. The operator replacement includes replacing all Pad operators in the first format model with Conv operators. The steps include: constructing the weights of the Conv operator. and bias Replace all Pad operators in the first format model with Conv operators that have been constructed with weights and biases; Remove the second type of operator from the first format model that is not supported by the toolchain of the first platform; The processed model in the first format is quantized and then deployed to the first platform.
2. The deployment method of the IRIS algorithm model according to claim 1, characterized in that, The weights for constructing the Conv operator and bias ,include: The structural shape is [ , The weights of [, 1, 1] Set all values with indices [i, i, 0, 0] to a value of 1, and set the rest to 0; construct a structure of shape [ paranoia Set all values in the set to 0, where and These represent the number of input feature map channels and the number of output feature map channels for the Pad operator, respectively.
3. The deployment method of the IRIS algorithm model according to claim 1, characterized in that, Operator replacement is performed on operators in the first format model whose errors exceed a set value after processing by the toolchain of the first platform. This includes: The PRelu operators in the model of the first format are replaced with a first replacement module, which includes two Relu operators, two Mul operators and one Add operator.
4. The deployment method of the IRIS algorithm model according to claim 3, characterized in that, The first replacement module includes a first branch and a second branch. The first branch includes a ReLU operator, and the second branch is connected in series with a Mul operator, a ReLU operator and another Mul operator. The outputs of the first branch and the second branch are connected to an Add operator.
5. The deployment method of the IRIS algorithm model according to claim 1, characterized in that, The first format model includes a facial calibration model. Operators in the first format model whose errors exceed a set value after processing by the toolchain of the first platform are replaced, including: In the branch where the output dimension of the facial calibration model is [1,1,1,1], the Add operator that receives the output of the MaxPool operator and the output of the Conv operator is replaced by a second replacement module. The second replacement module includes three Conv operators and one Add operator.
6. The deployment method of the IRIS algorithm model according to claim 5, characterized in that, The second replacement module includes a first branch and a second branch. The first branch is connected to the output of the Conv operator and includes a first Conv operator. The second branch is connected to the output of the MaxPool operator and includes a second Conv operator. The outputs of the first Conv operator and the second Conv operator are connected to an Add operator, and the output of the Add operator is connected to a third Conv operator.
7. The deployment method of the IRIS algorithm model according to claim 1, characterized in that, The first format model includes a facial calibration model. Operators in the first format model whose errors exceed a set value after processing by the toolchain of the first platform are replaced, including: The Conv operator with output dimension [1,1,1,1] at the end of the facial calibration model branch is replaced with the Mul operator, and the output of the Mul operator is used as the output of its branch, wherein the weight of the Mul operator is the same as the weight of the Conv operator.
8. The deployment method of the IRIS algorithm model according to claim 1, characterized in that, The second type of operator includes the Transpose operator, and removes the second type of operator from the first format model that is not supported by the toolchain of the first platform, including: The relevant structures of the Transpose operator in the model of the first format are deleted. The relevant structures of the Transpose operator are the Transpose operator itself or a structure that includes the Transpose operator and other operators.
9. A deployment device for an IRIS algorithm model, characterized in that, include: The format conversion module is used to convert all models in the IRIS algorithm model into models in the first format, which are editable models. The operator replacement module is used to replace operators in the model of the first format whose errors exceed a set value after processing by the toolchain of the first platform, or operators of the first type that are not supported by the toolchain, with the replacement operator having the same function as the replaced operator. The first type of operator includes the Pad operator, and the operator replacement includes: replacing all Pad operators in the model of the first format with Conv operators, the steps of which include: constructing the weights of the Conv operator. and bias Replace all Pad operators in the first format model with Conv operators that have been constructed with weights and biases; The operator pruning module is used to delete second-type operators that are not supported by the toolchain of the first platform in the first format model; The model deployment module is used to quantize the processed first-format model and deploy it to the first platform.