METHOD FOR COMPILING A TRAINED ARTIFICIAL NEURAL NETWORK

The compilation process for artificial neural networks, involving adaptive scaling, equalization, bias absorption, and tensor quantification, addresses the insufficiencies of existing tensor quantification methods by preserving precision and simplifying the quantization process.

FR3153919A1Pending Publication Date: 2025-04-11STMICROELECTRONICS INT NV
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
FR2023010810
Authority / Receiving Office
FR · FR
Patent Type
Applications
Current Assignee / Owner
Filing Date
2023-10-10
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

Existing tensor quantification methods for artificial neural networks are insufficient in certain cases, leading to a loss of precision when quantizing networks trained with floating-point representations.

Method used

A compilation process that modifies the topology of a trained artificial neural network by replacing the linear unit rectified to saturation layer with an adaptive scaling layer, followed by equalization between layers, bias absorption, and tensor quantification, to generate a quantified network with preserved precision.

Benefits of technology

The process achieves a tensor quantification after training that limits the loss of precision of the quantified network compared to the floating-point representation, without requiring all training data and with simpler implementation compared to quantization during training.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000018_0000
    Figure 00000018_0000
  • Figure 00000018_0001
    Figure 00000018_0001
  • Figure 00000020_0000
    Figure 00000020_0000
Patent Text Reader

Abstract

According to one aspect, a computer-implemented method for compiling a first trained artificial neural network is proposed. This first trained artificial neural network comprises at least one succession (SUCC_2) of layers, including a depth-convolutional layer, followed by a saturation-rectified linear unit layer, and then a two-dimensional convolutional layer. The method comprises: - an equalization (13) between layers, - a replacement (15) of the saturation-rectified linear unit layer with a per-channel adaptive trimming layer to obtain an artificial neural network with a modified topology, - a tensor quantization (16) of the layers of the artificial neural network with a modified topology, - a compilation (17) of the quantized artificial neural network with a modified topology. Figure for the abstract: Figure 3
Need to check novelty before this filing date? Find Prior Art

Description

Title of the invention: METHOD FOR COMPILING A TRAINED ARTIFICIAL NEURAL NETWORK

[0001] Embedding and implementation methods relate to artificial neural networks.

[0002] Artificial neural networks generally comprise a succession of layers of neurons. Each layer takes as input data to which weights are applied and outputs output data after processing by activation functions of the neurons in that layer. This output data (also referred to as "activations") is transmitted to the next layer in the neural network.

[0003] Weights are data, more specifically parameters, of configurable neurons to obtain good output data from the layers. The weights of a layer are defined in a weight tensor. The weight tensor can have several channels.

[0004] The weights are adjusted during a generally supervised training phase, notably by running the neural network with already classified data from a reference database as input data. This training phase makes it possible to obtain a trained neural network.

[0005] Artificial neural networks, once trained, can be integrated into integrated circuits, such as microcontrollers.

[0006] In particular, it is possible to use integration software to integrate an artificial neural network into an integrated circuit. For example, the STM32Cube.AI integration software and its X-CUBE-AI extension developed by STMicroelectronics are known.

[0007] Furthermore, some integrated circuits include a circuit dedicated to processing artificial neural networks, also called artificial neural network accelerators. Such a dedicated circuit is designed to improve the execution performance of artificial neural networks. In particular, such a circuit can be designed according to a specific hardware architecture to optimize common artificial neural network operations, such as matrix multiplications, activation functions, and convolution operations. This architecture allows, for example, highly efficient parallel computations. Thus, such a circuit is designed to maximize performance in terms of computation speed and energy efficiency. This makes it possible to significantly accelerate the execution of an artificial neural network.

[0008] Furthermore, an artificial neural network is generally trained using A floating-point representation for its weights and activations. Using a floating-point representation generally results in a trained artificial neural network with better accuracy.

[0009] However, circuits dedicated to processing artificial neural networks are generally configured to run neural networks quantized in integers or fixed points. Circuits dedicated to processing artificial neural networks are generally not configured to run artificial neural networks using a floating-point representation.

[0010] In particular, artificial neural networks can be quantized to accelerate their execution and reduce memory requirements. Neural network quantization involves defining a data representation format for the neural network, such as the weights, inputs, and outputs of each layer. Quantization notably allows for conversion from a floating-point representation to a fixed-point format. The layers of a neural network can be quantized in eight bits or in binary, for example. Neural network quantization can be implemented by the integration software.

[0011] Quantification can be carried out during the learning phase or after the learning phase.

[0012] Quantization during the training phase can be designated by the acronym "QAT," from the English expression "Quantization-Aware Training." Quantization during the training phase requires retraining a previously trained artificial neural network by simulating quantization. Such quantization is complex, requires significant computation to perform the training phase, and may also require hyperparameter tuning. It also has the disadvantage of requiring all the training data. Nevertheless, quantization during the training phase allows the performance of the quantized trained neural network to be brought closer to the performance of a trained neural network using a floating-point representation for its weights and activations.

[0013] The quantization performed after the training phase can be designated by the acronym "PTQ," from the English expression "Post-Training Quantization." This quantization is performed using a pre-trained neural network and requires little or no data. It also requires minimal adjustment of the artificial neural network's hyperparameters. This quantization does not require a subsequent retraining phase for the artificial neural network. This allows for a simpler quantization of an artificial neural network compared to the quantization of a pre-trained neural network. during the learning phase.

[0014] Furthermore, quantification can be carried out either by tensor or by channel.

[0015] Tensor quantization uses a single set of weight tensor quantization parameters. In other words, the weights of the same tensor share the same scale and the same offset.

[0016] Channel-based quantization uses separate parameter sets for each output channel of the weight tensor. In other words, the weights of the same channel of a weight tensor share the same scale and offset, but this scale and offset can differ from one channel of the weight tensor to another. Channel-based quantization improves the granularity of the quantization. This generally improves the accuracy of the quantized neural network compared to tensor-based quantization.

[0017] However, channel-based quantization is complex to implement on circuits dedicated to processing artificial neural networks. In particular, channel-based quantization may require scaling when using data that does not have the same scale. Thus, tensor-based quantization is more often chosen when the artificial neural network is integrated into an integrated circuit, such as a microcontroller, using a circuit dedicated to neural network processing.

[0018] The publication “A White Paper on Neural Network Quantization,” by Markus Nagel et al., published on June 15, 2021, on the arXiv.org website, describes a solution for improving the accuracy of a tensor-quantized artificial neural network to approach that of a trained artificial neural network using a floating-point representation. In particular, the publication describes a quantization method using cross-layer equalization and bias absorption.

[0019] However, the solution proposed by this publication proves insufficient in some cases.

[0020] There is therefore a need to improve tensor quantification of artificial neural networks.

[0021] According to one aspect, a computer-implemented method is proposed for compiling a first trained artificial neural network, the first trained artificial neural network comprising at least one succession of layers including a depth convolution layer, then a saturation rectified linear unit layer, then a two-dimensional convolution layer, the method comprising: - an equalization between the depth convolution layer and the two-dimensional convolution layer, - replacing the saturated rectified linear unit layer with a per-channel adaptive trimming layer to obtain an artificial neural network with a modified topology, - a tensor-based quantification of the layers of the artificial neural network with modified topology, - a compilation of the artificial neural network with modified topology and quantized so as to generate a computer program comprising instructions which, when the program is executed by a computer, lead the computer to implement the artificial neural network with modified topology and quantized.

[0022] The adaptive clipping layer per channel makes it possible to avoid using a saturated rectified linear unit layer, while preserving the initial behavior of the artificial neural network.

[0023] The compilation process thus makes it possible to perform tensor quantification after training the artificial neural network while limiting the loss of precision of the quantified artificial neural network compared to the trained artificial neural network using a floating-point representation for its weights and activations.

[0024] Such tensor quantification after training the artificial neural network has the advantage of being able to be carried out without requiring all the data used to perform the training.

[0025] Such tensor quantization has the advantage of being able to be implemented simply compared to quantization during the learning phase.

[0026] In an advantageous embodiment, the adaptive clipping layer per channel is adapted according to a saturation value defined for the saturated rectified linear unit layer.

[0027] Preferably, the adaptive per-channel trimming layer is configured to trim each channel of the activation tensor generated by the depth convolution layer between a minimum value of 0 and a maximum value calculated by applying the formula: max_val = X x .Vf1, where max_val is the maximum value, X is a saturation value defined by the saturated rectified linear unit layer and $ _ where / 4 b corresponds to the range of values ​​of channel i of a weight tensor of the depth convolution layer and corresponds to the range of values ​​of channel i of a weight tensor of the two-dimensional convolution layer.

[0028] In an advantageous embodiment, the method also includes bias absorption between the depth convolution layer and the two-dimensional convolution layer.

[0029] Advantageously, the method further comprises: - obtaining an initial trained artificial neural network comprising at least a succession of layers including a depth-first convolution layer, then a first batch normalization layer, then a saturation rectified linear unit layer, then a two-dimensional convolution layer, and possibly a second batch normalization layer, - a fusion of the first batch normalization layer of the initial trained artificial neural network with the depth convolution layer, and possibly a fusion of the second batch normalization layer with the two-dimensional convolution layer, so as to obtain said first trained artificial neural network.

[0030] According to another aspect, a computer program compilation product is proposed comprising instructions which, when the program is executed by a computer, cause the computer to implement a compilation process as described above.

[0031] According to another aspect, a quantized and trained artificial neural network is proposed, comprising at least one succession of layers including a depth-first convolution layer, then a channel-adaptive trimming layer, then a two-dimensional convolution layer,

[0032] According to another aspect, a computer system is proposed comprising: - a memory storing a compiled computer program product as described previously, - a main processing unit configured to run said compilation computer program.

[0033] According to another aspect, a computer-readable data carrier is proposed, on which the computer program compilation product as described above is recorded.

[0034] According to another aspect, a computer program product is proposed comprising instructions which, when the program is executed by a computer, lead the latter to implement a modified topology and quantized artificial neural network obtained according to a compilation process as described above.

[0035] According to another aspect, a microcontroller comprising: is proposed - a memory storing a computer program product as described above to execute a modified and quantized topology artificial neural network, - a main processing unit configured to run said computer program.

[0036] In an advantageous embodiment, the microcontroller further comprises a circuit dedicated to processing neural networks configured to execute the artificial neural network with modified and quantized topology.

[0037] According to another aspect, a computer-readable data carrier is proposed, on which is recorded the computer program product as described above to execute a modified and quantized topology artificial neural network.

[0038] Other advantages and features of the invention will become apparent upon examination of the detailed description of embodiments, which are by no means limiting, and the accompanying drawings in which:

[0039] [Fig.1]

[0040] [Fig.2]

[0041] [Fig.3]

[0042] [Fig.4]

[0043] [Fig.5]

[0044] [Fig.6] illustrate embodiments and implementations of the invention.

[0045] Figure 1 illustrates one embodiment of a computer system SYS. The SYS computer system comprises a main processing unit CPU1 and a memory MEM1. The memory MEM1 stores a compilation computer program PRG1 comprising instructions which, when the program is executed by the main processing unit CPU1, cause it to implement a compilation process for an artificial neural network as described below in relation to [Fig.2].

[0046] The PRG1 compilation computer program can be included in an integration software. The integration software is configured to integrate a quantized neural network into an integrated circuit.

[0047] Figure 2 illustrates an implementation method for compiling an artificial neural network. This method can be implemented by executing the PRG1 compilation computer program.

[0048] The method includes obtaining 10 of the trained artificial neural network TNN. The trained artificial neural network TNN can be provided as input to the integration software.

[0049] The TNN-trained artificial neural network comprises a succession of neuronal layers. Each layer takes as input data to which weights are applied and outputs output data after processing by activation functions of the neurons in that layer. This output data (also referred to as "activations") is transmitted to the next layer in the neural network. In particular, the TNN-trained artificial neural network then comprises an input layer LAY_I configured to receive input data from the TNN artificial neural network and an output layer LAY_O configured to generate output data from the TNN artificial neural network.

[0050] The weights of a layer are defined in a weight tensor. The weight tensor can have several channels. The weights are data, more specifically parameters, of configurable neurons to obtain good output data from the layers.

[0051] The weights are adjusted during a generally supervised training phase, notably by running the neural network with already classified data from a reference database as input data. This training phase makes it possible to obtain a trained neural network.

[0052] Training is used to define a neural network with optimal performance. More specifically, during neural network training, the network's weights are adjusted, and then the performance of the modified network is evaluated. If the neural network's performance is satisfactory, the network training is stopped.

[0053] The trained neural network can use a floating-point number representation for the weights and data (activations) generated by each layer of the neural network.

[0054] The trained neural network has a format known to a person skilled in the art. For example, the trained neural network can be obtained from artificial neural network design software, such as Keras, TensorFlow, and ONNX (acronym for "Open Neural Network Exchange").

[0055] As illustrated in [Fig. 3], the artificial neural network comprises at least one SUCC_1 sequence of layers, referred to as the sequence of layers of interest, including a depth-wise convolution layer D_CONV, then a first batch normalization layer B_NORM1, then a saturated rectified linear unit layer RELUX, then a two-dimensional convolution layer CONV_2D, and optionally a second batch normalization layer B_NORM2. In [Fig. 3], only one SUCC_1 sequence of layers of interest is shown. However, the artificial neural network may include several sequences of layers of interest like the one illustrated in [Fig. 3].

[0056] The depth convolution layer D_CONV is configured to apply a convolution kernel to each input channel of the depth convolution layer. A convolution kernel is therefore defined for each input channel of the depth convolution layer.

[0057] The first batch normalization layer B_NORM1 is configured to normalize the tensor activations it receives as input. In particular, the batch normalization layer is configured to calculate a mean and a standard deviation of the The first batch normalization layer is used to reduce the effects of activation distribution drift during the training phase of the artificial neural network. It also accelerates convergence during training. This faster convergence means the artificial neural network can be trained more quickly and helps reduce overfitting. Overfitting occurs when the artificial neural network's training fit is too closely tied to the training data (e.g., training images).Such overfitting can lead to a decrease in the accuracy of the artificial neural network when run with input data different from the training data (e.g., new images). In other words, overfitting causes an artificial neural network to lose its ability to generalize to data different from that used for training.

[0058] The RELUX saturation rectified linear unit layer allows for the introduction of non-linearity into the artificial neural network. Such non-linearity enables the artificial neural network to learn complex functions.

[0059] In particular, the saturation rectified linear unit layer is configured to perform the following function:

[0060] ReLUX(z) = min(max(0, z), X), where z corresponds to an output of the first batch normalization layer on channel i, ReLUX(z) corresponds to an activation of the output tensor of the first batch normalization layer on channel i, and X corresponds to the saturation value.

[0061] In other words, the RELUX saturation rectified linear unit layer makes it possible to generate an output tensor in which the activation values ​​of each channel of the output tensor correspond to the minimum value between the defined saturation value X and the maximum value between 0 and the corresponding value of the activations of the associated channel of the input tensor.

[0062] For example, the 6-saturated rectified linear unit layer (“ReLU6”) is configured to perform the following function:

[0063] ReLU6(z) = min(max(0, z), 6), where z corresponds to an output of the first batch normalization layer on channel i, ReLU6(z) corresponds to an activation of the output tensor of the first batch normalization layer on channel i, and 6 corresponds to the saturation value.

[0064] The two-dimensional convolution layer CONV_2D is configured to apply the same convolution kernel to all tensor channels of activations that this two-dimensional convolution layer receives as input.

[0065] Similar to the first batch normalization layer B_NORM1, the second batch normalization layer B_NORM2 is configured to normalize the tensor activations it receives as input. In particular, the batch normalization layer is configured to calculate a mean and standard deviation of the activations, and then to normalize the activations by subtracting them from the calculated mean and dividing them by the calculated standard deviation. The second batch normalization layer is used to reduce the drift effects of an activation distribution during the training phase of the artificial neural network. The second batch normalization layer is also used to accelerate convergence during training. Such faster convergence means that the artificial neural network can be trained more quickly. This also helps to reduce the phenomenon of overfitting.

[0066] The compilation process includes a detection 11 of said at least one SUCC_1 sequence of layers of interest. In this step, the main processing unit CPU1 detects each SUCC_1 sequence of layers of interest, which therefore comprises a depth-first convolution layer D_CONV, then a first batch normalization layer B_NORM1, then a saturation rectified linear unit layer RELUX, then a two-dimensional convolution layer CONV_2D, and then optionally a second batch normalization layer B_NORM2. This detection is performed using the information associated with each layer of the trained artificial neural network.

[0067] Next, the main processing unit CPU1 performs steps 12 to 15 described below for each SUCC_1 succession of layers of interest detected.

[0068] In particular, the method includes a step 12 of merging the batch normalization layers B_NORM1, B_NORM2 with the preceding layers D_CONV, CONV_2D. This step 12 is performed by the main processing unit CPU1. This merging can be referred to as "batch normalization folding." The merging eliminates the operations of each batch normalization layer in the artificial neural network, resulting in a SUCC_2 sequence of layers, as illustrated in [Fig. 4]. Specifically, the operations of each batch normalization layer are integrated into the layer preceding that batch normalization layer. This reduces the number of computations required to perform each batch normalization layer.

[0069] In particular, the weights and biases associated with the layer preceding each batch normalization layer are recalculated to incorporate the operations of the batch normalization layer. More specifically, the weights of said layer preceding the batch normalization layer are calculated using the function next:

[0070] Wk = where yk is a hyperparameter whose value is defined by training, Wk is the value of the old weight, o is the variance calculated during training and e is a predefined constant.

[0071] The biases of said layer preceding the batch normalization layer are calculated using the following function: perparameter of the batch normalization layer whose value is defined by training, yk is a second parameter of the batch normalization layer, pk is the mean calculated during training, ok is the variance calculated during training and e is a predefined constant.

[0073] The process then includes a cross-layer equalization step 13. This cross-layer equalization step 13 is performed by the main processing unit CPU1. The cross-layer equalization step 13 corresponds to the method described in the publication "A White Paper on Neural Network Quantization", Markus Nagel et al., June 15, 2021.

[0074] The layer equalization is configured to match the weights and biases of two consecutive layers of an artificial neural network, for example between the depth convolution layer D_CONV and the two-dimensional convolution layer CONV_2D, separated by the saturation rectified linear unit layer RELUX.

[0075] In particular, for two consecutive layers of the artificial neural network, the output activation tensor of the first layer can be defined by the expression.

[0076] x + b^ °where J is the activation function of the first layer, y / ( 0 is the initial weight tensor of the first layer, x corresponds to the input activation tensor of the first layer and t) is the bias tensor of the first layer.

[0077] The output activation tensor of the second layer can be defined by the expression.

[0078] y _ + b^y °à is the activation function of the second layer, yA2) is the initial weight tensor of the second layer, h corresponds to the input activation tensor of the second layer and ^(21 is the bias tensor of the second layer.

[0079] By applying layer equalization, it is possible to redefine the weight tensors of the two successive layers so that y=f[w 1 \ + / / j + where = corresponds to the new weight tensor of the second layer, 1) _ y corresponds to the new weight tensor of the first layer, / ( 1) _ ç-b ( ! ) corresponds to the new tensor

[0080]

[0081]

[0082]

[0083]

[0084]

[0085]

[0086]

[0087]

[0088]

[0089] of bias of the first layer, J corresponds to the adaptive cropping function described below, and where 5 = diag(s) is a diagonal matrix whose values ​​Sü correspond to the scale factor Sj. In particular, the scale factor s; is defined to equalize the ranges of values ​​between different successive layers. More specifically, the scale factor s; is obtained using the formula: S; ^(1)^2), where bV corresponds to the range of values ​​of channel i of a tensor of weight of the depth convolution layer and / 9 corresponds to the range of values ​​of the i channel of a two-dimensional convolution layer weight tensor. Such a scaling factor improves the robustness of quantization by reducing quantization noise. Layer equalization avoids the problem of magnitude differences between elements of the same tensor. This problem often arises, in particular, when a deep convolutional layer is used. Layer equalization thus reduces the loss of precision that can result from tensor quantization. The process then includes a bias absorption step 14. This bias absorption step 14 is performed by the main processing unit, CPU1. The bias absorption step 14 corresponds to the method described in the publication "A White Paper on Neural Network Quantization," Markus Nagel et al., June 15, 2021. Bias absorption is configured to modify parameters to absorb biases, using the following formula: y = ^il + where = w(2)c. + h = h~c? = b(n - Ci where c. — max(0, p. - ct are two hyperparameters of the BN0RM1 batch normalization layer for channel i. The value '3' can also be adjusted from simulation by extracting activation statistics. Furthermore, if the saturated rectified linear unit layer frequently leads to saturations, then the equalization between layers may be insufficient to avoid a loss of accuracy resulting from tensor quantization. To address this problem, the process then includes a step 15 of rem Placement of the saturated rectified linear unit layer. This step 15 is performed by the main processing unit CPU1. In this step, the saturated rectified linear unit layer is replaced by a channel-adaptive clipping CPL_L layer, resulting in a SUCC_3 sequence of layers, as illustrated in [Fig. 5]. This step therefore leads to a modification of the artificial neural network topology.

[0090] The CPL_L adaptive per-channel trimming layer is configured to trim the output tensor of the depth convolution layer.

[0091] In particular, each channel of the tensor generated by the depth convolution layer is independently trimmed between a minimum and a maximum value. The minimum value is set to 0. The maximum value is calculated according to the following formula: max_val — X x sy1, where max_val is the maximum value, X is the saturation value defined by the saturation-rectified linear unit layer replaced and s; is the value calculated for the inter-layer equalization for channel i.

[0092] The adaptive clipping layer per channel makes it possible to avoid using a saturated rectified linear unit layer, while preserving the initial behavior of the artificial neural network.

[0093] The method then includes a tensor quantization step 16 of the layers of the artificial neural network. This step 16 is performed by the main processing unit CPU 1.

[0094] Thus, such a process makes it possible to obtain a trained and quantized QNN artificial neural network having a precision close to that of the trained artificial neural network using a floating-point representation for its weights and activations.

[0095] The method then includes a step 17 of compiling the trained and quantized artificial neural network QNN. This step 17 is performed by the main processing unit CPU1. This step 17 generates a computer program PRG2 comprising instructions which, when the program is executed by a computer, cause the computer to implement the obtained quantized artificial neural network QNN. In particular, the computer program QNN may include instructions so that the quantized artificial neural network can be executed by a circuit dedicated to artificial neural network processing. This computer program PRG2 is then stored in the MEM1 memory of the SYS computer system.

[0096] This PRG2 computer program can then be integrated into an integrated circuit, such as a microcontroller (MCU). The integrated circuit can then implement the quantized artificial neural network (QNN) by executing the instructions of said PRG2 computer program.

[0097] The compilation method described above makes it possible to perform tensor quantification after training the artificial neural network while limiting the loss of precision of the quantified artificial neural network compared to the trained artificial neural network using a floating-point representation for its weights and activations.

[0098] Such tensor quantification after training the artificial neural network has the advantage of being able to be performed without requiring all the data used to perform the training. A limited amount of data used for training may still be required to calibrate the layer outputs and activations.

[0099] Such tensor quantization has the advantage of being able to be implemented simply compared to quantization during training.

[0100] Furthermore, the modified topology of the artificial neural network has little impact on the execution time of the artificial neural network and on the amount of data to be stored in a flash memory of the integrated circuit integrating the artificial neural network.

[0101] Of course, the implementation of the compilation method described above is susceptible to various variations and modifications that will become apparent to those skilled in the art. In particular, the processing unit may perform steps 13 to 15 only for certain sequences of layers of interest. Specifically, the computer program PRG1 can be configured to determine which sequences of layers of interest are likely to include a saturation rectified linear unit layer whose saturation frequency during the execution of the trained neural network exceeds a predefined threshold. More specifically, saturation can be evaluated by running the trained artificial neural network using input data already used during the training phase of the artificial neural network.The PRG1 computer program can then be configured to perform steps 13 to 15 only for SUCC_1 sequences of layers of interest that may include a saturation rectified linear unit layer whose saturation frequency during the execution of the trained neural network is greater than a predefined threshold. The PRG1 computer program can also be configured to modify the saturation rectified linear unit layer of other SUCC_1 sequences of layers of interest to a non-saturation rectified linear unit layer (i.e., of the "ReLU" type).

[0102] Fig. 6 illustrates an embodiment of a microcontroller MCU configured to execute a quantized artificial neural network QNN obtained by the process described above in relation to Fig. 3.

[0103] The microcontroller includes a main processing unit CPU2, a memory MEM2, and an ACC circuit dedicated to processing artificial neural networks. The MEM2 memory stores a computer program PRG2 comprising instructions which, when the program is executed by the ACC circuit dedicated to processing neural networks, lead the latter to implement said quantized artificial neural network QNN.

Claims

Claims

1. A computer-implemented method for compiling a first trained artificial neural network, the first trained artificial neural network comprising at least one succession (SUCC_2) of layers comprising a depth-wise convolution layer (D_CONV), then a saturation rectified linear unit layer (RELUX), then a two-dimensional convolution layer (C0NV_2D), the method comprising: - an equalization (13) between the depth-wise convolution layer (D_CONV) and the two-dimensional convolution layer (C0NV_2D), - a replacement (15) of the saturation rectified linear unit layer (RELUX) by a channel-adaptive cropping layer (CLP_L) so as to obtain a topology-modified artificial neural network, - a tensor quantization (16) of the layers of the topology-modified artificial neural network,- a compilation (17) of the modified and quantized topology artificial neural network (QNN) so as to generate a computer program (PRG2) comprising instructions which, when the program is executed by a computer, cause the latter to implement the modified and quantized topology artificial neural network (QNN).,

2. The method of claim 1, wherein the channel adaptive clipping layer (CPL_L) is adapted according to a saturation value defined for the saturation rectified linear unit layer.

3. The method of claim 2, wherein the channel-adaptive cropping layer is configured to crop each channel of the activation tensor generated by the depth-wise convolution layer between a minimum value equal to 0 and a maximum value calculated by applying the formula: max_val = X x .sy1, where max_val is the maximum value, X is a saturation value defined by the saturating rectified linear unit layer and v _ J_ / r(l)r(2), where / fb corresponds to the value range of the lyii channel i of a weight tensor of the depth-wise convolution layer and corresponds to the value range of the channel i of a weight tensor of the two-dimensional convolution layer.

4. Method according to one of claims 1 to 3 also comprising an absorption (14) of bias between the depth convolution layer (D_CONV) and the two-dimensional convolution layer (CONV_2D).

5. Method according to one of claims 1 to 4, comprising: - obtaining (10) an initial trained artificial neural network (TNN) comprising at least one succession (SUCC_1) of layers comprising a depth convolution layer (D_CONV), then a first batch normalization layer (B_NORM1), then a saturation rectified linear unit layer (RELUX), then a two-dimensional convolution layer (CONV_2D), then possibly a second batch normalization layer (B_NORM2), - merging (12) the first batch normalization layer of the initial trained artificial neural network with the depth convolution layer, and possibly merging the second batch normalization layer with the two-dimensional convolution layer, so as to obtain said first trained artificial neural network.

6. Compilation computer program product (PRG1) comprising instructions which, when the program is executed by a computer, cause the latter to implement a compilation method according to one of claims 1 to 5.

7. Computer system comprising: - a memory (MEM1) storing a compilation computer program product according to claim 6, - a main processing unit (CPU1) configured to execute said compilation computer program.

8. Computer-readable data carrier, on which the compilation computer program product (PRG1) according to claim 6 is recorded.

9. Computer program product (PRG2) comprising instructions which, when the program is executed by a computer, cause the latter to implement a topology-modified and quantized artificial neural network (QNN) obtained according to a compilation method according to one of claims 1 to 5.

10. Microcontroller comprising: - a memory (MEM2) storing a computer program product (PRG2) according to claim 9, - a main processing unit (CPU2) configured to execute said computer program (PRG2).

11. The microcontroller of claim 10, further comprising a circuit (ACC) dedicated to processing neural networks configured to execute the modified and quantized topology artificial neural network (QNN).

12. Computer-readable data carrier, on which the computer program product (PRG2) according to claim 9 is recorded.

Citation Information

Patent Citations

  • Parametric Power-Of-2 Clipping Activations for Quantization for Convolutional Neural Networks

    US20210224658A1