Model deployment method and device, equipment, storage medium and program product

By re-parameterizing the convolutional neural network model, the number of convolutional layers on the integrated storage and calculation chip is reduced, which solves the problem of increased computing time caused by multiple convolutional layers and improves computing efficiency.

CN118798322APending Publication Date: 2024-10-18CHINA MOBILE COMM LTD RES INST +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410804767.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-20
Publication Date
2024-10-18

AI Technical Summary

Technical Problem

On integrated storage and calculation chips, more convolutional layers lead to increased calculation time, and it is difficult for existing technology to effectively reduce convolution calculation time.

Method used

By re-parameterizing the convolutional neural network model, the number of convolutional layers is reduced, thereby reducing the number of convolutional layers required for model deployment on the integrated storage and computing chip and improving computing efficiency.

Benefits of technology

By reducing the number of convolutional layers, the model calculation time on the integrated storage and calculation chip is significantly reduced, the calculation efficiency is improved, and the deployment process is simplified.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118798322A_ABST
    Figure CN118798322A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a model deployment method and device, equipment, a storage medium and a program product, and the method comprises the steps: generating n convolutional neural network (CNN) model structures based on a first constraint rule which is a constraint rule about the number of model layers of the CNN model structures, the first constraint rule is determined according to size information of an array in the storage and calculation integrated chip and the channel number of input data of the CNN model structure, n is an integer greater than or equal to 1, and the CNN model structure comprises a plurality of convolutional layers; performing cascade training on the n CNN model structures to obtain n trained CNN models; re-parameterization processing is carried out on each CNN model in the n trained CNN models to obtain a single-layer model, and the number of convolutional layers in the single-layer model is 1; and deploying the single-layer model corresponding to each CNN model and parameters of the single-layer model corresponding to each CNN model in a storage and calculation integrated chip.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of artificial intelligence, and in particular relates to a model deployment method, apparatus, device, storage medium and program product. Background Art

[0002] As a new computing architecture, storage-computing integration breaks through the bottleneck of the von Neumann architecture by directly completing computing functions in the memory, greatly improving computing power and energy efficiency. Storage-computing integration technology makes the circuit into a cross-array structure, which is similar to the shape of a matrix. Kirchhoff's law and Ohm's law can efficiently complete matrix multiplication and addition operations, so it is widely used in AI reasoning scenarios. At present, the research on neural network models adapted for storage-computing integration is mainly aimed at convolution operators and fully connected operators, and other operators are generally calculated off-chip. On the storage-computing integration chip, the convolution calculation time is only related to the number of convolution layers. In related technologies, a single model deployed in the storage-computing integration chip has more convolution layers, which will affect the calculation time of the model. Summary of the invention

[0003] Embodiments of the present application provide a model deployment method, apparatus, device, storage medium, and program product.

[0004] The present application provides a model deployment method, the method comprising:

[0005] Based on the first constraint rule, n convolutional neural network (CNN) model structures are generated, wherein the first constraint rule is a constraint rule on the number of model layers of the CNN model structure, and the first constraint rule is determined according to the size information of the array in the storage-computing integrated chip and the number of channels of the input data of the CNN model structure, n is an integer greater than or equal to 1, and the CNN model structure includes multiple convolutional layers;

[0006] Performing cascade training on the n CNN model structures to obtain n trained CNN models;

[0007] Reparameterization is performed on each of the n trained CNN models to obtain a single-layer model, where the number of convolutional layers in the single-layer model is 1;

[0008] The single-layer model corresponding to each CNN model and the parameters of the single-layer model corresponding to each CNN model are deployed in the storage and computing integrated chip.

[0009] In some embodiments, the first constraint rule includes: the number of model layers of the CNN model structure is 2 to the mth power, where m is an integer greater than or equal to 0; and re-parameterizing each CNN model in the n trained CNN models to obtain a single-layer model, including: when the number k of convolutional layers in the first CNN model is greater than 1, re-parameterizing the k convolutional layers in the first CNN model m times to obtain a single-layer model corresponding to the first CNN model, and the first CNN model represents any one of the n trained CNN models.

[0010] It can be seen that the embodiment of the present application can obtain a single-layer model corresponding to the first CNN model by performing m re-parameterization processing on the k convolutional layers in the first CNN model. Since the single-layer model has fewer convolutional layers than the first CNN model, the embodiment of the present application can reduce the number of convolutional layers deployed on the storage and computing integrated chip, thereby reducing the convolution calculation time of the model deployed in the storage and computing integrated chip and improving the computational efficiency of the model.

[0011] In some embodiments, the k convolutional layers in the first CNN model are reparameterized m times to obtain a single-layer model corresponding to the first CNN model, including: when k is equal to 2, the k convolutional layers are divided into k / 2 convolutional layer combinations, and each convolutional layer combination in the k / 2 convolutional layer combination is composed of two adjacent convolutional layers in the k convolutional layers; according to the reparameterization method of the convolution kernel, each convolutional layer combination in the k / 2 convolutional layer combination is reparameterized to obtain a new convolutional layer; the reparameterization method of the convolution kernel includes: reparameterizing two convolutional layers with convolution kernel sizes of w×h into a new convolution kernel with a convolution kernel size of (w+2)×(h+2) layer; when k is greater than 2, in response to the need to perform an i-th reparameterization process on the k convolutional layers in the first CNN model, and i is equal to 1, the k convolutional layers are divided into k / 2 convolutional layer combinations, and each convolutional layer combination in the k / 2 convolutional layer combinations is reparameterized once according to the reparameterization method of the convolution kernel to obtain a corresponding new convolutional layer; when k is greater than 2, in response to the need to perform an i-th reparameterization process on the k convolutional layers in the first CNN model, and i is greater than 1, each new convolutional layer obtained after the i-1-th reparameterization process is obtained, and each new convolutional layer is reparameterized for the i-th time according to the reparameterization method of the convolution kernel.

[0012] It can be seen that when the number of convolutional layers k in the first CNN model is equal to 2, the embodiment of the present application can obtain a new convolutional layer by reparameterizing the convolution kernel once, which has the characteristics of simplicity to implement; when the number of convolutional layers k in the first CNN model is greater than 2, the embodiment of the present application can gradually reduce the number of convolutional layers of the model that needs to be deployed in the storage and computing integrated chip through multiple reparameterization processes of the convolution kernel, thereby reducing the convolution calculation time of the model deployed in the storage and computing integrated chip and improving the computing efficiency of the model.

[0013] In some embodiments, the first constraint rule includes: the product of the number of channels and the first parameter is less than the number of rows in each array in the storage and computing integrated chip, and the first parameter is positively correlated with the number of model layers of the CNN model structure.

[0014] In some embodiments, the first parameter is the square of the second parameter, and the second parameter is the sum of 2 times the number of model layers and 1.

[0015] It can be seen that when the product of the number of channels and the first parameter is less than the number of rows in each array in the storage-computing integrated chip, it can be considered that the product of the number of channels and the first parameter is small. Since the first parameter is positively correlated with the number of model layers of the CNN model structure, it can be considered that the product of the number of model layers of the CNN model structure and the number of channels of the input data of the CNN model structure is small, which is conducive to deploying the CNN model structure in the array of the storage-computing integrated chip.

[0016] In some embodiments, before generating n convolutional neural network (CNN) model structures based on the first constraint rule, the method further includes: determining the value of the number n of the CNN model structures based on the second constraint rule, wherein the second constraint rule includes: n is less than or equal to the number of arrays in the storage-computing integrated chip. It can be understood that when n is less than or equal to the number of arrays in the storage-computing integrated chip, even if each array can only deploy a single-layer model, the reliable deployment of n CNN model structures in the array of the storage-computing integrated chip can be achieved.

[0017] In some embodiments, the deploying of the single-layer model corresponding to each CNN model and the weight of the single-layer model corresponding to each CNN model in the storage-computing integrated chip includes: determining n arrays in the storage-computing integrated chip where single-layer models need to be deployed; and deploying the single-layer model corresponding to each CNN model and the weight of the single-layer model corresponding to each CNN model in the corresponding array of the storage-computing integrated chip in a deployment manner in which only one single-layer model is deployed in each array among the n arrays where single-layer models need to be deployed.

[0018] It can be seen that when the model is deployed in a manner of deploying only one single-layer model in each array, the embodiment of the present application can achieve reliable deployment of n CNN model structures in an array of a storage and computing integrated chip; further, when only one single-layer model is deployed in each array, the single-layer model can make full use of the computing resources of the corresponding array, thereby improving computing efficiency.

[0019] In some embodiments, the parameters of the single-layer model corresponding to each CNN model include the size and bias of the convolution kernel. It can be seen that the embodiment of the present application can deploy the size and bias of the convolution kernel in each CNN model in the storage and computing integrated chip.

[0020] The present application also provides a model deployment device, the device comprising:

[0021] A first processing module is used to generate n CNN model structures based on a first constraint rule, wherein the first constraint rule is a constraint rule on the number of model layers of the CNN model structure, the first constraint rule is determined according to size information of an array in a storage-computing integrated chip and the number of channels of input data of the CNN model structure, n is an integer greater than or equal to 1, and the CNN model structure includes multiple convolutional layers;

[0022] A training module, used for performing cascade training on the n CNN model structures to obtain n trained CNN models;

[0023] A second processing module is used to perform a reparameterization process on each of the n trained CNN models to obtain a single-layer model, where the number of convolutional layers in the single-layer model is 1;

[0024] A deployment module is used to deploy the single-layer model corresponding to each CNN model and the parameters of the single-layer model corresponding to each CNN model in the storage and computing integrated chip.

[0025] An embodiment of the present application also provides an electronic device, comprising a processor and a memory for storing a computer program that can be run on the processor; wherein the processor is used to run the computer program to execute any one of the above-mentioned model deployment methods.

[0026] An embodiment of the present application also provides a computer storage medium on which a computer program is stored. When the computer program is executed by a processor, any one of the above-mentioned model deployment methods is implemented.

[0027] An embodiment of the present application also provides a computer program product, including a computer program, which implements any of the above-mentioned model deployment methods when executed by a processor.

[0028] It can be seen that when each CNN model structure includes multiple convolutional layers, the embodiment of the present application can re-parameterize each CNN model in the n trained CNN models to obtain a single-layer model; since the number of convolutional layers in the single-layer model is 1, the embodiment of the present application can reduce the number of convolutional layers of the model deployed on the storage and computing integrated chip, thereby reducing the convolution calculation time of the model deployed in the storage and computing integrated chip and improving the computational efficiency of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] Figure 1 A flowchart of a model deployment method according to an embodiment of the present application;

[0030] Figure 2 This is a schematic diagram of re-parameterization processing for a 4-layer CNN network in an embodiment of the present application;

[0031] Figure 3 A schematic diagram of an AI model building system for a storage-computing integrated chip in an embodiment of the present application;

[0032] Figure 4 This is a schematic diagram of the CNN model structure in the embodiment of the present application;

[0033] Figure 5 A schematic diagram of the structure of a model deployment device according to an embodiment of the present application;

[0034] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0035] The von Neumann architecture is the mainstream architecture of modern computer systems. Its typical feature is the separation of storage and computing. Each operation requires reading data from the memory to the central processing unit (CPU). After the calculation is completed, the result is stored back to the memory from the CPU. This process involves frequent data transfer, which generates a lot of latency and energy consumption. In recent years, artificial intelligence has developed rapidly. For memory-intensive scenarios such as artificial intelligence, large amounts of data transfer have exacerbated the "storage wall" and "power wall" problems, which are also the main bottlenecks for computing power growth under the von Neumann architecture. As a new computing architecture, storage and computing integration breaks through the bottleneck of the von Neumann architecture by directly completing computing functions in the memory, greatly improving computing power and energy efficiency.

[0036] The classic von Neumann architecture has become the main bottleneck for computing power growth due to the data transfer latency and energy consumption caused by the separation of storage and computing. Storage-computing-in-one technology can break through the performance bottleneck of the von Neumann architecture by performing calculations directly in the memory, greatly improving computing power and energy efficiency, and is expected to become an advanced productivity in the digital economy era. At present, the research on neural network models adapted to storage-computing-in-one is mainly aimed at convolution operators. However, in order to adapt to the storage-computing-in-one matrix multiplication and addition operations, the convolution layer needs to slide the window and rearrange the input data, which affects the energy efficiency of matrix operations. Therefore, building a fully connected AI model architecture adapted to the storage-computing-in-one array is crucial to the effective use of the storage-computing-in-one characteristics.

[0037] The integrated storage and computing chip has certain requirements for the operators and structures of the model to obtain the best performance. Model structure search refers to a method of automatically evaluating the performance of the network structure and finding the best performing network structure in a large set of neural networks. In the first scheme of the related art, a model generation method and device are proposed. The method updates the preset model structure controller based on the current feedback reward value, and uses the updated model structure controller to generate multiple neural networks to be trained; according to the preset hierarchical training method, the neural network to be trained is trained at least two levels; the reward feedback value is updated according to the performance of the neural network after at least two levels of training; in response to determining that the reward feedback value reaches the preset convergence condition or the number of iterative operations reaches the preset threshold, the neural network with the best performance after at least two levels of training in the current iterative operation is determined as the neural network model for performing deep learning tasks. This method improves the efficiency of neural network model structure search. In the first scheme of the related art, by adding hardware noise for training, the accuracy of the model can be effectively improved. However, the model structure search algorithm needs to train a large number of models, which requires a lot of computing resources and time. In the case of insufficient resources, the above method is not applicable. Moreover, the model structure search algorithm is limited by pre-set rules, which does not mean that the model searched is the best model.

[0038] In the related art, some model structure search algorithms have been proposed for integrated storage and computing chips. The second scheme of the related art proposes a model structure search method for integrated storage and computing of resistive random-access memory (RRAM). Taking into account the model deployment of integrated storage and computing chips, storage and computing analog-to-digital conversion (AD) / digital-to-analog conversion (DA) noise, write noise, etc. during the calculation process, noise is added to the model structure search process, and the total area of ​​the model is used as a constraint for model structure search. This method takes into account the RRAM analog noise problem and adds noise during the training process to achieve higher accuracy.

[0039] In the related art, the number of layers of deep learning models is increasing, but the computing latency of the integrated storage and computing chip is proportional to the number of layers, and the deeper model does not have obvious advantages when running on the integrated storage and computing chip. The inventors found that compared with a deep model, multiple parallel shallow models are the most suitable for the integrated storage and computing chip.

[0040] Due to the characteristics of the graphics processing unit (GPU) computing method, during the calculation process executed by the GPU, a large-size convolution kernel is generally re-parameterized into multiple small-size convolution kernels to reduce the amount of calculation. For example, in the residual network (resnet), in order to reduce the amount of calculation, two 3×3 convolution kernels and one 1×1 convolution kernel can be used to replace a 5×5 convolution kernel for retraining. When the number of convolution kernel channels c remains unchanged, the amount of calculation is reduced from o(5×5×c) to o(3×3×c+3×3×c+1×1×c).

[0041] Limited by the GPU computing method, the series connection process of structural reparameterization in related technologies only includes two cases: 1×1 and 3×3 convolution branches in series, and 1×1 convolution and pooling layer in series. It does not consider the case of reparameterizing two 3×3 series convolutions or larger sizes. However, on the storage-computing integrated chip, the convolution calculation time has nothing to do with the size of the convolution kernel, but only with the number of convolution layers. Therefore, the method of reparameterizing a large convolution kernel into multiple small convolution kernels not only fails to reduce the calculation time on the storage-computing integrated chip, but increases the difficulty of calculation and deployment; merging multiple parallel-calculated convolution kernels into one convolution kernel does not change the calculation time.

[0042] On a storage-computing integrated chip, the convolution calculation time has nothing to do with the size of the convolution kernel, but is only related to the number of convolution layers. In related technologies, a single model deployed in a storage-computing integrated chip has more convolution layers, which will affect the calculation time of the model.

[0043] In view of the above problems existing in the related art, a technical solution of the embodiment of the present application is proposed. In the embodiment of the present application, a single-layer model with 1 convolution layer can be obtained by re-parameterizing the model, thereby reducing the calculation time of the model and improving the calculation efficiency of the model.

[0044] In some embodiments, the linear features of the convolution kernel can be used to reparameterize the three convolution layers in each convolution block into an ordinary convolution layer, thereby speeding up the reasoning speed. In some embodiments, the convolution branches can be fused into a 3×3 convolution through a structural reparameterization process. First, the two series branches are fused into a 3×3 convolution. For the 1×1 and 3×3 convolution series branches, the convolution parameters are directly multiplied; for the 1×1 convolution and pooling layer series structure, the pooling layer is first converted into a 3×3 convolution, and then the weights are directly multiplied to fuse the two convolutions into a 3×3 convolution. Next, the batch normalization (BN) layer is fused into the convolution kernel. At this time, the network structure becomes a feature map weighted addition structure. The multi-branch structure can be reparameterized into a single-branch structure by simply adding the parallel convolution kernels according to the rules.

[0045] The following is a further detailed description of the embodiments of the present application in conjunction with the accompanying drawings and examples. It should be understood that the embodiments provided herein are only used to explain the embodiments of the present application and are not intended to limit the embodiments of the present application. In addition, the embodiments provided below are partial embodiments for implementing the present application, rather than providing all embodiments for implementing the present application. In the absence of conflict, the technical solutions recorded in the embodiments of the present application can be implemented in any combination.

[0046] It should be noted that, in the embodiments of the present application, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a method or device including a series of elements includes not only the elements explicitly recorded, but also includes other elements not explicitly listed, or also includes elements inherent to the implementation of the method or device. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the presence of other related elements (such as steps in a method or units in a device, for example, a unit may be a part of a circuit, a part of a processor, a part of a program or software, etc.) in the method or device including the element.

[0047] The model deployment method provided in the embodiment of the present application includes a series of steps, but the model deployment method provided in the embodiment of the present application is not limited to the recorded steps. Similarly, the model deployment device provided in the embodiment of the present application includes a series of modules, but the device provided in the embodiment of the present application is not limited to including the modules explicitly recorded, and may also include modules required to obtain relevant information or perform processing based on information.

[0048] Figure 1 Flow chart of the model deployment method of the embodiment of the present application, such as Figure 1 As shown, the process may include:

[0049] Step 101: Based on the first constraint rule, generate n CNN model structures; the first constraint rule is a constraint rule on the number of model layers of the CNN model structure, and the first constraint rule is determined according to the size information of the array in the storage and computing integrated chip and the number of channels of the input data of the CNN model structure. n is an integer greater than or equal to 1, and the CNN model structure includes multiple convolutional layers.

[0050] In an embodiment of the present application, the storage and computing integrated chip generally includes multiple arrays, each array is an independent computing unit, and the size information of the array in the storage and computing integrated chip can be one or more of the number of rows and columns.

[0051] Step 102: Perform cascade training on the n CNN model structures to obtain n trained CNN models.

[0052] In an embodiment of the present application, the training effect of n CNN models can be improved by performing cascade training on n CNN model structures.

[0053] In some embodiments, the first CNN model among the n CNN models can be trained first, and the training data set can be tested using the trained first CNN model, and the test error data can be screened out in the training data set, and a new data set can be constructed using the screened test error data. Then, when i is greater than or equal to 1, the i-th trained CNN model can be used for transfer learning to train the i+1-th CNN model among the n CNN models, and the new data set constructed last time can be determined as a new training set, and the i+1-th trained CNN model can be used to test the new training set determined last time, and the test error data can be screened out in the new training set, and a new data set can be constructed using the screened test error data. It can be seen that when i is equal to n-1, the n-th CNN model among the n CNN models can be trained, thereby completing the cascade training of the n CNN model structure.

[0054] In some embodiments, the first CNN model among the n CNN models can be trained first, and the training data set can be tested using the trained first CNN model to obtain the test results corresponding to the first CNN model. The data in the training data set are weighted according to the test results corresponding to the first CNN model, and the data with a larger test error has a larger weight. Then, when i is greater than or equal to 1, the weight assigned last time is assigned to the loss function of the i+1th CNN model, and then the i-th trained CNN model is used for transfer learning to train the i+1th CNN model among the n CNN models. The i+1th trained CNN model is used to re-weight the data in the training data set, and the data with a larger test error has a larger weight. It can be seen that when i is equal to n-1, the n-th CNN model among the n CNN models can be trained, thereby completing the cascade training of the n CNN model structure.

[0055] Step 103: Reparameterize each CNN model in the n trained CNN models to obtain a single-layer model, in which the number of convolutional layers is 1.

[0056] Step 104: deploy the single-layer model corresponding to each CNN model and the parameters of the single-layer model corresponding to each CNN model in the storage and computing integrated chip.

[0057] Here, the parameters of the single-layer model corresponding to each CNN model include the size and bias of the convolution kernel. It can be seen that the embodiment of the present application can deploy the size and bias of the convolution kernel in each CNN model in a storage and computing integrated chip.

[0058] Exemplarily, a deployment tool for storage and computing integration can be used to deploy the single-layer model corresponding to each CNN model and the parameters of the single-layer model corresponding to each CNN model onto the storage and computing integration chip.

[0059] In practical applications, steps 101 to 104 can be implemented based on a processor, and the processor can be at least one of an application specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a CPU, a controller, a microcontroller, and a microprocessor.

[0060] It can be seen that when each CNN model structure includes multiple convolutional layers, the embodiment of the present application can re-parameterize each CNN model in the n trained CNN models to obtain a single-layer model; since the number of convolutional layers in the single-layer model is 1, the embodiment of the present application can reduce the number of convolutional layers of the model deployed on the storage and computing integrated chip, thereby reducing the convolution calculation time of the model deployed in the storage and computing integrated chip and improving the computational efficiency of the model.

[0061] In some embodiments of the present application, before generating n CNN model structures based on the first constraint rule, the method further includes: determining the value of the number n of CNN model structures based on the second constraint rule, and the second constraint rule includes: n is less than or equal to the number of arrays in the storage-computing integrated chip. It can be understood that when n is less than or equal to the number of arrays in the storage-computing integrated chip, even if each array can only deploy a single-layer model, the reliable deployment of n CNN model structures in the array of the storage-computing integrated chip can be achieved.

[0062] In some embodiments of the present application, the process of deploying the single-layer model corresponding to each CNN model and the weight of the single-layer model corresponding to each CNN model in the storage-computing integrated chip may include: determining n arrays in the storage-computing integrated chip where single-layer models need to be deployed; in the n arrays where single-layer models need to be deployed, deploying the single-layer model corresponding to each CNN model and the weight of the single-layer model corresponding to each CNN model in the corresponding array of the storage-computing integrated chip in accordance with the deployment method of deploying only one single-layer model in each array. It can be seen that when the model is deployed in accordance with the deployment method of deploying only one single-layer model in each array, the embodiment of the present application can realize the reliable deployment of the array of n CNN model structures in the storage-computing integrated chip; further, when only one single-layer model is deployed in each array, the single-layer model can make full use of the computing resources of the corresponding array, thereby improving computing efficiency.

[0063] In some embodiments of the present application, the first constraint rule includes: the number of model layers of the CNN model structure is 2 to the power of m, where m is an integer greater than or equal to 0;

[0064] The process of re-parameterizing each CNN model in the n trained CNN models to obtain a single-layer model may include:

[0065] When the number k of convolutional layers in the first CNN model is greater than 1, the k convolutional layers in the first CNN model are reparameterized m times to obtain a single-layer model corresponding to the first CNN model, and the first CNN model represents any one of the n trained CNN models.

[0066] Here, among the n trained CNN models, the number of convolutional layers of different models can be the same or different.

[0067] It can be seen that the embodiment of the present application can obtain a single-layer model corresponding to the first CNN model by performing m re-parameterization processing on the k convolutional layers in the first CNN model. Since the single-layer model has fewer convolutional layers than the first CNN model, the embodiment of the present application can reduce the number of convolutional layers deployed on the storage and computing integrated chip, thereby reducing the convolution calculation time of the model deployed in the storage and computing integrated chip and improving the computational efficiency of the model.

[0068] In some embodiments of the present application, the process of performing m reparameterization processes on k convolutional layers in the first CNN model to obtain a single-layer model corresponding to the first CNN model may include:

[0069] When k is equal to 2, the k convolutional layers are divided into k / 2 convolutional layer combinations, and each convolutional layer combination in the k / 2 convolutional layer combination is formed into two adjacent convolutional layers in the k convolutional layers; according to the reparameterization method of the convolution kernel, each convolutional layer combination in the k / 2 convolutional layer combination is reparameterized to obtain a new convolutional layer; the reparameterization method of the convolution kernel includes: reparameterizing two convolutional layers with convolution kernel sizes of w×h into a new convolution layer with a convolution kernel size of (w+2)×(h+2).

[0070] When k is greater than 2, in response to the need to perform the i-th reparameterization processing on the k convolutional layers in the first CNN model, and i is equal to 1, the k convolutional layers are divided into k / 2 convolutional layer combinations, and each convolutional layer combination in the k / 2 convolutional layer combinations is reparameterized once according to the reparameterization method of the convolution kernel to obtain the corresponding new convolutional layer; when k is greater than 2, in response to the need to perform the i-th reparameterization processing on the k convolutional layers in the first CNN model, and i is greater than 1, each new convolutional layer obtained after the i-1-th reparameterization processing is obtained, and each new convolutional layer is reparameterized for the i-th time according to the reparameterization method of the convolution kernel.

[0071] In some embodiments, the first constraint rule includes: the product of the number of channels and the first parameter is less than the number of rows of each array in the storage and computing integrated chip, and the first parameter is positively correlated with the number of model layers of the CNN model structure.

[0072] In some embodiments, the first parameter is the square of the second parameter, and the second parameter is the sum of 2 times the number of model layers and 1.

[0073] Here, when the number of model layers (i.e. the number of convolutional layers) is k, the second parameter is 2*k+1 and the first parameter is (2×k+1) 2 .

[0074] It can be seen that when the product of the number of channels and the first parameter is less than the number of rows in each array in the storage-computing integrated chip, it can be considered that the product of the number of channels and the first parameter is small. Since the first parameter is positively correlated with the number of model layers of the CNN model structure, it can be considered that the product of the number of model layers of the CNN model structure and the number of channels of the input data of the CNN model structure is small, which is conducive to deploying the CNN model structure in the array of the storage-computing integrated chip.

[0075] In an embodiment of the present application, the weights of multiple small-size CNN models can be reparameterized into a large-size weight through a model reparameterization tool. The reparameterization process of the model reparameterization tool includes: reparameterizing two adjacent convolution kernels into a large convolution kernel, and reparameterizing multiple convolution kernels into a large convolution kernel.

[0076] Exemplarily, when k is equal to 1, there is no need to reparameterize the first CNN model.

[0077] When k is equal to 2, the two convolution kernels of size w×h can be reparameterized into a new convolution kernel of size (w+2)×(h+2). For the two convolution kernels of size w×h, first fill the edges of the weights and biases of the two convolution kernels with 0 to obtain a convolution kernel of size (w+2)×(h+2). Among them, the weight of the first convolution kernel of the two convolution kernels of size w×h can be recorded as ω 0 , the bias of the first convolution kernel can be recorded as b 0 , the weight of the second convolution can be recorded as ω 1 , the bias of the second convolution kernel can be recorded as b 1 The weight of the first convolution kernel with a size of (w+2)×(h+2) is recorded as The bias of the convolution kernel of size (w+2)×(h+2) corresponding to the first convolution kernel is recorded as The weight of the second convolution kernel with a size of (w+2)×(h+2) is recorded as The bias of the convolution kernel of size (w+2)×(h+2) corresponding to the second convolution kernel is recorded as In the conclusion and Afterwards, you can and The convolution operation of derives the weight ω of the new convolution kernel, and b is determined as the bias of the new convolution kernel.

[0078] For example, ω 0 and ω 1 They can be expressed by formula (1) and formula (2) respectively.

[0079]

[0080] For b 0 and b 1 , can be converted into and

[0081]

[0082]

[0083] Targeting ω 0 and ω 1 , the edges can be filled with 0 to obtain the formulas (5) to (6) and

[0084]

[0085] against and The edges can be filled with 0 to obtain the equations (7) to (8) and

[0086]

[0087] Exemplarily, when k is greater than 2, the model with the number of model layers being 2 to the power of m can be reparameterized step by step; in the first step, the k convolutional layers are divided into k / 2 convolutional layer combinations, and each convolutional layer combination in the k / 2 convolutional layer combination is reparameterized once according to the reparameterization method of the convolution kernel to obtain the corresponding new convolutional layer; in the second step, the k / 2 new convolutional layers are reparameterized for the second time according to the reparameterization method of the convolution kernel to obtain the corresponding new convolutional layer, and so on, until a single-layer model is obtained.

[0088] For example, refer to Figure 2 For a CNN network with 4 layers and 3×3 convolution kernels, the first step is to reparameterize the 3×3 convolution kernels of the first and second layers to obtain a 5×5 convolution kernel, which is used as the new first-layer convolution kernel; reparameterize the 3×3 convolution kernels of the third and fourth layers to obtain a 5×5 convolution kernel, which is used as the new second-layer convolution kernel. In the second step, reparameterize the new first-layer convolution kernel and the new second-layer convolution kernel to obtain a 7×7 convolution kernel.

[0089] It can be seen that when the number k of convolutional layers in the first CNN model is equal to 2, the embodiment of the present application can obtain a new convolutional layer through a single reparameterization process of the convolutional kernel, which has the characteristics of being simple to implement; when the number k of convolutional layers in the first CNN model is greater than 2, the embodiment of the present application can gradually reduce the number of convolutional layers of the model to be deployed on the in-memory computing chip through multiple reparameterization processes of the convolutional kernel, thereby reducing the convolutional calculation time of the model deployed on the in-memory computing chip and improving the calculation efficiency of the model.

[0090] The embodiment of the present application also provides an AI model construction system for in-memory computing chips. Referring to Figure 3 , the system includes a model generation module 301, a reparameterization module 302, a communication module 303, and an in-memory computing module 304.

[0091] The model generation module 301 includes a model training module and a structure generation module. The model training module can preset a first constraint rule and a second constraint rule based on the array number of the in-memory computing chip and the size of each array. Exemplarily, in order to make full use of the array memory computing units of the in-memory computing chip, match the array size, and design a CNN model adapted to in-memory computing, the first constraint rule and the following second constraint rule are preset: the number of model layers of the CNN model structure is the m-th power of 2, (2×k + 1) 2 ×D<row, where D represents the number of channels of the input data of the CNN model structure, and row represents the number of rows of each array in the in-memory computing chip. For example, if D is equal to 3 and the number of rows of each array in the in-memory computing chip is less than 75, then k can be determined to be 1; when D is equal to 3 and 75 ≤ row < 147, k is determined to be 2; when D is equal to 3 and 147 ≤ row < 243, k is determined to be 4; when D is equal to 3 and 243 ≤ row < 363, k is determined to be 8.

[0092] The structure generation module can automatically generate a set of shallow CNN model structures based on the preset rules. Exemplarily, after inputting the array number of the in-memory computing chip and the single array size, the parameters of the CNN model can be determined based on the preset rules, thereby automatically generating a set of CNN model structures. Referring to Figure 4 , the generated CNN model structure includes n k-layer CNN models and a weighted classifier, where each k-layer CNN model includes k convolutional layers and a classifier, and the weighted classifier is used to perform weighted operations on the results of the n classifiers.

[0093] The model training module trains the CNN model structure using a cascade training method

[0094] The reparameterization module 302 is used to reparameterize the model and convert the multi-layer model into a single-layer model. Exemplarily, the reparameterization module 302 includes a single reparameterization module and a hierarchical reparameterization module. The single reparameterization module is used to reparameterize the 2-layer CNN model, and the hierarchical reparameterization module is used to reparameterize the CNN model with more than 2 convolutional layers step by step.

[0095] The communication module 303 is used to transmit the re-parameterized model weights and structural information to the interface of the storage-computing module 304. After parsing the received information, the storage-computing module 304 deploys the model weights layer by layer to the storage-computing array; then, inputs data to the model deployed to the storage-computing chip to perform model prediction and model reasoning.

[0096] The embodiment of the present application proposes an image processing and AI model deployment method for a storage-computing integrated array, which can be applied to scenarios such as the Internet of Things and artificial intelligence. The technical solution of the embodiment of the present application has at least the following advantages:

[0097] 1) An AI model building system for storage-computing integrated arrays is proposed. The system includes a structure generation module, a model reparameterization tool for storage-computing integrated, a communication module, and a storage-computing integrated module. The system makes full use of the fact that the parallel computing efficiency of storage-computing integrated chips is much higher than that of serial computing, and uses multiple shallow CNN networks as parallel classifiers to improve the computing efficiency of CNN models on storage-computing integrated chips.

[0098] 2) A method for building an AI model for storage-computing integrated arrays is proposed. First, a CNN model is automatically generated based on the chip structure. Then, the model parameters are trained using cascade training. Finally, the final model structure is obtained using structural reparameterization. Finally, the model is deployed on the storage-computing integrated chip for inference.

[0099] 3) A method for automatically generating CNN model structure is proposed to adapt the array quantity and single array size of the storage and computing integrated chip, so as to maximize the utilization of the storage array of the storage and computing integrated chip and improve computing efficiency.

[0100] 4) A model structure reparameterization method is proposed, including a method for reparameterizing two adjacent small convolution kernels into a large convolution kernel, and a method for hierarchically reparameterizing multiple small convolution kernels into a large convolution kernel. Taking advantage of the fact that the computing time on the integrated storage and computing chip is independent of the size of the convolution kernel, multi-layer small convolution kernels are reparameterized into a single-layer large convolution kernel, further reducing the model calculation time.

[0101] The embodiment of the present application proposes an AI model construction method and system for a storage-computing integrated chip. The size of the AI ​​chip is automatically generated based on the size of the storage-computing integrated chip, and the generated model is structurally reparameterized using a structural reparameterization method, thereby achieving efficient computing on the storage-computing integrated chip.

[0102] Compared with the model structure generation method based on model structure search in the related art, the automatic model structure generation method proposed in the embodiment of the present application is simpler to implement, does not require additional training resources, and is more suitable for storage and computing integrated chips.

[0103] In the technical solutions of the related art, generally, the parallel multi-branch convolution kernels are re-parameterized into one convolution kernel, or a convolution kernel of size 1×1 and a convolution kernel of size 3×3 are connected in series to obtain a new convolution kernel, and the new convolution kernel is re-parameterized into a convolution kernel of size 3×3. Compared with the technical solutions of the related art, the model structure re-parameterization method proposed in the embodiment of the present application is to re-parameterize a group of convolution kernels of size 3×3 or larger connected in series into a larger convolution kernel. The technical solutions of the related art are generally used for GPU computing, and thus will not increase the size of the convolution kernel. The embodiment of the present application is used for a storage-computing integrated chip. Aiming at the computing characteristics of the storage-computing integrated chip, multiple small convolution kernels are re-parameterized into a large convolution kernel, which can effectively improve computing efficiency.

[0104] Those skilled in the art will appreciate that, in the above method of specific implementation, the order in which the steps are written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of the steps should be determined by their functions and possible internal logic.

[0105] Figure 5 Schematic diagram of the structure of the model deployment device of the embodiment of the present application, such as Figure 5 As shown, the device comprises:

[0106] A first processing module 501 is used to generate n CNN model structures based on a first constraint rule, wherein the first constraint rule is a constraint rule on the number of model layers of the CNN model structure, and the first constraint rule is determined according to the size information of the array in the storage-computing integrated chip and the number of channels of the input data of the CNN model structure, n is an integer greater than or equal to 1, and the CNN model structure includes multiple convolutional layers;

[0107] A training module 502 is used to perform cascade training on the n CNN model structures to obtain n trained CNN models;

[0108] A second processing module 503 is used to perform a reparameterization process on each of the n trained CNN models to obtain a single-layer model, where the number of convolutional layers in the single-layer model is 1;

[0109] The deployment module 504 is used to deploy the single-layer model corresponding to each CNN model and the parameters of the single-layer model corresponding to each CNN model in the storage and computing integrated chip.

[0110] In some embodiments, the first constraint rule includes: the number of model layers of the CNN model structure is 2 to the power of m, where m is an integer greater than or equal to 0;

[0111] The second processing module 503 is used to perform reparameterization processing on each of the n trained CNN models to obtain a single-layer model, including:

[0112] When the number k of convolutional layers in the first CNN model is greater than 1, the k convolutional layers in the first CNN model are reparameterized m times to obtain a single-layer model corresponding to the first CNN model, and the first CNN model represents any one of the n trained CNN models.

[0113] In some embodiments, the second processing module 503 is used to perform m re-parameterization processes on the k convolutional layers in the first CNN model to obtain a single-layer model corresponding to the first CNN model, including:

[0114] When k is equal to 2, the k convolutional layers are divided into k / 2 convolutional layer combinations, and each convolutional layer combination in the k / 2 convolutional layer combinations is formed into two adjacent convolutional layers in the k convolutional layers; each convolutional layer combination in the k / 2 convolutional layer combinations is subjected to a reparameterization process according to a reparameterization method of a convolutional kernel to obtain a new convolutional layer; the reparameterization method of the convolutional kernel includes: reparameterizing two convolutional layers whose convolutional kernel sizes are both w×h into a new convolutional layer whose convolutional kernel size is (w+2)×(h+2);

[0115] When k is greater than 2, in response to the need to perform an i-th reparameterization process on the k convolutional layers in the first CNN model, and i is equal to 1, the k convolutional layers are divided into k / 2 convolutional layer combinations, and each convolutional layer combination in the k / 2 convolutional layer combinations is reparameterized once according to the reparameterization method of the convolution kernel to obtain a corresponding new convolutional layer; when k is greater than 2, in response to the need to perform an i-th reparameterization process on the k convolutional layers in the first CNN model, and i is greater than 1, each new convolutional layer obtained after the i-1th reparameterization process is obtained, and each new convolutional layer is reparameterized for the i-th time according to the reparameterization method of the convolution kernel.

[0116] In some embodiments, the first constraint rule includes: the product of the number of channels and the first parameter is less than the number of rows in each array in the storage and computing integrated chip, and the first parameter is positively correlated with the number of model layers of the CNN model structure.

[0117] In some embodiments, the first parameter is the square of the second parameter, and the second parameter is the sum of 2 times the number of model layers and 1.

[0118] In some embodiments, the first processing module 501 is also used to determine the value of the number n of the CNN model structures based on a second constraint rule before generating n CNN model structures based on the first constraint rule, and the second constraint rule includes: n is less than or equal to the number of arrays in the storage and computing integrated chip.

[0119] In some embodiments, the deployment module 504 is used to deploy the single-layer model corresponding to each CNN model and the weight of the single-layer model corresponding to each CNN model in the storage-computing integrated chip, including:

[0120] Determine n arrays in the storage-computing integrated chip that need to deploy a single-layer model;

[0121] In the n arrays where single-layer models need to be deployed, the single-layer model corresponding to each CNN model and the weight of the single-layer model corresponding to each CNN model are deployed in the corresponding array of the storage and computing integrated chip in a deployment manner in which only one single-layer model is deployed in each array.

[0122] In some embodiments, the parameters of the single-layer model corresponding to each CNN model include the size and bias of the convolution kernel.

[0123] It should be noted that the description of the above device embodiment is similar to the description of the above method embodiment, and has similar beneficial effects as the method embodiment. For technical details not disclosed in the device embodiment of the present application, please refer to the description of the method embodiment of the present application for understanding.

[0124] It should be noted that in the embodiments of the present application, if the above method is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium, including a number of instructions to enable a computer device (which can be a terminal, a server, etc.) to execute all or part of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory (ROM), a disk or an optical disk. In this way, the embodiments of the present application are not limited to any specific combination of hardware and software.

[0125] Correspondingly, an embodiment of the present application further provides a computer program product, which includes computer executable instructions, and the computer executable instructions are used to implement any model deployment method provided in the embodiment of the present application.

[0126] Correspondingly, an embodiment of the present application further provides a computer storage medium, on which computer executable instructions are stored, and the computer executable instructions are used to implement any one of the model deployment methods provided in the above embodiments.

[0127] An embodiment of the present application also provides an electronic device. Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application is shown in FIG. Figure 6 As shown, the electronic device 60 may include:

[0128] Memory 601, used to store executable instructions;

[0129] The processor 602 is used to implement any of the above-mentioned model deployment methods when executing the executable instructions stored in the memory 601.

[0130] The processor 602 may be at least one of an ASIC, a DSP, a DSPD, a PLD, a FPGA, a CPU, a controller, a microcontroller, and a microprocessor.

[0131] The above-mentioned computer-readable storage medium and memory 602 can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory (Flash Memory), a magnetic surface memory, an optical disk, or a compact disc read-only memory (CD-ROM) and other memories; it can also be various terminals including one or any combination of the above-mentioned memories, such as mobile phones, computers, tablet devices, personal digital assistants, etc.

[0132] In some embodiments, the functions or modules included in the device provided in the embodiments of the present application can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments. For the sake of brevity, it will not be repeated here.

[0133] The above description of various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced to each other, and for the sake of brevity, they will not be repeated herein.

[0134] The methods disclosed in the various method embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments.

[0135] The features disclosed in the various product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.

[0136] The features disclosed in the various method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method embodiments or device embodiments.

[0137] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0138] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A model deployment method, characterized in that: The method comprises: Based on the first constraint rule, n convolutional neural network (CNN) model structures are generated, wherein the first constraint rule is a constraint rule on the number of model layers of the CNN model structure, and the first constraint rule is determined according to the size information of the array in the storage-computing integrated chip and the number of channels of the input data of the CNN model structure, n is an integer greater than or equal to 1, and the CNN model structure includes multiple convolutional layers; Performing cascade training on the n CNN model structures to obtain n trained CNN models; Reparameterization is performed on each of the n trained CNN models to obtain a single-layer model, where the number of convolutional layers in the single-layer model is 1; The single-layer model corresponding to each CNN model and the parameters of the single-layer model corresponding to each CNN model are deployed in the storage and computing integrated chip.

2. The method according to claim 1, characterized in that The first constraint rule includes: the number of model layers of the CNN model structure is 2 to the power of m, where m is an integer greater than or equal to 0; The re-parameterization process is performed on each of the n trained CNN models to obtain a single-layer model, including: When the number k of convolutional layers in the first CNN model is greater than 1, the k convolutional layers in the first CNN model are reparameterized m times to obtain a single-layer model corresponding to the first CNN model, and the first CNN model represents any one of the n trained CNN models.

3. The method according to claim 2, characterized in that The step of performing m re-parameterization processing on the k convolutional layers in the first CNN model to obtain a single-layer model corresponding to the first CNN model includes: When k is equal to 2, the k convolutional layers are divided into k / 2 convolutional layer combinations, and each convolutional layer combination in the k / 2 convolutional layer combinations is formed into two adjacent convolutional layers in the k convolutional layers; each convolutional layer combination in the k / 2 convolutional layer combinations is subjected to a reparameterization process according to a reparameterization method of a convolutional kernel to obtain a new convolutional layer; the reparameterization method of the convolutional kernel includes: reparameterizing two convolutional layers whose convolutional kernel sizes are both w×h into a new convolutional layer whose convolutional kernel size is (w+2)×(h+2); When k is greater than 2, in response to the need to perform an i-th reparameterization process on the k convolutional layers in the first CNN model, and i is equal to 1, the k convolutional layers are divided into k / 2 convolutional layer combinations, and each convolutional layer combination in the k / 2 convolutional layer combinations is reparameterized once according to the reparameterization method of the convolution kernel to obtain a corresponding new convolutional layer; when k is greater than 2, in response to the need to perform an i-th reparameterization process on the k convolutional layers in the first CNN model, and i is greater than 1, each new convolutional layer obtained after the i-1th reparameterization process is obtained, and each new convolutional layer is reparameterized for the i-th time according to the reparameterization method of the convolution kernel.

4. The method according to any one of claims 1 to 3, characterized in that: The first constraint rule includes: the product of the number of channels and the first parameter is less than the number of rows in each array in the storage and computing integrated chip, and the first parameter is positively correlated with the number of model layers of the CNN model structure.

5. The method according to claim 4, characterized in that The first parameter is the square of the second parameter, and the second parameter is the sum of twice the number of model layers and 1.

6. The method according to any one of claims 1 to 3, characterized in that: Based on the first constraint rule, before generating n CNN model structures, the method further includes: Based on the second constraint rule, the value of the number n of the CNN model structure is determined, and the second constraint rule includes: n is less than or equal to the number of arrays in the storage and computing integrated chip.

7. The method according to claim 6, characterized in that The deploying the single-layer model corresponding to each CNN model and the weight of the single-layer model corresponding to each CNN model in the storage-computing integrated chip includes: Determine n arrays in the storage-computing integrated chip that need to deploy a single-layer model; In the n arrays where single-layer models need to be deployed, the single-layer model corresponding to each CNN model and the weight of the single-layer model corresponding to each CNN model are deployed in the corresponding array of the storage and computing integrated chip in a deployment manner in which only one single-layer model is deployed in each array.

8. The method according to any one of claims 1 to 3, characterized in that: The parameters of the single-layer model corresponding to each CNN model include the size and bias of the convolution kernel.

9. A model deployment device, characterized in that: The device comprises: A first processing module is used to generate n convolutional neural network (CNN) model structures based on a first constraint rule, wherein the first constraint rule is a constraint rule on the number of model layers of the CNN model structure, and the first constraint rule is determined according to size information of an array in a storage-computing integrated chip and the number of channels of input data of the CNN model structure, and n is an integer greater than or equal to 1, and the CNN model structure includes multiple convolutional layers; A training module, used for performing cascade training on the n CNN model structures to obtain n trained CNN models; A second processing module is used to perform a reparameterization process on each of the n trained CNN models to obtain a single-layer model, where the number of convolutional layers in the single-layer model is 1; A deployment module is used to deploy the single-layer model corresponding to each CNN model and the parameters of the single-layer model corresponding to each CNN model in the storage and computing integrated chip.

10. An electronic device, characterized in that: The electronic device comprises a processor and a memory for storing a computer program that can be run on the processor; wherein, The processor is configured to run the computer program to perform the method according to any one of claims 1 to 8.

11. A computer storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.

12. A computer program product, comprising a computer program, characterized in that The computer program implements the method according to any one of claims 1 to 8 when executed by a processor.