Target detection model optimization method and device, medium, device

By applying L1 norm weight pruning and singular value decomposition techniques in the target detection model to optimize the convolutional layer weight tensor, the battery capacity and accuracy issues of deploying the model on resource-constrained devices are solved, and efficient miniaturized target detection model deployment is achieved.

CN116468969BActive Publication Date: 2025-09-19SHANDONG INSPUR SCI RES INST CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310434070.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-04-18
Publication Date
2025-09-19
Estimated Expiration
2043-04-18

AI Technical Summary

Technical Problem

Deploying object detection models with a large number of parameters on resource-constrained devices is limited by battery capacity, physical size, and latency. Existing efficient small models may not be able to meet the accuracy requirements of specific application scenarios.

Method used

Select an object detection model suitable for edge devices and optimize the convolutional layer weight tensor through L1 norm weight pruning and singular value decomposition techniques, including matrix decomposition, singular value truncation and reconstruction, combined with the Leaky ReLU activation function to improve model efficiency.

Benefits of technology

While taking into account the model accuracy, the number of parameters and computing requirements are reduced, allowing the target detection model to be efficiently deployed on resource-constrained devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116468969B_ABST
    Figure CN116468969B_ABST
Patent Text Reader

Abstract

The present invention provides a target detection model optimization method, apparatus, medium, and equipment. The method includes: S1, selecting a target detection model suitable for deployment on an edge device; S2, decomposing the two-dimensional matrix corresponding to the weight tensor of each convolutional layer in the target detection model into a left singular matrix, a diagonal singular value matrix, and a right singular matrix; S3, selecting the first R singular values ​​from the diagonal singular value matrix, and retaining the corresponding left singular vectors and right singular vectors; S4, reconstructing the weight tensor of the convolutional layer; S5, evaluating the target detection model to determine whether the target detection model meets the requirements of the edge device; if so, taking the current target detection model as the optimized target detection model; otherwise, adjusting R and returning to S2. In this way, the number of parameters used in the target detection model can be reduced, and while taking into account the accuracy of the model, the scale of the target detection model can be reduced so that it can be deployed on resource-constrained devices.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of model optimization technology, and in particular to a target detection model optimization method and device, medium, and device. Background Art

[0002] Object detection is a fundamental technique in computer vision that enables software systems to detect and localize objects in images or video streams. The key characteristic of object detection is its ability to identify the object's category and its location within an image or video stream. Real-time object detection aims to perform object detection in real time by predicting and localizing objects in real time. It has many applications, including self-driving cars, face recognition, letter detection, and risk detection. However, deploying object detection models with a large number of parameters on resource-constrained hardware is infeasible due to limitations in battery capacity, physical size, privacy, and latency.

[0003] One approach to deploying computer vision models for real-time detection on resource-constrained devices is to design efficient neural network architectures that reduce memory and computational requirements. GoogleNet and SqueezeNet achieved this goal by using 1x1 convolution kernels instead of standard 3x3 kernels to reduce the number of model parameters. Compared to AlexNet, SqueezeNet reduced model size by 50 times while exceeding AlexNet's accuracy. MobileNet further simplified the convolution process by decomposing it into depthwise and pointwise convolutions. While designing efficient and small models is crucial, it also has its limitations. For example, in the process of designing efficient and small models, accuracy is often sacrificed in exchange for efficiency. Consequently, efficient and small models may not meet the required accuracy in specific application scenarios. Since efficient and small models are often designed based on specific hardware platforms and application scenarios, they may be limited when it comes to expanding model functionality or adapting to new application scenarios.

[0004] In order to overcome these limitations, it is necessary to propose new solutions for the optimization of target detection models. Summary of the Invention

[0005] In response to at least one of the above technical problems, embodiments of the present invention provide a target detection model optimization method and device, medium, and device.

[0006] According to a first aspect, an embodiment of the present invention provides a method for optimizing a target detection model, including:

[0007] S1. Select an object detection model suitable for deployment on edge devices;

[0008] S2. Convert the weight tensor of each convolutional layer in the target detection model into a corresponding two-dimensional matrix, and decompose the two-dimensional matrix into a left singular matrix, a diagonal singular value matrix, and a right singular matrix;

[0009] S3. Select the first R singular values ​​from the diagonal singular value matrix, delete the remaining singular values, and retain the left singular vectors corresponding to the first R singular values ​​in the left singular matrix and the right singular vectors corresponding to the first R singular values ​​in the right singular matrix; where R is a positive integer;

[0010] S4. Reconstruct the weight tensor of the convolutional layer according to the retained first R singular values, the left singular vectors corresponding to the first R singular values, and the right singular vectors corresponding to the first R singular values;

[0011] S5. Evaluate the accuracy and parameter quantity of the target detection model, and determine whether the target detection model meets the requirements of the edge device based on the evaluation results; if so, use the current target detection model as the optimized target detection model, and deploy the optimized target detection model on the edge device; otherwise, adjust R and return to S2.

[0012] According to a second aspect, an embodiment of the present invention provides an object detection model optimization device, comprising:

[0013] The model selection module is used to execute S1 and select an object detection model suitable for deployment on the edge device;

[0014] A matrix decomposition module, configured to execute S2, convert the weight tensor of each convolutional layer in the target detection model into a corresponding two-dimensional matrix, and decompose the two-dimensional matrix into a left singular matrix, a diagonal singular value matrix, and a right singular matrix;

[0015] a matrix truncation module, configured to execute S3, select the first R singular values ​​from the diagonal singular value matrix, delete the remaining singular values, and retain the left singular vectors corresponding to the first R singular values ​​in the left singular matrix and the right singular vectors corresponding to the first R singular values ​​in the right singular matrix; wherein R is a positive integer;

[0016] A tensor reconstruction module is used to execute S4, reconstruct the weight tensor of the convolution layer according to the retained first R singular values, the left singular vectors corresponding to the first R singular values, and the right singular vectors corresponding to the first R singular values;

[0017] The model evaluation module is used to execute S5, evaluate the accuracy and parameter quantity of the target detection model, and determine whether the target detection model meets the requirements of the edge device based on the evaluation results; if so, the current target detection model is used as the optimized target detection model, and the optimized target detection model is deployed on the edge device; otherwise, R is adjusted and the process returns to the matrix decomposition module to execute S2.

[0018] According to a third aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to execute the method provided in the first aspect.

[0019] According to a fourth aspect, an embodiment of the present invention provides a computing device, comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method provided in the first aspect is implemented.

[0020] The target detection model optimization method, apparatus, medium, and device provided by the embodiments of the present invention first select a target detection model suitable for deployment on an edge device, then reconstruct the weight tensor of the convolutional layer using singular value decomposition and truncation, perform lightweight processing on the target detection model, and then evaluate the accuracy and parameter count of the target detection model to determine whether further optimization is needed. In this way, the number of parameters used in the target detection model can be reduced, while taking into account the accuracy of the model and reducing the scale of the target detection model so that it can be deployed on resource-constrained devices. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 Schematic diagram of the process of optimizing the target detection model according to one embodiment of the present invention;

[0022] Figure 2 Schematic diagram of the process of optimizing the target detection model in one embodiment of the present invention. DETAILED DESCRIPTION

[0023] In the first aspect, the embodiment of the present invention provides a method for optimizing a target detection model. Figures 1-2 The method includes the following steps S1 to S5:

[0024] S1. Select an object detection model suitable for deployment on edge devices;

[0025] Understandably, the rise of edge computing in the IoT and mobile device applications is driving the efficient use of computing resources and energy. In this context, implementing deep learning-based object detection models on edge devices presents numerous challenges. Therefore, selecting the right object detection model for edge devices is crucial.

[0026] To achieve high-performance object detection with limited computing resources and energy, researchers have proposed various optimization strategies tailored to the needs of different devices and applications. Among them, the YOLOv7-tiny model, a target detection model specifically designed for edge computing, improves model performance by employing the Leaky ReLU activation function. Compared to other activation functions, the Leaky ReLU activation function can retain very small non-zero outputs when the input is negative, effectively preventing the occurrence of dead neurons and improving the accuracy of the target detection model. In contrast, the SiLU activation function uses a sigmoid function to smooth the output over the input, providing better gradient propagation. However, due to the limited computing resources and energy of edge devices, more efficient and compact model implementations are required. Therefore, by utilizing the Leaky ReLU activation function, the edge-optimized YOLOv7-tiny model can minimize the use of computing resources while maintaining high accuracy.

[0027] Therefore, in one embodiment, the activation function of the target detection model is a Leaky ReLU activation function. The target detection model is a YOLOv7-tiny model.

[0028] In one embodiment, after executing S1 and before executing S2, the method may further include: performing lightweight processing on the weight matrix of the target detection model using L1 norm weight pruning technology.

[0029] Understandably, model pruning is a widely used model compression technique in deep learning that reduces the number of parameters and computational complexity in neural networks by removing redundant or less important parameters. Two common pruning methods are unstructured pruning, which removes small weights, and structured pruning, which removes entire convolution kernels or channels. Unstructured pruning requires additional software or hardware to support the resulting sparse matrices, but structured pruning can be easily inferred and is more practical for deployments without specialized processing.

[0030] Among them, structured pruning involves marking certain structures of the neural network to be removed based on importance scores, which are determined by specific criteria. One of these criteria is the L1 norm, which measures the importance of each convolution kernel, channel, or layer by the sum of the absolute values ​​of the weights. For example, when the convolution kernels were pruned in order of the smaller L1 norm value of each convolution kernel, 64% of the weights were removed, but no significant difference was found in the accuracy of the unpruned and pruned models.

[0031] In an embodiment of the present invention, the L1 norm weight pruning technology is used to optimize the target detection model, which can reduce its size and improve the deployment efficiency on resource-constrained devices, making the target detection model lightweight.

[0032] In one embodiment, the use of L1 norm weight pruning technology to lightweight the weight matrix of the target detection model can specifically include: for each weight matrix in the target detection model, calculating the L1 norm corresponding to each element in the weight matrix; replacing the elements with the smallest L1 norm in a preset proportion in the weight matrix with 0.

[0033] For example, for a 3*3 weight matrix, the L1 norm calculation is performed on each weight value, and the table shown in Table 1 is obtained:

[0034] Table 1

[0035] 0.01 3.2 2.5 1.83 -0.35 0.23 -2.3 1.68 0.36

[0036] Sort the above 9 L1 norm values ​​in descending order to obtain the sorting result, and then replace the three elements corresponding to the last three L1 norm values ​​0.01, -0.35 and -2.3 in the weight matrix with 0.

[0037] L1-norm weight pruning is used because only a small number of weights in a neural network contribute significantly to its efficient representational capabilities. Therefore, removing unimportant weights can significantly reduce the size and computational requirements of the object detection model while having a minimal impact on its performance. Furthermore, L1-norm weight pruning can enhance the performance of the object detection model by improving its generalization ability, as removing unimportant weights reduces overfitting.

[0038] S2. Convert the weight tensor of each convolutional layer in the target detection model into a corresponding two-dimensional matrix, and decompose the two-dimensional matrix into a left singular matrix, a diagonal singular value matrix, and a right singular matrix;

[0039] S3. Select the first R singular values ​​from the diagonal singular value matrix, delete the remaining singular values, and retain the left singular vectors corresponding to the first R singular values ​​in the left singular matrix and the right singular vectors corresponding to the first R singular values ​​in the right singular matrix; where R is a positive integer;

[0040] S4. Reconstruct the weight tensor of the convolutional layer according to the retained first R singular values, the left singular vectors corresponding to the first R singular values, and the right singular vectors corresponding to the first R singular values;

[0041] The above S2 to S4 use the singular value decomposition method to achieve further lightweight processing.

[0042] Among them, SVD (i.e. singular value decomposition) is a mathematical technique used in linear algebra to decompose a matrix into three smaller matrices: a left singular vector matrix, a singular value diagonal matrix, and a right singular vector matrix. Truncated SVD is a variant of SVD that only retains singular values ​​and their corresponding singular vectors. This is achieved by setting a threshold, below which singular values ​​and their corresponding singular vectors are discarded. In neural network compression, truncated SVD can be used to reduce the size of the weight matrix and compress the network. By retaining only the first R singular values ​​and their corresponding singular vectors, a smaller compressed weight matrix can be obtained, which can replace the original weight matrix.

[0043] Specifically, an initial R value is set. The weight tensor corresponding to each convolutional layer in the target detection model is converted into a corresponding two-dimensional matrix, wherein the weight tensor is in a multidimensional form, and the conversion into a two-dimensional form facilitates subsequent calculations. The number of rows of the two-dimensional matrix can be the maximum integer factor of the total number of elements of the weight tensor, aiming to generate a square two-dimensional matrix as much as possible to make the SVD process more efficient. The two-dimensional matrix is ​​then decomposed into three small matrices: a left singular matrix, a diagonal singular value matrix, and a right singular matrix.

[0044] In one embodiment, decomposing the two-dimensional matrix into a left singular matrix, a diagonal singular value matrix, and a right singular matrix may specifically include: decomposing the two-dimensional matrix into a left singular matrix, a diagonal singular value matrix, and a right singular matrix by using low-rank singular value decomposition.

[0045] Please refer to the following formula for details:

[0046]

[0047] Where W is the two-dimensional matrix corresponding to the weight tensor of a convolutional layer in the target detection model, with a size of m×n, U is the left singular matrix with a size of m×k; Σ is the diagonal singular value matrix, which is a diagonal matrix with a size of k×k. The elements on the diagonal are singular values ​​and are arranged in order from large to small. T is a right singular matrix of size k×n, which is the transposed matrix of U. K is an integer less than m and n, and is the rank of the SVD decomposition matrix.

[0048] After the singular value matrix Σ is truncated, only the first R singular values ​​are retained, and the remaining singular values ​​are deleted. Then, the left singular vectors corresponding to the first R singular values ​​in U are retained, and the left singular vectors corresponding to the first R singular values ​​in V are retained. T The corresponding right singular vector in , the remaining left singular vectors and right singular vectors are truncated, that is, deleted.

[0049] After truncation, the size of the SVD decomposition matrix becomes R(IK2 +1+O). Where K is the size of the convolution kernel, I is the number of input channels, and 0 is the number of output channels of the convolution kernel. The amount of calculation for the parameters in the original matrix is ​​OIK 2 , and the amount of calculation of the truncated matrix is ​​smaller than that of the original matrix. Therefore, the singular value truncation technique can reduce the number of parameters and the amount of calculation of the target detection model while ensuring that the performance of the target detection model is not greatly affected.

[0050] Then, after truncation, the weight tensor of the convolutional layer is reconstructed using the retained singular values ​​and singular vectors to replace the original weight tensor.

[0051] In one embodiment, reconstructing the weight tensor of the convolutional layer according to the retained first R singular values, the left singular vectors corresponding to the first R singular values, and the right singular vectors corresponding to the first R singular values ​​may specifically include:

[0052] Reconstructing a corresponding two-dimensional matrix according to the retained first R singular values, the left singular vectors corresponding to the first R singular values, and the right singular vectors corresponding to the first R singular values;

[0053] Reconstruct the corresponding weight tensor based on the reconstructed two-dimensional matrix.

[0054] That is, after truncation, the corresponding two-dimensional matrix is ​​first reconstructed using the retained singular values ​​and singular vectors, and then the corresponding weight tensor is reconstructed using the two-dimensional matrix.

[0055] It can be seen that in the embodiment of the present invention, using singular value decomposition (ie, SVD) as a means of model optimization can further reduce the scale of the target detection model.

[0056] Since the scale of the three small matrices is reduced by truncation, the size of the target detection model is reduced while minimizing information loss. The number of singular values ​​R is selected based on the trade-off between the size and accuracy of the target detection model on the validation data.

[0057] S5. Evaluate the accuracy and parameter quantity of the target detection model, and determine whether the target detection model meets the requirements of the edge device based on the evaluation results; if so, use the current target detection model as the optimized target detection model, and deploy the optimized target detection model on the edge device; otherwise, adjust R and return to S2.

[0058] It is understandable that in order to evaluate the effectiveness of the SVD decomposition optimization technique, the performance of the optimized target detection model was compared with the original unoptimized target detection model on the validation set. By changing the number of singular values ​​R used in the singular value decomposition, its impact on the number of parameters and accuracy of the target detection model was evaluated.

[0059] For example, setting R to 50% and 70% and performing experimental comparisons on the test set yields the following results in Table 2:

[0060] Table 2

[0061] Optimized object detection model FPS mAP@0.5 Weight Size Unoptimized object detection model 1.50 0.717 12.3 70% 1.48 0.717 12.1 50% 1.44 0.677 9.92

[0062] mAP stands for mean average precision. WeightSize stands for weight size and is an evaluation metric for parameter size. FPS stands for frame per second and is an evaluation metric for object detection speed.

[0063] By optimizing the object detection model YOLOv7-Tiny, the dataset was trained using 70% of the data and tested using 30%. The dataset includes seven object categories, including cars, pedestrians, and bicycles. To make the data easier to process, the dataset was preprocessed by resizing the images to a fixed size of 640×640 pixels and normalizing the pixels to a value between 0 and 1. Additionally, data augmentation techniques were randomly applied to the dataset, such as random cropping, translation, and brightness and contrast adjustments.

[0064] It is understandable that in the embodiment of the present invention, weight pruning is combined with singular value decomposition to optimize the target detection model. Specifically, a target detection model suitable for deployment on edge devices is selected, and the L1 weight pruning technology is used to optimize the target detection model to reduce its size and improve the deployment efficiency on resource-constrained devices; singular value decomposition is used as a model optimization technology to further reduce the scale of the target detection model; the target detection model is evaluated to determine whether the number of truncated singular values ​​needs to be adjusted. It can be seen that the embodiment of the present invention combines weight pruning and singular value decomposition to optimize the target detection model to reduce the number of parameters used by the model, while taking into account the accuracy of the model, reducing the scale of the model so that it can be deployed on resource-constrained devices.

[0065] In a second aspect, an embodiment of the present invention provides a target detection model optimization device, comprising:

[0066] The model selection module is used to execute S1 and select an object detection model suitable for deployment on the edge device;

[0067] A matrix decomposition module, configured to execute S2, convert the weight tensor of each convolutional layer in the target detection model into a corresponding two-dimensional matrix, and decompose the two-dimensional matrix into a left singular matrix, a diagonal singular value matrix, and a right singular matrix;

[0068] a matrix truncation module, configured to execute S3, select the first R singular values ​​from the diagonal singular value matrix, delete the remaining singular values, and retain the left singular vectors corresponding to the first R singular values ​​in the left singular matrix and the right singular vectors corresponding to the first R singular values ​​in the right singular matrix; wherein R is a positive integer;

[0069] A tensor reconstruction module is used to execute S4, reconstruct the weight tensor of the convolution layer according to the retained first R singular values, the left singular vectors corresponding to the first R singular values, and the right singular vectors corresponding to the first R singular values;

[0070] The model evaluation module is used to execute S5, evaluate the accuracy and parameter quantity of the target detection model, and determine whether the target detection model meets the requirements of the edge device based on the evaluation results; if so, the current target detection model is used as the optimized target detection model, and the optimized target detection model is deployed on the edge device; otherwise, R is adjusted and the process returns to the matrix decomposition module to execute S2.

[0071] In one embodiment, it further includes:

[0072] The pruning processing module uses the L1 norm weight pruning technology to perform lightweight processing on the weight matrix of the target detection model before the matrix decomposition module.

[0073] Furthermore, the pruning processing module includes:

[0074] A norm calculation unit, configured to calculate, for each weight matrix in the target detection model, the L1 norm corresponding to each element in the weight matrix;

[0075] The element replacement unit is used to replace the elements with the smallest L1 norm in a preset proportion in the weight matrix with 0.

[0076] In one embodiment, the number of rows of the two-dimensional matrix is ​​the maximum integer factor of the total number of elements of the weight tensor.

[0077] In one embodiment, the tensor reconstruction module includes:

[0078] A first reconstruction unit is configured to reconstruct a corresponding two-dimensional matrix according to the retained first R singular values, the left singular vectors corresponding to the first R singular values, and the right singular vectors corresponding to the first R singular values;

[0079] The second reconstruction unit is used to reconstruct the corresponding weight tensor according to the reconstructed two-dimensional matrix.

[0080] In one embodiment, the matrix decomposition module is specifically configured to decompose the two-dimensional matrix into a left singular matrix, a diagonal singular value matrix, and a right singular matrix by using a low-rank singular value decomposition method.

[0081] In one embodiment, the activation function of the target detection model is a Leaky ReLU activation function.

[0082] It is understandable that the explanation, specific implementation, beneficial effects, examples, etc. of the relevant contents in the device provided by the embodiment of the present invention can be found in the corresponding parts of the method provided in the first aspect, and will not be repeated here.

[0083] In a third aspect, an embodiment of the present invention provides a computer-readable medium having computer instructions stored thereon. When the computer instructions are executed by a processor, the processor executes the method provided in the first aspect.

[0084] Specifically, a system or device equipped with a storage medium can be provided, on which software program codes that implement the functions of any of the above-mentioned embodiments are stored, and a computer (or CPU or MPU) of the system or device can be enabled to read and execute the program codes stored in the storage medium.

[0085] In this case, the program code itself read from the storage medium can realize the function of any one of the above-mentioned embodiments, and thus the program code and the storage medium storing the program code constitute part of the present invention.

[0086] Examples of storage media for providing program code include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), magnetic tapes, non-volatile memory cards, and ROMs. Alternatively, the program code can be downloaded from a server computer via a communication network.

[0087] In addition, it should be clear that the functions of any of the above embodiments can be achieved not only by executing the program code read by the computer, but also by enabling the operating system operating on the computer to complete part or all of the actual operations based on the instructions of the program code.

[0088] In addition, it can be understood that the program code read from the storage medium is written into a memory provided in an expansion board inserted into the computer or into a memory provided in an expansion module connected to the computer, and then based on the instructions of the program code, a CPU installed on the expansion board or expansion module is enabled to perform part or all of the actual operations, thereby realizing the functions of any of the above embodiments.

[0089] It is understandable that the explanation, specific implementation methods, beneficial effects, examples, etc. of the relevant contents in the computer-readable medium provided in the embodiment of the present invention can be found in the corresponding parts of the method provided in the first aspect, and will not be repeated here.

[0090] In a fourth aspect, an embodiment of this specification provides a computing device, comprising a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, it implements the method in any one of the embodiments in the specification.

[0091] It is understandable that the explanation, specific implementation, beneficial effects, examples, etc. of the relevant contents in the computing device provided by the embodiment of the present invention can be found in the corresponding parts of the method provided in the first aspect, and will not be repeated here.

[0092] The various embodiments in this specification are described in a progressive manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences from other embodiments. In particular, the device embodiments are generally similar to the method embodiments, so the description is relatively simple. For relevant parts, refer to the description of the method embodiments.

[0093] Those skilled in the art will appreciate that in one or more of the above examples, the functions described in the present invention may be implemented using hardware, software, widgets, or any combination thereof. When implemented using software, these functions may be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.

[0094] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent replacements, improvements, etc. made on the basis of the technical solution of the present invention should be included in the scope of protection of the present invention.

Claims

1. A target detection model optimization method, characterized in that: include: The dataset contains data of 7 categories of objects, including cars, pedestrians and bicycles. In order to make the data easier to process, the dataset was preprocessed and the image size was adjusted to a fixed size of 640×640 pixels. Apply data augmentation techniques to the dataset to expand it; Use the data in the dataset to generate training sets and test sets; S1. Select an object detection model suitable for deployment on edge devices; S2. Convert the weight tensor of each convolutional layer in the target detection model into a corresponding two-dimensional matrix, and decompose the two-dimensional matrix into a left singular matrix, a diagonal singular value matrix, and a right singular matrix; S3. Select the first R singular values ​​from the diagonal singular value matrix, delete the remaining singular values, and retain the left singular vectors corresponding to the first R singular values ​​in the left singular matrix and the right singular vectors corresponding to the first R singular values ​​in the right singular matrix; where R is a positive integer; S4. Reconstruct the weight tensor of the convolutional layer according to the retained first R singular values, the left singular vectors corresponding to the first R singular values, and the right singular vectors corresponding to the first R singular values; Using the training set to train the target detection model, and using the test set to evaluate the target detection model; S5. Evaluate the accuracy and parameter quantity of the target detection model, and determine whether the target detection model meets the requirements of the edge device based on the evaluation results; if so, use the current target detection model as the optimized target detection model, and deploy the optimized target detection model on the edge device; otherwise, adjust R and return to S2.

2. The method according to claim 1, characterized in that Before S2, the method further includes: using L1 norm weight pruning technology to perform lightweight processing on the weight matrix of the target detection model.

3. The method according to claim 2, characterized in that The lightweight processing of the weight matrix of the target detection model using the L1 norm weight pruning technology includes: For each weight matrix in the target detection model, calculate the L1 norm corresponding to each element in the weight matrix; The elements with the smallest L1 norm in the preset proportion in the weight matrix are replaced with 0.

4. The method according to claim 1, wherein The number of rows of the two-dimensional matrix is ​​the maximum integer factor of the total number of elements of the weight tensor.

5. The method according to claim 1, characterized in that The step of reconstructing the weight tensor of the convolutional layer according to the retained first R singular values, the left singular vectors corresponding to the first R singular values, and the right singular vectors corresponding to the first R singular values ​​comprises: Reconstructing a corresponding two-dimensional matrix according to the retained first R singular values, the left singular vectors corresponding to the first R singular values, and the right singular vectors corresponding to the first R singular values; Reconstruct the corresponding weight tensor based on the reconstructed two-dimensional matrix.

6. The method according to claim 1, characterized in that Decomposing the two-dimensional matrix into a left singular matrix, a diagonal singular value matrix, and a right singular matrix includes: The two-dimensional matrix is ​​decomposed into a left singular matrix, a diagonal singular value matrix and a right singular matrix by using a low-rank singular value decomposition method.

7. The method according to claim 1, characterized in that The activation function of the target detection model is the LeakyReLU activation function.

8. A target detection model optimization device using the method described in any one of 1 to 7, characterized in that: include: The model selection module is used to execute S1 and select an object detection model suitable for deployment on the edge device; A matrix decomposition module, configured to execute S2, convert the weight tensor of each convolutional layer in the target detection model into a corresponding two-dimensional matrix, and decompose the two-dimensional matrix into a left singular matrix, a diagonal singular value matrix, and a right singular matrix; a matrix truncation module, configured to execute S3, select the first R singular values ​​from the diagonal singular value matrix, delete the remaining singular values, and retain the left singular vectors corresponding to the first R singular values ​​in the left singular matrix and the right singular vectors corresponding to the first R singular values ​​in the right singular matrix; wherein R is a positive integer; A tensor reconstruction module is used to execute S4, reconstruct the weight tensor of the convolution layer according to the retained first R singular values, the left singular vectors corresponding to the first R singular values, and the right singular vectors corresponding to the first R singular values; The model evaluation module is used to execute S5, evaluate the accuracy and parameter quantity of the target detection model, and determine whether the target detection model meets the requirements of the edge device based on the evaluation results; if so, the current target detection model is used as the optimized target detection model, and the optimized target detection model is deployed on the edge device; otherwise, R is adjusted and the process returns to the matrix decomposition module to execute S2.

9. A computer-readable storage medium, characterized in that A computer program is stored thereon, and when the computer program is executed in a computer, the computer is caused to execute and implement the method according to any one of claims 1 to 7.

10. A computing device, characterized in that The method comprises a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Compression method and device of convolutional neural network and electronic equipment

    CN112308197A

  • Model training method and device, equipment and storage medium

    CN115829024A