Rail operator safety wearing detection method, device and equipment and storage medium

By collecting video images at the rail transit construction site and using a pre-trained safety wear detection model for detection, the problem of low manual patrol efficiency in the existing technology is solved, real-time and accurate detection of safe wear of workers is achieved, and the workload of managers is reduced.

CN119992463AInactive Publication Date: 2025-05-13INST OF COMPUTING TECH CHINA ACAD OF RAILWAY SCI +2

Patent Information

Application Number
CN202510437530.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-09
Publication Date
2025-05-13
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the prior art, manual inspection of the safety wear of rail transit operators is carried out, which has a large workload, low efficiency and poor timeliness, and problems cannot be discovered and dealt with in a timely manner.

Method used

A safety wear detection method for track workers is adopted. By collecting video images of the construction site and inputting them into the pre-trained safety wear detection model, a memory efficient visual converter with a cascading group attention mechanism is used as the backbone network of the real-time object detector model, and combined with the lightweight ADown downsampling layer, safe wear detection is performed.

Benefits of technology

It improves the inspection efficiency and detection effect of safe wear for operators, meets the real-time and accuracy requirements for safe wearable inspections at the rail transit construction site, and reduces the workload of safety inspections for managers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119992463A_ABST
    Figure CN119992463A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of target detection, and provides a track operator safety wearing detection method, device and equipment and a storage medium, and the method comprises the steps: collecting a video image of a track operation construction site, and inputting the video image into a pre-trained safety wearing detection model, detecting the safety wear of each operator in the video image to obtain a detection result of the safety wear of each operator; wherein the safe wearing detection model is constructed by taking a memory efficient visual converter with a cascade grouping attention mechanism as a backbone network of a real-time target detector model and taking an ADown downsampling layer as a downsampling layer of the real-time target detector model. Through the constructed safe wearing detection model, the detection efficiency and the detection effect of safe wearing of the operating personnel are improved, the requirements of real-time performance and accuracy of safe wearing condition detection of the operating personnel in a rail transit scene can be met, and the workload of safety patrol of management personnel is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of target detection technology, and in particular to a method, device, equipment and storage medium for detecting safety wear for track workers. Background Art

[0002] With the rapid development of urban transportation, the coverage of rail transit has gradually increased. In the current period of high-quality construction of rail transit network, the construction safety of rail transit is becoming more and more important. In the work of rail transit safety management, the safety wear of rail transit operators can greatly reduce safety risks and ensure the safety of operators. On the other hand, the safety protection equipment worn by operators can be used to distinguish between staff and non-staff, reducing the possibility of illegal personnel invading the track site and causing intrusion accidents.

[0003] At present, the management of rail transit safety mainly relies on management personnel to patrol various construction sites for unsafe behaviors and safety hazards such as failure to wear safety protection equipment correctly. This method is labor-intensive, inefficient and time-sensitive, and it is impossible to detect and deal with problems in a timely manner. Summary of the invention

[0004] The present invention provides a method, device, equipment and storage medium for detecting safety wear of rail workers, so as to solve the defects of the existing manual inspection method of the safety wear of rail transit workers, such as large workload, low efficiency and poor timeliness.

[0005] The present invention provides a method for detecting safety wear of track workers, comprising: Collect video images of the track operation construction site; Inputting the video image into a pre-trained safety wear detection model, and using the safety wear detection model to detect the safety wear of each operator in the video image to obtain a safety wear detection result of each operator; Among them, the safety wear detection model is a target detection model constructed by using a memory-efficient visual converter with a cascaded group attention mechanism as the backbone network of a real-time target detector model, and using an ADown downsampling layer as the downsampling layer of the real-time target detector model.

[0006] According to the track worker safety wear detection method provided by the present invention, the backbone network includes multiple feature processing stages, any of the feature processing stages includes a plurality of memory efficient visual converter layers with a cascaded group attention mechanism, and an efficient subsampling layer is arranged between two adjacent feature processing stages; the memory efficient visual converter layer includes a plurality of first feedforward layers, a cascaded group attention layer and a plurality of second feedforward layers; The plurality of first feed-forward layers, the cascaded group attention layers and the plurality of second feed-forward layers are connected in sequence.

[0007] According to the track worker safety wear detection method provided by the present invention, the first feedforward layer includes a first feedforward neural network and a first token interaction layer, and the second feedforward layer includes a second feedforward neural network and a second token interaction layer.

[0008] According to the track worker safety wear detection method provided by the present invention, the cascade grouping attention layer includes a feature splitting layer, a feature cascade layer, a splicing mapping layer and a multi-head attention layer; wherein: The feature splitting layer splits the input feature image of the cascaded grouping attention layer into multiple sub-feature images; The multi-head attention layer assigns an independent attention head to each of the sub-feature images for self-attention processing; The feature cascade layer is used to cascade the output features of each attention head of the multi-head attention layer, so as to combine the output of the first attention head with the input of the second attention head as the input of the second attention head, wherein the first attention head is any attention head in the multi-head attention layer, and the second attention head is the next attention head of the first attention head; The splicing mapping layer is used to perform splicing mapping processing on the output features of each attention head of the multi-head attention layer to obtain the output feature image of the cascade grouped attention layer.

[0009] According to the track worker safety wear detection method provided by the present invention, the backbone network further includes an overlapping embedding layer and an average pooling layer, wherein: The overlapping embedding layer is used to segment the video image into a plurality of overlapping image blocks, and convert the image blocks into feature vectors and embed them into the first memory-efficient visual converter layer for feature extraction; The average pooling layer is used to perform average pooling processing on the output features of the last memory-efficient visual converter layer; The safety wear detection model also includes a feature interaction layer, a first convolution layer, a first downsampling layer, a first fusion layer, a second convolution layer, a second downsampling layer, a second fusion layer, a first ADown downsampling layer, a third fusion layer, a second ADown downsampling layer, a fourth fusion layer and a first feature splicing layer connected to the backbone network in sequence; The first fusion layer is used to fuse the output features of the backbone network and the output features of the first downsampling layer to obtain the input features of the second convolutional layer; The second fusion layer is used to fuse the output features of the backbone network and the output features of the second downsampling layer to obtain the input features of the first ADown downsampling layer; The third fusion layer is used to fuse the output features of the second convolutional layer and the output features of the first ADown downsampling layer to obtain the input features of the second ADown downsampling layer; The fourth fusion layer is used to fuse the output features of the first convolutional layer and the output features of the second ADown downsampling layer; The first feature splicing layer is used to perform splicing processing on the input features of the second fusion layer, the output features of the third fusion layer, and the output features of the fourth fusion layer.

[0010] According to the track worker safety wear detection method provided by the present invention, the ADown downsampling layer includes a two-dimensional average pooling layer, a feature grouping layer, a third convolution layer, a maximum pooling layer, a fourth convolution layer and a second feature splicing layer; wherein: The two-dimensional average pooling layer is used to perform two-dimensional average pooling processing on the input features of the ADown downsampling layer; The feature grouping layer is used to perform feature grouping on the input features processed by two-dimensional average pooling to obtain a first input feature and a second input feature; The third convolutional layer is used to perform convolution processing on the first input feature to obtain a first target feature; The maximum pooling layer is used to perform maximum pooling processing on the second input feature to obtain a second target feature; The fourth convolutional layer is used to perform convolution processing on the second target feature to obtain a third target feature; The second feature concatenation layer is used to concatenate the first target feature and the third target feature to obtain the output feature of the ADown downsampling layer.

[0011] According to the method for detecting safety wear for track workers provided by the present invention, before inputting the video image into a pre-trained safety wear detection model, the method further includes: Acquire historical video images of the construction site, and construct a sample data set based on the historical video images; Iteratively training the constructed target detection model using the sample data set to obtain a pre-trained safety wear detection model; The loss function during the iterative training of the target detection model is : ; ; ; ; ; ; ; ; ; in, Represents the center point of the target box in the historical video image , Indicates the width of the target box, Indicates the height of the target frame; Represents the center point of the prediction box of the target detection model , represents the width of the prediction box, represents the height of the prediction box; is the preset scaling factor; is the intersection-and-union ratio of the target box and the prediction box, and the intersection-and-union ratio is the ratio of the intersection area to the union area; represents the Euclidean distance between the center point of the prediction box and the center point of the target box, Represents the diagonal distance of the minimum rectangle that covers both the prediction box and the target box; is the left boundary of the target box, is the right boundary of the target box, is the upper boundary of the target box, is the lower boundary of the target box, is the left boundary of the prediction box, is the right boundary of the prediction box, is the upper boundary of the prediction box and is the lower boundary of the prediction box; and is the bounding box regression loss of the predicted box; is the intersection area of ​​the target box and the prediction box, It is the union area of ​​the target box and the predicted box.

[0012] The present invention also provides a track worker safety wear detection device, comprising the following modules: An image acquisition module, used to acquire video images of the track operation construction site; A wearing detection module, used to input the video image into a pre-trained safety wearing detection model, and use the safety wearing detection model to detect the safety wearing of each operator in the video image to obtain a detection result of the safety wearing of each operator; Among them, the safety wear detection model is a target detection model constructed by using a memory-efficient visual converter with a cascaded group attention mechanism as the backbone network of a real-time target detector model, and using an ADown downsampling layer as the downsampling layer of the real-time target detector model.

[0013] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, a method for detecting safety wear for track workers as described in any one of the above is implemented.

[0014] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the method for detecting safety wear for track workers as described in any one of the above is implemented.

[0015] The present invention also provides a computer program product, including a computer program, which, when executed by a processor, implements any of the above-mentioned methods for detecting safety wear for track workers.

[0016] The method, device, equipment and storage medium for detecting safety wear of rail workers provided by the present invention collect video images of the rail operation construction site and input them into a pre-trained safety wear detection model to detect the safety wear of each worker and obtain a detection result. The safety wear detection model uses a memory-efficient visual converter with a cascaded group attention mechanism as the backbone network of the real-time target detector model for feature extraction, and replaces the downsampling layer of the real-time target detector model with an ADown downsampling layer, which reduces the number of parameters and the amount of calculation of the feature extraction network, improves the calculation speed and memory efficiency of the model, and the detection effect of small targets, ensures the detection efficiency and detection effect of the safety wear of the workers, can meet the real-time and accuracy requirements of the rail transit construction site for the detection of the safety wear of the workers, and reduces the workload of the management personnel for safety inspections. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0018] Figure 1 It is a flow chart of the track worker safety wear detection method provided by the present invention.

[0019] Figure 2 It is a schematic diagram of the backbone network structure of the safety wear detection model provided by the present invention.

[0020] Figure 3 It is a structural schematic diagram of the sandwich layout block of the backbone network provided by the present invention.

[0021] Figure 4 It is a structural diagram of the cascaded grouping attention layer of the backbone network provided by the present invention.

[0022] Figure 5 It is a schematic diagram of the network structure of the safety wear detection model provided by the present invention.

[0023] Figure 6 It is a structural schematic diagram of the downsampling layer of the safety wear detection model provided by the present invention.

[0024] Figure 7 It is a structural schematic diagram of the track worker safety wear detection device provided by the present invention.

[0025] Figure 8 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0026] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0027] It should be noted that with the popularization of video surveillance systems in rail transit scenarios, the foundation has been laid for the use of video image detection technology to identify unsafe behaviors. In rail transit scenarios, the detection of workers' safety wear can not only ensure the construction safety of workers, but also distinguish between workers and non-workers, and reduce the possibility of illegal personnel invading the track site and causing intrusion accidents. In the corresponding safety wear detection scheme, most of them use the YOLO series target detection algorithm, or integrate multi-target tracking algorithms on this basis to detect the wearing of workers' helmets and reflective clothing. Although this method can achieve real-time detection, there is a certain delay in the detector. In addition, since the monitoring equipment of rail transit is arranged at a high and far distance, there are low-light scenes, the on-site environment is complex, and the target of the operator in the video image is small, which increases the difficulty of detection and is prone to problems such as false detection and missed detection.

[0028] Based on this, an embodiment of the present invention provides a method for detecting the safe wearing of rail workers. The method is based on the RT-DETR (Real-Time Detection Transformer) model, and uses the lightweight network model EfficientViT (Memory Efficient Vision Transformer with Cascaded GroupAttention) as the backbone network for feature extraction. The lightweight ADown downsampling layer is used for downsampling to construct a safe wearing detection model for detecting the safe wearing conditions of workers at rail transit construction sites. The method can adapt to the complex environment of rail operation construction sites, improve the detection effect of small targets, and reduce false detections and missed detections.

[0029] Specifically, Figure 1 : is a flow chart of the method for detecting safety wear of track workers provided by the present invention, such as Figure 1 As shown, the method comprises the following steps: Step 100, collecting video images of the track operation construction site; Step 200, inputting the video image into a pre-trained safety wear detection model, using the safety wear detection model to detect the safety wear of each operator in the video image, and obtaining the detection result of the safety wear of each operator; Among them, the safety wear detection model is a target detection model constructed by using a memory-efficient visual converter with a cascaded group attention mechanism as the backbone network of a real-time target detector model, and using an ADown downsampling layer as the downsampling layer of the real-time target detector model.

[0030] First, video images of the rail construction site are collected. The video images are collected by monitoring equipment deployed at the construction site. Since the monitoring equipment at the construction site is generally deployed at a higher and farther position, the distance between different workers and the monitoring equipment at the construction site is different. Therefore, different workers appear in different sizes in the video images. For the small targets corresponding to workers who are far away from the monitoring equipment in the video image, it is more difficult to detect their safety wear.

[0031] Furthermore, the collected video images are input into the pre-trained safety wear detection model, and the safety wear detection model is used to detect the safety wear of each worker in the video image to obtain the detection results of the safety wear of each worker at the construction site. Among them, the detection results of the safety wear of the worker are used to indicate whether the worker has correctly worn the safety wear.

[0032] Optionally, the detection of the safety wear of the operators is the detection of the wearing of the safety protection equipment of the operators, including the detection of the wearing of the safety helmets of the operators and the detection of the wearing of the reflective clothing of the operators. The detection result of the safety wear of the operators includes the safety wearing level, and the safety wearing level of the operators is visually marked. Among them, the safety wearing level is used to characterize the wearing of safety protection equipment such as safety helmets and reflective clothing by the operators. For example, for operators who do not wear any protective equipment, the safety wearing level in the detection result is level 0; for operators who wear some protective equipment, according to the number of protective equipment actually worn by the operators, the safety wearing level in the detection result is level 1-2, and for operators who wear all protective equipment, the safety wearing level in the detection result is level 3.

[0033] Optionally, an early warning reminder for safe wearing may be given to operators whose safety wearing level in the test results does not meet the requirements. For example, risk early warning reminders may be given to operators who are not wearing any protective equipment and operators who are wearing partial protective equipment.

[0034] Furthermore, the safety wearable detection model is an object detection model constructed by using a memory-efficient visual converter with a cascaded group attention mechanism as the backbone network of the real-time object detector RT-DETR model, and using the ADown downsampling layer as the downsampling layer of the real-time object detector RT-DETR model.

[0035] Optionally, the RT-DETR model is based on the Transformer architecture and consists of a backbone network, a hybrid encoder, and a Transformer decoder with an auxiliary prediction head. The output features of the backbone network are used as the input of the encoder, and the encoder converts the multi-scale features into a series of image features through Attention-based Intra-scale Feature Interaction (AIFI) and cross-scale fusion. Then, a fixed number of image features are selected from the encoder output sequence using IoU (Intersection over Union)-aware query selection as the initial object query for the decoder. Finally, the decoder with an auxiliary prediction head is used to iteratively optimize the object query to generate the detection box and confidence score of the safety protective equipment worn by the operator, complete the detection of the safety wear of the operator, and obtain the detection result of the safety wear.

[0036] Among them, the memory-efficient visual converter with cascaded group attention mechanism, namely EfficientViT, is a lightweight multi-scale attention model that uses sandwich layout blocks and cascaded group attention (CGA) mechanism to reduce memory access time and computational redundancy, and improve model computational efficiency and performance. On this basis, the lightweight ADown downsampling layer is used to replace the downsampling layer in the RT-DETR model for feature extraction and downsampling operations, which can better capture the features of small targets such as helmets and safety clothing in subsequent detection tasks, and at the same time make the safety wear detection model lightweight. Optionally, the ADown downsampling layer can include one or more.

[0037] In the target detection task, the backbone network is mainly responsible for extracting features from the input image for subsequent target detection tasks. A good feature extraction network can significantly improve the performance of the algorithm model. Therefore, the choice of the backbone network is particularly important. The feature extraction network based on the deep convolutional neural network can extract richer and more advanced image semantic information as the network depth increases. At the same time, the number of model parameters also increases, making the model training and reasoning process more time-consuming. In the monitoring scenario of the railway construction site, the algorithm model of the safety wearable needs to be deployed on the edge computing device with limited resources. The algorithm model requires lower power consumption and smaller memory usage. Therefore, while maintaining good performance, it is necessary to reduce the model calculation and storage requirements. A lightweight model is a better choice as the feature extraction backbone network of the algorithm model. In order to improve the computing speed and memory efficiency of the safety wear detection model, EfficientViT is used as the backbone network of the safety wear detection model to improve the RT-DETR model. On this basis, the original downsampling layer of the RT-DETR model is replaced by the lightweight ADown downsampling layer to further reduce the model size. On the premise of meeting the real-time and accuracy requirements of safety wear detection at the construction site, the model calculation and storage requirements are reduced to meet the business needs of real-time detection of safety wear at the construction site.

[0038] Based on the RT-DETR model, the safety wearable detection model uses EfficientViT as the backbone network for feature extraction. The encoder performs intra-scale feature interaction and cross-scale fusion on the features extracted by the backbone network, which improves the detection effect of small targets and reduces false detection and missed detection of small targets.

[0039] In this embodiment, by collecting video images of the rail operation construction site and inputting them into a pre-trained safety wear detection model, the safety wear of each operator is detected to obtain the detection results. The safety wear detection model uses a memory-efficient visual converter with a cascaded group attention mechanism as the backbone network of the real-time target detector model for feature extraction, and replaces the downsampling layer of the real-time target detector model with an ADown downsampling layer, which reduces the number of parameters and calculations of the feature extraction network, improves the calculation speed and memory efficiency of the model, and the detection effect of small targets, ensures the detection efficiency and detection effect of the safety wear of the operators, can meet the real-time and accuracy requirements of the safety wear detection of the operators at the rail transit construction site, and reduces the workload of management personnel for safety inspections.

[0040] Optionally, the backbone network includes multiple feature processing stages, any of the feature processing stages includes several memory-efficient visual converter layers with a cascaded group attention mechanism, and an efficient subsampling layer is arranged between two adjacent feature processing stages; the memory-efficient visual converter layer includes several first feedforward layers, cascaded group attention layers and several second feedforward layers; the several first feedforward layers, the cascaded group attention layers and the several second feedforward layers are connected in sequence.

[0041] The backbone network includes multiple feature processing stages. Any feature processing stage includes an EfficientViT Block (i.e., EfficientViT block) composed of several memory-efficient visual converter layers EfficientViT with cascaded group attention mechanism. An efficient subsampling layer EfficientSubsample is set between two adjacent feature processing stages. As the number of feature processing stages increases, the dimension of the feature map decreases and the number of channels increases.

[0042] In the multiple feature processing stages of the backbone network, each feature processing stage includes several EfficientViTBlocks, and the number of EfficientViT Blocks included in different feature processing stages can be the same or different. Figure 2 As shown, the multiple feature processing stages mainly include three stages, the first stage, the second stage and the third stage. The first stage includes L1 EfficientViT Blocks, the second stage includes L2 EfficientViT Blocks, and the third stage includes L3 EfficientViT Blocks. The values ​​of L1, L2 and L3 can be the same or different. An efficient subsampling layer is set between two adjacent feature processing stages. Figure 2 In the embodiment, the efficient subsampling layer specifically includes a first subsampling layer between the first stage and the second stage, and a second subsampling layer between the second stage and the third stage.

[0043] Furthermore, EfficientViT includes several first feedforward layers, cascaded group attention layers and several second feedforward layers, which are connected in sequence to form a sandwich layout.

[0044] Figure 3 This is the structural diagram of the sandwich layout block of EfficientViT, as shown Figure 3 As shown, the sandwich layout is in the Feed-Forward Neu-ral Network (FFN) layer A self-attention layer is set between them. The process of EfficientViT to process features is shown in the following formula 1: ; (1) in, It is The input features of the EfficientViT Block are Figure 3 In the example, there are N FFN layers before and after a single cascaded group attention layer for feature processing. It is Cascaded group attention layer of EfficientViT Block. The EfficientViT Block performs input features , and obtain the The input features of the EfficientViTBlock, The EfficientViT Block performs input features The processing includes the processing of N first feed-forward layers, the processing of cascaded grouped attention layers, and the processing of N second feed-forward layers.

[0045] Memory access overhead is one of the key factors affecting model speed. Operations such as addition and normalization of elements in the self-attention layer need to be accessed across different storage units, resulting in inefficient memory access. The sandwich layout uses fewer memory-inefficient self-attention layers and more memory-efficient fully connected feedforward network layers to achieve communication between different feature channels, thereby improving model speed.

[0046] Optionally, the first feedforward layer includes a first feedforward neural network and a first token interaction layer, and the second feedforward layer includes a second feedforward neural network and a second token interaction layer.

[0047] The first feed-forward layer includes a first feed-forward neural network FFN and a first token interaction layer, and the second feed-forward layer includes a second feed-forward neural network and a second token interaction layer. Figure 3 As shown, the first feedforward layer and the second feedforward layer have the same network structure, that is, the first feedforward neural network and the second feedforward neural network have the same structure, and the first token interaction layer and the second token interaction layer have the same structure. Figure 3 In the above figure, any one of the N FFN layers before the self-attention layer includes a feed-forward neural network layer Feed-Forward Neu-ral Network and a token interaction layer Token Interaction, and any one of the N FFN layers before the self-attention layer also includes a feed-forward neural network layer Feed-Forward Neu-ral Network and a token interaction layer Token Interaction.

[0048] Optionally, the cascaded group attention layer includes a feature splitting layer, a feature cascade layer, a splicing mapping layer and a multi-head attention layer; wherein: the feature splitting layer splits the input feature image of the cascaded group attention layer into multiple sub-feature images; the multi-head attention layer assigns an independent attention head to each of the sub-feature images for self-attention processing; the feature cascade layer is used to cascade the output features of each attention head of the multi-head attention layer to combine the output of the first attention head with the input of the second attention head as the input of the second attention head, the first attention head is any attention head in the multi-head attention layer, and the second attention head is the next attention head of the first attention head; the splicing mapping layer is used to perform splicing mapping processing on the output features of each attention head of the multi-head attention layer to obtain the output feature image of the cascaded group attention layer.

[0049] The cascaded group attention mechanism can solve the computational redundancy problem in multi-head self-attention. In multi-head self-attention, each attention head performs the same task, resulting in computational redundancy. The cascaded group attention mechanism allows each attention head to focus on different features to solve this problem, thereby improving the diversity of attention heads. Each attention head uses a smaller QK channel dimension in the attention graph calculation, so the capacity of the model can be increased by increasing the network depth without introducing additional parameters, and without incurring more delay overhead.

[0050] Reference Figure 4 The cascaded group attention layer includes a feature splitting layer, a feature cascade layer, a concatenation mapping layer (Concat&Projection) and a multi-head attention layer. The multi-head attention layer consists of multiple attention heads. The feature splitting layer is used to split the input feature image of the cascaded group attention layer into multiple sub-feature images. Optionally, the number of the split sub-feature images is the same as the number of attention heads in the multi-head attention layer.

[0051] Furthermore, the multi-head attention layer assigns an independent attention head to each sub-feature image, performs self-attention processing on the sub-feature image, and the feature cascade layer is used to cascade the output features of each attention head of the multi-head attention layer. The cascade method is to combine the output of the first attention with the input of the second attention head as the input of the second attention. The first attention head is any one of the attention heads of the multi-head attention layer, and the second attention head is an attention head adjacent to the first attention head and located after the first attention head, that is, in the multi-head attention layer, the second attention head is the next attention head of the first attention head. The splicing mapping layer is used to splice the output features of each attention head of the multi-head attention layer to obtain the output feature image of the cascade grouped attention layer.

[0052] based on Figure 4 The network structure of the cascaded grouped attention layer shown in the figure, for the input feature image of the cascaded grouped attention layer, firstly, the input feature image is split into multiple sub-feature images through the feature splitting layer, and the multi-head attention layer assigns an independent attention head to each sub-feature image to process the attention mechanism. In each attention head of the multi-head attention layer, a token interaction layer and a self-attention layer are further included. The token interaction layer is set between the Q channel in the attention head and the self-attention layer, and is used to calculate the correlation between each token and other tokens, so as to determine the importance of each token in the sequence. Each attention head focuses on different parts of the input feature image, improving the diversity of the attention heads, and the features of different attention heads are fused in a cascade manner, so that each attention head uses a smaller QK channel dimension in the attention map calculation, which can increase the capacity of the model by increasing the network depth without introducing additional parameters, and will not generate more delay overhead.

[0053] Optionally, the backbone network also includes an overlapping embedding layer and an average pooling layer, wherein the overlapping embedding layer is used to segment the video image into multiple overlapping image blocks, and convert the image blocks into feature vectors and embed them into the first memory-efficient visual converter layer for feature extraction; the average pooling layer is used to perform average pooling processing on the output features of the last memory-efficient visual converter layer.

[0054] like Figure 2 As shown in the figure, the backbone network also includes an overlapping embedding layer (Overlap PatchEmbed) and an average pooling layer (AvgPool). The overlapping embedding layer is used to divide the input video image into multiple overlapping image blocks, and convert each image block into a feature vector and embed it into the first memory-efficient visual converter layer for the first stage of feature extraction processing. The average pooling layer is used to perform average pooling processing on the output features of the last memory-efficient visual converter layer.

[0055] Optionally, the safety wear detection model also includes a feature interaction layer, a first convolution layer, a first downsampling layer, a first fusion layer, a second convolution layer, a second downsampling layer, a second fusion layer, a first ADown downsampling layer, a third fusion layer, a second ADown downsampling layer, a fourth fusion layer and a first feature splicing layer connected to the backbone network in sequence.

[0056] Among them, the first fusion layer is used to fuse the output features of the backbone network and the output features of the first downsampling layer to obtain the input features of the second convolutional layer; the second fusion layer is used to fuse the output features of the backbone network and the output features of the second downsampling layer to obtain the input features of the first ADown downsampling layer; the third fusion layer is used to fuse the output features of the second convolutional layer and the output features of the first ADown downsampling layer to obtain the input features of the second ADown downsampling layer; the fourth fusion layer is used to fuse the output features of the first convolutional layer and the output features of the second ADown downsampling layer; the first feature splicing layer is used to splice the input features of the second fusion layer, the output features of the third fusion layer and the output features of the fourth fusion layer.

[0057] Reference Figure 5 The safety wear detection model further includes a feature interaction layer, a first convolution layer, a first downsampling layer, a first fusion layer, a second convolution layer, a second downsampling layer, a second fusion layer, a first ADown downsampling layer, a third fusion layer, a second ADown downsampling layer, a fourth fusion layer and a first feature splicing layer, which are sequentially connected to the backbone network.

[0058] During the feature processing, the output features of the backbone network are the input features of the feature interaction layer (Attention-based Intra-scale Feature Interaction, AIFI). The output features of the feature interaction layer AIFI are processed in sequence by the first convolutional layer, the first downsampling layer, the first fusion layer, the second convolutional layer, the second downsampling layer, the second fusion layer, the first ADown downsampling layer, the third fusion layer, the second ADown downsampling layer, the fourth fusion layer and the first feature concatenation layer.

[0059] Among them, Figure 5As shown, the first fusion layer specifically fuses the output features of the first downsampling layer with the output features of the backbone network as the input features of the second convolutional layer; the second fusion layer specifically fuses the input features of the second downsampling layer with the output features of the backbone network as the input features of the first ADown downsampling layer; the third fusion layer specifically fuses the output features of the first ADown downsampling layer with the output features of the second convolutional layer as the input features of the second ADown downsampling layer, and the fourth fusion layer specifically fuses the output features of the second ADown downsampling layer with the output features of the first convolutional layer as one of the input features of the first feature splicing layer. The first feature splicing layer is mainly used to splice the output features of the second fusion layer, the third fusion layer, and the fourth fusion layer to obtain the final extracted target features. The target features are used as the input features of the decoder layer, and the decoder layer is used to decode the target features to finally obtain the detection results of the safety wear of the operators.

[0060] Furthermore, the ADown downsampling layer includes a two-dimensional average pooling layer, a feature grouping layer, a third convolution layer, a maximum pooling layer, a fourth convolution layer and a second feature splicing layer. The two-dimensional average pooling layer is used to perform two-dimensional average pooling on the input features of the ADown downsampling layer; the feature grouping layer is used to perform feature grouping on the input features processed by two-dimensional average pooling to obtain a first input feature and a second input feature; the third convolution layer is used to perform convolution on the first input feature to obtain a first target feature; the maximum pooling layer is used to perform maximum pooling on the second input feature to obtain a second target feature; the fourth convolution layer is used to perform convolution on the second target feature to obtain a third target feature; the second feature splicing layer is used to perform splicing on the first target feature and the third target feature to obtain the output feature of the ADown downsampling layer.

[0061] Reference Figure 6The feature processing process of the ADown downsampling layer shown in the figure, the ADown downsampling layer includes a two-dimensional average pooling layer, a feature grouping layer, a third convolutional layer, a maximum pooling layer, a fourth convolutional layer and a second feature concatenation layer. Among them, the two-dimensional average pooling layer (AvgPool2D) is used to perform average pooling processing on the input features of the ADown downsampling layer, and the feature grouping layer (Chunk) is used to perform feature grouping on the output features of the average pooling layer to obtain the first input feature and the second input feature. The first input feature is used as the input feature of the third convolutional layer, and the third convolutional layer performs convolution processing on the first input feature to obtain the first target feature. The second input feature is used as the input feature of the maximum pooling layer (MaxPool2D), and the maximum pooling layer is used to perform maximum pooling processing on the second input feature to obtain the second target feature. The second target feature is used as the input feature of the fourth convolutional layer, and the fourth convolutional layer performs convolution processing on the second target feature to obtain the third target feature. The first target feature and the third target feature are input features of the second feature concatenation layer (Concat). The second feature concatenation layer is used to perform feature concatenation processing on the input first target feature and the third target feature to obtain the output feature of the ADown downsampling layer.

[0062] Optionally, the convolution kernel sizes of the first convolution layer, the second convolution layer, the third convolution layer, and the fourth convolution layer may be the same or different, and there is no specific limitation on this. Exemplarily, the convolution kernel size of the first convolution layer and the second convolution layer is 1×1, the convolution parameters of the third convolution layer are k=3, s=2, p=1, and the convolution parameters of the fourth convolution layer are k=1, s=1, p=0. Among them, k represents the convolution kernel size, k=3 represents the convolution kernel size of 3×3, and k=1 represents the convolution kernel size of 1×1; s represents the convolution step size, which is used to characterize the stride of the convolution kernel moving on the input feature map, s=1 represents the convolution kernel moving one pixel in each direction, and s=2 represents the convolution kernel moving two pixels in each direction; p represents the padding size, which means adding zero values ​​to the edges of the input feature map to maintain the spatial dimension of the output feature map. The padding size is usually set to an integer multiple of the convolution kernel size minus 1 to ensure that the spatial dimension of the output feature map is the same or close to that of the input feature map. For example, if the convolution kernel size is 3×3 and the padding size is 1 (i.e., k=3, p=1), then a circle of zero values ​​is added to each edge of the input feature map.

[0063] The ADown downsampling layer is mainly used for feature extraction and downsampling operations. In subsequent detection tasks, it can better capture the features of small targets such as helmets and safety clothing, and further make the model lightweight. The ADown downsampling layer gradually reduces the size of the feature map and increases the number of channels through multiple convolution and pooling operations to better extract the features of the target. Specifically, Figure 6As shown in the figure, average pooling is first used to reduce the size of the input feature, while retaining the average value information of all pixels, which helps to reduce the amount of calculation while maintaining the continuity of the feature map. Then, the feature vector corresponding to the input feature is divided into two feature blocks along the channel number dimension and then convolution operations are performed separately, which can reduce the number of parameters and calculations of the convolution operation, and can better capture the features at different positions of the image. Pooling operations are performed on one of the feature blocks to further reduce the feature size, retain the maximum activation value in the pooling window, and improve the spatial resolution of the feature map. Finally, the multiple features obtained by the above convolution and pooling operations are spliced ​​along the channel dimension to form a new feature map, so that the model can comprehensively learn features of different scales and different positions, and improve the generalization ability and robustness of the model. The design strategy of the ADown downsampling layer in the safety wear detection model can increase the capacity of the model, enhance the contrast of the feature map, and reduce the amount of model calculation and parameters, which helps to improve the performance of the model.

[0064] Furthermore, the safety wear detection model is obtained by iteratively training the constructed target detection model based on the constructed sample data set. Therefore, in this embodiment, the constructed target detection model has the same network structure as the safety wear detection model described in the above embodiments. Before inputting the collected video images into the pre-trained safety wear detection model and detecting the safety wear of each worker at the construction site, the constructed target detection model needs to be pre-trained.

[0065] In one embodiment, pre-training the target detection model specifically includes the following steps: Step 101, obtaining historical video images of the construction site, and constructing a sample data set based on the historical video images; Step 102, iteratively training the constructed target detection model using the sample data set to obtain a pre-trained safety wear detection model; The loss function during the iterative training of the target detection model is : ; ; ; ; ; ; ; ; ; in, Represents the center point of the target box in the historical video image , Indicates the width of the target box, Indicates the height of the target frame; Represents the center point of the prediction box of the target detection model , represents the width of the prediction box, represents the height of the prediction box; is the preset scaling factor; is the intersection-and-union ratio of the target box and the prediction box, and the intersection-and-union ratio is the ratio of the intersection area to the union area; represents the Euclidean distance between the center point of the prediction box and the center point of the target box, Represents the diagonal distance of the minimum rectangle that covers both the prediction box and the target box; is the left boundary of the target box, is the right boundary of the target box, is the upper boundary of the target box, is the lower boundary of the target box, is the left boundary of the prediction box, is the right boundary of the prediction box, is the upper boundary of the prediction box and is the lower boundary of the prediction box; and is the bounding box regression loss of the predicted box; is the intersection area of ​​the target box and the prediction box, It is the union area of ​​the target box and the predicted box.

[0066] The historical video images of the construction site are obtained, and a sample data set is constructed based on the historical video images. The constructed sample data set is used to iteratively train the constructed target detection model to obtain a pre-trained safety wear detection model. In the constructed sample data set, the safety protection equipment worn by each worker in the historical video images is annotated, and the sample data set contains the detection frames of the safety protection equipment worn by each worker in the historical video images.

[0067] During the iterative training of the target detection model, the loss function used is : ; (2) ; (3) ; (4) ; (5) ; (6) ; (7) ; (8) ; (9) ; (10) in, Represents the center point of the target box in the historical video image , Indicates the width of the target box. Indicates the height of the target box; Represents the center point of the prediction box of the target detection model , Indicates the width of the prediction box, Indicates the height of the prediction box; is the preset scaling factor; It is the intersection-union ratio of the target box and the prediction box. The intersection-union ratio is the ratio of the intersection area to the union area. Represents the Euclidean distance between the center point of the prediction box and the center point of the target box, Represents the diagonal distance of the smallest rectangle that covers both the prediction box and the target box.

[0068] Further, and is the bounding box regression loss of the predicted box, is the intersection area of ​​the prediction box and the target box, Represents the union area of ​​the prediction box and the target box; , , and Respectively represent the left boundary, right boundary, upper boundary and lower boundary of the target box, , , and Represent the left boundary, right boundary, upper boundary and lower boundary of the prediction box respectively.

[0069] In the training process of the target detection model, bounding box regression is the key to locating the target in the target detection task. The baseline algorithm uses GIoU (Generalized Intersection over Union) loss to calculate the regression loss of the bounding box. GIoU is an improvement on IoU (Intersection over Union) loss, which can solve the limitation of IoU loss function when the predicted box does not overlap with the marked target box. When the predicted box and the marked target box do not overlap, GIoU loss will increase the size of the predicted box to make it overlap with the target box, and then GIoU loss degenerates into IoU (Intersection over Union) loss, which leads to slow bounding box regression. DIoU (Distance-IoU) is also improved on the basis of IoU loss function, which can solve the problem that IoU loss function cannot be optimized when the predicted box and the marked target box do not intersect. DIoU loss function uses distance metric loss. When the predicted box and the target box do not overlap, the predicted box moves toward the target box by directly minimizing the center distance between the predicted box and the target box, thereby accelerating the convergence of bounding box loss.

[0070] Only by adding loss terms to accelerate the convergence of the loss function, the limitations of the IoU loss term itself are ignored. Although the IoU loss function can effectively describe the state of bounding box regression, in practical applications, it cannot be adaptively adjusted according to different detection tasks, and the generalization ability is weak. Based on this, the embodiment of the present invention introduces the Inner-IoU loss term on the basis of the DIoU loss term to replace the original loss function. The Inner-IoU loss term controls the scale of the auxiliary bounding box used to calculate the loss through the scaling factor ratio. For samples with high IoU, using a smaller auxiliary bounding box to calculate the loss can accelerate convergence, while for samples with low IoU, it is more suitable to use a larger auxiliary bounding box.

[0071] The loss function used in the embodiment of the present invention is shown in Formula 2. The calculation method of each loss term in Formula 2 is shown in Formulas 3-10. During the model training process, according to the position coordinates of the center point of the prediction box of the target detection model and the position coordinates of the center point of the target box marked in the sample data set, based on the scaling factor Calculate the boundaries of the prediction box and the target box, and then further calculate the loss terms corresponding to the regression loss between the prediction box and the target box. Has a preset value range, such as [0.5,1.5], optional, when When the value is less than 1, the size of the auxiliary bounding box is smaller than the actual bounding box, the effective range of regression is smaller than the IoU loss, but the absolute value of the gradient is larger than the gradient of the IoU loss, which can accelerate the convergence of high IoU samples; when When the value is greater than 1, a larger auxiliary bounding box can expand the effective range of regression and help the regression of low IoU samples.

[0072] Combining Inner-IoU and DIoU as the loss function when training the target detection model can not only accelerate the bounding box regression speed and improve the detection effect, but also improve the generalization ability of the model.

[0073] Further, Figure 5 In the network structure shown in , there is an IoU-aware Query Selection layer between the first feature concatenation layer and the decoder layer. The feature query layer is used to select a fixed number of image features from the encoder output sequence as the initial object query for the decoder. The feature query layer can introduce an additional IoU prediction branch during the model training process, so that the model can not only predict the category of the target, but also predict the IoU value between the real box and the predicted box. In the model inference stage, the classification score is multiplied by the predicted IoU value to obtain the final detection score, so as to more accurately evaluate the quality of the predicted box, so as to improve the positioning accuracy of the predicted box, enhance the detection performance of the model, and reduce false detection and missed detection.

[0074] In this embodiment, the EfficientViT network is used as the backbone network for feature extraction, and ADown downsampling is used to replace the original downsampling, which greatly reduces the model size, parameter quantity and calculation amount, improves the recognition accuracy of model detection, and realizes the lightweight of the detection model. It can better detect small targets, so that the target detection model can adapt to the complex environment of the construction site, effectively improve the problems of missed detection and false detection of small targets, and meet the detection needs of the safety wear of workers at the rail transit construction site.

[0075] Furthermore, in the model training stage, Inner-IoU and DIoU are combined to construct the loss function. While ensuring the model detection accuracy and detection speed, it improves the convergence speed of the loss function, shortens the model training cycle, and is more conducive to the deployment and application of the target detection model.

[0076] The track worker safety wear detection device provided by the present invention is described below. The track worker safety wear detection device described below and the track worker safety wear detection method described above can be referenced to each other.

[0077] Reference Figure 7The track worker safety wear detection device provided by the embodiment of the present invention comprises: An image acquisition module 10 is used to acquire video images of the track operation construction site; A wear detection module 20 is used to input the video image into a pre-trained safety wear detection model, and use the safety wear detection model to detect the safety wear of each operator in the video image to obtain a safety wear detection result of each operator; Among them, the safety wear detection model is a target detection model constructed by using a memory-efficient visual converter with a cascaded group attention mechanism as the backbone network of a real-time target detector model, and using an ADown downsampling layer as the downsampling layer of the real-time target detector model.

[0078] In one embodiment, the backbone network includes a plurality of feature processing stages, any of the feature processing stages includes a plurality of memory-efficient visual converter layers with a cascaded group attention mechanism, and an efficient subsampling layer is arranged between two adjacent feature processing stages; the memory-efficient visual converter layer includes a plurality of first feedforward layers, a cascaded group attention layer, and a plurality of second feedforward layers; The plurality of first feed-forward layers, the cascaded group attention layers and the plurality of second feed-forward layers are connected in sequence.

[0079] In one embodiment, the first feed-forward layer includes a first feed-forward neural network and a first token interaction layer, and the second feed-forward layer includes a second feed-forward neural network and a second token interaction layer.

[0080] In one embodiment, the cascaded grouping attention layer includes a feature splitting layer, a feature cascading layer, a splicing mapping layer and a multi-head attention layer; wherein: The feature splitting layer splits the input feature image of the cascaded grouping attention layer into a plurality of sub-feature images; The multi-head attention layer assigns an independent attention head to each of the sub-feature images for self-attention processing; The feature cascade layer is used to cascade the output features of each attention head of the multi-head attention layer, so as to combine the output of the first attention head with the input of the second attention head as the input of the second attention head, wherein the first attention head is any attention head in the multi-head attention layer, and the second attention head is the next attention head of the first attention head; The splicing mapping layer is used to perform splicing mapping processing on the output features of each attention head of the multi-head attention layer to obtain the output feature image of the cascade grouped attention layer.

[0081] In one embodiment, the backbone network further includes an overlapping embedding layer and an average pooling layer, wherein: The overlapping embedding layer is used to segment the video image into a plurality of overlapping image blocks, and convert the image blocks into feature vectors and embed them into the first memory-efficient visual converter layer for feature extraction; The average pooling layer is used to perform average pooling processing on the output features of the last memory-efficient visual converter layer; The safety wear detection model also includes a feature interaction layer, a first convolution layer, a first downsampling layer, a first fusion layer, a second convolution layer, a second downsampling layer, a second fusion layer, a first ADown downsampling layer, a third fusion layer, a second ADown downsampling layer, a fourth fusion layer and a first feature splicing layer connected to the backbone network in sequence; The first fusion layer is used to fuse the output features of the backbone network and the output features of the first downsampling layer to obtain the input features of the second convolutional layer; The second fusion layer is used to fuse the output features of the backbone network and the output features of the second downsampling layer to obtain the input features of the first ADown downsampling layer; The third fusion layer is used to fuse the output features of the second convolutional layer and the output features of the first ADown downsampling layer to obtain the input features of the second ADown downsampling layer; The fourth fusion layer is used to fuse the output features of the first convolutional layer and the output features of the second ADown downsampling layer; The second feature splicing layer is used to splice the input features of the second fusion layer, the output features of the third fusion layer, and the output features of the fourth fusion layer.

[0082] In one embodiment, the ADown downsampling layer includes a two-dimensional average pooling layer, a feature grouping layer, a third convolution layer, a maximum pooling layer, a fourth convolution layer and a second feature concatenation layer; wherein: The two-dimensional average pooling layer is used to perform two-dimensional average pooling processing on the input features of the ADown downsampling layer; The feature grouping layer is used to perform feature grouping on the input features processed by two-dimensional average pooling to obtain a first input feature and a second input feature; The third convolutional layer is used to perform convolution processing on the first input feature to obtain a first target feature; The maximum pooling layer is used to perform maximum pooling processing on the second input feature to obtain a second target feature; The fourth convolutional layer is used to perform convolution processing on the second target feature to obtain a third target feature; The second feature concatenation layer is used to concatenate the first target feature and the third target feature to obtain the output feature of the ADown downsampling layer.

[0083] In one embodiment, the track worker safety wear detection device further includes a model training module for: Acquire historical video images of the construction site, and construct a sample data set based on the historical video images; Iteratively training the constructed target detection model using the sample data set to obtain a pre-trained safety wear detection model; The loss function during the iterative training of the target detection model is : ; ; ; ; ; ; ; ; ; in, Represents the center point of the target box in the historical video image , Indicates the width of the target box, Indicates the height of the target frame; Represents the center point of the prediction box of the target detection model , represents the width of the prediction box, represents the height of the prediction box; is the preset scaling factor; is the intersection-and-union ratio of the target box and the prediction box, and the intersection-and-union ratio is the ratio of the intersection area to the union area; represents the Euclidean distance between the center point of the prediction box and the center point of the target box, Represents the diagonal distance of the minimum rectangle that covers both the prediction box and the target box; is the left boundary of the target box, is the right boundary of the target box, is the upper boundary of the target box, is the lower boundary of the target box, is the left boundary of the prediction box, is the right boundary of the prediction box, is the upper boundary of the prediction box and is the lower boundary of the prediction box; and is the bounding box regression loss of the predicted box; is the intersection area of ​​the target box and the prediction box, It is the union area of ​​the target box and the predicted box.

[0084] Figure 8 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 8 As shown, the electronic device may include: a processor 810, a communications interface 820, a memory 830 and a communication bus 840, wherein the processor 810, the communications interface 820 and the memory 830 communicate with each other through the communication bus 840. The processor 810 may call the logic instructions in the memory 830 to execute the steps of the track worker safety wear detection method, for example including: Collect video images of the track operation construction site; Inputting the video image into a pre-trained safety wear detection model, and using the safety wear detection model to detect the safety wear of each operator in the video image to obtain a safety wear detection result of each operator; Among them, the safety wear detection model is a target detection model constructed by using a memory-efficient visual converter with a cascaded group attention mechanism as the backbone network of a real-time target detector model, and using an ADown downsampling layer as the downsampling layer of the real-time target detector model.

[0085] In addition, the logic instructions in the above-mentioned memory 830 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0086] On the other hand, the present invention further provides a computer program product, the computer program product includes a computer program, the computer program can be stored on a non-transitory computer-readable storage medium, and when the computer program is executed by a processor, the computer can execute the steps of the track worker safety wear detection method provided by the above methods, for example, including: Collect video images of the track operation construction site; Inputting the video image into a pre-trained safety wear detection model, and using the safety wear detection model to detect the safety wear of each operator in the video image to obtain a safety wear detection result of each operator; Among them, the safety wear detection model is a target detection model constructed by using a memory-efficient visual converter with a cascaded group attention mechanism as the backbone network of a real-time target detector model, and using an ADown downsampling layer as the downsampling layer of the real-time target detector model.

[0087] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the track worker safety wear detection method provided by the above methods, for example, including: Collect video images of the track operation construction site; Inputting the video image into a pre-trained safety wear detection model, and using the safety wear detection model to detect the safety wear of each operator in the video image to obtain a safety wear detection result of each operator; Among them, the safety wear detection model is a target detection model constructed by using a memory-efficient visual converter with a cascaded group attention mechanism as the backbone network of a real-time target detector model, and using an ADown downsampling layer as the downsampling layer of the real-time target detector model.

[0088] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0089] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0090] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for detecting safety wear for track workers, characterized in that: include: Collect video images of the track operation construction site; Inputting the video image into a pre-trained safety wear detection model, and using the safety wear detection model to detect the safety wear of each operator in the video image to obtain a safety wear detection result of each operator; Among them, the safety wear detection model is a target detection model constructed by using a memory-efficient visual converter with a cascaded group attention mechanism as the backbone network of a real-time target detector model, and using an ADown downsampling layer as the downsampling layer of the real-time target detector model.

2. The method for detecting safety wear of track workers according to claim 1, characterized in that: The backbone network includes a plurality of feature processing stages, any of which includes a plurality of memory-efficient visual converter layers with a cascaded group attention mechanism, and an efficient subsampling layer is arranged between two adjacent feature processing stages; the memory-efficient visual converter layer includes a plurality of first feedforward layers, a cascaded group attention layer, and a plurality of second feedforward layers; The plurality of first feed-forward layers, the cascaded group attention layers and the plurality of second feed-forward layers are connected in sequence.

3. The method for detecting safety wear of track workers according to claim 2, characterized in that: The first feedforward layer includes a first feedforward neural network and a first token interaction layer, and the second feedforward layer includes a second feedforward neural network and a second token interaction layer.

4. The method for detecting safety wear of track workers according to claim 2, characterized in that: The cascade grouping attention layer includes a feature splitting layer, a feature cascading layer, a splicing mapping layer and a multi-head attention layer; wherein: The feature splitting layer splits the input feature image of the cascaded grouping attention layer into multiple sub-feature images; The multi-head attention layer assigns an independent attention head to each of the sub-feature images for self-attention processing; The feature cascade layer is used to cascade the output features of each attention head of the multi-head attention layer, so as to combine the output of the first attention head with the input of the second attention head as the input of the second attention head, wherein the first attention head is any attention head in the multi-head attention layer, and the second attention head is the next attention head of the first attention head; The splicing mapping layer is used to perform splicing mapping processing on the output features of each attention head of the multi-head attention layer to obtain the output feature image of the cascade grouped attention layer.

5. The method for detecting safety wear of track workers according to claim 2, characterized in that: The backbone network also includes an overlapping embedding layer and an average pooling layer, wherein: The overlapping embedding layer is used to segment the video image into a plurality of overlapping image blocks, and convert the image blocks into feature vectors and embed them into the first memory-efficient visual converter layer for feature extraction; The average pooling layer is used to perform average pooling processing on the output features of the last memory-efficient visual converter layer; The safety wear detection model also includes a feature interaction layer, a first convolution layer, a first downsampling layer, a first fusion layer, a second convolution layer, a second downsampling layer, a second fusion layer, a first ADown downsampling layer, a third fusion layer, a second ADown downsampling layer, a fourth fusion layer and a first feature splicing layer connected to the backbone network in sequence; The first fusion layer is used to fuse the output features of the backbone network and the output features of the first downsampling layer to obtain the input features of the second convolutional layer; The second fusion layer is used to fuse the output features of the backbone network and the output features of the second downsampling layer to obtain the input features of the first ADown downsampling layer; The third fusion layer is used to fuse the output features of the second convolutional layer and the output features of the first ADown downsampling layer to obtain the input features of the second ADown downsampling layer; The fourth fusion layer is used to fuse the output features of the first convolutional layer and the output features of the second ADown downsampling layer; The first feature splicing layer is used to perform splicing processing on the input features of the second fusion layer, the output features of the third fusion layer, and the output features of the fourth fusion layer.

6. The method for detecting safety wear of track workers according to claim 1, characterized in that: The ADown downsampling layer includes a two-dimensional average pooling layer, a feature grouping layer, a third convolutional layer, a maximum pooling layer, a fourth convolutional layer and a second feature splicing layer; wherein: The two-dimensional average pooling layer is used to perform two-dimensional average pooling processing on the input features of the ADown downsampling layer; The feature grouping layer is used to perform feature grouping on the input features processed by two-dimensional average pooling to obtain a first input feature and a second input feature; The third convolutional layer is used to perform convolution processing on the first input feature to obtain a first target feature; The maximum pooling layer is used to perform maximum pooling processing on the second input feature to obtain a second target feature; The fourth convolutional layer is used to perform convolution processing on the second target feature to obtain a third target feature; The second feature concatenation layer is used to concatenate the first target feature and the third target feature to obtain the output feature of the ADown downsampling layer.

7. The method for detecting safety wear of track workers according to claim 1, characterized in that: Before inputting the video image into the pre-trained safety wear detection model, the method further includes: Acquire historical video images of the construction site, and construct a sample data set based on the historical video images; Iteratively training the constructed target detection model using the sample data set to obtain a pre-trained safety wear detection model; The loss function during the iterative training of the target detection model is : ; ; ; ; ; ; ; ; ; in, Represents the center point of the target box in the historical video image , Indicates the width of the target box, Indicates the height of the target frame; Represents the center point of the prediction box of the target detection model , represents the width of the prediction box, represents the height of the prediction box; is the preset scaling factor; is the intersection-and-union ratio of the target box and the prediction box, and the intersection-and-union ratio is the ratio of the intersection area to the union area; represents the Euclidean distance between the center point of the prediction box and the center point of the target box, Represents the diagonal distance of the minimum rectangle that covers both the prediction box and the target box; is the left boundary of the target box, is the right boundary of the target box, is the upper boundary of the target box, is the lower boundary of the target box, is the left boundary of the prediction box, is the right boundary of the prediction box, is the upper boundary of the prediction box and is the lower boundary of the prediction box; and is the bounding box regression loss of the predicted box; is the intersection area of ​​the target box and the prediction box, It is the union area of ​​the target box and the predicted box.

8. A safety wear detection device for track workers, characterized in that: include: An image acquisition module, used to acquire video images of the track operation construction site; A wearing detection module, used to input the video image into a pre-trained safety wearing detection model, and use the safety wearing detection model to detect the safety wearing of each operator in the video image to obtain a detection result of the safety wearing of each operator; Among them, the safety wear detection model is a target detection model constructed by using a memory-efficient visual converter with a cascaded group attention mechanism as the backbone network of a real-time target detector model, and using an ADown downsampling layer as the downsampling layer of the real-time target detector model.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the track worker safety wear detection method as described in any one of claims 1 to 7 is implemented.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the track worker safety wear detection method as described in any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • User posture recognition method and device, electronic equipment and storage medium

    CN117765564A

Cited By

  • VHPC-DETR-based violent target detection method

    CN120411736A

  • A violent target detection method based on VHPC-DETR

    CN120411736B

  • Well site operation intelligent identification method and device

    CN120747875A