Safety helmet wearing detection method, device and equipment for road traffic and medium

By updating the network structure of the helmet wear detection model, the generalized feature pyramid module of the Star Block module, CAA attention mechanism and DySample module are introduced, which solves the problems of severe occlusion, complex background, insufficient detection accuracy of multi-scale and small targets in the prior art, and achieves more efficient and accurate detection effects of helmet wear.

CN119851226APending Publication Date: 2025-04-18SOUTH CHINA AGRICULTURAL UNIVERSITY
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202510053083.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-14
Publication Date
2025-04-18

AI Technical Summary

Technical Problem

The prior art has problems such as severe occlusion, complex background, multi-scale and small-object detection accuracy in road traffic helmet wear detection, resulting in poor detection results.

Method used

A safety helmet wear detection method for road traffic is adopted. By updating the Bottleneck structure in the backbone network of the helmet wear detection model, the Star Block module in the StarNet lightweight network is introduced, and the generalized feature pyramid module of the CAA attention mechanism module and the DySample module are introduced to build a second helmet wear detection model.

Benefits of technology

It significantly improves the detection accuracy of complex backgrounds and occlusions, enhances the detection ability of multi-scale targets, improves the detection accuracy of small targets, and improves the robustness and adaptability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119851226A_ABST
    Figure CN119851226A_ABST
Patent Text Reader

Abstract

The invention relates to a safety helmet wearing detection method and device for road traffic, equipment and a medium. The method comprises the following steps: acquiring a to-be-detected traffic intersection image frame containing a rider who does not wear a helmet in a road traffic scene; updating a Bottleneck structure in an original C2f module in a backbone network of a preset first helmet wearing detection model to a Star Block module in a StarNet lightweight network, introducing a CAA attention mechanism module, and updating the feature fusion network to a generalized feature pyramid module introducing a DySample module to construct a second helmet wearing detection model; and inputting the to-be-detected traffic intersection image frame to a second helmet wearing detection model trained to a convergence state to obtain a plurality of riders without wearing helmets in the to-be-detected traffic intersection image frame so as to complete safety helmet wearing detection of road traffic. According to the method, the detection precision and the model performance of the rider without wearing the helmet in the traffic scene are remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image recognition, and in particular to a method for detecting the wearing of a safety helmet in road traffic, a corresponding device, an electronic device, and a computer-readable storage medium. Background Art

[0002] At present, helmet detection methods based on video or image data can be roughly divided into two categories: traditional methods and deep learning-based methods. Traditional methods usually adopt similar methods, focusing on identifying moving objects and then classifying the behavior of helmets. Moving object detection usually includes multiple stages. First, the moving target is extracted from the surveillance video by motion segmentation technology. Common motion segmentation methods include optical flow, frame difference and background subtraction. Secondly, feature descriptors such as local binary pattern (LBP), HOG, scale-invariant feature transform (SIFT) are used to extract features of electric vehicles. Finally, binary classifiers such as SVM and K-nearest neighbors (KNN) are used to classify electric vehicles. Once the moving object is identified, the driver and passengers are further classified. Dahiya et al. initially used background subtraction and object segmentation to detect people riding electric vehicles, and then determined the use of helmets based on visual features and binary classification. Silva et al. decomposed the problem of detecting whether electric vehicle drivers are wearing helmets into two steps. First, the vehicle image is segmented and classified to detect all moving targets in the scene. Then, in the helmet detection stage, a hybrid descriptor is used to extract image features, and a support vector machine classifier is used to distinguish between helmet images and non-helmet images. Similarly, Talaulikar et al. used background subtraction technology to identify moving electric vehicles and applied principal component analysis to extract features. However, these methods have some limitations: due to multi-stage operations, ensuring real-time performance faces certain challenges; when there are multiple riders on an electric vehicle, it becomes difficult to accurately determine whether each rider is wearing a helmet, especially when the person without a helmet is obscured by the person wearing a helmet, the classification algorithm in this case is difficult to implement; the performance of motion segmentation-based methods is easily significantly affected by factors such as road congestion, camera shake, branch movement or other interference.

[0003] At present, road safety helmet detection based on deep learning is widely used. This method automatically learns high-level features of images through a large amount of labeled data and deep neural networks. Common deep learning detection algorithms include two-stage detection algorithms based on region candidate networks, such as R-CNN, FastR-CNN, FasterR-CNN, etc., and regression-based object detection algorithms, such as YOLO series, SSD, etc. For example, Shine et al. used background subtraction and SequentialMinimalOptimization (SMO) classifiers to detect electric vehicles, and used hand-crafted features and CNN to classify helmets and non-helmets. The results showed that CNN had higher accuracy. Vishnu et al. used adaptive background subtraction to extract moving targets from video frames and used CNN to classify people riding electric vehicles. Vishnu et al. used FasterR-CNN for helmet detection, and Gaussian Mixture Model (GMM) was used to segment foreground objects. FasterR-CNN was used to detect electric vehicles to ensure that people riding electric vehicles were correctly identified. Despite the use of deep learning methods for helmet detection, traditional background subtraction technology is still the main technology for obtaining foreground targets, and its performance is poor in crowded scenes. Khan et al. proposed an algorithm to detect whether a person riding an electric bike is wearing a helmet, but did not involve the detection of electric bikes. Tran et al. used SSD and YOLOv3 algorithms to detect the electric bike area and extracted the upper part of the image for classification to identify helmets and non-helmets. However, this method does not work well when multiple people are on an electric bike. Rohith et al. extracted frames from the video and used the CaffeNet model for object detection. After detecting electric bikes, motorcycles, and people, these bounding boxes were input into the image classifier for helmet classification. Singh et al. used the new target detection models Detectron2 and EfficientDet to detect helmets, improving the detection ability of small targets. Dasgupta et al. proposed a detection framework with two stages: using the YOLOv3 model to detect riders, and then using a CNN-based architecture for helmet detection. Li et al. proposed a new method for dual helmet detection through deep neural networks, first performing a first round of detection on mobile riders, and then using EfficientDet to locate the head and shoulder area. A post-processing strategy was introduced to eliminate duplicate detection and interference caused by pedestrians. Alfonso et al. proposed a multi-network ensemble detection model, first pre-training SSD-MobileNetV2 using the ImageNet dataset, and then input the detected riders into a convolutional network trained with a specific helmet dataset for classification.Li et al. proposed a hierarchical positive sample selection (HPSS) mechanism to improve the fitting ability of YOLOv5 based on the balance between detection model accuracy and speed, and implemented a post-processing algorithm based on frame density to effectively prevent false detection.

[0004] In the current research status of target detection algorithms and the analysis of road safety helmet wearing detection, this application mentions the following existing problems:

[0005] (1) Serious occlusion problem: The head area of ​​the motorcycle driver and passenger may be blocked by the body of the motorcycle, windshield and other parts, which brings challenges to helmet wearing detection. The current algorithm may perform poorly when dealing with occlusion and is prone to misjudgment. In order to avoid missed detection by the algorithm, it is necessary to design a method that can effectively solve the occlusion problem to accurately identify the wearing status of the helmet.

[0006] (2) Complex background problem: In actual scenarios, motorcycle driving may occur in various complex environments, including busy city streets, roads under different lighting conditions, etc. Existing algorithms may be disturbed when dealing with complex backgrounds, resulting in reduced detection performance. Therefore, it is necessary to improve the adaptability of the algorithm to complex scenes to ensure stable operation in various environments.

[0007] (3) Multi-scale problem: The heads of motorcycle drivers and passengers may present different scales at different distances and angles. Existing algorithms have difficulty in dealing with multi-scale changes, resulting in inaccurate detection results. In order to cope with the multi-scale challenge, it is necessary to design an algorithm with good scale adaptability to ensure that the helmet wearing condition can be effectively detected at different distances and angles.

[0008] (4) Insufficient detection accuracy of small targets: There are a large number of small targets in the images and video streams generated by traffic monitoring. There are still deficiencies and inadequacies in the research on traffic safety helmet wearing detection in small target scenarios. By improving the basic model of target detection, the detection accuracy of small targets can be improved, and better detection effects can be achieved in actual scenarios.

[0009] In summary, the existing technology for detecting the wearing of road safety helmets has problems such as severe occlusion, complex background, multi-scale and insufficient detection accuracy of small targets. The applicant has made corresponding explorations to solve these problems. Summary of the invention

[0010] The purpose of the present application is to solve the above-mentioned problems and to provide a road traffic safety helmet wearing detection method, corresponding device, electronic device and computer-readable storage medium.

[0011] In order to meet the various objectives of this application, this application adopts the following technical solutions:

[0012] A road traffic safety helmet wearing detection method proposed to meet one of the purposes of this application includes:

[0013] In response to a road traffic safety helmet wearing detection instruction, an image frame of a traffic intersection to be detected containing a cyclist who is not wearing a helmet is obtained in a road traffic scene;

[0014] The Bottleneck structure in the original C2f module in the backbone network of the preset first helmet wearing detection model is updated to the Star Block module in the StarNet lightweight network, and the CAA attention mechanism module is introduced. The feature fusion network is updated to the generalized feature pyramid module that introduces the DySample module to construct the second helmet wearing detection model.

[0015] The traffic intersection image frame to be detected is input into a second helmet wearing detection model that has been trained to a convergence state, and a plurality of riders who are not wearing helmets in the traffic intersection image frame to be detected are obtained to complete the safety helmet wearing detection for road traffic.

[0016] Optionally, the step of inputting the image frame of the traffic intersection to be detected into a second helmet wearing detection model that has been trained to a convergent state to obtain a plurality of cyclists not wearing helmets in the image frame of the traffic intersection to be detected includes:

[0017] In each Star Block module, the input image features are first processed by a 7×7 first depth separable convolution module, and the processed results are sent to two 1x1 convolution layers in parallel to expand the number of channels to 4 times the original number.

[0018] The first output result of the first 1x1 convolutional layer is activated by the ReLu6 activation function, and then combined with the second output result of the second 1x1 convolutional layer by element-by-element multiplication to determine the third output result;

[0019] Afterwards, the third output result adjusts the number of channels through a 1×1 convolution layer, reducing the number of channels to one quarter to restore the original number of channels, and a 7×7 second depthwise separable convolution module is added again at the end of the Star Block module to perform a second depthwise separable convolution process;

[0020] Performing a residual connection between the feature map after the second depthwise separable convolution and the original input, and finally outputting a high-dimensional image feature corresponding to the image frame of the traffic intersection to be detected;

[0021] The high-dimensional image features are input into a detection head network in a second helmet wearing detection model that has been trained to a convergent state, and a plurality of cyclists who are not wearing helmets in the image frame of the traffic intersection to be detected are obtained.

[0022] Optionally, the CAA attention mechanism module is constructed by an average pooling layer, a 1×1 first convolution layer, a 1×11 third depth-separable convolution module, a 11×1 fourth depth-separable convolution module, a 1×1 second convolution layer and a Sigmoid activation function, wherein the average pooling layer, the first convolution, the third depth-separable convolution module, the fourth depth-separable convolution module, the second convolution layer and the Sigmoid activation function are connected in sequence.

[0023] Optionally, the step of inputting the image frame of the traffic intersection to be detected into a second helmet wearing detection model that has been trained to a convergent state to obtain a plurality of cyclists not wearing helmets in the image frame of the traffic intersection to be detected includes:

[0024] In the generalized feature pyramid module of the DySample module, the feature pyramid network in the generalized feature pyramid module jointly performs multi-scale feature fusion in a bottom-up and top-down manner, wherein the top-down representation uses upsampling to transfer high-level semantic information to low-level semantic information, and the bottom-up representation transfers the lower detail information to the high-level semantic information through lateral connections;

[0025] When the generalized feature pyramid module performs feature fusion, it first extracts features through a convolutional network to obtain feature maps of different scales, and then upsamples and adjusts the scale of the feature map to be consistent with the maximum scale feature map. Then, it passes through the feature fusion module and uses a 1×1 convolution layer to adjust the number of channels. After that, the fused feature map is downsampled, and the above process is repeated until feature fusion is completed for all scale feature maps.

[0026] Optionally, the step of inputting the image frame of the traffic intersection to be detected into a second helmet wearing detection model that has been trained to a convergent state to obtain a plurality of cyclists not wearing helmets in the image frame of the traffic intersection to be detected includes:

[0027] In the DySample module, first, given a feature map X of size C×H1×W1 and a point collection δ of size 2g×H2×W2, wherein the point collection δ contains the position information for resampling the feature map X, a grid sampling function is used to resample the feature map X to a new feature map X of size C×H2×W2 according to the position information of the feature map X in the point sampling set δ. ′ .

[0028] Optionally, in the generalized feature pyramid module, the connection mode of the cross-layer connection is dense connection, and the connection mode of the cross-scale connection is log2n connection, and the expressions thereof include:

[0029] The densely connected expression is expressed as:

[0030]

[0031] The expression of the log2n connection is expressed as:

[0032]

[0033] in, It represents the feature information of the m-th layer feature map at the n-th level; Conv() represents a 3×3 convolution operation; Concat() represents a feature concatenation operation.

[0034] Optionally, the basic network structure of the first helmet wearing detection model is the original YOLOv8 model, and the basic network structure of the second helmet wearing detection model is the improved YOLOv8 model.

[0035] A road traffic safety helmet wearing detection device provided for another purpose of the present application comprises:

[0036] An image frame acquisition module is configured to respond to a safety helmet wearing detection instruction for road traffic, and acquire an image frame of a traffic intersection to be detected in a road traffic scene including a cyclist who is not wearing a helmet;

[0037] A detection model construction module is configured to update the Bottleneck structure in the original C2f module in the backbone network of the preset first helmet wearing detection model to the Star Block module in the StarNet lightweight network, introduce the CAA attention mechanism module, and update the feature fusion network to the generalized feature pyramid module that introduces the DySample module, so as to construct a second helmet wearing detection model;

[0038] The helmet wearing detection module is configured to input the image frame of the traffic intersection to be detected into a second helmet wearing detection model that has been trained to a convergence state, and obtain multiple riders who are not wearing helmets in the image frame of the traffic intersection to be detected, so as to complete the safety helmet wearing detection of road traffic.

[0039] An electronic device provided to meet another purpose of the present application includes a central processing unit and a memory, wherein the central processing unit is used to call and run a computer program stored in the memory to execute the steps of the road traffic safety helmet wearing detection method described in the present application.

[0040] A computer-readable storage medium is provided to meet another purpose of the present application, which stores a computer program implemented according to the road traffic safety helmet wearing detection method in the form of computer-readable instructions. When the computer program is called and executed by a computer, the steps included in the corresponding method are executed.

[0041] Compared with the prior art, the present application aims at the problems of serious occlusion, complex background, multi-scale and insufficient detection accuracy of small targets in the prior art for road safety helmet wearing detection. The present application includes but is not limited to the following beneficial effects:

[0042] First, this application improves the diversity and accuracy of the data set. By collecting images of cyclists in different scenes on urban roads, it covers a variety of factors, such as different locations, weather, traffic density, time periods, and viewing angles, making the data set more diverse and comprehensive. This can effectively deal with complex background and occlusion problems, help the model better adapt to various real-world scenarios, and improve the robustness of detection. In response to the problems existing in the data set, the data set is enhanced through image enhancement operations such as random rotation, horizontal flipping, brightness adjustment, and weather simulation, which effectively increases the number of data samples and enriches background information. The detection ability of the model in different scenarios is significantly improved, reducing the risk of overfitting due to single data.

[0043] Second, this application significantly improves the detection accuracy and model performance of cyclists who are not wearing helmets in traffic scenes. By improving the original YOLOv8 model, adding the Star Block module and CAA attention mechanism in the StarNet lightweight network, the model complexity is reduced while improving the detection ability of small-sized targets. This makes the model more efficient in practical applications, especially in high-density and complex traffic scenes, and can more accurately detect cyclists wearing helmets;

[0044] Third, by introducing the Generalized Feature Pyramid Network (GFPN) with a lightweight dynamic upsampling module (DySample), the information integration of cross-layer fusion and cross-scale features is greatly enhanced, so that the receptive field of the model is expanded, thereby improving the detection ability of multi-scale objects. This enhanced feature fusion capability makes the model more stable in complex scenes and can better identify occluded or small-sized objects.

[0045] Fourthly, the present application optimizes the automation level of road safety helmet wearing detection. The safety helmet wearing detection system of the present application solves the problems of low efficiency and wide coverage area of ​​manual detection. Through the automated image and video detection system, it is possible to monitor cyclists on the road in real time, and promptly detect illegal behaviors of not wearing helmets, greatly improving the efficiency and accuracy of traffic supervision. Through the ROI area adjustment function in the system, it is possible to focus on detecting specific areas in images or videos, avoiding false detections, and flexibly adjusting the detection area according to the characteristics of different road scenes. This enables the system to adapt to changing monitoring environments, improves the applicability and flexibility of the system, and enhances the accuracy of the detection results.

[0046] Fifth, this application not only improves the automation level of traffic management, but also provides a solid technical foundation for the intelligent and digital supervision of road traffic. Through functions such as real-time monitoring and violation record query, it can efficiently carry out traffic safety supervision, reduce manual intervention, and improve the accuracy and real-time nature of supervision.

[0047] The implementation of this system has also laid the foundation for the construction of more intelligent transportation systems in the future, and promoted the development of the transportation industry in a more intelligent and efficient direction.

[0048] Sixth, the helmet wearing detection model of this application greatly reduces overfitting and improves the generalization ability of the model. Through data enhancement and model optimization strategies (such as Starblocks and GFPN), it not only solves the data scarcity and noise problems in the training process, but also enhances the generalization ability of the model. This means that the model can better adapt to different road scenes and changing environmental conditions, thereby improving the detection system in practical applications. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0050] Figure 1 It is a flow chart of a method for detecting the wearing of a safety helmet in road traffic according to an embodiment of the present application;

[0051] Figure 2 An exemplary network structure of a safety helmet wearing detection system for road traffic in an embodiment of the present application;

[0052] Figure 3 This is an exemplary structure of the Star Block module in the embodiment of the present application;

[0053] Figure 4 is an exemplary structure of the CAA attention mechanism module in the embodiment of the present application;

[0054] Figure 5 : is an exemplary structure of a C2f-SC module in an embodiment of the present application;

[0055] Figure 6 is an exemplary structure of a path aggregation network in an embodiment of the present application;

[0056] Figure 7 is an exemplary structure of a generalized feature pyramid module in an embodiment of the present application;

[0057] Figure 8 This is an exemplary structure of the DySample module in the embodiment of the present application;

[0058] Fig. 9 An exemplary network structure of the improved YOLOv8 model in the embodiments of the present application;

[0059] Fig.10 This is a principle block diagram of a safety helmet wearing detection device for road traffic in an embodiment of the present application;

[0060] Fig.11 It is a schematic diagram of the structure of the computer device in the embodiment of the present application. DETAILED DESCRIPTION

[0061] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be interpreted as limiting the present application.

[0062] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present application refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any unit and all combinations of one or more associated listed items.

[0063] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as those generally understood by those skilled in the art to which this application belongs. It should also be understood that terms such as those defined in general dictionaries should be understood to have meanings consistent with those in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless specifically defined as here.

[0064] It will be understood by those skilled in the art that the "client", "terminal" and "terminal device" used herein include both devices with wireless signal receivers, which are devices with only wireless signal receivers without transmission capabilities, and devices with receiving and transmitting hardware, which are devices with receiving and transmitting hardware capable of two-way communication on a two-way communication link. Such devices may include: cellular or other communication devices such as personal computers, tablet computers, which have single-line displays or multi-line displays or cellular or other communication devices without multi-line displays; PCS (Personal Communications Service, personal communication system), which can combine voice, data processing, fax and / or data communication capabilities; PDA (Personal Digital Assistant, personal digital assistant), which may include a radio frequency receiver, pager, Internet / intranet access, web browser, notepad, calendar and / or GPS (Global Positioning System, global positioning system) receiver; conventional laptop and / or palmtop computers or other devices, which have and / or include a conventional laptop and / or palmtop computer or other device with and / or including a radio frequency receiver. The "client", "terminal" and "terminal device" used herein may be portable, transportable, installed in a vehicle (air, sea and / or land), or suitable for and / or configured to run locally, and / or in a distributed form, at any other location on the earth and / or in space. The "client", "terminal" and "terminal device" used herein may also be a communication terminal, an Internet terminal, a music / video playing terminal, for example, a PDA, a MID (Mobile Internet Device) and / or a mobile phone with a music / video playing function, or a smart TV, a set-top box and other devices.

[0065] The hardware referred to by the names such as "server", "client", and "service node" in this application is essentially an electronic device with the equivalent capabilities of a personal computer. It is a hardware device with the necessary components revealed by the von Neumann principle, such as a central processing unit (including an arithmetic unit and a controller), a memory, an input device, and an output device. The computer program is stored in its memory, and the central processing unit calls the program stored in the external memory into the internal memory for execution, executes the instructions in the program, and interacts with the input and output devices to complete specific functions.

[0066] It should be pointed out that the concept of "server" referred to in this application can also be extended to the case of server clusters. According to the network deployment principle understood by those skilled in the art, the servers should be logically divided. In physical space, these servers can be independent of each other but can be called through interfaces, or integrated into a physical computer or a set of computer clusters. Those skilled in the art should understand this flexibility, and should not use it to restrict the implementation of the network deployment method of this application.

[0067] Unless expressly specified, one or more technical features of the present application can be deployed on a server for implementation and accessed by a client through a remote call to obtain an online service interface provided by the server, or can be directly deployed and run on a client for access.

[0068] The neural network models referenced or may be referenced in this application, unless expressly specified, can be deployed on a remote server and remotely called on the client, or can be deployed and directly called on a client with sufficient device capabilities. In some embodiments, when it runs on the client, its corresponding intelligence can be obtained through transfer learning to reduce the requirements for the client's hardware operating resources and avoid excessive occupation of the client's hardware operating resources.

[0069] Unless explicitly specified, the various data involved in this application can be stored remotely on a server or on a local terminal device, as long as it is suitable for being called by the technical solution of this application.

[0070] Those skilled in the art should be aware that, although the various methods of the present application are described based on the same concept and thus present commonality to each other, unless otherwise specified, these methods can be independently executed. Similarly, for each embodiment disclosed in the present application, they are all proposed based on the same inventive concept, therefore, concepts with the same expression, and concepts that are appropriately changed for convenience despite different expressions, should be understood as equivalent.

[0071] Unless the mutually exclusive relationship between the embodiments to be disclosed in this application is explicitly stated, the relevant technical features involved in each embodiment can be cross-combined to flexibly construct a new embodiment, as long as such combination does not deviate from the creative spirit of this application and can meet the needs of the prior art or solve certain deficiencies in the prior art. Those skilled in the art should be aware of this flexibility.

[0072] See also Figure 1 In one embodiment, the road traffic safety helmet wearing detection method of the present application includes:

[0073] Step S10, responding to a road traffic safety helmet wearing detection instruction, obtaining an image frame of a traffic intersection to be detected in a road traffic scene including a cyclist who is not wearing a helmet;

[0074] The road traffic safety helmet wearing detection system in the terminal device can respond to the road traffic safety helmet wearing detection instruction and obtain the image frame of the traffic intersection to be detected in the road traffic scene including the cyclist who is not wearing a helmet;

[0075] In some embodiments, for the construction of the traffic intersection image frame dataset including cyclists without helmets, data collection can be performed in various scenarios such as different locations, different light intensities, different weather, and different time periods, so as to construct a high-quality road safety helmet dataset.

[0076] A total of more than 2,000 images of cyclists can be collected, and a series of image enhancement methods are used to enhance the original images of the dataset and perform data augmentation. These methods effectively expand the dataset and increase the diversity of dataset samples.

[0077] To ensure that the training data maintains a high degree of similarity with the actual road monitoring scene application data, the original images in the safety helmet wearing detection data set are collected by the camera at three different positions and angles, namely, 1.5 meters high and parallel to the road, 3.5 meters high and tilted from top to bottom on the overpass, and 5 meters high and tilted from top to bottom on the overpass. The following factors were mainly considered in the collection and screening of the safety helmet data set:

[0078] First, light intensity: For the same scene, the background under different light intensities will be quite different, and the image features presented will also be different.

[0079] Second, the collection location: Because many road environments in cities are different, taking images at multiple collection locations can increase the diversity of data set samples. The data set of this application collects images at multiple locations, and the number of samples taken at each collection location is roughly the same.

[0080] Third, weather: the foreground and background of the dataset images collected under different weather conditions have certain differences in light, shadow and color. Therefore, considering the impact of real weather on the safety helmet detection task, this application collects images of cyclists wearing safety helmets in scenes such as rain, snow, cloudy, overcast and sunny.

[0081] Fourth, nighttime environment: The natural environment during the day and at night is quite different, and the features of the foreground and background in the images collected at night are different from those during the day. Considering that road video surveillance not only has different scene differences such as different weather, different locations, and different lighting, but also needs to consider the nighttime environment, we collected images of cyclists wearing safety helmets in the nighttime road environment in the city.

[0082] In a further embodiment, image enhancement is performed on a data set of image frames of traffic intersections collected and including cyclists who are not wearing helmets. Effective image enhancement of the data set can not only expand the number of training samples, but also increase the diversity of training samples. On the one hand, it can avoid model overfitting, and on the other hand, it can bring about a significant improvement in performance. In terms of image enhancement, image enhancement operations are performed by setting reasonable geometric changes and brightness changes. Geometric change operations mainly include image rotation, mirror flipping, random extraction, scale transformation, etc.; brightness change operations mainly include color jittering, image brightness adjustment, contrast enhancement, and image grayscale.

[0083] In this embodiment, the samples for image enhancement are selected from some images in the collected safety helmet wearing detection data set, and the image enhancement methods used include rotation, flipping, random extraction, and color jitter. The rotation is generally to rotate the image clockwise or counterclockwise by 30 degrees, 60 degrees, 90 degrees, 180 degrees, etc. Considering the actual application scenario, a clockwise rotation of 30 degrees is selected to fine-tune the original image, and the rotated image is added as an expanded sample to the safety helmet wearing detection data set. The flipping is similar to the rotation, and both are to change the image by changing the image position spatial information. The flipping mainly includes vertical flipping, horizontal flipping, horizontal vertical flipping and other operations. The safety helmet wearing detection data set uses horizontal flipping for data enhancement. The random extraction is generally to extract image blocks at random positions on the original image with a larger square or rectangle. The number of random extractions of each image determines the multiple of the data set expansion. In addition, because the input image of the target detection algorithm model is usually a square image, the random extraction here uses a square for image extraction, which can effectively avoid the resolution distortion problem caused by the subsequent image stretching operation of rectangular extraction. The color jittering is a commonly used data enhancement and expansion method that uses color jittering operations on dataset images. Color jittering is to add a random perturbation factor to the RGB color distribution of a color image, and then randomly adjust the contrast, brightness, and saturation of the original image to generate a new image. The color-perturbed image has a certain difference in color from the original image, so that the target detection model has a certain adaptability to foreground and background features of different saturation and brightness, and increases the robustness of the model.

[0084] In a further embodiment, the data set is labeled and divided. First, the collected images are cleaned to remove duplicate images, images with unclear focus, and images without detection objects. Manually photographed electric bike riders are at different distances and sizes in the image. If the target area occupied by the image is too small, it is more difficult to mark small targets such as safety helmets, and such photos are also removed. Pre-classify the images by different weather, different light levels, and different locations to prepare for the subsequent construction of different data sets. Secondly, the samples of the safety helmet wearing detection data set are labeled by category, which mainly includes the following situations:

[0085] (1) Electric vehicles, motorcycles and their riders are considered as a whole and are labeled as electeicbicycle;

[0086] (2) The heads of riders who are not wearing helmets are labeled as head classes, without distinguishing between electric vehicles, motorcycles, and bicycles;

[0087] (3) Label the head of the rider wearing a safety helmet as the helmet class. Use the labelimg annotation tool to label the targets that meet the requirements in the image according to the above annotation rules. labelimg can automatically generate the corresponding xml configuration file for the labeled targets. Finally, perform the data set format conversion and convert the VOC format XML file into a txt file using a script. Finally, divide the image data into training set, validation set, and test set in a ratio of 7:2:1.

[0088] In some embodiments, see Figure 2 The module design of the road traffic safety helmet wearing detection system includes:

[0089] The safety helmet wearing detection system determines the safety helmet wearing status of riders through real-time detection and analysis of road monitoring video streams, and then displays the recognition results on the front-end page. This system mainly includes functions such as video / image acquisition, safety helmet wearing detection, violation record, ROI detection area adjustment, and violation record query.

[0090] (1) Video / Picture Acquisition Module: The video / picture acquisition module connects the road monitoring camera to the system and transmits the collected video / picture to the server safety helmet wearing detection module in real time.

[0091] (2) Safety helmet wearing detection module: The safety helmet wearing detection module transmits the road monitoring video stream to the optimized safety helmet wearing detection model proposed in this application, and the model automatically identifies the safety helmet wearing status.

[0092] (3) A violation recording module, which records the violation in the surveillance video in real time (the rider does not wear a safety helmet) and saves the frame image of the rider.

[0093] (4) ROI detection area adjustment module: The ROI detection area adjustment module controls the specific area that needs to be detected in the system by adjusting the coordinate parameters of the ROI region of interest in the video / image. This operation can effectively prevent false detection.

[0094] (5) Violation record query module: The violation record query module can view the original image query of the violation behavior and the image marked by the detection algorithm.

[0095] (6) User management module: The user management module is only open to super administrators. Due to the particularity of the road safety helmet detection system, there are extremely high requirements for system security, and administrator accounts must be issued with caution. Therefore, the system does not open the registration interface to the public, but the super account adds an administrator account in the user management module to achieve security management.

[0096] (7) Safety helmet wearing detection module: The safety helmet wearing detection module is the main functional module in this system. Its main working process is as follows: the road scene monitoring video is transmitted to the server where the algorithm model is located. The algorithm model in the server analyzes and judges the video stream. If there is any violation, the original image and the annotated image are recorded.

[0097] In some embodiments, the technical architecture of the safety helmet wearing detection system of the present application mainly includes five parts: presentation layer, communication layer, service layer, computing layer and data layer. The main function of the presentation layer is to display the information returned by the algorithm and the backend system in the service layer on the page. The detection system page structure is built through HTML, JavaScript and Vue technology stack, and CSS is responsible for style rendering of the detection system page. The communication layer adopts HTTP (Hypertext Transfer Protocol) technology, the purpose is to build a "bridge" for the presentation layer and the service layer, and establish an information transmission connection. The process is as follows: the front end establishes a connection with the back-end service layer, and then the front-end page sends a request through HTTP, and the back-end server accepts the request and returns relevant information; the service layer is the core layer of the safety helmet wearing detection system, based on the optimization algorithm of the present application and the back-end Flask framework, to complete the safety helmet wearing detection task, and then send the detection results to the front-end page; the data layer adopts MySql database to record the detection results, violation information, and user information.

[0098] The safety helmet wearing detection system of the present application comprises:

[0099] (1) System login page: On the system login page, supervisors can enter the road safety helmet detection system by entering the correct account and password. If the account and password do not match, they will be prompted to re-enter the correct account and password and will not be able to enter the system. Setting up a login verification page can not only distinguish the authority information of super administrators and ordinary administrators by the logged-in account, but also prevent the domain name of the road safety helmet detection system from being leaked, thereby preventing unauthorized personnel from logging into the system and improving the security of the system.

[0100] (2) System homepage: On the left side of the system page is the navigation bar of the safety helmet wearing detection system, which includes the homepage, picture detection, video detection, user management and other five pages. Click to jump to the corresponding page. The function of the homepage is mainly to visualize the road safety helmet detection data collected by the system background. Through the accumulation of detection results, line graphs, bar graphs and pie charts, it is convenient for administrators to intuitively and clearly understand the wearing of helmets by electric bike riders on the road.

[0101] (3) Image detection page: On the image detection page, the administrator can click the upload button to send the local image to the system backend, where it will be detected by the road safety helmet detection model. After the detection is completed, a prompt message will be displayed in the upper right corner of the page. The backend will then return the result and display it in the detection information column. The image of the violator will be captured and saved in a local folder for later manual review. The original image and the image after detection and annotation are displayed in the original image area and the detection result area respectively. Clicking on the image can enlarge the image for easy viewing by the administrator. The detection information column receives three types of detection result information from the system backend: target classification information, target size, and confidence, and displays them in a table.

[0102] (4) Video detection page: In the video detection page, the administrator can upload the road surveillance video to the system background, and the road safety helmet detection model will detect the video frame by frame. The background will continuously return the recognition results to the front-end page and display them in the detection information column. The violators in each frame will be captured and saved to a local folder for later manual review. The detection result display area receives the video of the marked target after the background recognition and displays it, so that the administrator can view the recognition effect; the detection information column continuously receives three types of detection result information from the system background: target classification information, target size and confidence, and displays them in real time in a table so that the administrator can know the helmet wearing situation of electric vehicle riders.

[0103] (5) User management page: Due to the particularity of the road safety helmet detection system and the extremely high requirements for system security, this system does not set a registration option on the login page. Only super administrators can add accounts to the user management page to add new management users. Therefore, the user management page is only visible to super administrators. When logging in with a normal account, the system does not provide navigation to the user management page to improve the security of the system. Super administrators can add, search, delete, and modify accounts on the user management page.

[0104] Step S20, updating the Bottleneck structure in the original C2f module in the backbone network of the preset first helmet wearing detection model to the Star Block module in the StarNet lightweight network, introducing the CAA attention mechanism module, and updating the feature fusion network to the generalized feature pyramid module introducing the DySample module, so as to construct a second helmet wearing detection model;

[0105] The Bottleneck structure in the original C2f module in the backbone network of the preset first helmet wearing detection model is updated to the Star Block module in the StarNet lightweight network, and the CAA attention mechanism module is introduced, and the feature fusion network is updated to the generalized feature pyramid module introducing the DySample module to construct the second helmet wearing detection model; wherein, the basic network structure of the first helmet wearing detection model is the original YOLOv8 model, and the basic network structure of the second helmet wearing detection model is the improved YOLOv8 model.

[0106] In some embodiments, YOLOv8 was proposed by Redmon et al. in 2023. YOLOv8 continues the fast and efficient detection characteristics of the YOLO series, and has made many improvements in network structure and detection performance, effectively improving the detection accuracy and speed, and is widely used in the field of target detection. The YOLOv8 network structure is mainly composed of a backbone network part, a feature fusion network part and a detection head part. The backbone network part includes a convolution module, a C2f module and an SPPF module to realize partial feature extraction. The convolution module includes a convolution layer, a batch normalization layer and a SiLU activation function to improve the model feature extraction capability. The C2f module contains Split and Bottleneck layers, which effectively reduce the amount of calculation while capturing global features and fusing multi-scale information. The SPPF module performs pooling and convolution operations on different scales, splicing feature maps of different scales to improve the detection capability of targets of different sizes. The feature fusion network part uses PAN and FPN to achieve feature fusion at different levels to improve the detection capability of targets of different scales. The detection head part adopts a decoupled type, including a classification head and a detection head, to achieve detection and classification of the target.

[0107] YOLOv8 adopts an adaptive anchor frame mechanism, which is highly flexible and helps to improve detection accuracy. At the same time, YOLOv8 adopts an improved loss function, including classification loss, positioning loss and confidence loss, and weighted combination of these functions to ensure the balance between model detection accuracy and running speed. Based on the above advantages, the original YOLOv8 model is used as the benchmark model, which is the first helmet wearing detection model of this application. The network of the YOLO series model often adopts a combination of linear projection and nonlinear activation functions. In order to improve the feature extraction ability of the model, a self-attention mechanism module based on this combination is often introduced. It constructs an attention matrix by dot product multiplication. The computational complexity will increase significantly with the improvement of feature extraction ability, reducing the model efficiency. In order to solve this problem, researchers have proposed star operations in recent years. This operation has shown good performance and efficiency in natural language processing, computer vision and other fields, and has been gradually introduced into lightweight network structures. The StarNet lightweight network of this application adopts a model based on star operations, which ensures low model complexity while significantly improving the model's ability to map inputs to high-dimensional feature spaces, thereby improving the model's feature extraction ability. The star operation fuses the features of two linear transformations through element-by-element multiplication. The calculation formula is as follows:

[0108]

[0109] Where: star represents the result after the star operation; W is the weight matrix of the linear layer; B is the bias of the linear layer; X is the input; * represents the star operation.

[0110] In some embodiments, the StarNet lightweight network of the present application adopts a four-level hierarchical structure, each level uses a convolutional layer for downsampling, and uses a Star Block module for feature extraction. In each Star Block module, the first deep separable convolution (DWConv) module is first used to realize preliminary feature extraction, and then batch normalization is performed on it to obtain two feature maps with doubled width and channel expansion factor of 4. After the ReLU activation function, it is input to the second deep separable convolution (DWConv) module to realize further feature extraction and obtain the output feature map. Compared with traditional convolution, deep separable convolution (DWConv) divides the convolution operation into two steps: convolution operation on each channel of the input data and element-by-element addition of the results of these channels to obtain the output, which can effectively reduce the number of parameters and calculations, and further improve the training and reasoning process of the model.

[0111] In some embodiments, the present application introduces the StarNet lightweight network to optimize the backbone network of the original YOLOv8 model. However, the overall structure of StarNet is relatively cumbersome, and direct reference will cause the model structure to be bloated, which is not conducive to the lightweight model. Therefore, the model of the present application only introduces the Star Block module in the StarNet lightweight network, replaces the Bottleneck structure in the original C2f module of the backbone network of the original YOLOv8 model with the Star Block structure in the StarNet lightweight network, and integrates the CAA attention mechanism to form a C2f-SC module.

[0112] Specifically, see Figure 3 , Figure 3 The exemplary structure of the Star Block module is that the Bottleneck structure in the original C2f module in the backbone network of the preset first helmet wearing detection model is updated to the Star Block module in the StarNet lightweight network, and the CAA attention mechanism module is introduced. The present application integrates the StarBlock module and the CAA attention mechanism in the StarNet lightweight network to form a Star-CAA module, and integrates the design of the Star-CAA module into the C2f module in the original YOLOv8 model, wherein the Bottleneck structure in the original C2f module in the backbone network of the original YOLOv8 model is updated to be replaced by the Star-CAA module, and finally forms a C2f-SC module.

[0113] For each Star Block module, a 7×7 depth-separable convolution is first used to reduce the number of parameters of ordinary convolutions at the same level and simplify the calculation model. Then two 1×1 convolutions are used to increase the dimension, and one of the results is activated by the ReLU6 function to incorporate nonlinear factors, and then multiplied by the other result; then a 1×1 convolution is used to reduce the dimension, thus completing the important dimensionality increase and reduction operations on the input feature map. Then a 7×7 depth-separable convolution is used to increase the network depth, and the feature map formed at the end forms a residual network with the input to improve the model's expressiveness and training stability.

[0114] For further examples, see Figure 4 , Figure 4The exemplary structure of the CAA attention mechanism module is constructed by an average pooling layer, a 1×1 first convolution layer, a 1×11 third depth separable convolution module, a 11×1 fourth depth separable convolution module, a 1×1 second convolution layer and a Sigmoid activation function, wherein the average pooling layer, the first convolution, the third depth separable convolution module, the fourth depth separable convolution module, the second convolution layer and the Sigmoid activation function are connected in sequence. For the input of the CAA attention mechanism module, firstly, an average pooling layer and a 1×1 first convolution layer are passed to obtain local area features; then, a 1×11 third depth separable convolution module and a 11×1 fourth depth separable convolution module are selected to promote feature recognition and extraction of slender objects while reducing parameters, then a 1×1 second convolution layer is passed to integrate features, and finally, a Sigmoid activation function is passed to generate contextual attention features.

[0115] From the above embodiments, it can be seen that Figure 5 , Figure 5 This is an exemplary structure of the C2f-SC module. The C2f-SC module constructed in this application effectively improves the input mapping feature dimension, improves the model's ability to extract features, and thus effectively improves the model's target detection accuracy. At the same time, the StarBlock module structure in the StarNet lightweight network has a small number of parameters, which effectively reduces the number of parameters of the C2f module in the original YOLOv8 model, thereby effectively reducing the number of parameters of the YOLOv8 model, improving the model's calculation speed, and improving the detection accuracy of small targets such as safety helmets.

[0116] For further examples, see Figure 6 and Figure 7 ,in, Figure 6 is an exemplary structure of a path aggregation network, Figure 7This is an exemplary structure of a generalized feature pyramid module. In order to improve the accuracy of multi-scale road safety helmet target recognition and target recognition accuracy of complex scene algorithms, the feature fusion network is updated to a generalized feature pyramid module that introduces the DySample module. This application proposes a generalized feature pyramid (GFPN) module based on the path aggregation network (PANet), which increases cross-layer connections and cross-scale connections between adjacent layers, and improves the utilization efficiency of multi-scale feature maps. Through multi-layer upsampling, downsampling and splicing operations, efficient fusion of multi-scale features is achieved, and high-level semantic information and low-level spatial information are combined layer by layer, so that the network can extract and integrate feature information at different resolutions. The generalized feature pyramid (GFPN) module not only enhances the expressiveness of features, but also retains the detailed information and semantic context of feature maps, and establishes long-distance dependencies of the network.

[0117] In a further embodiment, in the generalized feature pyramid module, the connection mode of the cross-layer connection is dense connection, and the connection mode of the cross-scale connection is log2n connection, and the expressions thereof include:

[0118] The densely connected expression is expressed as:

[0119]

[0120] The expression of the log2n connection is expressed as:

[0121]

[0122] in, Represents the feature information of the m-th layer feature map at level n; Conv() represents a 3×3 convolution operation; Concat() represents a feature concatenation operation, i-2 k Greater than or equal to 0.

[0123] In a further embodiment, the feature pyramid network of the generalized feature pyramid (GFPN) module performs multi-scale feature fusion in a bottom-up and top-down manner. Upsampling is used from top to bottom to transfer high-level semantic information to the lower layer, and from bottom to top, the detail information below is transferred to the upper layer through lateral connections, so that the global information and detail information complement each other and complete the information transfer between models. When GFPN performs feature fusion, it first extracts features through a convolutional network to obtain feature maps of different scales, and upsampling adjusts the scale of the feature map to be consistent with the maximum scale feature map, and then passes through the feature fusion module, uses a 1*1 size convolutional layer to adjust the number of channels, and then downsamples the fused feature map, and repeats the above process until all scale feature maps complete feature fusion.

[0124] In addition, in the feature fusion network, the DySample module (dynamic upsampling module) is introduced on the basis of the generalized feature pyramid (GFPN) module. By designing the upsampling process from the perspective of point sampling, this method not only significantly enhances the model's immunity to noise, but also has fewer parameters and higher computing resource utilization efficiency compared to the kernel-based dynamic upsampling module. The DySample module uses a grouped upsampling technique to divide the feature map into multiple groups and independently generate offsets for each group, effectively reducing interference between features. In addition, by introducing static and dynamic offset range factors, the offset range is effectively controlled to avoid overlap between sampling points, so that the DySample module can accurately perform upsampling operations, thereby significantly improving the performance of the model.

[0125] For further examples, see Figure 8 , Figure 8 is an exemplary structure of the DySample module, and the workflow of upsampling of the DySample module includes: in the DySample module, first, given a feature map X of size C×H1×W1 and a point collection δ of 2g×H2×W2, wherein the point collection δ contains the position information for resampling the feature map X, a grid sampling function (grid_sample) is used to resample the feature map X to a new feature map X′ of size C×H2×W2 according to the position information of the feature map X in the point sampling set δ, and the expression is expressed as:

[0126] χ′=grid_sample(χ, δ).

[0127] Finally, see Fig. 9 , Fig. 9 This is an exemplary network structure of an improved YOLOv8 model. The Star Block module in the StarNet lightweight network and the CAA attention mechanism are integrated to form a Star-CAA to form a C2f-SC module. The GFPN and DySample modules (dynamic upsampling modules) are introduced into the feature fusion network in the original YOLOv8 model. Finally, an improved YOLOv8 model is constructed, which is the second helmet wearing detection model of the present application, and can be named a YOLO-SCGD model.

[0128] Step S30: input the traffic intersection image frame to be detected into a second helmet wearing detection model that has been trained to a convergence state, and obtain multiple riders who are not wearing helmets in the traffic intersection image frame to be detected, so as to complete the safety helmet wearing detection of road traffic.

[0129] The Bottleneck structure in the original C2f module in the backbone network of the preset first helmet wearing detection model is updated to the Star Block module in the StarNet lightweight network, and the CAA attention mechanism module is introduced. The feature fusion network is updated to the generalized feature pyramid module that introduces the DySample module to construct the second helmet wearing detection model. Then, the image frame of the traffic intersection to be detected is input into the second helmet wearing detection model that has been trained to a convergent state, and multiple cyclists who are not wearing helmets in the image frame of the traffic intersection to be detected are obtained to complete the safety helmet wearing detection of road traffic.

[0130] In some embodiments, the step of inputting the traffic intersection image frame to be detected into a second helmet wearing detection model that has been trained to a convergent state, and obtaining a plurality of cyclists not wearing helmets in the traffic intersection image frame to be detected includes:

[0131] Step S301: In each Star Block module, the input image features are first processed by a 7×7 first depth-separable convolution module, and the processed results are sent to two 1x1 convolution layers in parallel to expand the number of channels to 4 times the original number.

[0132] Step S302: After being activated by the ReLu6 activation function, the first output result of the first 1x1 convolutional layer is combined with the second output result of the second 1x1 convolutional layer by element-by-element multiplication to determine a third output result;

[0133] Step S303: After that, the third output result adjusts the number of channels through a 1×1 convolution layer, reducing the number of channels to one quarter to restore the original number of channels, and a 7×7 second depthwise separable convolution module is added again at the end of the Star Block module to perform a second depthwise separable convolution process;

[0134] Step S304, performing a residual connection between the feature map after the second depthwise separable convolution processing and the original input, and finally outputting a high-dimensional image feature corresponding to the image frame of the traffic intersection to be detected;

[0135] Step S305: input the high-dimensional image features into the detection head network in the second helmet wearing detection model that has been trained to a convergent state, and obtain multiple cyclists who are not wearing helmets in the image frame of the traffic intersection to be detected.

[0136] In some embodiments, the step of inputting the image frame of the traffic intersection to be detected into a second helmet wearing detection model that has been trained to a convergent state, and obtaining a plurality of cyclists not wearing helmets in the image frame of the traffic intersection to be detected includes:

[0137] Step S3001, in the generalized feature pyramid module of the DySample module, the feature pyramid network in the generalized feature pyramid module jointly performs multi-scale feature fusion in a bottom-up and top-down manner, wherein the top-down representation uses upsampling to transfer high-level semantic information to low-level semantic information, and the bottom-up representation transfers the lower detail information to the high-level semantic information through lateral connections;

[0138] Step S3003, when the generalized feature pyramid module performs feature fusion, it first performs feature extraction through a convolutional network to obtain feature maps of different scales, and upsamples the feature map scale to be consistent with the maximum scale feature map, and then passes through the feature fusion module, uses a 1×1 convolution layer to adjust the number of channels, and then downsamples the fused feature map, and repeats the above process until all scale feature maps complete feature fusion.

[0139] In some embodiments, the step of inputting the image frame of the traffic intersection to be detected into a second helmet wearing detection model that has been trained to a convergent state, and obtaining a plurality of cyclists not wearing helmets in the image frame of the traffic intersection to be detected includes:

[0140] In the DySample module, first, given a feature map X of size C×H1×W1 and a point collection δ of size 2g×H2×W2, wherein the point collection δ contains the position information for resampling the feature map X, a grid sampling function is used to resample the feature map X to a new feature map X of size C×H2×W2 according to the position information of the feature map X in the point sampling set δ. ′ .

[0141] In some embodiments, please refer to Table 1, which is a comparison table of mainstream algorithm evaluation indicators on the data set. In order to compare the detection performance of the YOLO-SCGD algorithm of this application with the mainstream deep learning algorithm on this data set, a comparative experiment was conducted again. The experiment follows the principle of controlling variables, the experimental hardware and software environment remains unchanged, and the evaluation indicators use accuracy, recall, mAP50, mAP50-90, parameter amount, calculation amount, and frame rate. In order to test the memory usage after training different models, the model size (Modelsize) indicator is increased. The experimental results are shown in Table X. It can be seen from the experimental results that for road safety helmet detection, the YOLO series of algorithms is better than FasterR-CNN as a whole, and it is better than FasterR-CNN, SSD and other two-stage target detection algorithms in terms of calculation amount and accuracy. The algorithm with the highest detection accuracy in the YOLO series of algorithms is the algorithm proposed in this application, and its mAP50 and mAP50-90 accuracy indicators are better than other algorithms. Compared with the yolov8s algorithm, which is ranked second in accuracy index, the algorithm proposed in this application also increases by 1.2% and 1.6% respectively. While improving the accuracy, the number of parameters and the amount of calculation are reduced by 693.% and 69.6% respectively compared with yolov8s. In summary, the algorithm proposed in this application has great advantages over other mainstream algorithms. While improving the detection accuracy, it reduces the number of parameters and the amount of calculation. At the same time, the model occupies less storage and requires less resources on the deployment platform. It is suitable for embedded deployment and meets practical use.

[0142] Table 1 Comparison of evaluation indicators of mainstream algorithms on the dataset

[0143]

[0144] Please refer to Table 2, which is a comparison table of ablation experiment data on the dataset. In order to verify the optimization effect of each improved module on the YOLOv8 algorithm, training and testing are performed on the constructed road traffic dataset. The experiment follows the control variable method, and the experimental results are shown in Table 2. In Table 2, √ represents the mixed corresponding improvement in the original YOLOv8 network. Compared with the original YOLOv8 algorithm, only after optimizing the convolution layer, the amount of calculation and the amount of parameters are slightly reduced, and the accuracy is greatly improved by 4%. Other evaluation indicators such as recall rate, mAP50, and mAP50-90 are slightly improved; only after adding the CAA attention mechanism, its accuracy is significantly improved by 3%, but other evaluation indicators have no obvious changes; when optimizing the convolution layer and adding the CAA attention mechanism at the same time, its accuracy, recall rate, and mAP50-90 are significantly improved by 4%, 10%, and 2.5%. After optimizing the convolutional layers, adding the CAA attention mechanism, feature fusion, and optimized upsampling, its accuracy, recall, mAP50, and mAP50-90 increased by 4%, 3%, 1.5%, and 3%, respectively, which is significantly better than the original algorithm.

[0145] Table 2. Comparison of ablation experiment data on the dataset

[0146]

[0147] It can be seen from the above embodiments that, compared with the prior art, the present application aims at the problems of serious occlusion, complex background, multi-scale and insufficient detection accuracy of small targets in the prior art for road safety helmet wearing detection. The present application includes but is not limited to the following beneficial effects:

[0148] First, this application improves the diversity and accuracy of the data set. By collecting images of cyclists in different scenes on urban roads, it covers a variety of factors, such as different locations, weather, traffic density, time periods, and viewing angles, making the data set more diverse and comprehensive. This can effectively deal with complex background and occlusion problems, help the model better adapt to various real-world scenarios, and improve the robustness of detection. In response to the problems existing in the data set, the data set is enhanced through image enhancement operations such as random rotation, horizontal flipping, brightness adjustment, and weather simulation, which effectively increases the number of data samples and enriches background information. The detection ability of the model in different scenarios is significantly improved, reducing the risk of overfitting due to single data.

[0149] Second, this application significantly improves the detection accuracy and model performance of cyclists who are not wearing helmets in traffic scenes. By improving the original YOLOv8 model, adding the Star Block module and CAA attention mechanism in the StarNet lightweight network, the model complexity is reduced while improving the detection ability of small-sized targets. This makes the model more efficient in practical applications, especially in high-density and complex traffic scenes, and can more accurately detect cyclists wearing helmets;

[0150] Third, by introducing the Generalized Feature Pyramid Network (GFPN) with a lightweight dynamic upsampling module (DySample), the information integration of cross-layer fusion and cross-scale features is greatly enhanced, so that the receptive field of the model is expanded, thereby improving the detection ability of multi-scale objects. This enhanced feature fusion capability makes the model more stable in complex scenes and can better identify occluded or small-sized objects.

[0151] Fourthly, the present application optimizes the automation level of road safety helmet wearing detection. The safety helmet wearing detection system of the present application solves the problems of low efficiency and wide coverage area of ​​manual detection. Through the automated image and video detection system, it is possible to monitor cyclists on the road in real time, and promptly detect illegal behaviors of not wearing helmets, greatly improving the efficiency and accuracy of traffic supervision. Through the ROI area adjustment function in the system, it is possible to focus on detecting specific areas in images or videos, avoiding false detections, and flexibly adjusting the detection area according to the characteristics of different road scenes. This enables the system to adapt to changing monitoring environments, improves the applicability and flexibility of the system, and enhances the accuracy of the detection results.

[0152] Fifth, this application not only improves the level of automation of traffic management, but also provides a solid technical foundation for the intelligent and digital supervision of road traffic. Through functions such as real-time monitoring and violation record query, it can efficiently supervise traffic safety, reduce manual intervention, and improve the accuracy and real-time nature of supervision. The implementation of this system also lays the foundation for the construction of more intelligent transportation systems in the future, and promotes the development of the transportation industry in a more intelligent and efficient direction.

[0153] Sixth, the helmet wearing detection model of this application greatly reduces overfitting and improves the generalization ability of the model. Through data enhancement and model optimization strategies (such as Starblocks and GFPN), it not only solves the data scarcity and noise problems in the training process, but also enhances the generalization ability of the model. This means that the model can better adapt to different road scenes and changing environmental conditions, thereby improving the detection system in practical applications.

[0154] See also Fig.10, a safety helmet wearing detection device for road traffic provided to meet one of the purposes of the present application, includes an image frame acquisition module 1100, a detection model construction module 1200, and a helmet wearing detection module 1300. Among them, the image frame acquisition module 1100 is configured to respond to the safety helmet wearing detection instruction of road traffic, and obtain the image frame of the traffic intersection to be detected in the road traffic scene containing the cyclist who is not wearing a helmet; the detection model construction module 1200 is configured to update the Bottleneck structure in the original C2f module in the backbone network of the preset first helmet wearing detection model to the Star Block module in the StarNet lightweight network, and introduce the CAA attention mechanism module, and update the feature fusion network to the generalized feature pyramid module that introduces the DySample module to construct a second helmet wearing detection model; the helmet wearing detection module 1300 is configured to input the image frame of the traffic intersection to be detected into the second helmet wearing detection model that has been trained to a convergent state, and obtain multiple cyclists who are not wearing helmets in the image frame of the traffic intersection to be detected, so as to complete the safety helmet wearing detection of road traffic.

[0155] Based on any embodiment of this application, please refer to Fig.11 Another embodiment of the present application further provides an electronic device, which can be implemented by a computer device, such as Fig.11 As shown, a schematic diagram of the internal structure of a computer device. The computer device includes a processor, a computer-readable storage medium, a memory, and a network interface connected via a system bus. Among them, the computer-readable storage medium of the computer device stores an operating system, a database, and computer-readable instructions. The database may store a control information sequence. When the computer-readable instructions are executed by the processor, the processor can implement a road traffic safety helmet wearing detection method. The processor of the computer device is used to provide computing and control capabilities to support the operation of the entire computer device. The memory of the computer device may store computer-readable instructions. When the computer-readable instructions are executed by the processor, the processor can execute the road traffic safety helmet wearing detection method of the present application. The network interface of the computer device is used to connect and communicate with a terminal. Those skilled in the art will understand that Fig.11 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0156] In this embodiment, the processor is used to execute Fig.10The memory stores the program code and various data required to execute the above modules or submodules. The network interface is used to transmit data between user terminals or servers. The memory in this embodiment stores the program code and data required to execute all modules in the road traffic safety helmet wearing detection device of the present application, and the server can call the program code and data of the server to execute the functions of all modules.

[0157] The present application also provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the road traffic safety helmet wearing detection method described in any embodiment of the present application.

[0158] The present application also provides a computer program product, including a computer program / instruction, which, when executed by one or more processors, implements the steps of the road traffic safety helmet wearing detection method described in any embodiment of the present application.

[0159] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments of the present application can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a computer-readable storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0160] The above description is only a partial implementation method of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for detecting the wearing of a safety helmet in road traffic, characterized in that: include: In response to a road traffic safety helmet wearing detection instruction, an image frame of a traffic intersection to be detected containing a cyclist who is not wearing a helmet is obtained in a road traffic scene; The Bottleneck structure in the original C2f module in the backbone network of the preset first helmet wearing detection model is updated to the Star Block module in the StarNet lightweight network, and the CAA attention mechanism module is introduced. The feature fusion network is updated to the generalized feature pyramid module that introduces the DySample module to construct the second helmet wearing detection model. The traffic intersection image frame to be detected is input into a second helmet wearing detection model that has been trained to a convergence state, and a plurality of riders who are not wearing helmets in the traffic intersection image frame to be detected are obtained to complete the safety helmet wearing detection for road traffic.

2. The method for detecting the wearing of a safety helmet for road traffic according to claim 1, characterized in that: The step of inputting the traffic intersection image frame to be detected into a second helmet wearing detection model that has been trained to a convergent state to obtain a plurality of cyclists not wearing helmets in the traffic intersection image frame to be detected includes: In each Star Block module, the input image features are first processed by a 7×7 first depth separable convolution module, and the processed results are sent to two 1x1 convolution layers in parallel to expand the number of channels to 4 times the original number. The first output result of the first 1x1 convolutional layer is activated by the ReLu6 activation function, and then combined with the second output result of the second 1x1 convolutional layer by element-by-element multiplication to determine the third output result; Afterwards, the third output result adjusts the number of channels through a 1×1 convolution layer, reducing the number of channels to one quarter to restore the original number of channels, and a 7×7 second depthwise separable convolution module is added again at the end of the Star Block module to perform a second depthwise separable convolution process; Performing a residual connection between the feature map after the second depth-separable convolution processing and the original input, and finally outputting a high-dimensional image feature corresponding to the image frame of the traffic intersection to be detected; The high-dimensional image features are input into a detection head network in a second helmet wearing detection model that has been trained to a convergent state, and a plurality of cyclists who are not wearing helmets in the image frame of the traffic intersection to be detected are obtained.

3. The method for detecting the wearing of a safety helmet for road traffic according to claim 1, characterized in that: The CAA attention mechanism module is constructed by an average pooling layer, a 1×1 first convolution layer, a 1×11 third depth-separable convolution module, a 11×1 fourth depth-separable convolution module, a 1×1 second convolution layer and a Sigmoid activation function, wherein the average pooling layer, the first convolution, the third depth-separable convolution module, the fourth depth-separable convolution module, the second convolution layer and the Sigmoid activation function are connected in sequence.

4. The method for detecting the wearing of a safety helmet for road traffic according to claim 1, characterized in that: The step of inputting the traffic intersection image frame to be detected into a second helmet wearing detection model that has been trained to a convergent state to obtain a plurality of cyclists not wearing helmets in the traffic intersection image frame to be detected includes: In the generalized feature pyramid module of the DySample module, the feature pyramid network in the generalized feature pyramid module jointly performs multi-scale feature fusion in a bottom-up and top-down manner, wherein the top-down representation uses upsampling to transfer high-level semantic information to low-level semantic information, and the bottom-up representation transfers the lower detail information to the high-level semantic information through lateral connections; When the generalized feature pyramid module performs feature fusion, it first extracts features through a convolutional network to obtain feature maps of different scales, and then upsamples and adjusts the scale of the feature map to be consistent with the maximum scale feature map. Then, it passes through the feature fusion module and uses a 1×1 convolution layer to adjust the number of channels. After that, the fused feature map is downsampled, and the above process is repeated until feature fusion is completed for all scale feature maps.

5. The method for detecting the wearing of a safety helmet for road traffic according to claim 1, characterized in that: The step of inputting the traffic intersection image frame to be detected into a second helmet wearing detection model that has been trained to a convergent state to obtain a plurality of cyclists not wearing helmets in the traffic intersection image frame to be detected includes: In the DySample module, first, given a feature map X of size C×H1×W1 and a point collection δ of size 2g×H2×W2, wherein the point collection δ contains the position information for resampling the feature map X, a grid sampling function is used to resample the feature map X to a new feature map X of size C×H2×W2 according to the position information of the feature map X in the point sampling set δ. ′ .

6. The method for detecting the wearing of a safety helmet for road traffic according to any one of claims 1 to 5, characterized in that: In the generalized feature pyramid module, the connection mode of cross-layer connection is dense connection, and the connection mode of cross-scale connection is log2n connection, and its expression includes: The densely connected expression is expressed as: The expression of the log2n connection is expressed as: in, It represents the feature information of the m-th layer feature map at the n-th level; Conv() represents a 3×3 convolution operation; Concat() represents a feature concatenation operation.

7. The method for detecting the wearing of a safety helmet for road traffic according to any one of claims 1 to 5, characterized in that: The basic network structure of the first helmet wearing detection model is the original YOLOv8 model, and the basic network structure of the second helmet wearing detection model is the improved YOLOv8 model.

8. A road traffic safety helmet wearing detection device, characterized in that: include: An image frame acquisition module is configured to respond to a safety helmet wearing detection instruction for road traffic, and acquire an image frame of a traffic intersection to be detected in a road traffic scene including a cyclist who is not wearing a helmet; A detection model construction module is configured to update the Bottleneck structure in the original C2f module in the backbone network of the preset first helmet wearing detection model to the Star Block module in the StarNet lightweight network, introduce the CAA attention mechanism module, and update the feature fusion network to the generalized feature pyramid module that introduces the DySample module, so as to construct a second helmet wearing detection model; The helmet wearing detection module is configured to input the image frame of the traffic intersection to be detected into a second helmet wearing detection model that has been trained to a convergence state, and obtain multiple riders who are not wearing helmets in the image frame of the traffic intersection to be detected, so as to complete the safety helmet wearing detection of road traffic.

9. An electronic device, comprising a central processing unit and a memory, characterized in that: The central processing unit is used to call and run the computer program stored in the memory to execute the steps of the method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: It stores a computer program implemented according to the method described in any one of claims 1 to 7 in the form of computer-readable instructions, and when the computer program is called and executed by a computer, the steps included in the corresponding method are executed.

Citation Information

Patent Citations

  • Novel target detection system and method under roadside view angle

    CN115346177A

  • Improved aluminum profile surface defect detection method

    CN117252806A

  • Photovoltaic panel dust detection method, device and equipment and storage medium

    CN118608489A

  • Electric vehicle helmet intelligent detection method and device based on BottleNeck structure and SLLU

    CN118628990A

  • Model training method and intelligent construction site safety equipment detection method

    CN119131349A