Lightweight traffic sign identification method and system based on loss function optimization and module improvement

By introducing lightweight GhostConv module, DWConv module and DAttention mechanism into the YOLOv8s algorithm, combined with the Shape-IoU method, the loss function is optimized, and the problems of slow running speed and inaccurate target detection in traffic sign recognition are solved, and the compression and accuracy of the model are achieved.

CN120496030APending Publication Date: 2025-08-15WUHAN POLYTECHNIC UNIVERSITY
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510597304.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-09
Publication Date
2025-08-15

AI Technical Summary

Technical Problem

The existing YOLOv8s algorithm has problems in traffic sign recognition that the model runs slowly, the parameter complexity is high, and the target scale is prone to missed or missed when it changes.

Method used

The method of loss function optimization and module improvement is adopted, including the use of lightweight GhostConv module in the YOLOv8s backbone network to replace the traditional convolution module, the addition of DWConv module to reduce model parameters, and the introduction of DAttention mechanism and Shape-IoU method in the head network to optimize the loss function to improve the accuracy of feature extraction and bounding box regression.

Benefits of technology

It achieves the improvement of model compression performance, maintains detection speed and accuracy, enhances the extraction effect of related features, and improves detection accuracy and performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120496030A_ABST
    Figure CN120496030A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image recognition, and discloses a lightweight traffic sign recognition method based on loss function optimization and module improvement, which comprises the steps of collecting traffic sign image data for preprocessing, segmenting an image background, extracting image features and performing dimension reduction processing, and recognizing and classifying the image features. And traffic sign identification processing in different images is realized. According to the lightweight traffic sign recognition method and system based on loss function optimization and module improvement, in a YOLOv8s backbone network, a lightweight GhostConv module is used for replacing a traditional convolution module, the model compression performance is achieved, the detection speed and accuracy are kept, a DWConv module is added into a head network, model parameters are reduced, the feature fusion efficiency is improved, and the method and the system have the advantages that the model compression performance is improved, and the detection speed and accuracy are improved. An attention mechanism DAttention is introduced to enhance the extraction effect of related features, irrelevant features are inhibited to improve the detection precision of the algorithm, bounding box regression is more accurate by optimizing a loss function and combining a Shape-IoU method, and the model detection performance is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image recognition technology, and in particular to a lightweight traffic sign recognition method and system based on loss function optimization and module improvement. Background Art

[0002] Image recognition refers to the technology of using computers to process, analyze and understand images in order to identify targets and objects of various different patterns. It is a practical application of deep learning algorithms. At present, image recognition technology is generally divided into face recognition and object recognition. Especially in the field of traffic sign recognition, different traffic signs are efficiently detected and identified based on algorithm models. The application of artificial intelligence and transportation has become an important means to ensure traffic safety. It has important research value and significance in improving and perfecting intelligent transportation systems.

[0003] At present, when performing traffic sign recognition tasks, the minimum weight model of the YOLOv8s algorithm has the following problems in the actual detection process:

[0004] 1) The YOLOv8s minimum weight model uses a large number of standard convolution and C2f modules. Although this improves the accuracy of the algorithm, it significantly reduces the model running speed and increases the complexity of the model parameters.

[0005] 2) When the object scale varies greatly, the YOLO v8s model is prone to missed or false detection of objects. Furthermore, because YOLO v8s divides the input image into smaller grids, each of which only predicts a single object, it is difficult to apply to object detection with large scale variations.

[0006] Therefore, based on the above-mentioned technical problems, a lightweight traffic sign recognition method and system based on loss function optimization and module improvement is proposed. Summary of the Invention

[0007] (1) Technical problems solved

[0008] In response to the shortcomings of the existing technology, the present invention provides a lightweight traffic sign recognition method and system based on loss function optimization and module improvement, which has the advantages of achieving model compression performance, reducing model parameters and enhancing the effect of relevant feature extraction. It solves the problem that the minimum weight model of the existing YOLOv8s algorithm in the above background technology is prone to reduced model running speed and missed or false detection of targets when processing target detection with large scale changes.

[0009] (2) Technical solution

[0010] To achieve the above-mentioned model compression performance, reduce model parameters, and enhance the effect of relevant feature extraction, the present invention provides the following technical solution: a lightweight traffic sign recognition method based on loss function optimization and module improvement, comprising the following specific steps:

[0011] S1. Image acquisition and processing: Acquisition of traffic sign image data and preprocessing of the image data;

[0012] S2. Image Segmentation: Segment image background processing based on the U-Net algorithm model;

[0013] S3. Feature extraction and dimensionality reduction: Extract image features and reduce the dimensionality of high-dimensional features;

[0014] S4. Image Recognition: Image feature recognition and classification are performed based on the optimized YOLOv8s detection model to identify and process traffic signs in different images.

[0015] Preferably, a data interface of the Chinese Traffic Sign Dataset TT100K website is accessed through a storage medium to collect traffic sign image datasets under different lighting scenarios, including low-light scene images and normal-light scene images. The specific determination steps include:

[0016] 1) Build an image illumination intensity adjustment model based on the Retinex algorithm, including:

[0017] a. The Retinex algorithm is expressed as: I(x,y) = R(x,y)L(x,y), where I represents the image seen by the human eye, R represents the reflected component of the object, and L represents the ambient light component, i.e., the light intensity.

[0018] b. Set the average light intensity to l j , the light intensity mean expression based on the Retinex algorithm formula is: Where h and w represent the height and width of the input image respectively;

[0019] c. Determine the scene illumination intensity of different traffic sign images based on the calculated mean of the input traffic sign images to distinguish between low-light images and normal-light images;

[0020] 2) Set the illumination component of the low-light image to L low , the illumination component of the normal illumination image is L nor , constructing a lighting adjustment model including decomposition-enhancement-recombination modules, specifically:

[0021] a. Construct the loss function of the decomposition module, expressed as:

[0022] T=T recon +λ ir Tir +λ is T is

[0023] Where T recon is the reconstruction loss: T recon =∑ i=low,normalj=low,normal λ ij |R i ×L j -I j |;

[0024] T ir is the consistency loss of the reflection component: T ir =||R low -R nor ||:

[0025] T is The smoothing loss for the illumination component is:

[0026] b. Correction of the illumination component L of the low-light image based on the multi-scale Enhance-Net illumination network low , based on the BM3D algorithm and introducing the illumination strategy to suppress the reflection component R of the weak light image low Noise in

[0027] c. Based on the adjusted L low With R low The image data after weak light enhancement is reconstructed.

[0028] Preferably, the multi-scale color restoration Retinex algorithm (MSRCR) is used for the low-light enhanced image and the normal-light image, and the color restoration factor is used to adjust the proportional relationship between the three color channels R, G, and B in the original image, thereby highlighting the relatively dark area information in the image and eliminating the color distortion defect of the image to improve the contrast of the processed image. Specifically, the following steps are performed:

[0029] 1) Image filtering and denoising based on Gaussian blur filter, expressed as:

[0030]

[0031] Where σ is the space constant around Gaussian, r 2 =x 2 +y 2 ;

[0032] 2) The MSRCR algorithm is expressed as:

[0033]

[0034] Where P represents gain, b represents bias, I(x,y) represents the image of a certain channel, C represents the color restoration factor of a certain channel, which is used to adjust the channel color ratio, f(·) represents the mapping function of the color space, β is the gain constant, and α is the controllable nonlinear intensity;

[0035] 3) Among them I i is the input image, G n is the Gaussian filter function, N is the number of scales, w n is the weight of each scale, Represents the image output in the logarithmic domain.

[0036] Preferably, the image background segmentation process based on the U-Net segmentation model includes:

[0037] 1) Set the encoder to consist of a convolutional layer Conv2D and an activation function ReLU, followed by a maximum pooling MaxPooling2D at each stage to reduce the resolution and extract high-level features. Set the decoder to restore the resolution using bilinear interpolation, construct a skip connection to connect the encoder feature map with the corresponding decoder layer, set the output layer to include a 1×1 convolution and a sigmoid activation function, and generate a probability mask of 0 to 1, and build a U-Net segmentation model;

[0038] 2) Construct the cross entropy loss function, expressed as:

[0039] loss = -pos_weight × y true log(y pred )-(1-y pred )log(1-y pred ),

[0040]

[0041] where y true is the true label (value is 0 or 1), y pred Represents the probability predicted by the model, that is, the probability that the model believes the sample is class 1, pos_weight is the coefficient for balancing the weights of positive and negative samples, num_neg is the number of negative samples, and num_pos is the number of positive samples to ensure that the loss of positive and negative samples is balanced in the loss function;

[0042] 3) Set the Adam optimizer with a learning rate of 1e-4 to 1e-3, set hyperparameters including batch size and training rounds, and train a U-Net segmentation model based on the loss function. Input image data is segmented and background processed according to the U-Net segmentation model;

[0043] 4) Combined with the intersection-over-union (IOU) evaluation method, the overlapping area of the two circles is used as the intersection and the total coverage area is used as the union. The model prediction accuracy is judged based on the ratio between the two. The closer the ratio is to 1, the more accurate the model prediction structure is, which is expressed as

[0044] Preferably, the HOG feature extraction process of the image after background segmentation includes:

[0045] 1) Grayscale processing of the image based on weighted average is expressed as:

[0046] Gray=0.299R+0.587G+0.114B

[0047] Gray is the grayscale value, R, G, and B represent the three component values of red, green, and blue in the RGB image respectively, and 0.299, 0.587, and 0.114 are the weight coefficients corresponding to the three components;

[0048] 2) Calculate the gradient of each grayscale pixel, including its magnitude and direction, to capture contour information, divide the image into several 6*6 pixel blocks, and calculate the gradient histogram of each block to obtain the characteristics of each block;

[0049] 3) Combine several unit blocks to form a block, concatenate all unit block features in the block to obtain the block HOG feature, and then obtain the HOG feature of the image based on each block.

[0050] Preferably, the HOG features of the image are processed based on principal component analysis (PCA) dimensionality reduction, and the specific steps include:

[0051] 1) Standardize the image feature data to eliminate dimensional differences. The standardization formula is:

[0052]

[0053] Where z is the characteristic mean, σ is the standard deviation, and x i is the i-th sample data in the feature data;

[0054] 2) Calculate the covariance matrix to analyze the correlation between different features, expressed as:

[0055]

[0056] where X std is the standardized data matrix;

[0057] 3) Calculate the eigenvalues and eigenvectors of the covariance matrix, where the eigenvectors represent the principal component directions of the characteristic data, and the eigenvalues represent the importance of each principal component. Decompose the covariance matrix C into:

[0058] C=VΛV T

[0059] Where V is the eigenvector matrix and Λ is the diagonal matrix;

[0060] 4) Select the first K principal components to calculate the cumulative variance contribution rate to ensure that the cumulative variance ratio exceeds the threshold. The cumulative variance is expressed as:

[0061]

[0062] The original high-dimensional feature data is mapped to the selected K-dimensional principal component space, where the first k eigenvectors are taken to form a projection matrix, and the feature data is reduced in dimensionality, which is expressed as:

[0063] X pca =X std W k

[0064] where X pca is the feature data after dimensionality reduction, W k is the projection matrix.

[0065] Preferably, the YOLOv8s detection model is used for recognition and classification based on the image feature data after dimensionality reduction, and the YOLOv8s detection model is Europeanized. The specific steps include:

[0066] 1) Set up a Darknet-53 backbone network, with convolutional layers and residual connections in the backbone network to learn feature representations at different scales. Set up a batch normalization layer for regularization. Set up a classification head, including a global average pooling layer to compress the feature map to the mean of each channel to reduce parameters and prevent overfitting. Set up a fully connected layer to map the pooled feature vector to the category space. Finally, configure the Sigmoid activation function to build a YOLOv8s detection model.

[0067] 2) In the Darknet-53 backbone network of YOLOv8s, a lightweight GhostConv module is added to replace the convolutional layer to achieve model compression, including:

[0068] a. For the input feature map, the GhostConv module uses a small number of convolution kernels to extract features;

[0069] b. Then make a simpler linear change to this part of the feature map Operation;

[0070] c. Generate the final feature map through splicing operation;

[0071] 3) Adding a DWConv module to the head network to reduce model parameters and accelerate feature fusion, including: a. Using the DWConv module to split the input image into single channels and convolution the feature maps of the same channel with the same convolution kernel;

[0072] b. Perform convolution operations in a two-dimensional plane, ensuring that the number of filters is the same as the number of depths in the input layer, so that the three-channel image generates three feature maps after operation;

[0073] c. The shape of the convolution kernel is expressed as: convolution kernel shape = convolution kernel W * convolution kernel H * number of input channels, and its computational cost is shape *;

[0074] 3) The DAttention module introduced in the backbone network of the YOLOv8s model includes a deformable attention mechanism, which ensures that the model dynamically adjusts attention weights based on the input content. The deformable attention mechanism introduces additional learnable parameters to calculate the attention weights, and ensures that the parameters are learned through backpropagation training;

[0075] 4) The Shape-IoU method is introduced into the YOLOv8s model. The loss is calculated by focusing on the shape and size of the bounding box itself to optimize the loss function. The calculation formula of each parameter is expressed as:

[0076]

[0077] Where scale is the scaling factor and is related to the target size in the dataset, ww and hh represent the weight coefficients in the horizontal and vertical directions respectively;

[0078] Then the bounding box regression loss is expressed as:

[0079]

[0080] A lightweight traffic sign recognition system based on loss function optimization and module improvement, including a data acquisition module for collecting traffic sign image datasets;

[0081] The pre-processing module is used to perform light intensity judgment and adjustment, filtering and denoising, and image contrast enhancement on the collected image data;

[0082] Image segmentation module, used for image data to perform image background segmentation processing;

[0083] Feature extraction and dimensionality reduction module, used to extract image features and perform feature dimensionality reduction processing;

[0084] The detection and recognition model module builds an improved YOLOv8s detection model based on the Python development language and further optimizes the model structure to improve model recognition efficiency and accuracy;

[0085] The experimental verification module is based on the deep learning framework PyTorch and CUDA11.8 to accelerate model training, and sets precision, recall rate and average precision as evaluation indicators to evaluate the model recognition accuracy.

[0086] (3) Beneficial effects

[0087] Compared with the existing technology, the present invention provides a lightweight traffic sign recognition method and system based on loss function optimization and module improvement, which has the following beneficial effects:

[0088] 1. This lightweight traffic sign recognition method and system based on loss function optimization and module improvement effectively achieves model compression performance while maintaining detection speed and accuracy by adding a lightweight GhostConv module to the YOLOv8s backbone network to replace the traditional convolution module. Furthermore, adding a DWConv module to the YOLOv8 head network can further reduce model parameters and thus improve feature fusion efficiency.

[0089] 2. This lightweight traffic sign recognition method and system based on loss function optimization and module improvement can enhance the extraction of relevant features and suppress irrelevant features to improve the detection accuracy of the algorithm by introducing the attention mechanism DAttention. By optimizing the loss function and combining the Shape-IoU method, the bounding box regression is made more accurate, thereby effectively improving the model detection performance. BRIEF DESCRIPTION OF THE DRAWINGS

[0090] Figure 1 This is a schematic diagram of the improved YOLOv8s detection model structure of the present invention;

[0091] Figure 2 Schematic diagram of the GhostConv module of the present invention;

[0092] Figure 3 Schematic diagram of the DWConv module of the present invention;

[0093] Figure 4 Schematic diagram of the DAttention module of the present invention;

[0094] Figure 5 Schematic diagram of the Shape-IoU module of the present invention;

[0095] Figure 6 Schematic diagram of a weighted curve of prediction results for accuracy evaluation of the present invention;

[0096] Figure 7 Schematic diagram of a weight curve of prediction results for recall evaluation of the present invention;

[0097] Figure 8 Schematic diagram of the weighted curve of the prediction results of the average precision mean evaluation of the present invention;

[0098] Figure 9 Schematic diagram of the experimental results of the traditional YOLOv8s and improved YOLOv8s models of the present invention;

[0099] Figure 10 This is a schematic diagram comparing the average precision means of different algorithms of the present invention;

[0100] Figure 11 Schematic diagram of the ablation experiment results of the traditional YOLOv8s and improved YOLOv8s models of the present invention;

[0101] Figure 12 This is a schematic diagram of the traffic sign recognition results in an image using traditional YOLOv8s of the present invention;

[0102] Figure 13 This is a schematic diagram of the traffic sign recognition results in an image using the improved YOLOv8s of the present invention. DETAILED DESCRIPTION

[0103] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the embodiments of the present invention and the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0104] Example 1

[0105] In this embodiment, precision, recall, and mean average precision (mAP) are used as evaluation indicators to objectively evaluate the performance of the traditional YOLOv8s and improved YOLOv8s models. The specific calculation formula is:

[0106] according to Figure 6 The data shows that the precision rate represents the proportion of correct predictions among all the results predicted as positive, and is used to represent the number of true positive samples among the samples predicted as positive, which is expressed as:

[0107]

[0108] according to Figure 7The data shows that the recall rate represents the proportion of correct predictions among all results with true values of Positive, which is used to measure the model's ability to identify positive samples, and is expressed as:

[0109] according to Figure 8 The data shows that the average precision is the average of the prediction accuracy of all categories, where AP is obtained by dividing the sum of all the precision rates of a certain category in the set by the number of images containing the target of that category, and is expressed as: The larger the area enclosed by the precision-recall curve, the better the algorithm performance.

[0110] Example 2

[0111] In this embodiment, according to Figure 9 The experimental results of the traditional YOLOv8s and improved YOLOv8s models show that compared with the traditional YOLOv8s, the mAP50 of the improved network structure is improved by 3.61%, the number of parameters is reduced by 27.8%, and the computational FLOPs is significantly reduced by 35.9%.

[0112] Example 3

[0113] In this embodiment, based on the TT100K dataset, in order to prevent excessive loss, we selected categories with more than 100 images for training and testing. Finally, we selected 42 categories with a total of 6598 images for training. Then we tested the model weights with the best performance. The test results were based on Figure 12 and Figure 13 It can be clearly observed that the traditional YOLOv8s model algorithm has missed detection of small targets in the distance. Figure 12 The following examples show low confidence and false positives:

[0114] The improved YOLOv8s model algorithm can accurately identify small targets in the distance, thereby effectively improving missed detection and false detection problems and increasing confidence. Compared with the traditional YOLOv8s model algorithm, it shows good results in traffic sign recognition.

[0115] In summary, based on the improvement of the YOLOv8s traffic sign recognition model, and to address the problem that traffic signs are relatively small in road scenes, a lightweight module GhostConv was added to the YOLOv8s backbone network to achieve model compression while maintaining detection speed and accuracy.

[0116] Introducing the DWConv module in the head network can further reduce model parameters and accelerate feature fusion. Then, introducing the deformable attention mechanism enables the model to automatically focus on the most important parts when processing data, thereby improving the model's prediction accuracy and interpretability. Finally, using Shape-IoU to optimize the loss function can effectively improve detection performance and show stable performance in different detection tasks.

[0117] At the same time, data from ablation experiments and comparative experiments show that the improved YOLOv8s model has the advantages of smaller parameters, higher accuracy, and lower volume calculation. In future research, we can focus on higher detection accuracy and more convenient program deployment, and improve the model program according to actual needs.

[0118] The relevant modules involved in this system are all hardware system modules or functional modules that combine computer software programs or protocols with hardware in the existing technology. The computer software programs or protocols involved in the functional modules are themselves technologies that are well known to those skilled in the art and are not improvements to this system. The improvements to this system are the interaction or connection relationships between the modules, that is, improvements to the overall structure of the system to solve the corresponding technical problems to be solved by this system.

[0119] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to these embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the appended claims and their equivalents.

Claims

1. A lightweight traffic sign recognition method based on loss function optimization and module improvement, characterized by: The specific steps include: S1. Image acquisition and processing: Acquisition of traffic sign image data and preprocessing of the image data; S2. Image Segmentation: Segment image background processing based on the U-Net algorithm model; S3. Feature extraction and dimensionality reduction: Extract image features and reduce the dimensionality of high-dimensional features; S4. Image Recognition: Image feature recognition and classification are performed based on the optimized YOLOv8s detection model to identify and process traffic signs in different images.

2. The lightweight traffic sign recognition method based on loss function optimization and module improvement according to claim 1 is characterized in that: Traffic sign image datasets under different lighting scenarios are collected using the data interface of the China Traffic Sign Dataset TT100K website accessed through the storage medium. These datasets include images of low-light scenes and images of normal-light scenes. The specific judgment steps include: 1) Build an image illumination intensity adjustment model based on the Retinex algorithm, including: a. The Retinex algorithm is expressed as: I(x,y) = R(x,y)L(x,y), where I represents the image seen by the human eye, R represents the reflected component of the object, and L represents the ambient light component, i.e., the light intensity. b. Set the average light intensity to l j , the light intensity mean expression based on the Retinex algorithm formula is: Where h and w represent the height and width of the input image respectively; c. Determine the scene illumination intensity of different traffic sign images based on the calculated mean of the input traffic sign images to distinguish between low-light images and normal-light images; 2) Set the illumination component of the low-light image to L low , the illumination component of the normal illumination image is L nor , constructing a lighting adjustment model including decomposition-enhancement-recombination modules, specifically: a. Construct the loss function of the decomposition module, expressed as: T=T recon +λ ir T ir +λ is T is Where T recon is the reconstruction loss: T recon =∑ i=low,normalj=low,normal λ ij |R i ×L j -I j |; T ir is the consistency loss of the reflection component: T ir =||R low -R nor ||: T is The smoothing loss for the illumination component is: b. Correction of the illumination component L of the low-light image based on the multi-scale Enhance-Net illumination network low , based on the BM3D algorithm and introducing the illumination strategy to suppress the reflection component R of the weak light image low Noise in c. Based on the adjusted L low With R low The image data after weak light enhancement is reconstructed.

3. The lightweight traffic sign recognition method based on loss function optimization and module improvement according to claim 2 is characterized in that: The Multi-Scale Retinex (MSRCR) algorithm for color restoration is used for the low-light enhanced image and the normal-light image. The color restoration factor is used to adjust the proportional relationship between the three color channels R, G, and B in the original image, thereby highlighting the relatively dark area information in the image and eliminating the color distortion defect of the image to improve the contrast of the processed image. Specifically, the following steps are performed: 1) Image filtering and denoising based on Gaussian blur filter, expressed as: Where σ is the space constant around Gaussian, r 2 =x 2 +y 2 ; 2) The MSRCR algorithm is expressed as: Where P represents gain, b represents bias, I(x,y) represents the image of a certain channel, C represents the color restoration factor of a certain channel, which is used to adjust the channel color ratio, f(·) represents the mapping function of the color space, β is the gain constant, and α is the controllable nonlinear intensity; 3) Among them I i is the input image, G n is the Gaussian filter function, N is the number of scales, w n is the weight of each scale, Represents the image output in the logarithmic domain.

4. The lightweight traffic sign recognition method based on loss function optimization and module improvement according to claim 1 is characterized in that: Image background segmentation processing based on the U-Net segmentation model includes: 1) Set the encoder to consist of a convolutional layer Conv2D and an activation function ReLU, followed by a maximum pooling MaxPooling2D at each stage to reduce the resolution and extract high-level features. Set the decoder to restore the resolution using bilinear interpolation, construct a skip connection to connect the encoder feature map with the corresponding decoder layer, set the output layer to include a 1×1 convolution and a sigmoid activation function, and generate a probability mask of 0 to 1, and build a U-Net segmentation model; 2) Construct the cross entropy loss function, expressed as: loss=-pos_weight×y true log(y pred )-(1-and pred )log(1-y pred ), where y true is the true label (value is 0 or 1), y pred Represents the probability predicted by the model, that is, the probability that the model believes the sample is class 1, pos_weight is the coefficient for balancing the weights of positive and negative samples, num_neg is the number of negative samples, and num_pos is the number of positive samples to ensure that the loss of positive and negative samples is balanced in the loss function; 3) Set the Adam optimizer with a learning rate of 1e-4 to 1e-3, set hyperparameters including batch size and training rounds, and train a U-Net segmentation model based on the loss function. Input image data is segmented and background processed according to the U-Net segmentation model; 4) Combined with the intersection-over-union (IOU) evaluation method, the overlapping area of the two circles is used as the intersection and the total coverage area is used as the union. The model prediction accuracy is judged based on the ratio between the two. The closer the ratio is to 1, the more accurate the model prediction structure is, which is expressed as 5. The lightweight traffic sign recognition method based on loss function optimization and module improvement according to claim 1 is characterized in that: Extract HOG features from the image after background segmentation, including: 1) Grayscale processing of the image based on weighted average is expressed as: Gray=0.299R+0.587G+0.114B Gray is the grayscale value, R, G, and B represent the three component values of red, green, and blue in the RGB image respectively, and 0.299, 0.587, and 0.114 are the weight coefficients corresponding to the three components; 2) Calculate the gradient of each grayscale pixel, including its magnitude and direction, to capture contour information, divide the image into several 6*6 pixel blocks, and calculate the gradient histogram of each block to obtain the characteristics of each block; 3) Combine several unit blocks to form a block, concatenate all unit block features in the block to obtain the block HOG feature, and then obtain the HOG feature of the image based on each block.

6. The lightweight traffic sign recognition method based on loss function optimization and module improvement according to claim 1 is characterized in that: The HOG features of the image are processed based on the principal component analysis method PCA dimensionality reduction. The specific steps include: 1) Standardize the image feature data to eliminate dimensional differences. The standardization formula is: Where z is the characteristic mean, σ is the standard deviation, and x i is the i-th sample data in the feature data; 2) Calculate the covariance matrix to analyze the correlation between different features, expressed as: where X std is the standardized data matrix; 3) Calculate the eigenvalues and eigenvectors of the covariance matrix, where the eigenvectors represent the principal component directions of the characteristic data, and the eigenvalues represent the importance of each principal component. Decompose the covariance matrix C into: C=VΛV T Where V is the eigenvector matrix and Λ is the diagonal matrix; 4) Select the first K principal components to calculate the cumulative variance contribution rate to ensure that the cumulative variance ratio exceeds the threshold. The cumulative variance is expressed as: The original high-dimensional feature data is mapped to the selected K-dimensional principal component space, where the first k eigenvectors are taken to form a projection matrix, and the feature data is reduced in dimensionality, which is expressed as: X pca =X std ·W k where X pca is the feature data after dimensionality reduction, W k is the projection matrix.

7. The lightweight traffic sign recognition method based on loss function optimization and module improvement according to claim 1 is characterized in that: The YOLOv8s detection model is used to identify and classify the image feature data after dimensionality reduction, and the YOLOv8s detection model is Europeanized. The specific steps include: 1) Set up a Darknet-53 backbone network, with convolutional layers and residual connections in the backbone network to learn feature representations at different scales. Set up a batch normalization layer for regularization. Set up a classification head, including a global average pooling layer to compress the feature map to the mean of each channel to reduce parameters and prevent overfitting. Set up a fully connected layer to map the pooled feature vector to the category space. Finally, configure the Sigmoid activation function to build a YOLOv8s detection model. 2) In the Darknet-53 backbone network of YOLOv8s, a lightweight GhostConv module is added to replace the convolutional layer to achieve model compression, including: a. For the input feature map, the GhostConv module uses a small number of convolution kernels to extract features; b. Then make a simpler linear change to this part of the feature map Operation; c. Generate the final feature map through splicing operation; 3) Adding a DWConv module to the head network to reduce model parameters and accelerate feature fusion, including: a. Using the DWConv module to split the input image into single channels and convolution the feature maps of the same channel with the same convolution kernel; b. Perform convolution operations in a two-dimensional plane, ensuring that the number of filters is the same as the number of depths in the input layer, so that the three-channel image generates three feature maps after operation; c. The shape of the convolution kernel is expressed as: convolution kernel shape = convolution kernel W * convolution kernel H * number of input channels, and its computational cost is shape *; 3) The DAttention module introduced in the backbone network of the YOLOv8s model includes a deformable attention mechanism, which ensures that the model dynamically adjusts attention weights based on the input content. The deformable attention mechanism introduces additional learnable parameters to calculate the attention weights, and ensures that the parameters are learned through backpropagation training; 4) The Shape-IoU method is introduced into the YOLOv8s model. The loss is calculated by focusing on the shape and size of the bounding box itself to optimize the loss function. The calculation formula of each parameter is expressed as: Where scale is the scaling factor and is related to the target size in the dataset, ww and hh represent the weight coefficients in the horizontal and vertical directions respectively; Then the bounding box regression loss is expressed as:

8. A lightweight traffic sign recognition system based on loss function optimization and module improvement, characterized by: It includes a data acquisition module for collecting traffic sign image data sets; The pre-processing module is used to perform light intensity judgment and adjustment, filtering and denoising, and image contrast enhancement on the collected image data; Image segmentation module, used for image data to perform image background segmentation processing; Feature extraction and dimensionality reduction module, used to extract image features and perform feature dimensionality reduction processing; The detection and recognition model module builds an improved YOLOv8s detection model based on the Python development language and further optimizes the model structure to improve model recognition efficiency and accuracy; The experimental verification module is based on the deep learning framework PyTorch and CUDA11.8 to accelerate model training, and sets precision, recall rate and average precision as evaluation indicators to evaluate the model recognition accuracy.

Citation Information

Cited By

  • Event detection method, system and device for optical cable detection and storage medium

    CN121808706A