Lightweight traffic text detection model and method

By improving the YOLOv8n-obb model, combining SPPELAN, EMCA, CARAFE and CoReToNext modules, and performing model pruning and knowledge distillation, the computing resources and real-time problems of lightweight traffic sign text detection in autonomous vehicles are solved, and the Efficient traffic text detection effect.

CN118587679APending Publication Date: 2024-09-03ANHUI POLYTECHNIC UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410716132.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-04
Publication Date
2024-09-03

AI Technical Summary

Technical Problem

Existing technology cannot provide a lightweight traffic sign text detection model suitable for driverless vehicles, and cannot meet the real-time and high-efficiency requirements in an environment with limited computing resources.

Method used

Based on the YOLOv8n-obb model, the feature pyramid module is replaced with SPPELAN, the EMCA attention mechanism is added, the upsampling module is replaced with CARAFE, and the Head is replaced with the CoReToNext module. Model pruning and knowledge distillation are performed at the same time to obtain YOLOV8s- obb-our model.

Benefits of technology

It improves the accuracy and efficiency of traffic text detection without increasing the model size. It is suitable for the deployment of driverless cars, reduces computing resource requirements and energy consumption, and improves real-time performance and response speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118587679A
    Figure CN118587679A
Patent Text Reader

Abstract

The invention discloses a lightweight traffic text detection model and method, the model is obtained based on improvement of a YOLOv8n-obb model, and the improvement method comprises the following steps: replacing a feature pyramid module SPPF of the YOLOv8n-obb model with an SPPELAN module, adding an upper EMCA attention mechanism module behind the SPPELAN module, replacing an upper sampling module of the YOLOv8n-obb model with a CARAFE module, and adding an upper EMCA attention mechanism module behind the SPPELAN module; and a C2f module at the head of the Head is replaced by a CoReToNext module. The method has the advantages that the detection requirement of the unmanned vehicle is met, meanwhile, the requirement of a lightweight model is met, and the traffic text can be detected more accurately.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of traffic sign text detection for target detection, and in particular to a lightweight text detection model deployed on a traffic sign for an unmanned vehicle. Background Art

[0002] The text information on traffic signs usually provides important information such as road rules, speed limit reminders, direction instructions, etc. Through text detection, the autonomous driving system can accurately understand this information and help the vehicle better understand the road environment and driving conditions.

[0003] Autonomous driving systems are often limited by computing and storage resources, and lightweight technology can effectively solve these problems and improve system performance and availability. The following is the significance of using lightweight in autonomous driving:

[0004] Reduce computing resource requirements: Lightweight models usually have fewer parameters and computational complexity, so they can run in resource-constrained environments, such as embedded systems, mobile devices, etc. For application scenarios such as driverless cars, where computing resources are often limited, the use of lightweight models can effectively reduce the demand for computing resources and improve system performance and efficiency.

[0005] Improve real-time performance and response speed: Lightweight models usually have shorter inference time and can process and recognize input images faster. In driverless cars, real-time performance is crucial. Timely and accurate recognition of text information on traffic signs can help vehicles make timely decisions and improve driving safety.

[0006] Reduced energy consumption: Since lightweight models have fewer parameters and computational complexity, they consume relatively less energy during operation. In applications such as driverless cars, reduced energy consumption can extend the vehicle's range, reduce the frequency of battery charging, and improve the vehicle's efficiency and reliability.

[0007] Easy to deploy and update: Lightweight models usually have a smaller model size, are easier to deploy to embedded systems or mobile devices, and can be updated and iterated more quickly. This is especially important for driverless cars, because vehicles need to constantly adapt to new road environments and traffic rules, and timely updating of models can help vehicles stay up to date.

[0008] Therefore, lightweight is one of the important references for unmanned vehicles when choosing models to recognize traffic text. Although traditional neural network models can achieve a certain degree of detection accuracy when performing image detection, they cannot meet the requirements of lightweight. Therefore, the models of existing technologies cannot be directly applied to unmanned vehicles. Summary of the invention

[0009] The purpose of the present invention is to overcome the shortcomings of the prior art and provide a lightweight traffic text detection method for application in unmanned vehicles to meet the needs of lightweight text detection models.

[0010] In order to achieve the above-mentioned purpose, the technical solution adopted by the present invention is: a lightweight traffic text detection model, which is improved based on the YOLOv8n-obb model, and the improvement method comprises: replacing the feature pyramid module SPPF of the YOLOv8n-obb model with a SPPELAN module, and adding an EMCA attention mechanism module after the SPPELAN module, and replacing the upsampling module of the YOLOv8n-obb model with a CARAFE module, and replacing the Head C2f module with a CoReToNext module.

[0011] The SPPELAN module combines the SPP and ELAN modules to capture more contextual information at different scales.

[0012] The EMCA attention module is improved based on the ECA attention mechanism module. The input layer in the ECA attention mechanism module is respectively subjected to AdaptiveAvgPool2d and AdaptiveMaxPool2d, and then sent to the addition operation module.

[0013] CARAFE upsampling is mainly divided into a kernel prediction module and a content-aware reconstruction module. In the kernel prediction module, the number of channels of the input H×W×C feature map is first compressed to C m Get C m ×H×W feature map, this process is used to reduce the amount of subsequent calculations, and then through a size of k up ×k up The convolution kernel of is encoded to generate a recombinant kernel with a size of The feature map of

[0014]

[0015] Where C m represents the number of feature layer channels after dimensionality reduction, σ is the multiple of upsampling, and k up is the size of the predicted upsampling kernel; then, the channel is expanded in the spatial dimension and rearranged to obtain a size of The upsampling kernel is then normalized by Softmax to make the sum of its weights 1. In the content-aware reconstruction module, the upsampling kernel is used to reorganize the features and extract the target features. For each target position in the output feature map, a k-th target is taken as the center. up ×kup The area is taken as the dot product with the up-sampled kernel predicted at the point position, and it is mapped back to the input feature map to obtain a feature map of size σH×σW×C.

[0016] A lightweight traffic text detection method is provided. The method is based on the detection model YOLOv8n-obb-our. The detection model YOLOv8n-obb-our is subjected to pruning and knowledge distillation to obtain a final detection model. The final detection model is integrated into an unmanned vehicle to detect traffic text.

[0017] The detection model YOLOv8n-obb-our is pruned using the LAMP algorithm, and then the detection model YOLOV8s-obb-our model is used as the teacher model of the pruned model to distill the pruned model, so as to improve the detection effect of the model without increasing the model size. The network width and depth of YOLOV8n-obb-our are modified to obtain the YOLOV8s-obb-our model as the teacher model. YOLOV8n-obb-our and YOLOV8s-obb-our are two versions of the "YOLOV8-obb-our" network, and their d and w parameters are 0.33 and 0.25, 0.5 and 0.33 respectively. Among them, d represents the depth, and w represents the ratio of the width of the network. YOLOV8n-obb-our has a smaller model size and faster reasoning speed than YOLOV8s-obb-our, but the detection accuracy of YOLOV8n-obb-our is relatively low.

[0018] (The network structure diagrams of YOLOV8n-obb-our and YOLOV8s-obb-our are the same.)

[0019] The pruning method comprises:

[0020] (1) Train YOLOV8n-obb-our and initialize the weight file;

[0021] (2) The LAMP score is obtained by calculating the square of the connection weight amplitude and normalizing it to the sum of the square weight amplitudes of all "surviving weights" in the same layer;

[0022] (3) According to the LAMP score, select the connection with a smaller score, and according to the pre-set global sparsity requirement, select the corresponding number of connections for pruning;

[0023] (4) Remove the selected connections from the model, i.e. set their weights to zero.

[0024] (5) Retrain the pruned model to recover the performance that may have been lost during the pruning process;

[0025] (6) Evaluate the detection performance of the model and determine whether to end pruning.

[0026] Knowledge distillation methods include: L2 logic distillation and CWD feature distillation. L2 logic distillation uses the information of the last output layer of the teacher model to train the student model. CWD feature distillation uses the intermediate features of the teacher model to guide the student model.

[0027] The advantages of the present invention are: meeting the detection requirements of unmanned vehicles and the requirements of lightweight models, and can detect traffic texts more accurately. The YOLOV8n-obb-our model has improved the detection effect of traffic texts compared to the original model (YOLOV8n-obb), and the size of the model has also increased. In order to better deploy it to the vehicle's on-board computer and improve the real-time detection effect of the on-board computer system on text detection, the present invention prunes and distills the YOLOV8n-obb-our model to ensure that the model is lightweight without reducing its detection effect. And it has at least the following advantages:

[0028] 1. Self-driving cars are better at detecting traffic text

[0029] 2. The lightweight model is easy to deploy to the on-board computer; it reduces the demand for computing resources; it improves real-time performance and response speed; and it reduces energy consumption. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] The following is a brief description of the contents expressed in the drawings of the present invention and the symbols in the drawings:

[0031] Figure 1 It is a flow chart of the detection method of the present invention;

[0032] Figure 2 This is the structure diagram of the improved YOLOv8n-obb-our traffic text detection network model of the present invention;

[0033] Figure 3 This is the SPPELAN network structure diagram of the present invention;

[0034] Figure 4 This is the EMCA network structure diagram of the present invention;

[0035] Figure 5 This is a structural diagram of the CARAFE upsampling network of the present invention;

[0036] Figure 6 This is the CreToNext network structure diagram of the present invention;

[0037] Figure 7 This is a schematic diagram of the pruning process;

[0038] Figure 8 Schematic diagram of the knowledge distillation principle. DETAILED DESCRIPTION

[0039] The specific implementation of the present invention will be further explained in detail below by describing the optimal embodiment with reference to the accompanying drawings.

[0040] The present invention mainly uses the YOLOv8n-obb algorithm as the main framework to detect traffic text. It mainly replaces the feature pyramid of the YOLOv8n-obb algorithm with SPPF and SPPELAN, adds an EMCA attention mechanism after SPPELAN, replaces the upsampling module with CARAFE, and replaces the Head C2f module with CoReToNext. The improved traffic text detection model is recorded as YOLOv8n-obb-our, and its network structure is as follows Figure 2 As shown. YOLOv8n-obb is introduced into SPPELAN to ensure the ability to detect texts of different sizes while maintaining sensitivity to important local features in traffic text images. Secondly, the EMCA attention mechanism is added after SPPELAN to enhance the global perspective information and features of different scales of traffic text images while also having good cross-channel information capture capabilities to ensure the effect of text detection. The upsampling module is replaced with CARAFE. This module introduces a larger receptive field and efficient upsampling operations, which not only effectively aggregates contextual information and utilizes feature information, but also links it with the semantic information of the input feature map, thereby enhancing the perception of important content while also maintaining the lightweight of the model. The Head C2f module is replaced with CoReToNext. This module avoids the problems of decreased inference speed and increased feature redundancy that may occur during the fusion process, and improves the detection effect and performance of the model.

[0041] From the experiment in Table 1, it can be seen that the YOLOv8n-obb-our model will be larger than the original model, so the present invention uses LAMP to prune the model and retain important weights, but it will inevitably reduce its detection effect. Therefore, this paper uses YOLOv8s-obb-our as the teacher model of the pruned model to distill the pruned model, so as to improve the detection effect of the model without increasing the size of the model. The network width and depth of YOLOV8n-obb-our are modified to obtain the YOLOV8s-obb-our model as the teacher model. YOLOV8n-obb-our and YOLOV8s-obb-our are two versions of the "YOLOV8-obb-our" network, and their d and w parameters are 0.33 and 0.25, 0.5 and 0.33 respectively. Among them, d represents the depth, and w represents the ratio of the width of the network. YOLOV8n-obb-our has a smaller model size and faster inference speed than YOLOV8s-obb-our, but the detection accuracy of YOLOV8n-obb-our is relatively low. (The network structure diagrams of YOLOV8n-obb-our and YOLOV8s-obb-our are the same.)

[0042] The overall process is as follows Figure 1 As shown in the figure, the Chinese traffic text sign dataset is used as the training dataset and the test dataset, and the improved YOLOv8s-obb-our model is used as the basic model. Then, the final detection model is obtained through pruning and knowledge distillation. The model is then deployed on the unmanned vehicle, and the video images obtained by the unmanned vehicle are analyzed to realize real-time traffic text detection.

[0043] The following is a description of the improved modules involved in the YOLOv8n-obb-our model obtained by improving the YOLOv8n-obb model:

[0044] SPPELAN module: SPPELAN is a novel structure in YOLOv9, which combines the advantages of SPP (SpatialPyramid Pooling) and ELAN (Efficient Layer Aggregation Network). SPP is a spatial pyramid pooling method that can effectively capture information of different scales, thereby improving the robustness of the model. ELAN is an efficient layer aggregation network , which improves the expressiveness of the model by effectively fusing features from different layers. By combining SPP and ELAN, the SPPELAN structure can capture more contextual information at different scales, thereby improving the accuracy of the model. The specific structure is as follows Figure 3As shown in the figure, the principle of the SPPELAN module: SPPELAN combines the multi-scale feature extraction capability of SPP and the local feature aggregation capability of ELAN. It first uses SPP to extract features at different scales, and then locally aggregates these features through ELAN to enhance the model's capture of key information. Function: Through this combination, SPPELAN aims to improve the model's detection ability for objects of different sizes while maintaining sensitivity to important local features in the image.

[0045] EMCA attention module: The EMCA attention mechanism in the present invention is an improvement on the ECA attention mechanism. ECA attention can weight the features of different channels so that the network can better capture long-distance dependencies; the ECA attention parameter is smaller than that of traditional convolutional neural networks, but it can greatly improve the computational efficiency while ensuring accuracy; ECA attention adapts to different input sizes, so it has good adaptability when processing images of different sizes. However, ECA attention weakens the global perspective information and features of different scales. In order to overcome this weakness, the present invention performs AdaptiveAvgPool2d and AdaptiveMaxPool2d on the input layer respectively, and then performs an addition operation. The improved EMCA attention network structure model is as follows: Figure 4 As shown:

[0046] 1. Pass the input feature map through AdaptiveAvgPool2d and AdaptiveMaxPool2d, then perform an addition operation, and then convert the feature map from a matrix of [h,w,c] to a vector of [1,1,c]

[0047] 2. Calculate the adaptive one-dimensional convolution kernel size kernel_size according to the number of channels of the feature map

[0048] 3. Use kernel_size for one-dimensional convolution to get the weight for each channel of the feature map

[0049] 4. Multiply the normalized weights and the original input feature map channel by channel to generate a weighted feature map;

[0050] Through the above operations, EMCA attention not only enhances the global perspective information and features of different scales, but also has good cross-channel information capture capabilities.

[0051] CARAFE upsampling module: The CARAFE structure effectively aggregates context information and utilizes feature information by introducing a larger receptive field and efficient upsampling operations, and connects it with the semantic information of the input feature map, thereby enhancing the perception of important content. Due to the small amount of operations, it maintains the lightweight characteristics of the model and improves the accuracy of the model for tasks such as text detection by retaining image detail information.

[0052] CARAFE upsampling is mainly divided into a kernel prediction module and a content-aware reconstruction module. In the kernel prediction module, the number of channels of the input H×W×C feature map is first compressed to C m Get C m ×H×W feature map, this process can reduce the amount of subsequent calculations. Then, up ×k up The convolution kernel of is encoded to generate a recombinant kernel with a size of The characteristic graph of. As shown in formula (1);

[0053]

[0054] Where C m represents the number of feature layer channels after dimensionality reduction, σ is the multiple of upsampling (σ=2), k up is the size of the predicted upsampling kernel. Then, the channels are expanded in the spatial dimension and rearranged to obtain a size of The upsampling kernel is then normalized by Softmax to make the sum of its weights equal to 1. In the content-aware reconstruction module, the obtained upsampling kernel is used to perform feature reconstruction and extract target features. For each target position in the output feature map, a k-th target is taken as the center. up ×k up The area is taken as the dot product with the up-sampled kernel predicted at the point position, and it is mapped back to the input feature map to obtain a feature map of size σH×σW×C.

[0055] The CARAFE upsampling structure can generate different upsampling kernels for each feature according to the distribution of different features, and pay more attention to the distribution of features in the global feature map. Therefore, the present invention applies CARAFE upsampling to the YOLOv8n-obb model to replace the original nearest neighbor interpolation upsampling module. Such a replacement improves the detection capability of important features without adding additional parameters and calculation amount. CReToNext module: In the detection network, there are large differences in the feature depths of features of different scales. For example, high-resolution features are usually located in the shallow layers of the network, while low-resolution features are usually located in the deep layers of the network. Due to the difference in feature depth, simply fusing these two features directly often fails to achieve ideal results.

[0056] CReToNext extracts features of different scales and simply splices them together without the need for complex resolution alignment operations. This avoids the problems of decreased inference speed and increased feature redundancy that may occur during the fusion process. At the same time, this simple splicing operation achieves the fusion and complementarity of multi-scale features, improving the performance and effect of the model.

[0057] The CReToNext structure improves the performance of the model by treating high-level and low-level semantic information equally and strengthening the fusion of this information through multi-layer connection operations. Figure 6 As shown in the figure, the module is first divided into two groups of convolutions. The upper group of convolutions passes through three Dmodel modules, and the lower group of convolutions and three feature maps processed by Dmodel are merged (Concat) together in the depth dimension. The merging operation allows the network to consider the information of multiple feature maps at the same time. The merged feature map contains the features extracted by all parallel paths (shallow and deep layers of the network), forming a richer feature representation. The Dmodel module consists of multiple convolutional layers and residual connections. It uses parallel paths, addition operations and SiLU activation functions to perform deep nonlinear transformation and fusion on features, enhance feature expression capabilities, and improve model performance.

[0058] LAMP pruning: LAMP calculates the square of the weight amplitude of the target connection and normalizes it to the sum of the square weight amplitudes of all "surviving weights" in the same layer. The specific formula is as follows:

[0059]

[0060] Where: W t represents the weight, W t [u] and W t [v] represents the W items of the index u mapping, and u and v represent the index mappings corresponding to the weights sorted in ascending order.

[0061] The LAMP score measures the relative importance of the target connection among all the "surviving" connections in the same layer, and prunes the weights with the lowest LAMP score in each layer until the pruning requirement is met. This pruning method can keep at least one weight in each layer while keeping the most important weights. The pruning method is as follows Figure 7 .

[0062] The main process of LAMP score pruning is:

[0063] (1) Train YOLOV8n-obb-our and initialize the weight file;

[0064] (2) The LAMP score is obtained by calculating the square of the connection weight amplitude and normalizing it to the sum of the square weight amplitudes of all "surviving weights" in the same layer;

[0065] (3) Based on the LAMP score, select the connection with the smaller score, and select the corresponding number of connections for pruning according to the pre-set global sparsity requirement; after setting a target pruning ratio, LAMP selects the link with the smallest LAMP score for pruning, and automatically determines the hierarchical sparsity (unlike local pruning, not necessarily every layer is pruned at the same ratio) until the global sparsity constraint is met.

[0066] (4) Remove the selected connections from the model, i.e. set their weights to zero.

[0067] (5) Retrain the pruned model to recover the performance that may have been lost during the pruning process;

[0068] (6) Evaluate the detection performance of the model and make judgments based on the experimental data (accuracy, recall rate, etc.). If the effect is not good, adjust some data (such as pruning ratio) to re-perform the LAMP pruning operation experiment until the requirements such as recall rate and accuracy are met, and then output the pruned network model as the optimal result.

[0069] Knowledge distillation: The knowledge distillation of the present invention consists of two parts, namely L2 logic distillation and CWD feature distillation. L2 logic distillation uses the information of the last output layer of the teacher model to train the student model. CWD feature distillation uses the intermediate features of the teacher model to guide the student model, and modifies the network width and depth of YOLOV8n-obb-our to obtain the YOLOV8s-obb-our model as the teacher model. YOLOV8n-obb-our and YOLOV8s-obb-our are two versions of the "YOLOV8-obb-our" network, and their d and w parameters are 0.33 and 0.25, 0.5 and 0.33, respectively. Among them, d represents the depth, and w represents the ratio of the width of the network. YOLOV8n-obb-our has a smaller model size and faster inference speed than YOLOV8s-obb-our, but the detection accuracy of YOLOV8n-obb-our is relatively low. (The network structure diagrams of YOLOv8n-obb-our and YOLOv8s-obb-our are the same.) The present invention uses the 16, 19, and 22 intermediate layers of the YOLOv8s-obb-our model to guide the student model (using the 16, 19, and 22 layer features in the YOLOv8s-obb-our model to guide the 16, 19, and 22 layers of the pruned YOLOv8n-obb-our.). The pruned model of YOLOv8n-obb-our is the student model, and YOLOv8s-obb-our (the network structure diagrams of YOLOv8s-obb-our and YOLOv8n-obb-our are the same, except that the network width and depth of the two are different.) is the teacher model. The knowledge distillation process is as follows Figure 8 , the process of knowledge distillation: first, there is a larger and more complex model, called the "Teacher Model", which can perform well on the training set; second, there is a smaller and simpler model, called the "Student Model", which has fewer parameters and less computation; finally, the output of the teacher model is used as auxiliary information to guide the student model to learn. Specifically, the output of the teacher model (such as probability distribution) is used as additional supervision information and trained together with the prediction results of the student model. In this way, the student model can learn some "soft" knowledge of the teacher model, such as the similarity between categories, the distribution law of samples, etc., thereby improving the generalization performance of the model without increasing too many parameters and computation.

[0070] The advantage of knowledge distillation is that it can reduce the number of model parameters and computational complexity without changing the model structure, so that the model can be deployed and run in resource-constrained scenarios such as embedded devices and mobile terminals. In addition, knowledge distillation can also be used to build model ensembling to improve the generalization performance and robustness of the model.

[0071] The main methods of knowledge distillation can be divided into three types: logical distillation (using the output of the teacher model or imitation of the final prediction), feature-based knowledge distillation (using the feature representation of the intermediate layer of the teacher model), and relationship-based knowledge distillation (using the relationship between different layers or different data points within the model). Each method aims to extract effective information from the large model and instill this information into the student model through a specific loss function; this patent combines CWD feature distillation and L2 logical distillation methods to perform knowledge distillation on the model. L2 logical distillation: Use the information of the last output layer of the teacher model (such as category probability) to train the student model. CWD feature distillation: Use the intermediate layer features of the teacher model to guide the student model. The logic of knowledge distillation is: use the existing CWD feature distillation and L2 logical distillation methods and combine them (that is, perform CWD feature distillation first, and then perform L2 logical distillation method).

[0072] Experimental Evaluation

[0073] I0U refers to the ratio of the intersection and union between the predicted box A generated by the model and the true box B. The value range of the intersection and union ratio is 0-1, 1 means that the predicted box and the true box completely overlap, and 0 means that the predicted box and the true box are completely separated. IOU reflects the accuracy of positioning. The higher the ratio, the closer the predicted result is to the true value.

[0074]

[0075] The precision rate P refers to the probability that the predicted category is the correct category, that is, the proportion of the number of correctly predicted road targets to the number of road targets predicted by the detection network.

[0076]

[0077] Recall rate R refers to the probability of the predicted correct category in the positive sample, that is, the ratio of the number of correctly predicted road targets to all real road targets.

[0078]

[0079] Among them: TP is true positive, that is, the positive sample is correctly identified as a positive sample; FN is false negative, that is, the positive sample is mistakenly identified as a negative sample; TN is true negative, that is, the negative sample is correctly identified as a negative sample; FP is false positive, that is, the negative sample is mistakenly identified as a positive sample.

[0080] The average precision AP is calculated by integration to calculate the area enclosed by the PR curve and the coordinate axis. P(r) is the corresponding P value under different R values.

[0081]

[0082] The average AP value mAP refers to the average AP value of multiple predicted categories.

[0083] This experiment was trained on the 3090 graphics card on the AutoDL graphics card rental platform.

[0084] Table 1 CTST-1600 (China Traffic Sign Dataset) algorithm detection effect

[0085]

[0086]

[0087] It can be seen from the above table that YOLOv8n-obb-our has improved detection effect than the original model, but its model size becomes larger, which is not conducive to deployment on driverless cars. Therefore, the present invention prunes the YOLOv8n-obb-our model, removes some unimportant weights that affect the detection results, and retains the most important weights. The size of the model is reduced to 5.1M, which is smaller than the original model, but its accuracy P drops sharply. Therefore, the present invention performs knowledge distillation on the pruned model and uses YOLOv8s-obb-our as a teacher model to distill (teach) the pruned model, so as to improve the detection effect.

[0088] Obviously, the specific implementation of the present invention is not limited to the above-mentioned methods. As long as various non-substantial improvements are made using the method concept and technical solution of the present invention, they are all within the protection scope of the present invention.

Claims

1. A lightweight traffic text detection model, characterized by: The model is improved based on the YOLOv8n-obb model, and the improvement method includes: replacing the feature pyramid module SPPF of the YOLOv8n-obb model with a SPPELAN module, and adding an EMCA attention mechanism module after the SPPELAN module, while replacing the upsampling module of the YOLOv8n-obb model with a CARAFE module, and replacing the Head C2f module with a CoReToNext module.

2. A lightweight traffic text detection model as claimed in claim 1, characterized in that: The SPPELAN module combines the SPP and ELAN modules to capture more contextual information at different scales.

3. A lightweight traffic text detection model as claimed in claim 1, characterized in that: The EMCA attention module is improved based on the ECA attention mechanism module. The input layer in the ECA attention mechanism module is respectively subjected to AdaptiveAvgPool2d and AdaptiveMaxPool2d, and then sent to the addition operation module.

4. A lightweight traffic text detection model as claimed in claim 1, characterized in that: CARAFE upsampling is mainly divided into a kernel prediction module and a content-aware reconstruction module. In the kernel prediction module, the number of channels of the input H×W×C feature map is first compressed to C m Get C m ×H×W feature map, this process is used to reduce the amount of subsequent calculations, and then through a size of k up ×k up The convolution kernel of is encoded to generate a recombinant kernel with a size of The feature map of Where C m represents the number of feature layer channels after dimensionality reduction, σ is the multiple of upsampling, and k up is the size of the predicted upsampling kernel; then, the channel is expanded in the spatial dimension and rearranged to obtain a size of The upsampling kernel is then normalized by Softmax so that the sum of its weights is 1; In the content-aware reconstruction module, the obtained upsampling kernel is used to perform feature reconstruction and extract target features. For each target position in the output feature map, a k-th pixel with the target as the center is taken. up ×k up The area is taken as the dot product with the up-sampled kernel predicted at the point position, and it is mapped back to the input feature map to obtain a feature map of size σH×σW×C.

5. A lightweight traffic text detection method, characterized in that: The method is based on the detection model YOLOv8n-obb-our as claimed in claim 1, and obtains a final detection model after pruning and knowledge distillation of the detection model YOLOv8n-obb-our. The final detection model is integrated into an unmanned vehicle to detect traffic text.

6. A lightweight traffic text detection method as claimed in claim 5, characterized in that: The detection model YOLOv8n-obb-our is pruned using the LAMP algorithm, and then the detection model YOLOv8s-obb-our is used as a teacher model of the pruned model to distill the pruned model, so as to improve the detection effect of the model without increasing the size of the model.

7. A lightweight traffic text detection method as claimed in claim 6, characterized in that: The pruning method comprises: (1) Train YOLOV8n-obb-our and initialize the weight file; (2) The LAMP score is obtained by calculating the square of the connection weight amplitude and normalizing it to the sum of the square weight amplitudes of all "surviving weights" in the same layer; (3) According to the LAMP score, select the connection with a smaller score, and according to the pre-set global sparsity requirement, select the corresponding number of connections for pruning; (4) Remove the selected connections from the model, i.e. set their weights to zero. (5) Retrain the pruned model to recover the performance that may have been lost during the pruning process; (6) Evaluate the detection performance of the model and determine whether to end pruning.

8. A lightweight traffic text detection method as claimed in claim 5, characterized in that: Knowledge distillation methods include: L2 logic distillation and CWD feature distillation. L2 logic distillation uses the information of the last output layer of the teacher model to train the student model. CWD feature distillation uses the intermediate features of the teacher model to guide the student model.

9. A lightweight traffic text detection method as claimed in claim 6, characterized in that: The network width and depth of the YOLOV8n-obb-our model are modified to obtain the YOLOV8s-obb-our model, and the YOLOV8s-obb-our model is used as the teacher model of the pruned model to distill the pruned model.

Citation Information

Patent Citations

  • Lightweight moving target detection method combining YOLOv8 with dynamic confidence compensation

    CN117315294A

  • Traffic sign board detection method based on improved YOLOv8s

    CN117392640A