Lightweight deep learning target detection and recognition model and method
By adopting the CnTR module, lightweight YOLOv5s algorithm, adaptive adjustment strategy, RELU activation function and GIOU loss function in the deep learning object detection model, the application problem of traditional models in resource-constrained scenarios is solved, efficient and accurate object detection is achieved, and it is suitable for the FPGA platform.
Patent Information
- Application Number
- CN202411398153.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-09
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2044-10-09
AI Technical Summary
The traditional deep learning object detection model is limited in scenarios where computing resources and storage resources are limited, especially the YOLOv5s algorithm has the problem of large models and high computational complexity. The traditional loss function is not accurate and convergent in object detection tasks in complex scenarios.
A lightweight deep learning object detection and recognition model is proposed, using the CnTR module for feature extraction, and lightweight processing is performed based on the YOLOv5s algorithm. The overall framework module has an adaptive adjustment strategy, adopts the RELU activation function and the GIOU loss function, and the model quantization module converts the model parameters into low-digit representations.
The model's network is lightweight, high computing efficiency, high detection accuracy, and adapts to FPGA platform applications, and can achieve efficient object detection tasks in resource-constrained environments.
Smart Images

Figure CN119579851A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of detection and recognition technology, and specifically to a lightweight deep learning target detection and recognition model and method. Background Art
[0002] With the rapid development of deep learning technology, object detection has made remarkable achievements in the field of computer vision. However, traditional deep learning object detection models usually have large computational and storage requirements, which greatly limits their application in some resource-constrained scenarios, such as embedded devices and mobile terminals.
[0003] At present, the main deep learning-based object detection algorithms are region proposal-based methods and regression-based methods. Among them, the YOLO series of algorithms have attracted widespread attention for their fast detection speed and high accuracy. However, the original YOLOv5s algorithm still has the problems of large model and high computational complexity, which makes it difficult to meet the needs of some application scenarios that require demanding computing and storage resources.
[0004] In addition, traditional loss functions have problems such as low accuracy and slow convergence when dealing with object detection tasks in complex scenarios. At the same time, the design of the activation function and feature extraction module in the model also directly affects the performance and efficiency of the model. Summary of the invention
[0005] In view of the above-mentioned defects or deficiencies in the prior art, the present application aims to provide a lightweight deep learning target detection and recognition model and method.
[0006] In the first aspect, the present application proposes a lightweight deep learning target detection and recognition model, including: A feature extraction unit, wherein the feature extraction unit adopts a CnTR module, and the CnTR module extracts from an input image through a plurality of convolutional layers, and then performs nonlinear processing, dimension concatenation, and summation operations through a RELU activation function to obtain initial features of different levels of a target object in the input image; A target detection unit, wherein the target detection unit includes an overall framework module, an activation function module, and a loss function module obtained by lightweight processing of a network framework based on a YOLOv5s algorithm; The overall framework module has an adaptive adjustment strategy that can dynamically optimize the correlation coefficient; wherein the correlation coefficient includes at least a depth coefficient and a width coefficient, the depth coefficient is the degree of extraction of the initial features by different levels of the overall framework module, and the width coefficient is the number of neurons and the number of feature channels in each level of the overall framework module; The overall framework module fuses the initial features at different levels through the adaptive adjustment strategy to obtain high-level features; The activation function module uses a RELU activation function to perform nonlinear transformation on the high-level features to obtain transformed high-level features; The loss function module adopts the GIOU loss function to obtain the gradient information and adjustment direction of the correlation coefficient of the overall framework module according to the initial features, the high-level features and the transformed high-level features; The overall framework module receives the transformed high-level features, and continuously adjusts the correlation coefficient according to the gradient information and adjustment direction of the correlation coefficient. In the process of the overall framework module continuously adjusting the correlation coefficient, it repeatedly iterates to output the target detection result corresponding to the initial feature, and the target detection result at least includes the position and category of the target object in the input image.
[0007] According to the technical solution provided in the embodiment of the present application, the number of layers of the network framework of the overall framework module is half the number of layers of the network framework based on the YOLOv5s algorithm.
[0008] According to the technical solution provided in the embodiment of the present application, for the layers of the network framework of the YOLOv5s algorithm retained in the network framework of the overall framework module, the number of neurons in the layers, weight parameters and RELU activation function settings are adjusted according to the importance of each layer in target detection to ensure that the overall framework module outputs the target detection result when the number of layers is halved.
[0009] According to the technical solution provided in the embodiment of the present application, the feature extraction unit adopts a CnTR module as a simplified CnTR module, and the simplified CnTR module is a computing structure composed of a convolutional layer, a RELU activation function, dimensional splicing and a summation operation.
[0010] According to the technical solution provided in the embodiment of the present application, the activation function module uses the RELU activation function to perform a nonlinear transformation on the high-level features, and performs a nonlinear transformation on each element in the high-level features to obtain the transformed high-level features.
[0011] According to the technical solution provided in the embodiment of the present application, when outputting the target detection result corresponding to the transformed high-level feature, the depth coefficient of the overall framework module is 0.20 and the width coefficient is 0.25.
[0012] According to the technical solution provided in the embodiment of the present application, the convolution layer adopts a convolution kernel and a step size of a specific size to adapt to the feature distribution of the input image; the RELU activation function adopts an adaptive slope adjustment strategy during the activation process to enhance the nonlinear mapping capability of different features, the dimensional splicing operation dynamically allocates weights according to the importance of the features, and the summation operation is combined with an adaptive weight coefficient to optimize the feature fusion effect.
[0013] According to the technical solution provided in the embodiment of the present application, it also includes a model quantization module, which converts the model parameters represented by 32-bit floating point numbers into low-bit integer numbers, and the model parameters include at least weights and biases.
[0014] According to the technical solution provided in the embodiment of the present application, the GIOU loss function of the loss function module introduces a dynamic weight adjustment mechanism when obtaining the gradient information and adjustment direction of the correlation coefficient of the overall framework module, and assigns different weights to each sub-item in the GIOU loss function according to different feature extraction stages and task difficulties.
[0015] In the second aspect, the present application proposes a lightweight deep learning target detection and recognition method, which is implemented based on the lightweight deep learning target detection and recognition model as described above, and includes the following steps: Collecting and organizing an image data set for target detection, the image data set includes a plurality of images; preprocessing the images to obtain input images; Initialize the model, after the overall framework module, feature extraction module, loss function module, and activation function module are all in a normal initial state, input the input image into the model; The feature extraction unit processes and extracts features from the input image through convolutional layers, RELU activation functions, dimension concatenation, and summation operations to obtain initial features of different levels of the target object in the input image; The initial features are input into the target detection unit to obtain target detection results corresponding to the initial features.
[0016] Among them, the loss function module adopts the GIOU loss function; the activation function module adopts the RELU activation function; the overall framework module dynamically optimizes the correlation coefficient of the model through an adaptive adjustment strategy, and continuously adjusts the structure and parameters of the model to improve the performance of the model.
[0017] Compared with the prior art, the beneficial effects of the present application are as follows: the present application uses a network framework based on the YOLOv5s algorithm for lightweight processing, reduces the number of layers to half of the traditional YOLOv5s algorithm, adopts a network lightweight design, adopts a CnTR module, extracts features through streamlined convolutional layers, RELU activation functions, dimension splicing and summation operations, adopts a RELU activation function, performs nonlinear transformation on the feature extraction results, can quickly and effectively activate features, improve the model's computational efficiency and other measures, and make the model more suitable for the application of the FPGA platform. FPGA has the advantages of strong parallel processing capabilities and low power consumption, and can meet the real-time requirements of the model in a resource-constrained environment. The lightweight deep learning target detection and recognition model of the present invention has the advantages of lightweight network, high computational efficiency, high detection accuracy and adaptability to FPGA platform applications, and can achieve efficient target detection tasks in a resource-constrained environment. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 A schematic diagram of the structure of a lightweight deep learning target detection and recognition model provided in an embodiment of the present application; Figure 2 A calculation process diagram of the lightweight deep learning target detection and recognition model provided in an embodiment of the present application. DETAILED DESCRIPTION
[0019] The present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the relevant invention, rather than to limit the invention. It is also necessary to explain that, for ease of description, only the parts related to the invention are shown in the accompanying drawings.
[0020] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0021] Example 1 As mentioned in the background technology, in response to the problems in the prior art, this application proposes a lightweight deep learning target detection and recognition model, please refer to Figure 1 As shown, including: A feature extraction unit, wherein the feature extraction unit adopts a CnTR module, and the CnTR module extracts from an input image through a plurality of convolutional layers, and then performs nonlinear processing, dimension concatenation, and summation operations through a RELU activation function to obtain initial features of different levels of a target object in the input image; A target detection unit, wherein the target detection unit includes an overall framework module, an activation function module, and a loss function module obtained by lightweight processing of a network framework based on a YOLOv5s algorithm; The overall framework module has an adaptive adjustment strategy that can dynamically optimize the correlation coefficient; wherein the correlation coefficient includes at least a depth coefficient and a width coefficient, the depth coefficient is the degree of extraction of the initial features by different levels of the overall framework module, and the width coefficient is the number of neurons and the number of feature channels in each level of the overall framework module; The overall framework module fuses the initial features at different levels through the adaptive adjustment strategy to obtain high-level features; The activation function module uses a RELU activation function to perform nonlinear transformation on the high-level features to obtain transformed high-level features; The loss function module adopts the GIOU loss function to obtain the gradient information and adjustment direction of the correlation coefficient of the overall framework module according to the initial features, the high-level features and the transformed high-level features; The overall framework module receives the transformed high-level features, and continuously adjusts the correlation coefficient according to the gradient information and adjustment direction of the correlation coefficient. In the process of the overall framework module continuously adjusting the correlation coefficient, it repeatedly iterates to output the target detection result corresponding to the initial feature, and the target detection result at least includes the position and category of the target object in the input image.
[0022] Furthermore, when outputting the target detection result corresponding to the transformed high-level feature, the depth coefficient of the overall framework module is 0.20 and the width coefficient is 0.25.
[0023] Specifically, the feature extraction module adopts a CnTR module, and the CnTR module processes and extracts features from the input image through a convolution layer (CONV), a RELU activation function (RELU), a dimension concatenation (CAT), and a summation operation (SUM), to obtain a feature extraction result including at least initial features of different levels of the target object in the input image; A loss function module, wherein the loss function module adopts a GIOU loss function. During the process of processing and feature extraction by the feature extraction module, the GIOU loss function measures the gap between the prediction of the model and the true value according to the feature extraction result, and guides the parameter adjustment of the model; An activation function module, wherein the activation function module adopts a RELU activation function, and the RELU activation function performs a nonlinear transformation on the feature extraction result output by the feature extraction module; the local feature information serves as an important basis for subsequent processing in the activation function module and the overall framework module and calculation of the loss function module; The model quantization module quantizes the parameters and data in the overall framework module, the feature extraction module and the activation function module to reduce the storage requirements and calculation amount of the model.
[0024] The overall framework module is lightweight based on the network framework of the YOLOv5s algorithm, reducing the number of layers to half of the traditional YOLOv5s algorithm, greatly reducing the complexity and computational complexity of the model. At the same time, through the adaptive adjustment strategy, the depth coefficient, width coefficient and other related coefficients are dynamically optimized, and the model structure can be automatically adjusted according to different tasks and data, improving the adaptability and performance of the model.
[0025] In the feature extraction module, the CnTR module is used to extract features through streamlined convolutional layers, RELU activation functions, dimension concatenation, and summation operations, eliminating unnecessary calculation steps and improving the efficiency of feature extraction. The model quantization module quantizes the parameters and data in the overall framework module, feature extraction module, and activation function module, converting the parameters and data originally represented by 32-bit floating-point numbers into low-bit integer representations, greatly reducing the storage space occupied by the parameters. In addition, when calculating, integer operations are usually faster than floating-point operations, thereby reducing the complexity and time cost of calculations.
[0026] The activation function module uses the RELU activation function to perform nonlinear transformation on the feature extraction results, which can quickly and effectively activate the features and improve the computational efficiency of the model. The loss function module uses the GIOU loss function. During the processing and feature extraction process of the feature extraction module, the gap between the model's prediction and the true value is measured based on the feature extraction results, which can more accurately evaluate the performance of the model, guide the adjustment of the model's parameters, and improve the detection accuracy.
[0027] During the training process, the model quantization module uses a method for compressing the amount of calculation for quantitative reasoning. During the forward propagation process of the training phase, the quantized value is used for calculation, and during the back propagation process, the loss function of quantitative reasoning is used for optimization. Compared with directly quantizing the existing model parameters, this method can better ensure that the model accuracy will not decrease.
[0028] Through measures such as lightweight network design, computing layer simplification and data quantization, the model is more suitable for the application of FPGA platform. FPGA has the advantages of strong parallel processing capability and low power consumption, which can meet the real-time requirements of the model in a resource-constrained environment.
[0029] In summary, the lightweight deep learning target detection and recognition model of the present invention has the advantages of lightweight network, high computational efficiency, high detection accuracy and adaptability to FPGA platform application, and can achieve efficient target detection tasks in a resource-constrained environment.
[0030] The design concept of the present application is as follows: the present invention is optimized based on the YOLOv5s network, and its most prominent feature is its flexible structure. It introduces the depth_multiple coefficient to control the depth of the model and the width_multiple coefficient to control the number of convolution kernels. The coefficient depth_multiple is used in the case of number≠1 in the backbone (number=1 indicates the functional background layer, such as downsampling Conv, Focus, SPP, etc.), that is, it is used in the Bottleneck layer to control the depth of the model. For example, it is set to 0.33 in YOLOv5s. If there are three Bottlenecks in YOLOv5l, there is only one Bottleneck in YOLOv5s. The coefficient width_multiple is used to set the number of convolution kernels of the convolution layer. For example, YOLOv5s is set to 0.5, and the number of convolution kernels becomes half of the setting. Since the structures such as global average pooling GAP, sigmod activation function, and one-dimensional convolution are not suitable for FPGA calculation, the present invention replaces the sigmod activation function with the RELU activation function and replaces the CSP module with the CnTR module.
[0031] The RELU activation function can be expressed by the formula:
[0032] Among them, y is the output result of RELU activation function, is the value of pixel i.
[0033] The CnTR module refers to a structure consisting of multiple residual blocks and extracting sufficient local features through dense convolutional layers. The present invention simplifies it into a calculation structure consisting of only CONV, RELU, CAT, and SUM. Figure 1 The C3TR structure in refers to the RDB structure containing 3 residual blocks, the C2TR structure refers to the RDB structure containing 2 residual blocks, and the C1TR structure refers to the RDB structure containing 1 residual block.
[0034]
[0035] Among them, F∗ is the output of the previous step; Conv is the convolutional layer; is the RELU activation function; Represents the concatenation of the dimensions of the result.
[0036] The present invention uses the GIOU loss function and contains only 75 layers, which is relatively small in number. In addition, the algorithm does not contain structures such as global average pooling GAP, Sigmod activation function, and one-dimensional convolution that are difficult to layout in FPGA, so it is easy to transplant to FPGA.
[0037] Quantization of convolutional layers The convolutional layer calculation process is as follows Figure 2 As shown, model it: The input feature map before and after quantization can be expressed as:
[0038] In the formula, x represents the floating point value of the input feature map, q x Represents the fixed-point value of the input feature map, s x is the scaling factor for quantizing the input feature map, z x To quantize the offset of the input feature map, for a convolutional layer, there is only one set of quantization parameters s x and z x .
[0039] The weight parameters before and after quantization can be expressed as:
[0040] In the formula, w represents the floating point value of the weight, q w represents the fixed-point value of the weight, S w is the scaling factor of the quantized weights, Z w The quantized weight is the offset. For a convolution layer, there are n sets of quantization parameters S w and Z w .
[0041] The process of adding a convolutional layer to an activation layer is to convolve the input feature map with the weights and then calculate it through RELU, which can be expressed by the formula:
[0042] In the formula, m represents the input feature map dimension, k represents the size of the convolution kernel, and bias represents the bias value of the convolution layer, which is obtained through training.
[0043] Due to the effect of the relu function, the floating-point value of the output feature map can be expressed as:
[0044] On the other hand, the output feature map is quantized:
[0045] Where y represents the floating point value of the output feature map, q y Represents the fixed-point value of the output feature map, s y is the scaling factor for quantizing the output feature map, z y The quantized output feature map is the offset. For a convolutional layer, there is only one set of quantization parameters s y and z y .
[0046] Substituting the input feature map and weight quantization formula, the quantized output is:
[0047] because And the relu function value is greater than or equal to 0 So q y The numerator and denominator have the same sign, and we will discuss removing relu in different cases:
[0048] For a convolutional layer with m-dimensional input, n-dimensional output, and a convolution kernel of m*n*k: , , , Has unique value, , There are n values.
[0049] when When , for 1:n latitude output:
[0050] The great advantage of the SSD algorithm is the activation of the relu function, which makes the feature map of each layer distributed in the positive real number interval. , It is always 0, which greatly simplifies the calculation, and the formula is simplified to:
[0051] make , , the formula can be expressed as:
[0052] Among them, M and b are constants and can be obtained offline.
[0053] In summary, the output of the convolutional layer is:
[0054] Since the input of each convolutional layer is actually the output of the previous convolutional layer, there is a relationship between the scaling factors: For the kth convolutional layer, ,but:
[0055] In summary, for the kth convolutional layer, the quantization result of the output feature map can be expressed as:
[0056] Loss function design The loss function of the target detection task is generally composed of two parts: bounding box regression loss and classification loss. Here we explain the bounding box regression loss and classification loss used in the experimental training phase. The most commonly used calculation indicator in the bounding box regression loss is the intersection over union (IoU), and the calculation method is as follows:
[0057] The intersection-over-union ratio can obtain the distance between the predicted box and the real box, thus reflecting the detection effect. However, it has the following disadvantages as a loss function: If IoU=0, the overlap between the two is also 0, which means that the loss function is 0, and gradient backpropagation and algorithm training cannot be performed; IoU cannot accurately reflect the degree of overlap between the two. Figure 1 It shows three different cases of the same IoU value. It can be seen that equal IoU does not mean equal overlap.
[0058] Since IoU has the above-mentioned shortcomings, GIOU overcomes the shortcomings of IoU while fully inheriting the existing advantages of IoU.
[0059] Therefore, the present invention adopts GIOU as the loss function of bounding box regression. Assume that the predicted box is A, the true box is B, and C can be represented by the minimum convex closed box containing A and B. The calculation formula of GIOU is as follows:
[0060] Similar to IoU, GIOU can also be used as a distance, and the loss can be expressed as follows:
[0061] The classification loss in the training phase uses the binary cross entropy loss (BCE loss). Therefore, as shown in the formula below, the complete loss function consists of three parts: bounding box regression loss (first term), confidence prediction loss (second and third terms), and category prediction loss (fourth term).
[0062]
[0063] Quantization is the reduction of the number of bits in a value, which refers to the way a value is represented. In deep learning applications, the data format used for research and development is generally 32-bit floating point numbers. However, due to the limited computing resources of all platforms in the project, we need to represent a large number of parameter weights and feature maps using 8-bit integer data format without much loss in model accuracy to obtain performance similar to that of floating point models. The most significant advantage of the quantization method is that it can greatly reduce bandwidth and storage space. For example, the use of 8-bit integer parameter weights and feature maps can reduce bandwidth requirements by 4 times compared to 32-bit floating point models when performing calculations. In addition, compared with floating point numbers, integers are faster in calculations and require less platform power consumption and memory storage.
[0064] The present invention adopts a method for compressing the amount of calculation for quantitative reasoning. Compared with the existing methods of the same type, the forward propagation stage of this method will add both the parameter quantization module and the activation value quantization module. Therefore, this method can quantize the feature map at the same time, and can use all integers for calculation in the reasoning stage, thereby improving the calculation efficiency of the algorithm model; at the same time, this method uses quantized values for calculation in the forward propagation process of the training stage, and uses the loss function of quantitative reasoning for optimization in the back propagation process. Therefore, compared with directly quantizing the existing model parameters, this method can better ensure that the model accuracy will not decrease.
[0065] For neural network models based on deep learning, there are two types of parameters that need to be quantized, one is the model weight, and the other is the model activation value, that is, the feature map. If the weight range of a layer is [a, b], then the quantization method is: regard the minimum value of the weight as a, the maximum value of the weight as b, fine-tune the weight through training, and map the weight range to [0, 255], thereby converting it into an 8-bit integer. As for the activation value, its value depends largely on the input of the network. Assuming that the activation value range in the retraining phase is still [a, b], during training, the EMA (Exponential Moving Average) with a smoothing parameter close to 1 is used to update the activation value. The role of EMA is to slow down the trend of change when the activation value range changes dramatically.
[0066] When designing the quantization scheme, we plan to select the mainstream 8-bit quantization accuracy and continue to use 32-bit floating point numbers in the training phase. The combination of the two can optimize the performance of the compressed model (the bias vector also uses 32-bit floating point numbers). When determining the quantization scheme, we must first determine how to link the corresponding real value r and the quantized value q. The mapping form between q and r, that is, the quantization formula, is as follows:
[0067] Among them, S and Z are quantization parameters, both of which are constants. After transformation:
[0068]
[0069] The quantized value in the formula Moving to the left, we get:
[0070] Will Defined as the multiplier O, we get:
[0071] Since O is obtained through S1, S2 and S3, and S1, S2 and S3 are the previously defined quantization parameters, all of which are constants, it can be known that the value of N is between (0,1), from which we can get:
[0072] Where n is a non-negative integer and the value range of O0 is [0.5,1).
[0073] In order to reduce the number of operations, it is converted into the following form:
[0074] Will Defined as , Defined as . Because each and Only n calculations are required, so a total of 2n2 additions are required, and the remaining computational cost is mainly concentrated in middle.
[0075] Next, we need to modify the quantization matrix 3-13, fuse the bias matrix and the activation matrix, assuming that q1 is the weight matrix and q2 is the activation matrix. The weight and activation value types are both unit8, and we can get the following formula:
[0076] To ensure that the quantized bias addends are int32 and accumulated into the addends, the bias matrix needs to be quantized to int32 data type. Therefore, we need to quantize both weights and activations to 8-bit integers and the bias matrix to 32-bit integers.
[0077] In a preferred embodiment, during the process of processing and feature extraction by the feature extraction module, the loss function module measures the gap between the model's prediction and the true value based on the feature extraction result output by the feature extraction module and the intermediate output of the overall framework module, and then adjusts the model parameters.
[0078] In a preferred embodiment, after the activation function module performs a nonlinear transformation on the feature extraction result output by the feature extraction module, the feature extraction result after the nonlinear transformation is transmitted to the subsequent layer in the overall framework module for more in-depth feature processing, and the feature information processed by the activation function module is provided to the loss function module to guide the parameter adjustment of the model.
[0079] In a preferred embodiment, the feature extraction module uses a CnTR module as a simplified CnTR module, and the simplified CnTR module is a computing structure consisting of a convolutional layer, a RELU activation function, dimensional concatenation, and a summation operation.
[0080] In a preferred embodiment, the RELU activation function used by the activation function module receives the feature extraction result and performs a nonlinear transformation on each element in the processed image within the feature extraction result.
[0081] In a preferred embodiment, when the CnTR module of the feature extraction module performs feature extraction, the convolution layer adopts a convolution kernel and a step size of a specific size to adapt to the feature distribution of the input image; the RELU activation function adopts an adaptive slope adjustment strategy during the activation process to enhance the nonlinear mapping capability of different features, the dimensional splicing operation dynamically allocates weights according to the importance of the features, and the summation operation is combined with an adaptive weight coefficient to optimize the feature fusion effect.
[0082] In a preferred embodiment, the model quantization module converts the model parameters represented by 32-bit floating point numbers into low-bit integer numbers, and the model parameters include at least weights and biases.
[0083] In a preferred embodiment, the GIOU loss function of the loss function module introduces a dynamic weight adjustment mechanism when measuring the gap between the model's prediction and the true value, and assigns different weights to each sub-item in the GIOU loss function according to different feature extraction stages and task difficulties.
[0084] Example 2 On the basis of Example 1, this embodiment proposes a lightweight deep learning target detection and recognition method, which is implemented based on the lightweight deep learning target detection and recognition model as described above, and includes the following steps: Collecting and organizing an image data set for target detection, the image data set includes a plurality of images; preprocessing the images to obtain input images; Initialize the model, after the overall framework module, feature extraction module, loss function module, and activation function module are all in a normal initial state, input the input image into the model; The feature extraction unit processes and extracts features from the input image through convolutional layers, RELU activation functions, dimension concatenation, and summation operations to obtain initial features of different levels of the target object in the input image; The initial features are input into the target detection unit to obtain target detection results corresponding to the initial features.
[0085] Among them, the loss function module adopts the GIOU loss function; the activation function module adopts the RELU activation function; the overall framework module dynamically optimizes the correlation coefficient of the model through an adaptive adjustment strategy, and continuously adjusts the structure and parameters of the model to improve the performance of the model.
[0086] This article uses specific examples to illustrate the principles and implementation methods of this application. The description of the above embodiments is only used to help understand the method and its core ideas of this application. The above is only the preferred implementation method of this application. It should be pointed out that due to the limitations of textual expression and the objective existence of infinite specific structures, ordinary technicians in this technical field can make several improvements, modifications or changes without departing from the principles of the present invention, and can also combine the above technical features in an appropriate manner; these improvements, modifications, changes or combinations, or the direct application of the inventive concept and technical solution to other occasions without improvement, should be regarded as the scope of protection of this application.
Claims
1. A lightweight deep learning target detection and recognition model, characterized in that: include: A feature extraction unit, wherein the feature extraction unit adopts a CnTR module, and the CnTR module extracts from an input image through a plurality of convolutional layers, and then performs nonlinear processing, dimension concatenation, and summation operations through a RELU activation function to obtain initial features of different levels of a target object in the input image; A target detection unit, wherein the target detection unit includes an overall framework module, an activation function module, and a loss function module obtained by lightweight processing of a network framework based on a YOLOv5s algorithm; The overall framework module has an adaptive adjustment strategy that can dynamically optimize the correlation coefficient; wherein the correlation coefficient includes at least a depth coefficient and a width coefficient, the depth coefficient is the degree of extraction of the initial features by different levels of the overall framework module, and the width coefficient is the number of neurons and the number of feature channels in each level of the overall framework module; The overall framework module fuses the initial features at different levels through the adaptive adjustment strategy to obtain high-level features; The activation function module uses a RELU activation function to perform nonlinear transformation on the high-level features to obtain transformed high-level features; The loss function module adopts the GIOU loss function to obtain the gradient information and adjustment direction of the correlation coefficient of the overall framework module according to the initial features, the high-level features and the transformed high-level features; The overall framework module receives the transformed high-level features, and continuously adjusts the correlation coefficient according to the gradient information and adjustment direction of the correlation coefficient. In the process of the overall framework module continuously adjusting the correlation coefficient, it repeatedly iterates to output the target detection result corresponding to the initial feature, and the target detection result at least includes the position and category of the target object in the input image.
2. The lightweight deep learning target detection and recognition model according to claim 1, characterized in that: The number of layers of the network framework of the overall framework module is half the number of layers of the network framework based on the YOLOv5s algorithm.
3. The lightweight deep learning target detection and recognition model according to claim 2, characterized in that: For the layers of the network framework of the YOLOv5s algorithm retained in the network framework of the overall framework module, the number of neurons, weight parameters and RELU activation function settings within the layers are adjusted according to the importance of each layer in target detection to ensure that the overall framework module outputs the target detection result when the number of layers is halved.
4. The lightweight deep learning target detection and recognition model according to claim 1, characterized in that: The feature extraction unit adopts a CnTR module as a simplified CnTR module, and the simplified CnTR module is a calculation structure composed of a convolution layer, a RELU activation function, dimensional splicing and a summation operation.
5. The lightweight deep learning target detection and recognition model according to claim 1, characterized in that: The activation function module uses a RELU activation function to perform a nonlinear transformation on the high-level features, and performs a nonlinear transformation on each element in the high-level features to obtain the transformed high-level features.
6. The lightweight deep learning target detection and recognition model according to claim 1, characterized in that: When outputting the target detection result corresponding to the transformed high-level feature, the depth coefficient of the overall framework module is 0.20 and the width coefficient is 0.
25.
7. The lightweight deep learning target detection and recognition model according to claim 1, characterized in that: The convolution layer adopts a convolution kernel and a step size of a specific size to adapt to the feature distribution of the input image; the RELU activation function adopts an adaptive slope adjustment strategy during the activation process to enhance the nonlinear mapping capability of different features; the dimensional splicing operation dynamically allocates weights according to the importance of the features; and the summation operation is combined with an adaptive weight coefficient to optimize the feature fusion effect.
8. The lightweight deep learning target detection and recognition model according to claim 1, characterized in that: It also includes a model quantization module, which converts model parameters represented by 32-bit floating point numbers into low-bit integer numbers, and the model parameters include at least weights and biases.
9. The lightweight deep learning target detection and recognition model according to claim 1, characterized in that: When obtaining the gradient information and adjustment direction of the correlation coefficient of the overall framework module, the GIOU loss function of the loss function module introduces a dynamic weight adjustment mechanism, and assigns different weights to each sub-item in the GIOU loss function according to different feature extraction stages and task difficulties.
10. A lightweight deep learning target detection and recognition method, based on the lightweight deep learning target detection and recognition model according to any one of claims 1 to 9, characterized in that: The following steps are involved: Collecting and organizing an image data set for target detection, the image data set includes a plurality of images; preprocessing the images to obtain input images; Initialize the model, after the overall framework module, feature extraction module, loss function module, and activation function module are all in a normal initial state, input the input image into the model; The feature extraction unit processes and extracts features from the input image through convolutional layers, RELU activation functions, dimension concatenation, and summation operations to obtain initial features of different levels of the target object in the input image; The initial features are input into the target detection unit to obtain target detection results corresponding to the initial features. Among them, the loss function module adopts the GIOU loss function; the activation function module adopts the RELU activation function; the overall framework module dynamically optimizes the correlation coefficient of the model through an adaptive adjustment strategy, and continuously adjusts the structure and parameters of the model to improve the performance of the model.
Citation Information
Patent Citations
Convolutional lightweight-based target detection model construction method and application
CN116310721A
Lightweight target detection method and system for edge equipment
CN117036730A
Lightweight apple target detection method
CN117095391A
Lightweight CASL-YOLO fall detection method and system in complex environment
CN117935370A
Vehicle small target detection method and device based on lightweight network design
CN118038379A