Low-calculation-amount neural network affine layer optimization method based on homogeneous transformation
By introducing homogeneous transformation into the affine transformation layer of neural networks and fusing the offset into part of the homogeneous matrix, the problem of computing redundancy and performance bottlenecks in the prior art is solved, and more efficient computing and lower inference latency and power consumption are achieved.
Patent Information
- Application Number
- CN202510000525.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-02
- Publication Date
- 2025-04-08
AI Technical Summary
The affine transformation layer in existing neural networks has problems such as computational redundancy, performance bottlenecks and inconsistent structure during the calculation process, especially in mobile devices and embedded systems, which affect inference performance and computing efficiency.
By introducing homogeneous transformation, the offsets are fused into part of the homogeneous matrix and unified into a single matrix multiplication operation, thereby eliminating the independent calculation steps of the offsets and simplifying the calculation process.
This method improves computing efficiency, reduces computational burden, improves inference performance, and optimizes the utilization of hardware accelerators, significantly reducing inference latency and power consumption.
Smart Images

Figure CN119783731A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of artificial intelligence and deep learning, and in particular to an affine layer design method for optimizing the computing efficiency of a neural network, which is particularly suitable for mobile devices and embedded systems and aims to simplify offset calculations through homogeneous transformations, thereby improving reasoning performance and reducing computing burden. Background Art
[0002] Modern neural network models, especially in convolutional neural networks (CNN) and fully connected neural networks (FCN), widely use affine transformation layers. Affine transformation layers are usually used to linearly transform input features and add offsets, which can be expressed mathematically as: y=Wx+b Where W is the weight matrix, x is the input vector, and b is the bias term. In practical applications of neural networks, the calculation of the bias is usually independent of the linear transformation, which brings the following problems: Computational redundancy: The addition of offsets adds extra computational steps. Especially in multi-layer neural networks, the processing of offsets will bring obvious computational overhead.
[0003] Performance bottleneck: In mobile devices and embedded systems, computing resources are limited, and independent offset calculations may lead to inference delays and increased power consumption.
[0004] Inconsistent structure: The weight matrix and offset are processed separately, which makes the calculation structure of affine transformation complex and is not conducive to the optimal use of hardware accelerators. Summary of the invention
[0005] This paper proposes a new affine layer optimization method based on homogeneous transformation. This method introduces homogeneous coordinates, merges the offset into a part of the homogeneous matrix, and unifies it into a matrix multiplication operation, thereby eliminating the independent calculation steps of the offset, simplifying the calculation process, and improving the calculation efficiency.
[0006] Technical Solution
[0007] The input vector is expanded to homogeneous coordinates: Assume the input vector is x∈R n , whose homogeneous coordinates are represented by x′=[x,1] T .
[0008] This extension adds a dimension to the input vector so that the offsets can be handled uniformly via matrix calculations.
[0009] Homogeneous affine transformation matrix design: The affine transformation matrix A is defined as: A=\left [ {{^{W}_{0}{^{b}_{1}}}} \right ] Where W is an n×n weight matrix and b is an n×1 offset vector. The matrix calculation becomes: y′=A⋅x′ The first n elements of the output vector y' are the result of the affine transformation, and the last element is the constant 1. Beneficial Effects
[0010] By fusing the offset b into the homogeneous matrix A, the affine transformation is simplified to a matrix multiplication calculation, avoiding additional addition operations and improving the computational efficiency and utilization of the hardware accelerator. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 shows the computational flow of the affine layer of a traditional neural network, where the offset is an independent computational step.
[0012] Figure 2 shows the affine layer structure based on homogeneous transformation, where the offset is fused as part of the homogeneous matrix to achieve unified calculation.
[0013] Figure 3 shows the application scenario in a mobile device. The new affine layer structure reduces the amount of computation and lowers the inference latency. DETAILED DESCRIPTION
[0014] Embodiment 1: (1) Affine layer optimization for 2D image classification tasks
[0015] In traditional 2D image classification tasks, after the input image is extracted through the convolution layer, it is usually classified through the fully connected layer. Using the homogeneous transformation affine layer of the present invention to replace the traditional affine layer, the calculation formula becomes:
[0016] x′=[x,1] T y' = \left [ {{^{W}_{0}{^{b}_{1}}}} \right ] x′ The optimization method has been shown in experiments to reduce inference time by 15%-20%, and the calculation results are completely consistent with the traditional method.
[0017] (2) Geometric Deep Learning for 3D Point Cloud Classification
[0018] In 3D point cloud processing tasks, the input point cloud data needs to be standardized, including translation and rotation transformations. The homogeneous transformation affine layer of the present invention can directly process these geometric transformations: p′=[p,1] T q' = \left [ {{^{R}_{0}}{^{t}_{1}}} \right ] p′ Where R is the rotation matrix and t is the translation vector. This method shows better geometric invariance and robustness in the 3D point cloud classification task.
[0019] (3) AI inference acceleration for embedded systems
[0020] In embedded systems (such as smart cameras and drones), neural network reasoning requires low latency and low power consumption. The homogeneous transformation affine layer of the present invention can reduce the computational burden of the offset and use the hardware matrix multiplication accelerator to complete the unified calculation. Experimental data shows that the model reasoning time is reduced by 25% and the power consumption is reduced by 10%.
Claims
1. A method for optimizing the affine layer of a neural network based on homogeneous transformation, characterized in that: The input vector is expanded into homogeneous coordinates, and the offset in the affine transformation is uniformly represented as a part of the homogeneous matrix, so that the affine transformation calculation is completed through one matrix multiplication, avoiding the independent calculation steps of the offset and improving the calculation efficiency.
2. The method according to claim 1, wherein the input vector x is expanded into homogeneous coordinates x′, where x′=[x,1] T ; The affine transformation matrix A is expressed as: A=\left [ {{^{W}_{0}{^{b}_{1}}}} \right ] in, W is the weight matrix, b is the offset; the affine transformation is calculated as: y′=A⋅x′ Thereby, the offset b is integrated into a part of the homogeneous matrix and the affine transformation is calculated uniformly.
3. The method according to claim 1 or 2, wherein the method is applied to the affine transformation calculation of the fully connected layer and the convolutional layer, reducing the separate calculation steps of the offset and improving the reasoning speed and computing efficiency of the neural network.
4. The method according to claim 1, wherein the method is applied to neural network reasoning acceleration of mobile devices or embedded systems, and by simplifying the affine layer calculation structure, the calculation burden and power consumption requirements during reasoning are effectively reduced.
5. The method according to claim 1 or 4, wherein the matrix calculation of the homogeneous transformation can be efficiently calculated using existing hardware accelerators, thereby further improving the AI reasoning performance in mobile devices or embedded systems.
6. The method according to claim 1 or 2, wherein the method is applicable to geometric deep learning tasks, including 3D point cloud processing, SLAM pose estimation, and geometric data processing in AR / VR applications, and enhances the robustness and invariance of the model to geometric transformations such as translation and rotation through homogeneous transformation.
7. The method according to claim 1 or 2, wherein the homogeneous transformation affine layer design can be used in combination with model optimization methods such as quantization, pruning, and distillation to further achieve efficient compression and inference acceleration of the neural network.
8. The method according to claim 1, wherein the homogeneous transformation affine layer can reduce the number of parameters in the affine transformation, and reduce the storage requirements and transmission bandwidth of the neural network model by reducing the separate storage and calculation of the offset.
9. A neural network model comprising an affine layer based on homogeneous transformation, characterized in that: The neural network model uses a homogeneous transformation affine layer to replace the traditional affine transformation layer to implement the affine transformation of the input data and uniformly calculate the offset and weight matrix, thereby improving the inference speed and computational efficiency of the model.
10. The neural network model according to claim 9, wherein the model is used for tasks such as image classification, object detection, speech recognition, natural language processing, etc., can effectively reduce reasoning delay, and is suitable for mobile devices, embedded systems and edge computing devices.